This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new eae15b4  Remove use of JreCompat as it is not required with Java 11+
eae15b4 is described below

commit eae15b427288986fd5f735cf185f04ef21d6ee2a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jul 28 14:02:28 2021 +0100

    Remove use of JreCompat as it is not required with Java 11+
---
 .../tomcat/util/scan/TestStandardJarScanner.java   | 51 ----------------------
 1 file changed, 51 deletions(-)

diff --git a/test/org/apache/tomcat/util/scan/TestStandardJarScanner.java 
b/test/org/apache/tomcat/util/scan/TestStandardJarScanner.java
index 15886bb..da9d941 100644
--- a/test/org/apache/tomcat/util/scan/TestStandardJarScanner.java
+++ b/test/org/apache/tomcat/util/scan/TestStandardJarScanner.java
@@ -24,62 +24,15 @@ import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.Assert;
-import org.junit.Assume;
 import org.junit.Test;
 
 import org.apache.tomcat.Jar;
 import org.apache.tomcat.JarScanType;
 import org.apache.tomcat.JarScannerCallback;
 import org.apache.tomcat.unittest.TesterServletContext;
-import org.apache.tomcat.util.compat.JreCompat;
 
 public class TestStandardJarScanner {
 
-    @Test
-    public void testWebappClassPath() {
-        Assume.assumeFalse("No URLClassLoader with Java 9", 
JreCompat.isJre9Available());
-
-        StandardJarScanner scanner = new StandardJarScanner();
-
-        scanner.setScanClassPath(true);
-        // When running the test on Java 9, one or more URLs to jimage files 
may
-        // be returned. By setting the scanAllFiles option, a callback will be
-        // generated for these files which in turn will mean the number of URLs
-        // and the number of call backs will agree and this test will pass.
-        // There is a TODO in StandardJarScanner to add 'proper' Java 9 
support.
-        scanner.setScanAllFiles(true);
-
-        LoggingCallback callback = new LoggingCallback();
-
-        scanner.scan(JarScanType.PLUGGABILITY, new TesterServletContext(), 
callback);
-
-        List<String> callbacks = callback.getCallbacks();
-
-        ClassLoader cl = TesterServletContext.class.getClassLoader();
-        if (cl instanceof URLClassLoader) {
-            URL[] urls =  ((URLClassLoader) cl).getURLs();
-
-            int size;
-            if (urls == null) {
-                size = 0;
-            } else {
-                size = urls.length;
-            }
-            // Some JREs (Gump) construct a class path that includes JARs that
-            // reference additional JARs via the Class-Path attribute of the
-            // Manifest. These JARs are not returned in ClassLoader.getURLs().
-            // Therefore, this test looks for at least as many JARs as there 
are
-            // URLs but it can't check for an exact match.
-            Assert.assertTrue("[" + callbacks.size() + "] callbacks but 
expected at least [" +
-                    size + "]", callbacks.size() >= size);
-
-        } else {
-            Assert.fail("Unexpected class loader type: " + 
cl.getClass().getName());
-        }
-    }
-
-
     /**
      * Tomcat should ignore URLs which do not have a file part and do not use 
the file scheme.
      */
@@ -124,9 +77,5 @@ public class TestStandardJarScanner {
         public void scanWebInfClasses() throws IOException {
             callbacks.add("N/A::WEB-INF/classes::N/A");
         }
-
-        public List<String> getCallbacks() {
-            return callbacks;
-        }
     }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to