This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch merge/master-2024-06-10 in repository https://gitbox.apache.org/repos/asf/struts.git
commit 28ea6d01c2c117ab3147519daa1a69eb7c1b9583 Merge: 62eac8f58 444e4d4c0 Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Mon Jun 10 07:24:49 2024 +0200 Merge branch 'master' into merge/master-2024-06-10 .asf.yaml | 5 +- .github/workflows/scorecards-analysis.yaml | 4 +- apps/showcase/pom.xml | 2 +- assembly/pom.xml | 2 +- core/pom.xml | 6 + .../com/opensymphony/xwork2/ActionSupport.java | 5 + .../opensymphony/xwork2/DefaultLocaleProvider.java | 18 +- .../com/opensymphony/xwork2/LocaleProvider.java | 16 + .../xwork2/ognl/SecurityMemberAccess.java | 7 +- .../xwork2/validator/ActionValidatorManager.java | 4 +- .../validator/DefaultActionValidatorManager.java | 18 +- .../validator/DelegatingValidatorContext.java | 12 +- .../java/org/apache/struts2/components/Set.java | 12 +- .../struts2/interceptor/I18nInterceptor.java | 25 +- .../struts2/interceptor/csp/CspInterceptor.java | 53 ++- .../struts2/interceptor/csp/CspSettings.java | 8 + .../interceptor/csp/DefaultCspSettings.java | 34 +- .../interceptor/exec/StrutsBackgroundProcess.java | 20 +- .../xwork2/DefaultLocaleProviderTest.java | 174 ++++++++++ .../opensymphony/xwork2/LocaleProviderTest.java} | 70 ++-- .../DefaultActionValidatorManagerTest.java | 358 ++++++++++----------- .../validator/VisitorFieldValidatorTest.java | 11 + .../validator/VisitorValidatorTestAction.java | 11 +- .../struts2/interceptor/CspInterceptorTest.java | 116 ++++++- .../struts2/interceptor/I18nInterceptorTest.java | 20 ++ .../exec/StrutsBackgroundProcessTest.java | 60 +++- .../org/apache/struts2/views/jsp/SetTagTest.java | 58 +++- .../VisitorValidatorTestAction-validation.xml | 8 + plugins/tiles/pom.xml | 12 +- .../struts2/tiles/StrutsTilesContainerFactory.java | 16 +- .../StrutsWildcardServletApplicationContext.java | 9 +- .../tiles/StrutsTilesContainerFactoryTest.java | 8 +- ...trutsWildcardServletApplicationContextTest.java | 78 +++++ plugins/tiles/src/test/resources/WEB-INF/tiles.xml | 39 +++ .../org/apache/tiles/core/config/tiles_defs1.xml | 75 +++++ pom.xml | 31 +- 36 files changed, 1072 insertions(+), 333 deletions(-) diff --cc core/pom.xml index b76bb7615,4027d37e7..66e3a89ff --- a/core/pom.xml +++ b/core/pom.xml @@@ -214,12 -259,13 +214,18 @@@ <artifactId>spring-context-support</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>jakarta.el</groupId> + <artifactId>jakarta.el-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> diff --cc core/src/main/java/org/apache/struts2/interceptor/csp/DefaultCspSettings.java index 9e5b6180a,b245ab352..338a29914 --- a/core/src/main/java/org/apache/struts2/interceptor/csp/DefaultCspSettings.java +++ b/core/src/main/java/org/apache/struts2/interceptor/csp/DefaultCspSettings.java @@@ -20,9 -20,10 +20,10 @@@ package org.apache.struts2.interceptor. import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; + import org.apache.struts2.action.CspSettingsAware; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.security.SecureRandom; import java.util.Base64; import java.util.Objects; diff --cc core/src/test/java/org/apache/struts2/interceptor/CspInterceptorTest.java index c711eccd7,221e725db..f913f74d5 --- a/core/src/test/java/org/apache/struts2/interceptor/CspInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/CspInterceptorTest.java @@@ -31,7 -32,8 +32,8 @@@ import org.apache.struts2.interceptor.c import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSession; ++import jakarta.servlet.http.HttpServletRequest; import static org.junit.Assert.assertNotEquals; diff --cc core/src/test/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcessTest.java index 19faf41ea,a705c2c7b..3b1617bbd --- a/core/src/test/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcessTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcessTest.java @@@ -18,8 -18,15 +18,9 @@@ */ package org.apache.struts2.interceptor.exec; -import com.mockobjects.servlet.MockHttpServletRequest; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.mock.MockActionInvocation; -import org.apache.struts2.StrutsInternalTestCase; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; + import java.io.NotSerializableException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.security.SecureRandom; @@@ -35,13 -42,8 +36,15 @@@ import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.struts2.StrutsInternalTestCase; +import org.springframework.mock.web.MockHttpServletRequest; + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.ActionInvocation; +import com.opensymphony.xwork2.mock.MockActionInvocation; + + import static org.awaitility.Awaitility.await; + /** * Test case for BackgroundProcessTest. */ diff --cc core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java index 5c1f9047a,f14e07735..078c4a626 --- a/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java @@@ -18,21 -18,14 +18,17 @@@ */ package org.apache.struts2.views.jsp; -import com.mockobjects.servlet.MockJspWriter; import java.io.IOException; -import javax.servlet.jsp.JspException; +import java.io.StringWriter; + +import org.springframework.mock.web.MockJspWriter; + +import jakarta.servlet.jsp.JspException; - - /** - */ public class SetTagTest extends AbstractUITagTest { - Chewbacca chewie; - SetTag tag; - + private Chewbacca chewie; + private SetTag tag; public void testApplicationScope() throws JspException { tag.setName("foo"); diff --cc plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java index def7aab96,4cda08522..d6e7cf9b3 --- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java +++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java @@@ -59,19 -59,16 +59,16 @@@ import org.apache.tiles.request.render. import org.apache.tiles.request.render.ChainedDelegateRenderer; import org.apache.tiles.request.render.Renderer; -import javax.el.ArrayELResolver; -import javax.el.BeanELResolver; -import javax.el.CompositeELResolver; -import javax.el.ELResolver; -import javax.el.ListELResolver; -import javax.el.MapELResolver; -import javax.el.ResourceBundleELResolver; -import javax.servlet.jsp.JspFactory; +import jakarta.el.ArrayELResolver; +import jakarta.el.BeanELResolver; +import jakarta.el.CompositeELResolver; +import jakarta.el.ELResolver; +import jakarta.el.ListELResolver; +import jakarta.el.MapELResolver; +import jakarta.el.ResourceBundleELResolver; +import jakarta.servlet.jsp.JspFactory; import java.util.ArrayList; - import java.util.Arrays; import java.util.Collection; - import java.util.Collections; - import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; diff --cc plugins/tiles/src/test/java/org/apache/struts2/tiles/StrutsTilesContainerFactoryTest.java index dbadffa7a,944aac2c9..89d4b5397 --- a/plugins/tiles/src/test/java/org/apache/struts2/tiles/StrutsTilesContainerFactoryTest.java +++ b/plugins/tiles/src/test/java/org/apache/struts2/tiles/StrutsTilesContainerFactoryTest.java @@@ -34,8 -34,8 +34,9 @@@ import org.apache.tiles.request.render. import org.junit.Before; import org.junit.Test; -import javax.servlet.jsp.JspFactory; +import jakarta.servlet.ServletContext; +import jakarta.servlet.jsp.JspFactory; + import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; diff --cc plugins/tiles/src/test/java/org/apache/struts2/tiles/StrutsWildcardServletApplicationContextTest.java index 000000000,972ed705a..ec12873f9 mode 000000,100644..100644 --- a/plugins/tiles/src/test/java/org/apache/struts2/tiles/StrutsWildcardServletApplicationContextTest.java +++ b/plugins/tiles/src/test/java/org/apache/struts2/tiles/StrutsWildcardServletApplicationContextTest.java @@@ -1,0 -1,79 +1,78 @@@ + /* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.struts2.tiles; + -import org.apache.tiles.core.definition.DefinitionsFactory; + import org.apache.tiles.request.ApplicationResource; + import org.junit.Before; + import org.junit.Test; + import org.springframework.core.io.FileSystemResource; + import org.springframework.core.io.FileUrlResource; + import org.springframework.core.io.Resource; + import org.springframework.core.io.ResourceLoader; + import org.springframework.mock.web.MockServletContext; + -import javax.servlet.ServletContext; ++import jakarta.servlet.ServletContext; + import java.net.MalformedURLException; + import java.net.URL; + import java.util.Collection; + + import static org.assertj.core.api.Assertions.assertThat; + + public class StrutsWildcardServletApplicationContextTest { + + private ServletContext context; + + @Before + public void setUp() throws Exception { + URL resource = getClass().getResource("/"); + context = new MockServletContext(resource.getPath(), new ResourceLoader() { + @Override + public Resource getResource(String location) { + try { + String finalLocation = location.replaceAll("//", "/"); + if (finalLocation.endsWith("/")) { + return new FileSystemResource(finalLocation); + } + return new FileUrlResource(finalLocation); + } catch (MalformedURLException e) { + return null; + } + } + + @Override + public ClassLoader getClassLoader() { + return StrutsWildcardServletApplicationContextTest.class.getClassLoader(); + } + }); + } + + @Test + public void wildcardSupport() { + StrutsWildcardServletApplicationContext applicationContext = new StrutsWildcardServletApplicationContext(context); + + Collection<ApplicationResource> resources = applicationContext.getResources("*tiles*.xml"); + + assertThat(resources) + .hasSize(1) + .extracting(ApplicationResource::getLocalePath) + .first().asString() + .endsWith("/WEB-INF/tiles.xml"); + } + + } diff --cc pom.xml index d4fb87309,185ab02a1..d330c70b4 --- a/pom.xml +++ b/pom.xml @@@ -104,27 -104,22 +104,27 @@@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.build.outputTimestamp>2024-04-07T09:22:16Z</project.build.outputTimestamp> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> + <project.build.outputTimestamp>2024-04-20T07:24:31Z</project.build.outputTimestamp> + <maven.compiler.release>17</maven.compiler.release> + <maven.compiler.source>17</maven.compiler.source> + <maven.compiler.target>17</maven.compiler.target> <!-- dependency versions in alphanumeric order --> - <asm.version>9.6</asm.version> + <asm.version>9.7</asm.version> + <byte-buddy.version>1.14.11</byte-buddy.version> - <freemarker.version>2.3.32</freemarker.version> ++ <freemarker.version>2.3.33</freemarker.version> + <hibernate-validator.version>8.0.1.Final</hibernate-validator.version> - <jackson.version>2.16.0</jackson.version> + <jackson.version>2.17.1</jackson.version> <log4j2.version>2.23.1</log4j2.version> + <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version> + <mockito.version>5.8.0</mockito.version> <ognl.version>3.3.5</ognl.version> + <sitemesh.version>2.5.0</sitemesh.version> - <slf4j.version>2.0.12</slf4j.version> + <slf4j.version>2.0.13</slf4j.version> - <spring.platformVersion>5.3.31</spring.platformVersion> + <spring.platformVersion>6.0.13</spring.platformVersion> <tiles.version>3.0.8</tiles.version> <tiles-request.version>1.0.7</tiles-request.version> - <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version> - <hibernate-validator.version>6.2.4.Final</hibernate-validator.version> - <freemarker.version>2.3.33</freemarker.version> + <velocity-tools.version>3.1</velocity-tools.version> <!-- Site generation --> <fluido-skin.version>1.9</fluido-skin.version> @@@ -730,10 -774,17 +730,17 @@@ <scope>test</scope> </dependency> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <version>4.2.1</version> + <scope>test</scope> + </dependency> + <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <version>6.0.0</version> <scope>provided</scope> </dependency>