-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replay-tests: fasttags and gtfasttags on classpath example
- Loading branch information
Showing
6 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
replay-tests/multi-module-app/app/app/tags/fasttags/HelloFromApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package tags.fasttags; | ||
|
||
import groovy.lang.Closure; | ||
import play.templates.ExecutableTemplate; | ||
import play.templates.FastTags; | ||
import java.io.PrintWriter; | ||
import java.util.Map; | ||
|
||
@FastTags.Namespace("app") | ||
public class HelloFromApp extends FastTags { | ||
|
||
public static void _hello (Map<?, ?> args, Closure<String> body, PrintWriter out, ExecutableTemplate template, int fromLine) { | ||
String name = args.containsKey("name") ? args.get("name").toString() : ""; | ||
if (name.isEmpty()) { | ||
throw new play.exceptions.TagInternalException("name attribute cannot be empty for " + Thread.currentThread().getStackTrace()[1].getMethodName().substring(1) + " tag"); | ||
} | ||
|
||
out.print("Hello from " + HelloFromApp.class.getAnnotation(FastTags.Namespace.class).value() + ", " + name + "!"); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
replay-tests/multi-module-app/app/app/tags/fasttags/HelloFromAppGT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package tags.fasttags; | ||
|
||
import play.template2.GTContentRenderer; | ||
import play.template2.GTFastTag; | ||
import play.template2.GTJavaBase; | ||
import java.util.Map; | ||
|
||
@GTFastTag.TagNamespace("appGT") | ||
public class HelloFromAppGT extends GTFastTag { | ||
public static void tag_hello (GTJavaBase template, Map<String, Object> args, GTContentRenderer content) { | ||
String name = args.containsKey("name") ? args.get("name").toString() : ""; | ||
if (name.isEmpty()) { | ||
throw new play.exceptions.TagInternalException("name attribute cannot be empty for " + Thread.currentThread().getStackTrace()[1].getMethodName().substring(4) + " tag"); | ||
} | ||
|
||
template.out.append("Hello from ") | ||
.append(HelloFromAppGT.class.getAnnotation(GTFastTag.TagNamespace.class).value()) | ||
.append(", ").append(name).append("!"); | ||
} | ||
} |
23 changes: 20 additions & 3 deletions
23
replay-tests/multi-module-app/app/test/ui/hello/MultiModuleAppGotRenderStaticSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
package ui.hello; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static com.codeborne.selenide.Condition.text; | ||
import static com.codeborne.selenide.Selenide.$; | ||
import static com.codeborne.selenide.Selenide.open; | ||
|
||
import hello.fasttags.HelloFromCore; | ||
import hello.fasttags.HelloFromCoreGT; | ||
import tags.fasttags.HelloFromApp; | ||
import tags.fasttags.HelloFromAppGT; | ||
|
||
import play.template2.GTFastTag; | ||
import play.templates.FastTags; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class MultiModuleAppGotRenderStaticSpec extends BaseSpec { | ||
@Test | ||
public void openHelloWorldPage() { | ||
open("/"); | ||
$("h1").shouldHave(text("Hello, world!")); | ||
|
||
$("h1#fasttag_hello_app").shouldHave(text("Hello from "), | ||
text(HelloFromApp.class.getAnnotation(FastTags.Namespace.class).value())); | ||
$("h1#fasttag_hello_core").shouldHave(text("Hello from "), | ||
text(HelloFromCore.class.getAnnotation(FastTags.Namespace.class).value())); | ||
|
||
$("h1#gt_hello_app").shouldHave(text("Hello from "), | ||
text(HelloFromAppGT.class.getAnnotation(GTFastTag.TagNamespace.class).value())); | ||
$("h1#gt_hello_core").shouldHave(text("Hello from "), | ||
text(HelloFromCoreGT.class.getAnnotation(GTFastTag.TagNamespace.class).value())); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
replay-tests/multi-module-app/core/app/hello/fasttags/HelloFromCore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package hello.fasttags; | ||
|
||
import groovy.lang.Closure; | ||
import play.templates.ExecutableTemplate; | ||
import play.templates.FastTags; | ||
import java.io.PrintWriter; | ||
import java.util.Map; | ||
|
||
@FastTags.Namespace("core") | ||
public class HelloFromCore extends FastTags { | ||
|
||
public static void _hello (Map<?, ?> args, Closure<String> body, PrintWriter out, ExecutableTemplate template, int fromLine) { | ||
String name = args.containsKey("name") ? args.get("name").toString() : ""; | ||
if (name.isEmpty()) { | ||
throw new play.exceptions.TagInternalException("name attribute cannot be empty for " + Thread.currentThread().getStackTrace()[1].getMethodName().substring(1) + " tag"); | ||
} | ||
out.print("Hello from " + HelloFromCore.class.getAnnotation(FastTags.Namespace.class).value() + ", " + name + "!"); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
replay-tests/multi-module-app/core/app/hello/fasttags/HelloFromCoreGT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package hello.fasttags; | ||
|
||
import play.template2.GTContentRenderer; | ||
import play.template2.GTFastTag; | ||
import play.template2.GTJavaBase; | ||
import java.util.Map; | ||
|
||
@GTFastTag.TagNamespace("coreGT") | ||
public class HelloFromCoreGT extends GTFastTag { | ||
public static void tag_hello (GTJavaBase template, Map<String, Object> args, GTContentRenderer content) { | ||
String name = args.containsKey("name") ? args.get("name").toString() : ""; | ||
if (name.isEmpty()) { | ||
throw new play.exceptions.TagInternalException("name attribute cannot be empty for " + Thread.currentThread().getStackTrace()[1].getMethodName().substring(4) + " tag"); | ||
} | ||
|
||
template.out.append("Hello from ") | ||
.append(HelloFromCoreGT.class.getAnnotation(GTFastTag.TagNamespace.class).value()) | ||
.append(", ").append(name).append("!"); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters