This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch tomee-10.x
in repository https://gitbox.apache.org/repos/asf/tomee.git
The following commit(s) were added to refs/heads/tomee-10.x by this push:
new 6d661b283e fix tests of the recent security backports on 10.x
6d661b283e is described below
commit 6d661b283ef63fec64c4f31a902e071e1bb165a3
Author: Richard Zowalla <[email protected]>
AuthorDate: Tue Oct 13 14:51:46 2026 +0200
fix tests of the recent security backports on 10.x
Add the tomee-remote-secpol container to the new security Arquillian tests,
let the fake AsyncContext return a request and check the scan exclusion
report without depending on the logging setup.
---
.../src/test/resources/arquillian.xml | 18 +++++++++
.../apache/openejb/config/NewLoaderLogicTest.java | 43 +++-------------------
.../jwt/MPJWTFilterExitWebAppTest.java | 4 +-
3 files changed, 26 insertions(+), 39 deletions(-)
diff --git
a/arquillian/arquillian-tomee-tests/arquillian-tomee-security-tests/src/test/resources/arquillian.xml
b/arquillian/arquillian-tomee-tests/arquillian-tomee-security-tests/src/test/resources/arquillian.xml
index 774185d205..e660401f12 100644
---
a/arquillian/arquillian-tomee-tests/arquillian-tomee-security-tests/src/test/resources/arquillian.xml
+++
b/arquillian/arquillian-tomee-tests/arquillian-tomee-security-tests/src/test/resources/arquillian.xml
@@ -51,4 +51,22 @@
</property>
</configuration>
</container>
+ <container qualifier="tomee-remote-secpol">
+ <configuration>
+ <property name="httpPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="dir">target/apache-tomee-remote</property>
+ <property
name="appWorkingDir">target/arquillian-test-working-dir</property>
+ <property name="cleanOnStartUp">true</property>
+ <property name="simpleLog">true</property>
+ <property name="conf">src/test/resources/security-conf</property>
+ <!-- same as security-conf/server.xml plus the TomEE ServerListener a
standalone server needs -->
+ <property name="serverXml">src/test/tomee/server.xml</property>
+ <property name="properties">
+
openejb.classloader.forced-load=org.apache.openejb.arquillian.tests.security
+ jakarta.security.jacc.policy.provider=sun.security.provider.PolicyFile
+ </property>
+ </configuration>
+ </container>
</arquillian>
diff --git
a/container/openejb-core/src/test/java/org/apache/openejb/config/NewLoaderLogicTest.java
b/container/openejb-core/src/test/java/org/apache/openejb/config/NewLoaderLogicTest.java
index f62892fe84..0b88b304c0 100644
---
a/container/openejb-core/src/test/java/org/apache/openejb/config/NewLoaderLogicTest.java
+++
b/container/openejb-core/src/test/java/org/apache/openejb/config/NewLoaderLogicTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.openejb.config;
-import org.apache.openejb.util.LogCategory;
+import org.apache.xbean.finder.filter.Filters;
import org.junit.Test;
import java.io.File;
@@ -26,9 +26,6 @@ import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.logging.Handler;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -59,39 +56,11 @@ public class NewLoaderLogicTest {
exclusions.getParentFile().mkdirs();
Files.write(exclusions.toPath(),
"internal-\n".getBytes(StandardCharsets.UTF_8));
- final List<LogRecord> records = new ArrayList<>();
- final Handler handler = new Handler() {
- @Override
- public void publish(final LogRecord record) {
- records.add(record);
- }
+ final List<URL> scannable = DeploymentLoader.filterWebappUrls(webUrls,
null, exclusions.toURI().toURL());
+ assertEquals(Collections.singletonList(appJar), scannable);
- @Override
- public void flush() {
- // no-op
- }
-
- @Override
- public void close() {
- // no-op
- }
- };
- final Logger logger =
Logger.getLogger(LogCategory.OPENEJB_STARTUP_CONFIG.getName());
- logger.addHandler(handler);
- try {
- final List<URL> scannable =
DeploymentLoader.filterWebappUrls(webUrls, null, exclusions.toURI().toURL());
- assertEquals(Collections.singletonList(appJar), scannable);
- } finally {
- logger.removeHandler(handler);
- }
-
- final List<String> messages = new ArrayList<>();
- for (final LogRecord record : records) {
- if (record.getMessage().startsWith("Application jars not
scanned")) {
- messages.add(record.getMessage());
- }
- }
- assertEquals(1, messages.size());
- assertTrue(messages.get(0),
messages.get(0).contains("[ant-reporting-web.jar (prefix 'ant-')]"));
+ // only the application jar dropped by the container list is reported,
not the one excluded by the app itself
+ assertEquals(Collections.singletonList("ant-reporting-web.jar (prefix
'ant-')"),
+ new
ArrayList<>(DeploymentLoader.builtinExcludedWebappJars(webUrls, scannable,
Filters.prefixes("internal-"))));
}
}
diff --git
a/mp-jwt/src/test/java/org/apache/tomee/microprofile/jwt/MPJWTFilterExitWebAppTest.java
b/mp-jwt/src/test/java/org/apache/tomee/microprofile/jwt/MPJWTFilterExitWebAppTest.java
index 28dab8844b..e6cfa2de85 100644
---
a/mp-jwt/src/test/java/org/apache/tomee/microprofile/jwt/MPJWTFilterExitWebAppTest.java
+++
b/mp-jwt/src/test/java/org/apache/tomee/microprofile/jwt/MPJWTFilterExitWebAppTest.java
@@ -359,12 +359,12 @@ public class MPJWTFilterExitWebAppTest {
@Override
public ServletRequest getRequest() {
- throw new UnsupportedOperationException();
+ return null; // AsyncEvent(AsyncContext) reads both with some
Servlet API versions
}
@Override
public ServletResponse getResponse() {
- throw new UnsupportedOperationException();
+ return null; // AsyncEvent(AsyncContext) reads both with some
Servlet API versions
}
@Override