You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2022/11/02 10:06:06 UTC
[tomcat-jakartaee-migration] branch main updated: Skip two tests when security manager is disabled
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
The following commit(s) were added to refs/heads/main by this push:
new f6c8ba9 Skip two tests when security manager is disabled
f6c8ba9 is described below
commit f6c8ba92a1d6442cff7a6eeceb837cc959096b02
Author: remm <re...@apache.org>
AuthorDate: Wed Nov 2 11:05:51 2022 +0100
Skip two tests when security manager is disabled
---
.../org/apache/tomcat/jakartaee/MigrationTest.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
index 812e6a3..9987c2e 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java
@@ -25,6 +25,7 @@ import java.util.jar.JarFile;
import org.apache.commons.io.FileUtils;
import org.junit.After;
+import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
@@ -32,14 +33,25 @@ import static org.junit.Assert.*;
public class MigrationTest {
+ private boolean securityManagerAvailable = true;
+
@Before
public void setUp() {
- System.setSecurityManager(new NoExitSecurityManager());
+ try {
+ System.setSecurityManager(new NoExitSecurityManager());
+ } catch (Throwable t) {
+ // Throws exception by default on newer Java versions
+ securityManagerAvailable = false;
+ }
}
@After
public void tearDown() {
- System.setSecurityManager(null);
+ try {
+ System.setSecurityManager(null);
+ } catch (Throwable t) {
+ // Throws exception by default on newer Java versions
+ }
}
@Test
@@ -83,6 +95,7 @@ public class MigrationTest {
@Test
public void testInvalidOption() throws Exception {
+ Assume.assumeTrue(securityManagerAvailable);
File sourceFile = new File("target/test-classes/HelloServlet.java");
File migratedFile = new File("target/test-classes/HelloServlet.migrated.java");
@@ -96,6 +109,7 @@ public class MigrationTest {
@Test
public void testInvalidProfile() throws Exception {
+ Assume.assumeTrue(securityManagerAvailable);
File sourceFile = new File("target/test-classes/HelloServlet.java");
File migratedFile = new File("target/test-classes/HelloServlet.migrated.java");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org