-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from sdutry/issue90
#90 - added tests for the sj:a and the sj:div tag
- Loading branch information
Showing
66 changed files
with
1,036 additions
and
30 deletions.
There are no files selected for viewing
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
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
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
3 changes: 1 addition & 2 deletions
3
struts2-jquery-archetypes/struts2-jquery-archetype-base/pom.xml
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
3 changes: 1 addition & 2 deletions
3
struts2-jquery-archetypes/struts2-jquery-archetype-mobile/pom.xml
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
3 changes: 1 addition & 2 deletions
3
struts2-jquery-archetypes/struts2-jquery-bootstrap-archetype-grid/pom.xml
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
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
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
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
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
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 @@ | ||
target |
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,186 @@ | ||
<?xml version="1.0"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.jgeppert.struts2.jquery</groupId> | ||
<artifactId>struts2-jquery</artifactId> | ||
<version>4.0.3-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>struts2-jquery-integration-tests</artifactId> | ||
<name>tests for the struts2-jquery-plugin</name> | ||
<packaging>war</packaging> | ||
|
||
<scm> | ||
<url>https://github.com/struts-community-plugins/struts2-jquery/struts2-jquery-plugin-tests/</url> | ||
</scm> | ||
|
||
<properties> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<!-- plugins --> | ||
<jetty-maven-plugin.version>8.1.16.v20140903</jetty-maven-plugin.version> | ||
<maven-failsafe-plugin.version>2.19.1</maven-failsafe-plugin.version> | ||
<!-- dependencies --> | ||
<junit.version>4.12</junit.version> | ||
<selenium.version>3.0.1</selenium.version> | ||
<htmlunit-driver.version>2.23</htmlunit-driver.version> | ||
<lombok.version>1.16.2</lombok.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
|
||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
<version>${jetty-maven-plugin.version}</version> | ||
<configuration> | ||
<stopKey>CTRL+C</stopKey> | ||
<stopPort>8999</stopPort> | ||
<scanIntervalSeconds>10</scanIntervalSeconds> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-jsp</artifactId> | ||
<version>${jetty-maven-plugin.version}</version> | ||
</dependency> | ||
</dependencies> | ||
<executions> | ||
<execution> | ||
<id>start-jetty</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>start</goal> | ||
</goals> | ||
<configuration> | ||
<scanIntervalSeconds>0</scanIntervalSeconds> | ||
<daemon>true</daemon> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>stop-jetty</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${maven-failsafe-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.struts</groupId> | ||
<artifactId>struts2-convention-plugin</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.jgeppert.struts2.jquery</groupId> | ||
<artifactId>struts2-jquery-plugin</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.struts</groupId> | ||
<artifactId>struts2-json-plugin</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-server</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>htmlunit-driver</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.struts</groupId> | ||
<artifactId>struts2-convention-plugin</artifactId> | ||
<version>${struts2.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.jgeppert.struts2.jquery</groupId> | ||
<artifactId>struts2-jquery-plugin</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.struts</groupId> | ||
<artifactId>struts2-json-plugin</artifactId> | ||
<version>${struts2.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-server</artifactId> | ||
<version>${selenium.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>htmlunit-driver</artifactId> | ||
<version>${htmlunit-driver.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
</dependencyManagement> | ||
</project> | ||
|
13 changes: 13 additions & 0 deletions
13
struts2-jquery-integration-tests/src/main/java/com/jgeppert/jquery/actions/EchoAction.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,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; | ||
} |
25 changes: 25 additions & 0 deletions
25
...y-integration-tests/src/main/java/com/jgeppert/jquery/actions/ajax/LettersJsonAction.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,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; | ||
} | ||
} | ||
|
1 change: 1 addition & 0 deletions
1
struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/ajax/simple-text.jsp
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 @@ | ||
This is simple text from an ajax call. |
2 changes: 2 additions & 0 deletions
2
struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/echo.jsp
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,2 @@ | ||
<%@ taglib prefix="s" uri="/struts-tags"%> | ||
<p>Echo : <s:property value="echo" escapeHtml="%{escape}"/></p> |
20 changes: 20 additions & 0 deletions
20
struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/events.jsp
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 @@ | ||
<%@ taglib prefix="s" uri="/struts-tags" %> | ||
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> | ||
|
||
<script type="text/javascript"> | ||
jQuery.subscribe("ajaxlinkclick", function(event, data) { | ||
alert("ajax link clicked"); | ||
}); | ||
jQuery.subscribe("ajaxlinkcomplete", function(event, data) { | ||
alert("ajax link complete"); | ||
}); | ||
</script> | ||
|
||
<s:url var="ajax" namespace="/ajax" action="simple-text"/> | ||
|
||
<div id="result" class="result ui-widget-content ui-corner-all">result div</div> | ||
<sj:a id="ajaxlink" href="%{ajax}" targets="result" onClickTopics="ajaxlinkclick" onCompleteTopics="ajaxlinkcomplete" button="true" buttonIcon="ui-icon-refresh"> | ||
Run AJAX action | ||
</sj:a> | ||
|
13 changes: 13 additions & 0 deletions
13
struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/form-submit.jsp
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,13 @@ | ||
<%@ taglib prefix="s" uri="/struts-tags" %> | ||
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> | ||
|
||
<div id="formResult" class="result ui-widget-content ui-corner-all">formResult div</div> | ||
|
||
<s:form id="form" action="echo" namespace="/"> | ||
<s:label for="echo">Echo</s:label> | ||
<s:textfield id="echo" name="echo" value="something to echo"/> | ||
</s:form> | ||
<sj:a id="ajaxformlink" formIds="form" targets="formResult" clearForm="true" indicator="indicator" button="true" buttonIcon="ui-icon-gear"> | ||
Submit form | ||
</sj:a> | ||
|
20 changes: 20 additions & 0 deletions
20
struts2-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/json-result.jsp
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 @@ | ||
<%@ taglib prefix="s" uri="/struts-tags" %> | ||
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> | ||
|
||
<script type="text/javascript"> | ||
jQuery.subscribe("handleJsonResult", function(event, data) { | ||
jQuery('#result').html('<ul id="lettersList"></ul>'); | ||
var $lettersList = jQuery('#lettersList'); | ||
jQuery.each(event.originalEvent.data, function(index, value) { | ||
$lettersList.append('<li>' + value + '</li>'); | ||
}); | ||
}); | ||
</script> | ||
|
||
<s:url var="lettersUrl" namespace="/ajax" action="letters"/> | ||
|
||
<div id="result" class="result ui-widget-content ui-corner-all">result div</div> | ||
<sj:a id="ajaxjsonlink" href="%{lettersUrl}" dataType="json" onSuccessTopics="handleJsonResult" button="true" buttonIcon="ui-icon-refresh"> | ||
Run AJAX action | ||
</sj:a> | ||
|
11 changes: 11 additions & 0 deletions
11
...-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/multiple-targets.jsp
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,11 @@ | ||
<%@ taglib prefix="s" uri="/struts-tags" %> | ||
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> | ||
|
||
<s:url var="ajax" namespace="/ajax" action="simple-text"/> | ||
|
||
<div id="div1" class="result ui-widget-content ui-corner-all">Div 1</div> | ||
<div id="div2" class="result ui-widget-content ui-corner-all">Div 2</div> | ||
<sj:a id="ajaxlink" href="%{ajax}" targets="div1,div2" indicator="indicator" button="true" buttonIcon="ui-icon-refresh"> | ||
Run AJAX action | ||
</sj:a> | ||
|
10 changes: 10 additions & 0 deletions
10
...-jquery-integration-tests/src/main/webapp/WEB-INF/content/includes/a/simple-ajax-link.jsp
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,10 @@ | ||
<%@ taglib prefix="s" uri="/struts-tags" %> | ||
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> | ||
|
||
<s:url var="ajax" namespace="/ajax" action="simple-text"/> | ||
|
||
<div id="result" class="result ui-widget-content ui-corner-all">Click on the link bellow.</div> | ||
<sj:a id="ajaxlink" href="%{ajax}" targets="result" indicator="indicator" button="true" buttonIcon="ui-icon-refresh"> | ||
Run AJAX action | ||
</sj:a> | ||
|
Oops, something went wrong.