diff --git a/README.md b/README.md index 432cd870d..dfc975d7a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # Struts2 jQuery Plugin +## Build status: +* Branch `release/4.0.3`: [![Build Status](https://travis-ci.org/struts-community-plugins/struts2-jquery.svg?branch=release%2F4.0.3)](https://travis-ci.org/struts-community-plugins/struts2-jquery) +* Branch `release/4.0.2`: [![Build Status](https://travis-ci.org/struts-community-plugins/struts2-jquery.svg?branch=release%2F4.0.2)](https://travis-ci.org/struts-community-plugins/struts2-jquery) A Plugin for the popular java web framework struts2 to provide ajax functionality and UI Widgets based on the jQuery javascript framework. diff --git a/pom.xml b/pom.xml index 67d1958c2..b2cb4bba2 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery struts2-jquery @@ -92,6 +91,7 @@ struts2-jquery-grid-showcase struts2-jquery-mobile-showcase struts2-jquery-archetypes + struts2-jquery-integration-tests diff --git a/struts2-jquery-archetypes/pom.xml b/struts2-jquery-archetypes/pom.xml index e1d2f644b..7c774da8d 100644 --- a/struts2-jquery-archetypes/pom.xml +++ b/struts2-jquery-archetypes/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-archetypes/struts2-jquery-archetype-base/pom.xml b/struts2-jquery-archetypes/struts2-jquery-archetype-base/pom.xml index cfd4f87ae..4cff56515 100644 --- a/struts2-jquery-archetypes/struts2-jquery-archetype-base/pom.xml +++ b/struts2-jquery-archetypes/struts2-jquery-archetype-base/pom.xml @@ -1,5 +1,4 @@ - + com.jgeppert.struts2.jquery struts2-jquery-archetypes diff --git a/struts2-jquery-archetypes/struts2-jquery-archetype-mobile/pom.xml b/struts2-jquery-archetypes/struts2-jquery-archetype-mobile/pom.xml index 071474c3a..255046123 100644 --- a/struts2-jquery-archetypes/struts2-jquery-archetype-mobile/pom.xml +++ b/struts2-jquery-archetypes/struts2-jquery-archetype-mobile/pom.xml @@ -1,5 +1,4 @@ - + com.jgeppert.struts2.jquery struts2-jquery-archetypes diff --git a/struts2-jquery-archetypes/struts2-jquery-bootstrap-archetype-grid/pom.xml b/struts2-jquery-archetypes/struts2-jquery-bootstrap-archetype-grid/pom.xml index 8907b3dc8..5efc6668a 100644 --- a/struts2-jquery-archetypes/struts2-jquery-bootstrap-archetype-grid/pom.xml +++ b/struts2-jquery-archetypes/struts2-jquery-bootstrap-archetype-grid/pom.xml @@ -1,5 +1,4 @@ - + com.jgeppert.struts2.jquery struts2-jquery-archetypes diff --git a/struts2-jquery-chart-plugin/pom.xml b/struts2-jquery-chart-plugin/pom.xml index 9d8311c9e..1d0b6e545 100644 --- a/struts2-jquery-chart-plugin/pom.xml +++ b/struts2-jquery-chart-plugin/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-datatables-plugin/pom.xml b/struts2-jquery-datatables-plugin/pom.xml index 26709da97..352dd9dce 100644 --- a/struts2-jquery-datatables-plugin/pom.xml +++ b/struts2-jquery-datatables-plugin/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-grid-plugin/pom.xml b/struts2-jquery-grid-plugin/pom.xml index a74477262..82d3d5910 100644 --- a/struts2-jquery-grid-plugin/pom.xml +++ b/struts2-jquery-grid-plugin/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-grid-showcase/pom.xml b/struts2-jquery-grid-showcase/pom.xml index 354e1ede6..3a044e131 100644 --- a/struts2-jquery-grid-showcase/pom.xml +++ b/struts2-jquery-grid-showcase/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-integration-tests/.gitignore b/struts2-jquery-integration-tests/.gitignore new file mode 100644 index 000000000..eb5a316cb --- /dev/null +++ b/struts2-jquery-integration-tests/.gitignore @@ -0,0 +1 @@ +target diff --git a/struts2-jquery-integration-tests/pom.xml b/struts2-jquery-integration-tests/pom.xml new file mode 100644 index 000000000..f6a416fe3 --- /dev/null +++ b/struts2-jquery-integration-tests/pom.xml @@ -0,0 +1,186 @@ + + + 4.0.0 + + com.jgeppert.struts2.jquery + struts2-jquery + 4.0.3-SNAPSHOT + + struts2-jquery-integration-tests + tests for the struts2-jquery-plugin + war + + + https://github.com/struts-community-plugins/struts2-jquery/struts2-jquery-plugin-tests/ + + + + UTF-8 + + 8.1.16.v20140903 + 2.19.1 + + 4.12 + 3.0.1 + 2.23 + 1.16.2 + + + + + + org.mortbay.jetty + jetty-maven-plugin + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + + + + org.mortbay.jetty + jetty-maven-plugin + ${jetty-maven-plugin.version} + + CTRL+C + 8999 + 10 + + + + org.eclipse.jetty + jetty-jsp + ${jetty-maven-plugin.version} + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + + integration-test + verify + + + + + + + + + + + org.apache.struts + struts2-convention-plugin + + + + com.jgeppert.struts2.jquery + struts2-jquery-plugin + + + + org.apache.struts + struts2-json-plugin + + + + junit + junit + + + + org.seleniumhq.selenium + selenium-server + + + + org.seleniumhq.selenium + htmlunit-driver + + + org.projectlombok + lombok + + + + + + + org.apache.struts + struts2-convention-plugin + ${struts2.version} + + + + com.jgeppert.struts2.jquery + struts2-jquery-plugin + ${project.version} + + + + org.apache.struts + struts2-json-plugin + ${struts2.version} + + + + junit + junit + ${junit.version} + test + + + + org.seleniumhq.selenium + selenium-server + ${selenium.version} + test + + + + org.seleniumhq.selenium + htmlunit-driver + ${htmlunit-driver.version} + test + + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/java/com/jgeppert/jquery/actions/EchoAction.java b/struts2-jquery-integration-tests/src/main/java/com/jgeppert/jquery/actions/EchoAction.java new file mode 100644 index 000000000..6102abe13 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/java/com/jgeppert/jquery/actions/EchoAction.java @@ -0,0 +1,13 @@ +package com.jgeppert.jquery.actions; + +import com.opensymphony.xwork2.ActionSupport; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class EchoAction extends ActionSupport { + private String echo; + private boolean escape = true; +} diff --git a/struts2-jquery-integration-tests/src/main/java/com/jgeppert/jquery/actions/ajax/LettersJsonAction.java b/struts2-jquery-integration-tests/src/main/java/com/jgeppert/jquery/actions/ajax/LettersJsonAction.java new file mode 100644 index 000000000..2adfab9c1 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/java/com/jgeppert/jquery/actions/ajax/LettersJsonAction.java @@ -0,0 +1,25 @@ +package com.jgeppert.jquery.actions.ajax; + +import com.opensymphony.xwork2.ActionSupport; + +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.ParentPackage; +import org.apache.struts2.convention.annotation.Result; + +@ParentPackage("json-default") +@Action(value="/ajax/letters", results = {@Result(type="json", name="success", params= {"root", "letters"})}) +public class LettersJsonAction extends ActionSupport { + private static final char[] LETTERS; + + static { + LETTERS = new char[26]; + for (int i = 0; i < 26; i++) { + LETTERS[i] = (char)('a' + (char)i); + } + } + + public char[] getLetters() { + return LETTERS; + } +} + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/ajax/simple-text.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/ajax/simple-text.jsp new file mode 100644 index 000000000..2df9b9dc1 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/ajax/simple-text.jsp @@ -0,0 +1 @@ +This is simple text from an ajax call. diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/echo.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/echo.jsp new file mode 100644 index 000000000..f598c6ee5 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/echo.jsp @@ -0,0 +1,2 @@ +<%@ taglib prefix="s" uri="/struts-tags"%> +

Echo :

diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/events.jsp new file mode 100644 index 000000000..0ce8deb76 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/events.jsp @@ -0,0 +1,20 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + +
result div
+ + Run AJAX action + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/form-submit.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/form-submit.jsp new file mode 100644 index 000000000..08e9ee1c9 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/form-submit.jsp @@ -0,0 +1,13 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + +
formResult div
+ + + Echo + + + + Submit form + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/json-result.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/json-result.jsp new file mode 100644 index 000000000..8957dcafb --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/json-result.jsp @@ -0,0 +1,20 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + +
result div
+ + Run AJAX action + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/multiple-targets.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/multiple-targets.jsp new file mode 100644 index 000000000..0b7ca651b --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/multiple-targets.jsp @@ -0,0 +1,11 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + +
Div 1
+
Div 2
+ + Run AJAX action + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/simple-ajax-link.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/simple-ajax-link.jsp new file mode 100644 index 000000000..2e5158904 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/simple-ajax-link.jsp @@ -0,0 +1,10 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + +
Click on the link bellow.
+ + Run AJAX action + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/ajax-div.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/ajax-div.jsp new file mode 100644 index 000000000..8d74cc4f4 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/ajax-div.jsp @@ -0,0 +1,6 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/events.jsp new file mode 100644 index 000000000..71328c049 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/events.jsp @@ -0,0 +1,16 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/listen-topics.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/listen-topics.jsp new file mode 100644 index 000000000..74ad6377f --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/div/listen-topics.jsp @@ -0,0 +1,8 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + +ajax div + +Click me! diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/events.jsp new file mode 100644 index 000000000..9186126b6 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/form-submit.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/form-submit.jsp new file mode 100644 index 000000000..4abdfc85d --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/form-submit.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/json-result.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/json-result.jsp new file mode 100644 index 000000000..8fc76c6fd --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/json-result.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/multiple-targets.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/multiple-targets.jsp new file mode 100644 index 000000000..ecbed4cdd --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/multiple-targets.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/simple-ajax-link.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/simple-ajax-link.jsp new file mode 100644 index 000000000..2bb943c00 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/a/simple-ajax-link.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/ajax-div.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/ajax-div.jsp new file mode 100644 index 000000000..3457ddadb --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/ajax-div.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/events.jsp new file mode 100644 index 000000000..e9d70d1bf --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/listen-topics.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/listen-topics.jsp new file mode 100644 index 000000000..2565cffe7 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadatonce/div/listen-topics.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/events.jsp new file mode 100644 index 000000000..b2ba3de57 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/form-submit.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/form-submit.jsp new file mode 100644 index 000000000..938b44811 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/form-submit.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/json-result.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/json-result.jsp new file mode 100644 index 000000000..e1800f16b --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/json-result.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/multiple-targets.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/multiple-targets.jsp new file mode 100644 index 000000000..72a2411b0 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/multiple-targets.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/simple-ajax-link.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/simple-ajax-link.jsp new file mode 100644 index 000000000..9fdeb4bd1 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/a/simple-ajax-link.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/ajax-div.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/ajax-div.jsp new file mode 100644 index 000000000..42eb64165 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/ajax-div.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/events.jsp new file mode 100644 index 000000000..5a12390d1 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/listen-topics.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/listen-topics.jsp new file mode 100644 index 000000000..86506f1fb --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/loadfromgoogle/div/listen-topics.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/events.jsp new file mode 100644 index 000000000..3ac2374fa --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/form-submit.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/form-submit.jsp new file mode 100644 index 000000000..977ca37f4 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/form-submit.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/json-result.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/json-result.jsp new file mode 100644 index 000000000..d73ffc6e5 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/json-result.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/multiple-targets.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/multiple-targets.jsp new file mode 100644 index 000000000..65c5ca523 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/multiple-targets.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/simple-ajax-link.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/simple-ajax-link.jsp new file mode 100644 index 000000000..63802fdf8 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/a/simple-ajax-link.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/ajax-div.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/ajax-div.jsp new file mode 100644 index 000000000..7c104fc9d --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/ajax-div.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/events.jsp new file mode 100644 index 000000000..d4cab2bcd --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/listen-topics.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/listen-topics.jsp new file mode 100644 index 000000000..837735a85 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/regular/div/listen-topics.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/events.jsp new file mode 100644 index 000000000..b311aa33b --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/form-submit.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/form-submit.jsp new file mode 100644 index 000000000..0383f361e --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/form-submit.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/json-result.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/json-result.jsp new file mode 100644 index 000000000..42fc5b633 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/json-result.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/multiple-targets.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/multiple-targets.jsp new file mode 100644 index 000000000..3ddde8274 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/multiple-targets.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/simple-ajax-link.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/simple-ajax-link.jsp new file mode 100644 index 000000000..3d8f6cd94 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/a/simple-ajax-link.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/ajax-div.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/ajax-div.jsp new file mode 100644 index 000000000..742cb56a0 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/ajax-div.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/events.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/events.jsp new file mode 100644 index 000000000..7187009cf --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/events.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/listen-topics.jsp b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/listen-topics.jsp new file mode 100644 index 000000000..0b77443b4 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/uncompressed/div/listen-topics.jsp @@ -0,0 +1,12 @@ + +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + + + + + + + + diff --git a/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/web.xml b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..6be2aa192 --- /dev/null +++ b/struts2-jquery-integration-tests/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + Struts jQuery Plugin - Tests + + + struts2 + org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter + + + + struts2 + /* + + + + COOKIE + + + + diff --git a/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/a/ATagIT.java b/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/a/ATagIT.java new file mode 100644 index 000000000..2c2d2f7f9 --- /dev/null +++ b/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/a/ATagIT.java @@ -0,0 +1,163 @@ +package com.jgeppert.struts2.jquery.a; + +import com.jgeppert.struts2.jquery.selenium.JQueryIdleCondition; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import org.openqa.selenium.Alert; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.htmlunit.HtmlUnitDriver; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +@RunWith(Parameterized.class) +public class ATagIT { + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList(new Object[][] { + { "http://localhost:8080/regular" }, + { "http://localhost:8080/uncompressed" }, + { "http://localhost:8080/loadatonce" }, + { "http://localhost:8080/loadfromgoogle" } + }); + } + + private static final JQueryIdleCondition JQUERY_IDLE = new JQueryIdleCondition(); + + private String baseUrl; + + public ATagIT(final String baseUrl) { + this.baseUrl = baseUrl; + } + + @Test + public void testSimpleAjaxPageLink() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/a/simple-ajax-link.action"); + WebElement resultDiv = driver.findElement(By.id("result")); + WebElement ajaxlink = driver.findElement(By.id("ajaxlink")); + + Assert.assertEquals("Click on the link bellow.", resultDiv.getText()); + ajaxlink.click(); + + wait.until(JQUERY_IDLE); + + Assert.assertEquals("This is simple text from an ajax call.", resultDiv.getText()); + } + + @Test + public void testMultipleTargets() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/a/multiple-targets.action"); + WebElement div1 = driver.findElement(By.id("div1")); + WebElement div2 = driver.findElement(By.id("div2")); + WebElement ajaxLink = driver.findElement(By.id("ajaxlink")); + + Assert.assertEquals("Div 1", div1.getText()); + Assert.assertEquals("Div 2", div2.getText()); + + ajaxLink.click(); + + wait.until(JQUERY_IDLE); + + Assert.assertEquals("This is simple text from an ajax call.", div1.getText()); + Assert.assertEquals("This is simple text from an ajax call.", div2.getText()); + } + + @Test + public void testFormSubmit() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/a/form-submit.action"); + WebElement formResult = driver.findElement(By.id("formResult")); + WebElement echoInput = driver.findElement(By.id("echo")); + WebElement ajaxFormLink = driver.findElement(By.id("ajaxformlink")); + + Assert.assertEquals("formResult div", formResult.getText()); + Assert.assertEquals("something to echo", echoInput.getAttribute("value")); + + ajaxFormLink.click(); + + wait.until(JQUERY_IDLE); + + Assert.assertEquals("Echo : something to echo", formResult.getText()); + Assert.assertEquals("", echoInput.getAttribute("value")); + + echoInput.sendKeys("userinput to echo"); + ajaxFormLink.click(); + + wait.until(JQUERY_IDLE); + + Assert.assertEquals("Echo : userinput to echo", formResult.getText()); + Assert.assertEquals("", echoInput.getAttribute("value")); + } + + @Test + public void testEvents() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/a/events.action"); + WebElement result = driver.findElement(By.id("result")); + WebElement ajaxLink = driver.findElement(By.id("ajaxlink")); + + Assert.assertEquals("result div", result.getText()); + + ajaxLink.click(); + + wait.until(JQUERY_IDLE); + wait.until(ExpectedConditions.alertIsPresent()); + Alert alert = driver.switchTo().alert(); + + Assert.assertEquals("ajax link clicked", alert.getText()); + + alert.accept(); + + wait.until(JQUERY_IDLE); + wait.until(ExpectedConditions.alertIsPresent()); + alert = driver.switchTo().alert(); + + Assert.assertEquals("ajax link complete", alert.getText()); + + alert.accept(); + + Assert.assertEquals("This is simple text from an ajax call.", result.getText()); + } + + @Test + public void testJsonResult() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/a/json-result.action"); + WebElement result = driver.findElement(By.id("result")); + WebElement ajaxJsonLink = driver.findElement(By.id("ajaxjsonlink")); + + Assert.assertEquals("result div", result.getText()); + + ajaxJsonLink.click(); + wait.until(JQUERY_IDLE); + + WebElement lettersList = result.findElement(By.id("lettersList")); + List listItems = lettersList.findElements(By.tagName("li")); + + Assert.assertEquals(26, listItems.size()); + Assert.assertEquals("a", listItems.get(0).getText()); + Assert.assertEquals("z", listItems.get(25).getText()); + } +} + diff --git a/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/div/DivTagIT.java b/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/div/DivTagIT.java new file mode 100644 index 000000000..67fa833cb --- /dev/null +++ b/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/div/DivTagIT.java @@ -0,0 +1,99 @@ +package com.jgeppert.struts2.jquery.div; + +import com.jgeppert.struts2.jquery.selenium.JQueryIdleCondition; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import org.openqa.selenium.Alert; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.htmlunit.HtmlUnitDriver; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +@RunWith(Parameterized.class) +public class DivTagIT { + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList(new Object[][] { + { "http://localhost:8080/regular" }, + { "http://localhost:8080/uncompressed" }, + { "http://localhost:8080/loadatonce" }, + { "http://localhost:8080/loadfromgoogle" } + }); + } + + private static final JQueryIdleCondition JQUERY_IDLE = new JQueryIdleCondition(); + + private String baseUrl; + + public DivTagIT(final String baseUrl) { + this.baseUrl = baseUrl; + } + + @Test + public void testAjaxDiv() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/div/ajax-div.action"); + WebElement ajaxDiv = driver.findElement(By.id("ajaxdiv")); + + wait.until(JQUERY_IDLE); + + Assert.assertEquals("This is simple text from an ajax call.", ajaxDiv.getText()); + } + + @Test + public void testEvents() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/div/events.action"); + WebElement ajaxDiv = driver.findElement(By.id("ajaxdiv")); + + wait.until(JQUERY_IDLE); + wait.until(ExpectedConditions.alertIsPresent()); + Alert alert = driver.switchTo().alert(); + + Assert.assertEquals("Before div", alert.getText()); + + alert.accept(); + + wait.until(JQUERY_IDLE); + wait.until(ExpectedConditions.alertIsPresent()); + alert = driver.switchTo().alert(); + + Assert.assertEquals("Complete div", alert.getText()); + + alert.accept(); + + Assert.assertEquals("This is simple text from an ajax call.", ajaxDiv.getText()); + } + + @Test + public void testListenTopics() { + WebDriver driver = new HtmlUnitDriver(true); + WebDriverWait wait = new WebDriverWait(driver, 30); + + driver.get(baseUrl + "/div/listen-topics.action"); + WebElement ajaxDiv = driver.findElement(By.id("ajaxdiv")); + WebElement topicsLink = driver.findElement(By.id("topicslink")); + + Assert.assertEquals("ajax div", ajaxDiv.getText()); + + topicsLink.click(); + wait.until(JQUERY_IDLE); + + Assert.assertEquals("This is simple text from an ajax call.", ajaxDiv.getText()); + } +} + diff --git a/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/selenium/JQueryIdleCondition.java b/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/selenium/JQueryIdleCondition.java new file mode 100644 index 000000000..f8791bdeb --- /dev/null +++ b/struts2-jquery-integration-tests/src/test/java/com/jgeppert/jquery/selenium/JQueryIdleCondition.java @@ -0,0 +1,18 @@ +package com.jgeppert.struts2.jquery.selenium; + +import org.openqa.selenium.support.ui.ExpectedCondition; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.WebDriver; + +public class JQueryIdleCondition implements ExpectedCondition{ + + @Override + public Boolean apply(final WebDriver driver) { + try { + return ((Long)((JavascriptExecutor)driver).executeScript("return jQuery.active") == 0); + } catch (final Exception e) { + return true; + } + } + +} diff --git a/struts2-jquery-mobile-plugin/pom.xml b/struts2-jquery-mobile-plugin/pom.xml index 43f9331d0..1f9e533c7 100644 --- a/struts2-jquery-mobile-plugin/pom.xml +++ b/struts2-jquery-mobile-plugin/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-mobile-showcase/pom.xml b/struts2-jquery-mobile-showcase/pom.xml index 3fc1dbe7a..4116d92c2 100755 --- a/struts2-jquery-mobile-showcase/pom.xml +++ b/struts2-jquery-mobile-showcase/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-plugin/pom.xml b/struts2-jquery-plugin/pom.xml index 944d9677b..cd224ee75 100644 --- a/struts2-jquery-plugin/pom.xml +++ b/struts2-jquery-plugin/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-richtext-plugin/pom.xml b/struts2-jquery-richtext-plugin/pom.xml index ca58bb9cf..1f2e791eb 100644 --- a/struts2-jquery-richtext-plugin/pom.xml +++ b/struts2-jquery-richtext-plugin/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-showcase/pom.xml b/struts2-jquery-showcase/pom.xml index 2862c366b..d32c6cefc 100644 --- a/struts2-jquery-showcase/pom.xml +++ b/struts2-jquery-showcase/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery diff --git a/struts2-jquery-tree-plugin/pom.xml b/struts2-jquery-tree-plugin/pom.xml index fb51d24e3..6b19b95be 100755 --- a/struts2-jquery-tree-plugin/pom.xml +++ b/struts2-jquery-tree-plugin/pom.xml @@ -1,6 +1,5 @@ - + 4.0.0 com.jgeppert.struts2.jquery