Skip to content

Commit

Permalink
Merge pull request #792 from apache/release/struts-7-0-x
Browse files Browse the repository at this point in the history
Struts 7.0.x
  • Loading branch information
lukaszlenart authored Nov 30, 2024
2 parents b3e0747 + c16ab0d commit 5f35af0
Show file tree
Hide file tree
Showing 2,367 changed files with 15,517 additions and 116,291 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ name: "CodeQL"

on:
push:
branches: [ "master" ]
branches:
- master
- release/struts-7-0-x
pull_request:

permissions:
Expand All @@ -43,6 +45,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/[email protected]
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
push:
branches:
- master
- release/struts-7-0-x

permissions: read-all

Expand All @@ -33,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '17', '21' ]
java: [ '17', '21' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/scorecards-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ on:
schedule:
- cron: "30 1 * * 6" # Weekly on Saturdays
push:
branches: [ "master" ]
branches:
- master

permissions: read-all

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
push:
branches:
- master
- release/struts-7-0-x

permissions: read-all

Expand Down
89 changes: 9 additions & 80 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,86 +92,10 @@ pipeline {
}
stage('Build Source & JavaDoc') {
when {
branch 'release/struts-7-0-x'
}
steps {
dir("local-snapshots-dir/") {
deleteDir()
}
sh './mvnw -B source:jar javadoc:jar -DskipTests -DskipAssembly --no-transfer-progress'
}
}
stage('Deploy Snapshot') {
when {
branch 'release/struts-7-0-x'
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
sh './mvnw -s \${CUSTOM_SETTINGS} deploy -DskipTests -DskipAssembly --no-transfer-progress'
}
}
}
stage('Upload nightlies') {
when {
branch 'release/struts-7-0-x'
}
steps {
sh './mvnw -B package -DskipTests --no-transfer-progress'
sshPublisher(publishers: [
sshPublisherDesc(
configName: 'Nightlies',
transfers: [
sshTransfer(
remoteDirectory: '/struts/snapshot',
removePrefix: 'assembly/target/assembly/out',
sourceFiles: 'assembly/target/assembly/out/struts-*.zip',
cleanRemote: true
)
],
verbose: true
)
])
}
}
}
post {
always {
cleanWs deleteDirs: true, patterns: [[pattern: '**/target/**', type: 'INCLUDE']]
}
}
}
stage('JDK 8') {
agent {
label 'ubuntu'
}
tools {
jdk 'jdk_1.8_latest'
maven 'maven_3_latest'
}
environment {
MAVEN_OPTS = "-Xmx1024m"
}
stages {
stage('Build') {
steps {
sh './mvnw -B clean install -DskipTests -DskipAssembly --no-transfer-progress'
}
}
stage('Test') {
steps {
sh './mvnw -B verify --no-transfer-progress'
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
anyOf {
branch 'master'; branch 'release/struts-7-0-x'
}
}
}
stage('Build Source & JavaDoc') {
when {
branch 'master'
}
steps {
dir("local-snapshots-dir/") {
deleteDir()
Expand All @@ -181,7 +105,9 @@ pipeline {
}
stage('Deploy Snapshot') {
when {
branch 'master'
anyOf {
branch 'master'; branch 'release/struts-7-0-x'
}
}
steps {
withCredentials([file(credentialsId: 'lukaszlenart-repository-access-token', variable: 'CUSTOM_SETTINGS')]) {
Expand All @@ -191,7 +117,10 @@ pipeline {
}
stage('Upload nightlies') {
when {
branch 'master'
anyOf {
branch 'master'
branch 'release/struts-7-0-x'
}
}
steps {
sh './mvnw -B package -DskipTests --no-transfer-progress'
Expand Down
2 changes: 1 addition & 1 deletion apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>6.7.1-SNAPSHOT</version>
<version>7.0.0-M11-SNAPSHOT</version>
</parent>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
Expand Down
8 changes: 4 additions & 4 deletions apps/rest-showcase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>6.7.1-SNAPSHOT</version>
<version>7.0.0-M11-SNAPSHOT</version>
</parent>

<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>6.7.1-SNAPSHOT</version>
<version>7.0.0-M11-SNAPSHOT</version>
<name>Struts 2 Rest Showcase Webapp</name>
<description>Struts 2 Rest Showcase Example</description>

Expand Down Expand Up @@ -76,7 +76,7 @@
</dependency>

<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -107,7 +107,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.46.v20220331</version>
<version>11.0.18</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
package org.demo.rest.example;

import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.ValidationAwareSupport;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.Validateable;
import org.apache.struts2.ValidationAwareSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.convention.annotation.Result;
Expand Down
1 change: 0 additions & 1 deletion apps/rest-showcase/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
</Console>
</Appenders>
<Loggers>
<Logger name="com.opensymphony.xwork2" level="info"/>
<Logger name="org.apache.struts2" level="info"/>
<Logger name="org.demo.rest" level="debug"/>
<Root level="warn">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,41 @@
*/
package it.org.apache.struts2.rest.example;

import net.sourceforge.jwebunit.junit.WebTestCase;
import org.junit.Before;
import org.junit.Test;

public class GetOrdersTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextNotPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;

public class GetOrdersTest {

@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}


@Test
public void testGetOrders() {
beginAt("/orders/3");
assertTextPresent("Bob");
assertTextNotPresent("Sarah");
}

@Test
public void testGetOrdersInHtml() {
beginAt("/orders/3.xhtml");
assertTextPresent("Bob");
}

@Test
public void testGetOrdersInXml() {
beginAt("/orders/3.xml");
assertTextPresent("<clientName>Bob");
}

@Test
public void testGetOrdersInJson() {
beginAt("/orders/3.json");
assertTextPresent("\"clientName\":\"Bob\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,45 @@
*/
package it.org.apache.struts2.rest.example;

import net.sourceforge.jwebunit.junit.WebTestCase;
import org.junit.Before;
import org.junit.Test;

public class ListOrdersTest extends WebTestCase {
import static net.sourceforge.jwebunit.junit.JWebUnit.assertTextPresent;
import static net.sourceforge.jwebunit.junit.JWebUnit.beginAt;
import static net.sourceforge.jwebunit.junit.JWebUnit.getTestContext;

public class ListOrdersTest {

@Before
public void setUp() throws Exception {
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
}


@Test
public void testListOrders() {
beginAt("/orders");
assertTextPresent("Bob");
assertTextPresent("Sarah");
assertTextPresent("Jim");
}

@Test
public void testListOrdersInHtml() {
beginAt("/orders.xhtml");
assertTextPresent("Bob");
assertTextPresent("Sarah");
assertTextPresent("Jim");
}

@Test
public void testListOrdersInXml() {
beginAt("/orders.xml");
assertTextPresent("<clientName>Bob");
assertTextPresent("<clientName>Sarah");
assertTextPresent("<clientName>Jim");
}

@Test
public void testListOrdersInJson() {
beginAt("/orders.json");
assertTextPresent("\"clientName\":\"Bob\"");
Expand Down
Loading

0 comments on commit 5f35af0

Please sign in to comment.