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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new 44b85d93 Add disabled tests for the verifier
44b85d93 is described below

commit 44b85d93eefc10d44618c2cad08578580e6ff48a
Author: Gary David Gregory (Code signing key) <ggreg...@apache.org>
AuthorDate: Wed Nov 16 10:10:43 2022 -0500

    Add disabled tests for the verifier
---
 .../java/org/apache/bcel/generic/JavaHome.java     | 28 ++++++++++++++++
 .../bcel/verifier/VerifyJavaHomesTestCase.java     | 38 ++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/src/test/java/org/apache/bcel/generic/JavaHome.java 
b/src/test/java/org/apache/bcel/generic/JavaHome.java
index 0b348511..a13f57d5 100644
--- a/src/test/java/org/apache/bcel/generic/JavaHome.java
+++ b/src/test/java/org/apache/bcel/generic/JavaHome.java
@@ -35,6 +35,8 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.stream.Stream;
 
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Utility;
 import org.apache.bcel.util.ModularRuntimeImage;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.SystemUtils;
@@ -103,6 +105,24 @@ public class JavaHome {
         return streamJavaHome().flatMap(JavaHome::streamJarEntryByExt);
     }
 
+    /**
+     * Used from {@code @MethodSource} for tests.
+     *
+     * @return a stream of JarFile.
+     */
+    public static Stream<JarEntry> streamJarEntryClass() {
+        return streamJavaHome().flatMap(JavaHome::streamJarEntryByExtClass);
+    }
+
+    /**
+     * Used from {@code @MethodSource} for tests.
+     *
+     * @return a stream of JarFile.
+     */
+    public static Stream<String> streamJarEntryClassName() {
+        return 
streamJavaHome().flatMap(JavaHome::streamJarEntryByExtClassName);
+    }
+
     /**
      * Used from {@code @MethodSource} for tests.
      *
@@ -216,6 +236,14 @@ public class JavaHome {
         return streamJarFileByExt().flatMap(JarFile::stream);
     }
 
+    private Stream<JarEntry> streamJarEntryByExtClass() {
+        return streamJarEntryByExt().filter(je -> 
je.getName().endsWith(JavaClass.EXTENSION));
+    }
+
+    private Stream<String> streamJarEntryByExtClassName() {
+        return streamJarEntryByExtClass().map(je -> 
Utility.pathToPackage(je.getName().substring(0, 
je.getName().indexOf(JavaClass.EXTENSION))));
+    }
+
     private Stream<JarFile> streamJarFileByExt() {
         return streamJarPathByExt().map(this::toJarFile);
     }
diff --git 
a/src/test/java/org/apache/bcel/verifier/VerifyJavaHomesTestCase.java 
b/src/test/java/org/apache/bcel/verifier/VerifyJavaHomesTestCase.java
new file mode 100644
index 00000000..04351239
--- /dev/null
+++ b/src/test/java/org/apache/bcel/verifier/VerifyJavaHomesTestCase.java
@@ -0,0 +1,38 @@
+/*
+ * 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.bcel.verifier;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+public class VerifyJavaHomesTestCase extends AbstractVerifierTestCase {
+
+    @Disabled("Run once in a while, it takes a long time.")
+    @ParameterizedTest
+    // @Execution(ExecutionMode.CONCURRENT)
+    @MethodSource("org.apache.bcel.generic.JavaHome#streamJarEntryClassName")
+    public void testJarEntryClassName(final String name) throws 
ClassNotFoundException {
+        // System.out.println(jarEntry.getName());
+        // Skip $ classes for now
+        if (!name.contains("$")) {
+            doAllPasses(name);
+        }
+    }
+
+}

Reply via email to