Skip to content

Commit

Permalink
Merge pull request #1 from apache/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
aleksandr-m authored Jan 12, 2019
2 parents 81ac9b2 + aabed3e commit 42ef171
Show file tree
Hide file tree
Showing 145 changed files with 2,904 additions and 886 deletions.
30 changes: 17 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@ sudo: false

jdk:
- openjdk7
- oraclejdk8
- oraclejdk9
- oraclejdk11

install: true
script: mvn test -DskipAssembly

after_success:
# TODO delete following if statement after fix of https://github.com/cobertura/cobertura/issues/271
- if [ "$TRAVIS_JDK_VERSION" == "openjdk8" ] || [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]; then
mvn cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report com.updateimpact:updateimpact-maven-plugin:submit -Ptravis-coveralls,update-impact -DskipAssembly;
env:
global:
- secure: iI7IpfDtS+LUyS2yNuRCR3KelNyvBHuoMQ3gb1UNmR5SSL7jO/p3olQWrQROs28FJ+dpE3lHyIjoHrebKQGJHHAgTG2XWxn+G3fDsf+wSSFSLoDGj0o2SgGXooBbR2dccnNZHCyQaOyE2cIPWaOxrQZFE4No70LQB4mrP/gdkoc=
matrix:
include:
- jdk: oraclejdk8
env: STRUTS_IT=true # do integration tests and coverage reports when jdk7,9 and 11 tests prospered

script:
- if [ "$STRUTS_IT" == "true" ]; then
./mvnw clean verify org.jacoco:jacoco-maven-plugin:report org.jacoco:jacoco-maven-plugin:report-integration org.eluder.coveralls:coveralls-maven-plugin:report -Ptravis-coveralls -DskipAssembly -B;
else
echo "Not reporting coverage for $TRAVIS_JDK_VERSION due to incompatibility or to save performance";
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
./mvnw test -DskipAssembly -B;
else
./mvnw test -DskipAssembly -Dupdate-impact -B;
fi;
fi;

env:
global:
secure: DusDFL9cuX+mj64tXQfrYVbUVYnxlXmad4nuIMj0/lgDbwJ6kxYasJmR99bdvwu08gS9D5b7a+m7WJTN0FNATzEiiGDXcM+TiDPlYDh7dcalU4QGiLmMuCCEw1r7hp2XE4BWVgDfFhCsHhStgjE4RXzHIyPowoPXr4ugPf8at6w=

cache:
directories:
- $HOME/.m2

- $HOME/.m2
34 changes: 34 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pipeline {

agent {
label 'ubuntu'
}

options {
buildDiscarder logRotator(daysToKeepStr: '14', numToKeepStr: '10')
timeout(80)
disableConcurrentBuilds()
}

tools {
jdk 'JDK 1.7 (latest)'
maven 'Maven 3 (latest)'
}

triggers {
pollSCM 'H/15 * * * *'
}

environment {
MAVEN_OPTS = "-Xmx1024m -XX:MaxPermSize=256m"
}

stages {
stage('Build') {
steps {
sh 'mvn --version'
sh 'mvn clean source:jar javadoc:jar install deploy -DskipWiki -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2'
}
}
}
}
72 changes: 55 additions & 17 deletions apps/showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,24 @@
<artifactId>commons-fileupload</artifactId>
</dependency>

<dependency>
<groupId>net.sourceforge.jwebunit</groupId>
<artifactId>jwebunit-core</artifactId>
<version>1.4.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>net.sourceforge.jwebunit</groupId>
<artifactId>jwebunit-htmlunit-plugin</artifactId>
<version>1.4.1</version>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.24</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- BeanValidation Example -->
Expand All @@ -188,6 +181,30 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<includes>
<include>it.org.apache.struts2.showcase.*Test</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
Expand All @@ -212,6 +229,27 @@
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<!-- stop any previous instance to free up the port -->
<goal>stop</goal>
<goal>run-forked</goal>
</goals>
<configuration>
<waitForChild>false</waitForChild>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/
package org.apache.struts2.showcase.chat;

import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.struts2.util.StrutsTypeConverter;
Expand All @@ -33,14 +35,22 @@ public class DateConverter extends StrutsTypeConverter {

private static final Logger LOG = LogManager.getLogger(DateConverter.class);

private XWorkConverter fallbackConverter;

@Inject
public void setXWorkConverter(XWorkConverter fallbackConverter) {
this.fallbackConverter = fallbackConverter;
}

public Object convertFromString(Map context, String[] values, Class toClass) {

if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat();
try {
return sdf.parse(values[0]);
} catch (ParseException e) {
LOG.error("error converting value [" + values[0] + "] to Date ", e);
LOG.warn("error converting value [" + values[0] + "] to Date. Trying fallback converter.");
return this.fallbackConverter.convertValue(context, values[0], toClass);
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</field>
<field name="regexValidatorField">
<field-validator type="regex">
<param name="regex"><![CDATA[ [^<>]+ ]]></param>
<param name="regex"><![CDATA[ .*\.txt ]]></param>
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
</field-validator>
</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
-->
<ul<#rt/>
<#if parameters.id??>
id="${parameters.id?html}"<#rt/>
id="${parameters.id}"<#rt/>
</#if>
<#if parameters.cssClass??>
class="${parameters.cssClass?html}"<#rt/>
class="${parameters.cssClass}"<#rt/>
<#else>
class="errorMessage"<#rt/>
</#if>
<#if parameters.cssStyle??>
style="${parameters.cssStyle?html}"<#rt/>
style="${parameters.cssStyle}"<#rt/>
</#if>
>
<#if (actionErrors?? && actionErrors?size > 0)>
<#list actionErrors as error>
<#if error??>
<li><span><#if parameters.escape>${error!?html}<#else>${error!}</#if></span><#rt/></li><#rt/>
<li><span><#if parameters.escape>${error!}<#else>${error!}</#if></span><#rt/></li><#rt/>
</#if>
</#list>
</#if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ${parameters.after!}<#t/>
<td class="tdErrorMessage" colspan="2"><#rt/>
<#if hasFieldErrors>
<#list fieldErrors[parameters.name] as error>
<div class="errorMessage">${error?html}</div><#t/>
<div class="errorMessage">${error}</div><#t/>
</#list>
</#if>
</td><#lt/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<td class="tdErrorMessage" colspan="2" data-error-for-fieldname="${parameters.name}"><#rt/>
<#if hasFieldErrors>
<#list fieldErrors[parameters.name] as error>
<div class="errorMessage">${error?html}</div><#t/>
<div class="errorMessage">${error}</div><#t/>
</#list>
</#if>
</td><#lt/>
Expand All @@ -51,7 +51,7 @@
<#if parameters.label??>
<label <#t/>
<#if parameters.id??>
for="${parameters.id?html}" <#t/>
for="${parameters.id}" <#t/>
</#if>
<#if hasFieldErrors>
class="errorLabel"<#t/>
Expand All @@ -62,11 +62,11 @@
<#if parameters.required!false && parameters.requiredPosition!"right" != 'right'>
<span class="required">*</span><#t/>
</#if>
${parameters.label?html}<#t/>
${parameters.label}<#t/>
<#if parameters.required!false && parameters.requiredPosition!"right" == 'right'>
<span class="required">*</span><#t/>
</#if>
${parameters.labelseparator!":"?html}<#t/>
${parameters.labelseparator!":"}<#t/>
<#include "/${parameters.templateDir}/${parameters.expandTheme}/tooltip.ftl" />
</label><#t/>
</#if>
Expand Down
6 changes: 3 additions & 3 deletions apps/showcase/src/main/webapp/WEB-INF/person/list-people.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
</tr>
<#list people as person>
<tr>
<td>${person.id?html}</td>
<td>${person.name?html}</td>
<td>${person.lastName?html}</td>
<td>${person.id}</td>
<td>${person.name}</td>
<td>${person.lastName}</td>
</tr>
</#list>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<p>You have come to this page because you used an <strong>action</strong> prefix.<p/>

<p>The text you've entered is ${text!''?html}<p/>
<p>The text you've entered is ${text!''}<p/>

<@s.a href="javascript:history.back();" cssClass="btn btn-info"><i class="icon icon-arrow-left"></i> Back</@s.a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<p>You have come to this page because you used an <strong>method</strong> prefix.<p/>

<p>The text you've enter is ${text!''?html}<p/>
<p>The text you've enter is ${text!''}<p/>

<@s.a href="javascript:history.back();" cssClass="btn btn-info"><i class="icon icon-arrow-left"></i> Back</@s.a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<p>Because this is a <strong>redirect-action</strong>, the text will be lost, due to a redirection
implies a new request being issued from the client.<p/>

The text you've enter is ${text!''?html}<p/>
The text you've enter is ${text!''}<p/>

<@s.a href="javascript:history.back();" cssClass="btn btn-info"><i class="icon icon-arrow-left"></i> Back</@s.a>
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/showcase/src/main/webapp/async/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
this.lastIndex = 0;
this.sendMessage = function(message) {
$.ajax({
async: false,
url: "sendMessage",
data: {
message: message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,22 @@
*/
package it.org.apache.struts2.showcase;

public class ActionChainingTest extends ITBaseTest {
public void test() {
beginAt("/actionchaining/actionChain1!input");
assertTextPresent("Action Chain 1 Property 1: Property Set In Action Chain 1");
assertTextPresent("Action Chain 2 Property 1: Property Set in Action Chain 2");
assertTextPresent("Action Chain 3 Property 1: Property set in Action Chain 3");
import org.junit.Assert;
import org.junit.Test;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

public class ActionChainingTest {
@Test
public void test() throws Exception {
try (final WebClient webClient = new WebClient()) {
final HtmlPage page = webClient.getPage(ParameterUtils.getBaseUrl() + "/actionchaining/actionChain1!input");

final String pageAsText = page.asText();
Assert.assertTrue(pageAsText.contains("Action Chain 1 Property 1: Property Set In Action Chain 1"));
Assert.assertTrue(pageAsText.contains("Action Chain 2 Property 1: Property Set in Action Chain 2"));
Assert.assertTrue(pageAsText.contains("Action Chain 3 Property 1: Property set in Action Chain 3"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@
*/
package it.org.apache.struts2.showcase;

public class ActionTagExampleTest extends ITBaseTest {
public void test() {
beginAt("/tags/ui/actionTagExample!input.action");
assertTextPresent("This text is from the called class");
}
import org.junit.Assert;
import org.junit.Test;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

public class ActionTagExampleTest {
@Test
public void test() throws Exception {
try (final WebClient webClient = new WebClient()) {
final HtmlPage page = webClient.getPage(ParameterUtils.getBaseUrl() + "/tags/ui/actionTagExample!input.action");

final String pageAsText = page.asText();
Assert.assertTrue(pageAsText.contains("This text is from the called class"));
}
}
}
Loading

0 comments on commit 42ef171

Please sign in to comment.