This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git
The following commit(s) were added to refs/heads/main by this push:
new 1d72919b50 make the scan exclusion and async MP-JWT tests independent
of their environment (#3088)
1d72919b50 is described below
commit 1d72919b50ebd447fe839d9b9dfa36add82e206e
Author: Richard Zowalla <[email protected]>
AuthorDate: Tue Oct 13 14:59:11 2026 +0200
make the scan exclusion and async MP-JWT tests independent of their
environment (#3088)
Check the excluded webapp jars directly instead of capturing a log record,
and
let the fake AsyncContext return null instead of throwing in getRequest.
---
.../apache/openejb/config/NewLoaderLogicTest.java | 43 +++-------------------
.../jwt/MPJWTFilterExitWebAppTest.java | 4 +-
2 files changed, 8 insertions(+), 39 deletions(-)
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