[Git][java-team/plexus-classworlds][upstream] New upstream version 2.6.0

Emmanuel Bourg gitlab at salsa.debian.org
Fri Jan 11 12:58:20 GMT 2019


Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / plexus-classworlds


Commits:
1414c620 by Emmanuel Bourg at 2019-01-11T12:47:45Z
New upstream version 2.6.0
- - - - -


26 changed files:

- + .travis.yml
- + README.md
- pom.xml
- src/main/java/org/codehaus/classworlds/BytesURLConnection.java
- src/main/java/org/codehaus/classworlds/ClassRealm.java
- src/main/java/org/codehaus/classworlds/ConfiguratorAdapter.java
- src/main/java/org/codehaus/classworlds/DefaultClassRealm.java
- src/main/java/org/codehaus/plexus/classworlds/launcher/ConfigurationHandler.java
- src/main/java/org/codehaus/plexus/classworlds/launcher/ConfigurationParser.java
- src/main/java/org/codehaus/plexus/classworlds/launcher/Launcher.java
- src/main/java/org/codehaus/plexus/classworlds/realm/ClassRealm.java
- src/main/java/org/codehaus/plexus/classworlds/strategy/Strategy.java
- src/main/java/org/codehaus/plexus/classworlds/strategy/StrategyFactory.java
- src/site/site.xml
- + src/site/xdoc/apiusage.xml
- + src/site/xdoc/index.xml
- + src/site/xdoc/launcher.xml
- src/test/java/org/codehaus/plexus/classworlds/AbstractClassWorldsTestCase.java
- src/test/java/org/codehaus/plexus/classworlds/ClassWorldTest.java
- src/test/java/org/codehaus/plexus/classworlds/launcher/ConfigurationParserTest.java
- src/test/java/org/codehaus/plexus/classworlds/launcher/ConfiguratorTest.java
- src/test/java/org/codehaus/plexus/classworlds/launcher/LauncherTest.java
- src/test/java/org/codehaus/plexus/classworlds/realm/ClassRealmImplTest.java
- src/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java
- src/test/java/org/codehaus/plexus/classworlds/realm/EntryTest.java
- src/test/java/org/codehaus/plexus/classworlds/strategy/StrategyTest.java


Changes:

=====================================
.travis.yml
=====================================
@@ -0,0 +1,27 @@
+language: java
+jdk:
+  - openjdk7
+  - openjdk8
+  - openjdk9
+  - openjdk10
+  - openjdk11
+  - openjdk-ea
+  
+dist: trusty
+
+#
+# Run all integration tests.
+script: 
+  - "mvn --show-version --errors --batch-mode clean verify"
+# -XX:MaxPermSize in mavenrc deprecated
+env: "MAVEN_SKIP_RC=true"
+#
+cache:
+    directories:
+    - $HOME/.m2
+branches:
+    except:
+        - gh-pages
+notifications:
+    email:
+        - rfscholte at apache.org


=====================================
README.md
=====================================
@@ -0,0 +1,8 @@
+Plexus-Classworlds
+===============
+
+[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/codehaus-plexus/plexus-classworlds.svg?label=License)](http://www.apache.org/licenses/)
+[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-classworlds.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.codehaus.plexus%22%20a%3A%22plexus-classworlds%22)
+[![Build Status](https://travis-ci.org/codehaus-plexus/plexus-classworlds.svg?branch=master)](https://travis-ci.org/codehaus-plexus/plexus-classworlds)
+
+Current master is now at https://github.com/codehaus-plexus/plexus-classworlds


=====================================
pom.xml
=====================================
@@ -21,11 +21,11 @@
   <parent>
     <groupId>org.codehaus.plexus</groupId>
     <artifactId>plexus</artifactId>
-    <version>3.3.1</version>
+    <version>5.1</version>
   </parent>
 
   <artifactId>plexus-classworlds</artifactId>
-  <version>2.5.2</version>
+  <version>2.6.0</version>
   <packaging>bundle</packaging>
 
   <name>Plexus Classworlds</name>
@@ -33,18 +33,26 @@
   <inceptionYear>2002</inceptionYear>
 
   <scm>
-    <connection>scm:git:git at github.com:sonatype/plexus-classworlds.git</connection>
-    <developerConnection>scm:git:git at github.com:sonatype/plexus-classworlds.git</developerConnection>
-    <url>http://github.com/sonatype/plexus-classworlds</url>
-    <tag>plexus-classworlds-2.5.2</tag>
+    <connection>scm:git:git at github.com:codehaus-plexus/plexus-classworlds.git</connection>
+    <developerConnection>scm:git:git at github.com:codehaus-plexus/plexus-classworlds.git</developerConnection>
+    <url>http://github.com/codehaus-plexus/plexus-classworlds/tree/${project.scm.tag}/</url>
+    <tag>plexus-classworlds-2.6.0</tag>
   </scm>
+  <issueManagement>
+    <system>github</system>
+    <url>http://github.com/codehaus-plexus/plexus-classworlds/issues</url>
+  </issueManagement>
 
   <distributionManagement>
     <site>
-      <id>adm-site</id>
-      <url>scm:git:git at github.com:sonatype/plexus-classworlds.git</url>
+      <id>github:gh-pages</id>
+      <url>${project.scm.developerConnection}</url>
     </site>
   </distributionManagement>
+  
+  <properties>
+    <javaVersion>7</javaVersion>
+  </properties> 
 
   <build>
     <pluginManagement>
@@ -52,17 +60,8 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-scm-publish-plugin</artifactId>
-          <version>1.0</version>
           <configuration>
-            <scmBranch>gh-pages</scmBranch>
-          </configuration>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-site-plugin</artifactId>
-          <version>3.3</version>
-          <configuration>
-            <scmBranch>gh-pages</scmBranch>
+            <content>${project.reporting.outputDirectory}</content><!-- mono-module doesn't require site:stage -->
           </configuration>
         </plugin>
         <plugin>
@@ -80,9 +79,23 @@
       </plugins>
     </pluginManagement>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-scm-publish-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>scm-publish</id>
+            <phase>site-deploy</phase><!-- deploy site with maven-scm-publish-plugin -->
+            <goals>
+              <goal>publish-scm</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
+        <version>3.5.1</version>
         <extensions>true</extensions>
         <configuration>
           <instructions>
@@ -115,8 +128,6 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
           <excludes>
             <exclude>org/codehaus/plexus/classworlds/event/*</exclude>
           </excludes>
@@ -184,7 +195,6 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-project-info-reports-plugin</artifactId>
-        <version>2.7</version>
         <configuration>
           <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
         </configuration>


=====================================
src/main/java/org/codehaus/classworlds/BytesURLConnection.java
=====================================
@@ -22,10 +22,6 @@ import java.io.InputStream;
 import java.io.ByteArrayInputStream;
 
 /**
- * @author Hani Suleiman (hani at formicary.net)
- *         <p/>
- *         Date: Oct 20, 2003
- *         Time: 12:46:01 AM
  */
 @Deprecated
 public class BytesURLConnection extends URLConnection


=====================================
src/main/java/org/codehaus/classworlds/ClassRealm.java
=====================================
@@ -51,13 +51,11 @@ import java.net.URL;
 import java.util.Enumeration;
 
 /**
- * Autonomous sub-portion of a <code>ClassWorld</code>.
- * <p/>
- * <p/>
- * This class most closed maps to the <code>ClassLoader</code>
+ * <p>Autonomous sub-portion of a <code>ClassWorld</code>.</p>
+ * 
+ * <p>This class most closed maps to the <code>ClassLoader</code>
  * role from Java and in facts can provide a <code>ClassLoader</code>
- * view of itself using {@link #getClassLoader}.
- * </p>
+ * view of itself using {@link #getClassLoader}.</p>
  *
  * @author <a href="mailto:bob at eng.werken.com">bob mcwhirter</a>
  * @author <a href="mailto:jason at zenplex.com">Jason van Zyl</a>


=====================================
src/main/java/org/codehaus/classworlds/ConfiguratorAdapter.java
=====================================
@@ -21,10 +21,6 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 
 /**
- * Created by IntelliJ IDEA.
- *
- * @uthor: Andrew Williams
- * @since: Nov 25, 2006
  */
 @Deprecated
 public class ConfiguratorAdapter


=====================================
src/main/java/org/codehaus/classworlds/DefaultClassRealm.java
=====================================
@@ -92,6 +92,7 @@ public class DefaultClassRealm
      *
      *  @param constituent class name
      *  @param b the class definition as a byte[]
+     *  @throws ClassNotFoundException when class couldn't be loaded
      */
     public void addConstituent(String constituent,
                                byte[] b) throws ClassNotFoundException


=====================================
src/main/java/org/codehaus/plexus/classworlds/launcher/ConfigurationHandler.java
=====================================
@@ -40,18 +40,18 @@ public interface ConfigurationHandler
     /**
      * Define a new realm
      * @param realmName the new realm name
-     * @throws DuplicateRealmException
+     * @throws DuplicateRealmException when realm with name already exists
      */
     void addRealm( String realmName )
         throws DuplicateRealmException;
 
     /**
      * Add an import specification from a realm
-     * @param relamName the realm name
+     * @param realmName the realm name
      * @param importSpec the import specification
-     * @throws NoSuchRealmException
+     * @throws NoSuchRealmException if realm doesn't exist 
      */
-    void addImportFrom( String relamName, String importSpec )
+    void addImportFrom( String realmName, String importSpec )
         throws NoSuchRealmException;
 
     /**


=====================================
src/main/java/org/codehaus/plexus/classworlds/launcher/ConfigurationParser.java
=====================================
@@ -66,6 +66,12 @@ public class ConfigurationParser
 
     /**
      * Parse launcher configuration file and send events to the handler.
+     * 
+     * @param is the inputstream
+     * @throws IOException when IOException occurs
+     * @throws ConfigurationException when ConfigurationException occurs
+     * @throws DuplicateRealmException when realm already exists
+     * @throws NoSuchRealmException when realm doesn't exist 
      */
     public void parse( InputStream is )
         throws IOException, ConfigurationException, DuplicateRealmException, NoSuchRealmException
@@ -315,7 +321,7 @@ public class ConfigurationParser
      *                               a valid path element.
      * @throws FileNotFoundException If the line does not represent
      *                               a valid path element in the filesystem.
-     * @throws ConfigurationException 
+     * @throws ConfigurationException will never occur (thrown for backwards compatibility)
      */
     protected void loadGlob( String line,
                              boolean optionally )


=====================================
src/main/java/org/codehaus/plexus/classworlds/launcher/Launcher.java
=====================================
@@ -31,19 +31,15 @@ import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
 import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
 
 /**
- * Command-line invokable application launcher.
- * <p/>
- * <p/>
- * This launcher class assists in the creation of classloaders and <code>ClassRealm</code>s
+ * <p>Command-line invokable application launcher.</p>
+ * 
+ * <p>This launcher class assists in the creation of classloaders and <code>ClassRealm</code>s
  * from a configuration file and the launching of the application's <code>main</code>
- * method from the correct class loaded through the correct classloader.
- * </p>
- * <p/>
- * <p/>
- * The path to the configuration file is specified using the <code>classworlds.conf</code>
+ * method from the correct class loaded through the correct classloader.</p>
+ * 
+ * <p> The path to the configuration file is specified using the <code>classworlds.conf</code>
  * system property, typically specified using the <code>-D</code> switch to
- * <code>java</code>.
- * </p>
+ * <code>java</code>.</p>
  *
  * @author <a href="mailto:bob at eng.werken.com">bob mcwhirter</a>
  */
@@ -239,12 +235,9 @@ public class Launcher
     }
 
     /**
-     * Attempt to launch the application through the enhanced main method.
-     * <p/>
-     * <p/>
-     * This will seek a method with the exact signature of:
-     * </p>
-     * <p/>
+     * <p>Attempt to launch the application through the enhanced main method.</p>
+     * 
+     * <p>This will seek a method with the exact signature of:</p>
      * <pre>
      *  public static void main(String[] args, ClassWorld world)
      *  </pre>
@@ -297,12 +290,10 @@ public class Launcher
     }
 
     /**
-     * Attempt to launch the application through the standard main method.
-     * <p/>
-     * <p/>
-     * This will seek a method with the exact signature of:
-     * </p>
-     * <p/>
+     * <p>Attempt to launch the application through the standard main method.</p>
+     * 
+     * <p>This will seek a method with the exact signature of:</p>
+
      * <pre>
      *  public static void main(String[] args)
      *  </pre>


=====================================
src/main/java/org/codehaus/plexus/classworlds/realm/ClassRealm.java
=====================================
@@ -272,6 +272,30 @@ public class ClassRealm
         }
     }
 
+    // java11
+    protected Class<?> findClass( String moduleName, String name )
+    {
+        if ( moduleName != null )
+        {
+            return null;
+        }
+        try
+        {
+            return super.findClass( name );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            try
+            {
+                return strategy.getRealm().findClass( name );
+            }
+            catch ( ClassNotFoundException nestedException )
+            {
+                return null;
+            }
+        }
+    }
+
     protected Class<?> findClass( String name )
         throws ClassNotFoundException
     {


=====================================
src/main/java/org/codehaus/plexus/classworlds/strategy/Strategy.java
=====================================
@@ -25,9 +25,6 @@ import org.codehaus.plexus.classworlds.realm.ClassRealm;
 /**
  * A strategy is a class for defining how classes and resources are located
  * in classworlds.
- *
- * @uthor: Andrew Williams
- * @since: Nov 19, 2006
  */
 public interface Strategy
 {


=====================================
src/main/java/org/codehaus/plexus/classworlds/strategy/StrategyFactory.java
=====================================
@@ -20,9 +20,6 @@ import org.codehaus.plexus.classworlds.realm.ClassRealm;
 
 /**
  * StrategyFactory loads a strategy, either default or from a given hint.
- *
- * @uthor: Andrew Williams
- * @since: Nov 19, 2006
  */
 public class StrategyFactory
 {


=====================================
src/site/site.xml
=====================================
@@ -1,16 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0  http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0  http://maven.apache.org/xsd/decoration-1.0.0.xsd">
   <bannerLeft>
     <name>Plexus Classworlds</name>
   </bannerLeft>
-  <skin>
-    <groupId>org.apache.maven.skins</groupId>
-    <artifactId>maven-fluido-skin</artifactId>
-    <version>1.3.0</version>
-  </skin>
   <body>
     <menu name="Overview">
       <item name="Introduction" href="index.html"/>
+      <item name="Launcher" href="launcher.html"/>
+      <item name="API Usage" href="apiusage.html"/>
       <item name="JavaDocs" href="apidocs/index.html"/>
       <item name="Source Xref" href="xref/index.html"/>
       <!--item name="FAQ" href="faq.html"/-->


=====================================
src/site/xdoc/apiusage.xml
=====================================
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+
+<document>
+
+  <properties>
+    <title>Classworlds API Usage</title>
+    <author email="bob at werken.com">bob mcwhirter</author>
+  </properties>
+
+  <body>
+
+  <section name="Classworlds API Usage">
+
+    <p>
+    The Java API can be used to create new realms and connect
+    realms together through importation of specific packages.
+    </p>
+
+    <p>
+    The core of the <b>Classworlds</b> infrastructure is
+    the 
+    <a href="apidocs/index.html?org/codehaus/plexus/classworlds/ClassWorld.html">ClassWorld</a>
+    class.  An application must create a <code>ClassWorld</code> instance.
+    It is advisable to store the instance as a singleton or some other
+    handy location.
+    </p>
+
+<source><![CDATA[
+ClassWorld world = new ClassWorld();
+]]></source>
+
+    <p>
+    Once a <code>ClassWorld</code> is created, realms within it
+    can be created.  These realms effectively only allow loading
+    of the core JVM classes.  
+    </p>
+
+<source><![CDATA[
+ClassWorld world = new ClassWorld();
+ClassRealm containerRealm    = world.newRealm( "container" );
+ClassRealm logComponentRealm = world.newRealm( "logComponent" );
+]]></source>
+
+    <p>
+    In order to make each <code>ClassRealm</code> useful, constituent
+    must be added to that each can provide certain classes.
+    </p>
+
+<source><![CDATA[
+containerRealm.addURL( containerJarUrl );
+logComponentRealm.addURL( logComponentJarUrl );
+]]></source>
+
+    <p>
+    Now, links between the various realms need to be created to allow
+    classes loaded from one to be available to classes loaded in another.
+    </p>
+
+<source><![CDATA[
+logComponentRealm.importFrom( "container", 
+                              "com.werken.projectz.component" );
+]]></source>
+
+    <p>
+    The container implementation can then be loaded from its realm
+    and used.
+    </p>
+
+<source><![CDATA[
+Class containerClass = containerRealm.loadClass( CONTAINER_CLASSNAME );
+MyContainer container = (MyContainer) containerClass.newInstance();
+Thread.currentThread().setContextClassLoader( containerRealm.getClassLoader() );
+container.run();
+]]></source>
+
+    <p>
+    Ideally, the container itself would be responsible for creating
+    a <code>ClassRealm</code> for each component that's loaded, and
+    importing the component contract interfaces into the component's
+    <code>ClassRealm</code> and using <code>loadClass(..)</code>
+    to gain entry into the sandboxed component realm.
+    </p>
+
+  </section>
+
+</body>
+</document>
\ No newline at end of file


=====================================
src/site/xdoc/index.xml
=====================================
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+
+<document>
+
+  <properties>
+    <title>Plexus Classworlds</title>
+    <author email="bob at werken.com">bob mcwhirter</author>
+  </properties>
+
+  <body>
+
+  <section name="Overview">
+
+    <p>
+    <b>Plexus Classworlds</b> is a framework for container developers
+    who require complex manipulation of Java's ClassLoaders.  Java's
+    native ClassLoader mechanisms and classes can cause
+    much headache and confusion for certain types of application
+    developers.  Projects which involve dynamic loading of components
+    or otherwise represent a 'container' can benefit from the classloading
+    control provided by <b>Classworlds</b>.  
+    </p>
+
+    <p>
+    <b>Plexus Classworlds</b> provides a richer set of semantics for
+    class loading than Java's normal mechanisms, while still being
+    able to provide a ClassLoader interface to integrate
+    seamlessly with the Java environment.
+    </p>
+
+    <p>
+    The <b>Classworlds</b> model does away with the hierarchy
+    normally associated with ClassLoaders.  Instead,
+    <a href="apidocs/index.html?org/codehaus/plexus/classworlds/ClassWorld.html"><code>ClassWorld</code></a> provides a
+    pool of <a href="apidocs/index.html?org/codehaus/plexus/classworlds/realm/ClassRealm.html"><code>ClassRealms</code></a>
+    which can import arbitrary packages from other ClassRealms.
+    Effectively, <b>Classworlds</b> turns the old-style
+    hierarchy into a directed graph.
+    </p>
+
+    <p>
+    In a application container environment, the container may
+    have a realm capable of loading on the container/component
+    contract interfaces and classes.  Another realm is created
+    for each component which imports the contract classes from
+    the container realm.
+    </p>
+
+    <p>
+    This model allows for fine-grained control of which 
+    classloader loads any particular class.  This form of
+    partial isolation can reduce the myriad strange errors
+    that are produced by loading classes from multiple
+    loaders.
+    </p>
+
+    <p>
+    In addition, <b>Plexus Classworlds</b> provides a
+    <a href="launcher.html">launcher</a>
+    to assist in the creation of classloaders and <code>ClassRealm</code>s
+    from a configuration file and the launching of the application's <code>main</code>
+    method from the correct class loaded through the correct classloader.
+    </p>
+
+    <p>
+    And for seamless transition from <a href="https://github.com/codehaus/classworlds">older <b>Classworlds</b> up to 1.1</a>,
+    <b>Plexus Classworlds</b> provides
+    <a href="apidocs/index.html?org/codehaus/classworlds/package-summary.html">a compatibility layer</a>.
+    </p>
+  </section>
+
+</body>
+</document>
+


=====================================
src/site/xdoc/launcher.xml
=====================================
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+
+<document>
+
+  <properties>
+    <title>App Launching</title>
+    <author email="bob at eng.werken.com">bob mcwhirter</author>
+  </properties>
+
+  <body>
+
+  <section name="Launcher Introduction">
+
+    <subsection name="Purpose"> 
+
+      <p>
+      In order to reduce the number of classloading projects,
+      <b>Plexus Classworlds</b> replaces forehead
+      for application launching.  
+      </p>
+
+      <p>
+      The main problems to solve in application launching include
+      locating all of application's JARs, configuring the initial
+      classloaders, and invoking the <code>main</code> entry method.
+      </p>
+
+      <p>
+      The <a href="apidocs/index.html?org/codehaus/plexus/classworlds/launcher/package-summary.html">launcher facilities</a>
+      of <b>Classworlds</b> simplify
+      the process of locating application jars.  A common idiom is
+      to have a script which starts the JVM with only the 
+      <code>plexus-classworlds.jar</code> in the classpath and a system
+      property to specify the location of a launcher configuration.
+      Additionally, typically a property specifying the application installation
+      location is passed on the command-line.
+      </p>
+
+<source><![CDATA[
+$JAVA_HOME/bin/java \
+    -classpath $APP_HOME/boot/plexus-classworlds-2.5.2.jar \
+    -Dclassworlds.conf=$APP_HOME/etc/classworlds.conf \
+    -Dapp.home=$APP_HOME \
+    org.codehaus.plexus.classworlds.launcher.Launcher \
+    $*
+]]></source>
+
+    </subsection>
+
+  </section>
+
+  <section name="Configuration">
+
+    <subsection name="Entry Point Definition">
+
+      <p>
+      The entry-point class and realm must be specified
+      using the <code>main is</code> directive before
+      specifying realm definitions. 
+      </p>
+
+<source><![CDATA[
+main is com.werken.projectz.Server from app
+]]></source>
+
+    </subsection>
+
+    <subsection name="System Properties Definition">
+
+      <p>
+      System properties can be set before and after the entry point, but before realms:
+      </p>
+
+<source><![CDATA[
+set <property> [[using <properties filename>]] [[default <default value>]]
+]]></source>
+
+    </subsection>
+
+    <subsection name="Realm Definitions">
+
+      <p>
+      At least one <b>Classworlds</b> realm must be defined
+      within the configuration file.  The syntax for starting a
+      realm definition is <code>[realm.name]</code>.  All lines
+      following the realm header are considered directives for 
+      that realm.  The realm definition continues either until
+      another realm is defined or until the end of the file is
+      reached.  
+      </p>
+
+<source><![CDATA[
+[realm.one]
+    ...
+    ...
+[realm.two]
+    ...
+    ...
+[realm.three]
+    ...
+    ...
+]]></source>
+
+      <p>
+      Within a realm definition, three directives are available:
+      <code>load</code>, <code>optionally</code> and <code>import</code>.  
+      </p>
+
+      <p>
+      The <code>load</code> and <code>optionally</code>
+      directives specify a class source to be used for loading
+      classes in the realm: the only difference is that in case of absent source,
+      <code>load</code> fails but <code>optionally</code> does not.
+      Any loaded source that contain a star (<code>*</code>) in the file name is
+      replaced by the list of files that match the filename prefix and suffix.
+      System properties may be referred to using <code>${propname}</code> notation.
+      The <code>load</code> and <code>optionally</code> directives are equivalent to the
+      <code>addURL(..)</code> method of <code>ClassRealm</code>.
+      </p>
+
+<source><![CDATA[
+[app]
+    load ${app.home}/lib/*.jar
+    optionally ${app.home}/lib/ext/*.jar
+    load ${tools.jar}
+]]></source>
+
+      <p>
+      The <code>import</code> directive specifies that certain
+      packages should be imported and loaded by way of another
+      realm.  The <code>import</code> directive is equivalent
+      to the <code>importFrom(..)</code> method of
+      <code>ClassRealm</code>.
+      </p>
+
+<source><![CDATA[
+[app]
+    ...
+  
+[subcomponent]
+    import com.werken.projectz.Foo from app
+    ...
+]]></source>
+
+    </subsection>
+
+    <subsection name="Entry point methods">
+
+      <p>
+      <b>Classworlds</b> can be used to invoke any existing
+      application's <code>main()</code> method.  Using the standard
+      entry point does not allow for gaining access to the 
+      <code>ClassWorld</code> of the application, but not all 
+      applications will need it at run-time.
+      </p>
+
+      <p>
+      For those applications that do require the <code>ClassWorld</code>
+      instance, an alternative entry-point method signature can be
+      provided.  Simply add a <code>ClassWorld</code> parameter to 
+      the standard <code>main</code> parameter list.
+      </p>
+
+<source><![CDATA[
+public class MyApp
+{
+    public static void main( String[] args, ClassWorld world )
+    {
+        ...     
+    }
+}
+]]></source>
+
+    </subsection>
+
+  </section>
+
+  </body>
+
+</document>
\ No newline at end of file


=====================================
src/test/java/org/codehaus/plexus/classworlds/AbstractClassWorldsTestCase.java
=====================================
@@ -1,9 +1,5 @@
 package org.codehaus.plexus.classworlds;
 
-import java.net.URL;
-
-import junit.framework.TestCase;
-
 /*
  * Copyright 2001-2006 Codehaus Foundation.
  *
@@ -20,18 +16,13 @@ import junit.framework.TestCase;
  * limitations under the License.
  */
 
+import java.net.URL;
+
 /**
  * @author Jason van Zyl
  */
 public abstract class AbstractClassWorldsTestCase
-    extends TestCase
 {
-
-    public AbstractClassWorldsTestCase( String string )
-    {
-        super( string );
-    }
-
     protected URL getJarUrl( String jarName )
     {
         return TestUtil.getTestResourceUrl( jarName );


=====================================
src/test/java/org/codehaus/plexus/classworlds/ClassWorldTest.java
=====================================
@@ -15,6 +15,11 @@ package org.codehaus.plexus.classworlds;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -23,32 +28,34 @@ import java.util.Enumeration;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
 import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
 import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class ClassWorldTest
     extends AbstractClassWorldsTestCase
 {
     private ClassWorld world;
 
-    public ClassWorldTest( String name )
-    {
-        super( name );
-    }
-
+    @Before
     public void setUp()
     {
         this.world = new ClassWorld();
     }
 
+    @After
     public void tearDown()
     {
         this.world = null;
     }
 
+    @Test
     public void testEmpty()
     {
         assertTrue( this.world.getRealms().isEmpty() );
     }
 
+    @Test
     public void testNewRealm()
         throws Exception
     {
@@ -57,6 +64,7 @@ public class ClassWorldTest
         assertNotNull( realm );
     }
 
+    @Test
     public void testGetRealm()
         throws Exception
     {
@@ -65,6 +73,7 @@ public class ClassWorldTest
         assertSame( realm, this.world.getRealm( "foo" ) );
     }
 
+    @Test
     public void testNewRealm_Duplicate()
         throws Exception
     {
@@ -85,6 +94,7 @@ public class ClassWorldTest
         }
     }
 
+    @Test
     public void testGetRealm_NoSuch()
         throws Exception
     {
@@ -103,6 +113,7 @@ public class ClassWorldTest
         }
     }
 
+    @Test
     public void testGetRealms()
         throws Exception
     {
@@ -121,6 +132,7 @@ public class ClassWorldTest
         assertTrue( this.world.getRealms().contains( bar ) );
     }
     
+    @Test
     public void testPLX334() 
         throws Exception 
     {


=====================================
src/test/java/org/codehaus/plexus/classworlds/launcher/ConfigurationParserTest.java
=====================================
@@ -1,6 +1,11 @@
 package org.codehaus.plexus.classworlds.launcher;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
+import org.junit.Test;
 
 public class ConfigurationParserTest
     extends AbstractClassWorldsTestCase
@@ -8,11 +13,7 @@ public class ConfigurationParserTest
     
     ConfigurationParser configurator = new ConfigurationParser( null, System.getProperties() );
 
-    public ConfigurationParserTest( String string )
-    {
-        super( string );
-    }
-
+    @Test
     public void testFilter_Unterminated()
         throws Exception
     {
@@ -28,6 +29,7 @@ public class ConfigurationParserTest
         }
     }
 
+    @Test
     public void testFilter_Solitary()
         throws Exception
     {
@@ -38,6 +40,7 @@ public class ConfigurationParserTest
         assertEquals( "test prop value", result );
     }
 
+    @Test
     public void testFilter_AtStart()
         throws Exception
     {
@@ -48,6 +51,7 @@ public class ConfigurationParserTest
         assertEquals( "test prop valuecheese", result );
     }
 
+    @Test
     public void testFilter_AtEnd()
         throws Exception
     {
@@ -58,6 +62,7 @@ public class ConfigurationParserTest
         assertEquals( "cheesetest prop value", result );
     }
 
+    @Test
     public void testFilter_Multiple()
         throws Exception
     {
@@ -71,6 +76,7 @@ public class ConfigurationParserTest
         assertEquals( "I like test prop value one and test prop value two a lot", result );
     }
 
+    @Test
     public void testFilter_NonExistent()
         throws Exception
     {
@@ -86,6 +92,7 @@ public class ConfigurationParserTest
         }
     }
 
+    @Test
     public void testFilter_InMiddle()
         throws Exception
     {


=====================================
src/test/java/org/codehaus/plexus/classworlds/launcher/ConfiguratorTest.java
=====================================
@@ -15,6 +15,12 @@ package org.codehaus.plexus.classworlds.launcher;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -27,6 +33,9 @@ import org.codehaus.plexus.classworlds.ClassWorld;
 import org.codehaus.plexus.classworlds.TestUtil;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
 import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class ConfiguratorTest
     extends AbstractClassWorldsTestCase
@@ -34,17 +43,14 @@ public class ConfiguratorTest
     private Launcher launcher;
     private Configurator configurator;
 
-    public ConfiguratorTest( String name )
-    {
-        super( name );
-    }
-
+    @Before
     public void setUp()
     {
         this.launcher = new Launcher();
         this.configurator = new Configurator( this.launcher );
     }
 
+    @After
     public void tearDown()
     {
         this.launcher = null;
@@ -57,6 +63,7 @@ public class ConfiguratorTest
         System.getProperties().remove( "set.using.filtered.default" );
     }
 
+    @Test
     public void testConfigure_Nonexistent()
         throws Exception
     {
@@ -71,6 +78,7 @@ public class ConfiguratorTest
         }
     }
 
+    @Test
     public void testConfigure_DuplicateMain()
         throws Exception
     {
@@ -86,6 +94,7 @@ public class ConfiguratorTest
         }
     }
 
+    @Test
     public void testConfigure_DuplicateRealm()
         throws Exception
     {
@@ -101,6 +110,7 @@ public class ConfiguratorTest
         }
     }
 
+    @Test
     public void testConfigure_EarlyImport()
         throws Exception
     {
@@ -116,6 +126,7 @@ public class ConfiguratorTest
         }
     }
 
+    @Test
     public void testConfigure_RealmSyntax()
         throws Exception
     {
@@ -131,6 +142,7 @@ public class ConfiguratorTest
         }
     }
 
+    @Test
     public void testConfigure_Valid()
         throws Exception
     {
@@ -172,6 +184,7 @@ public class ConfiguratorTest
         assertArrayContains( urls, new File( basedir, "src/test/test-data/c.jar" ).toURI().toURL() );
     }
 
+    @Test
     public void testConfigure_Optionally_NonExistent()
         throws Exception
     {
@@ -196,6 +209,7 @@ public class ConfiguratorTest
         assertEquals( "no urls", 0, urls.length );
     }
 
+    @Test
     public void testConfigure_Optionally_Existent()
         throws Exception
     {
@@ -222,6 +236,7 @@ public class ConfiguratorTest
         assertSame( null, optRealm.getImportClassLoader( "org.xml.sax.SAXException" ) );
     }
 
+    @Test
     public void testConfigure_Unhandled()
         throws Exception
     {
@@ -237,6 +252,7 @@ public class ConfiguratorTest
         }
     }
 
+    @Test
     public void testSet_Using_Existent()
         throws Exception
     {
@@ -247,6 +263,7 @@ public class ConfiguratorTest
         assertEquals( "testSet_Using_Existent", System.getProperty( "set.using.existent" ) );
     }
 
+    @Test
     public void testSet_Using_NonExistent()
         throws Exception
     {
@@ -257,6 +274,7 @@ public class ConfiguratorTest
         assertNull( System.getProperty( "set.using.nonexistent" ) );
     }
 
+    @Test
     public void testSet_Using_NonExistent_Default()
         throws Exception
     {
@@ -267,6 +285,7 @@ public class ConfiguratorTest
         assertEquals( "testSet_Using_NonExistent_Default", System.getProperty( "set.using.nonexistent.default" ) );
     }
 
+    @Test
     public void testSet_Using_NonExistent_Override()
         throws Exception
     {
@@ -278,6 +297,7 @@ public class ConfiguratorTest
         assertEquals( "testSet_Using_NonExistent_Override", System.getProperty( "set.using.default" ) );
     }
 
+    @Test
     public void testSet_Using_Existent_Override()
         throws Exception
     {
@@ -289,6 +309,7 @@ public class ConfiguratorTest
         assertEquals( "testSet_Using_Existent_Override", System.getProperty( "set.using.existent" ) );
     }
 
+    @Test
     public void testSet_Using_Existent_Default()
         throws Exception
     {
@@ -299,6 +320,7 @@ public class ConfiguratorTest
         assertEquals( "testSet_Using_Existent_Default", System.getProperty( "set.using.default" ) );
     }
 
+    @Test
     public void testSet_Using_Missing_Default()
         throws Exception
     {
@@ -309,6 +331,7 @@ public class ConfiguratorTest
         assertEquals( "testSet_Using_Missing_Default", System.getProperty( "set.using.missing" ) );
     }
 
+    @Test
     public void testSet_Using_Missing_Override()
         throws Exception
     {
@@ -320,6 +343,7 @@ public class ConfiguratorTest
         assertEquals( "testSet_Using_Missing_Override", System.getProperty( "set.using.missing" ) );
     }
 
+    @Test
     public void testSet_Using_Filtered_Default()
         throws Exception
     {


=====================================
src/test/java/org/codehaus/plexus/classworlds/launcher/LauncherTest.java
=====================================
@@ -15,23 +15,25 @@ package org.codehaus.plexus.classworlds.launcher;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.FileInputStream;
 
 import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
 import org.codehaus.plexus.classworlds.TestUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class LauncherTest
     extends AbstractClassWorldsTestCase
 {
     private Launcher launcher;
 
-    public LauncherTest( String name )
-    {
-        super( name );
-    }
-
+    @Before
     public void setUp()
     {
         System.setProperty( "java.protocol.handler.pkgs", "org.codehaus.classworlds.protocol" );
@@ -41,11 +43,13 @@ public class LauncherTest
         this.launcher.setSystemClassLoader( Thread.currentThread().getContextClassLoader() );
     }
 
+    @After
     public void tearDown()
     {
         this.launcher = null;
     }
 
+    @Test
     public void testConfigure_Valid()
         throws Exception
     {
@@ -60,6 +64,7 @@ public class LauncherTest
         assertEquals( "app", launcher.getMainRealm().getId() );
     }
 
+    @Test
     public void testLaunch_ValidStandard()
         throws Exception
     {
@@ -68,6 +73,7 @@ public class LauncherTest
         launcher.launch( new String[]{} );
     }
 
+    @Test
     public void testLaunch_ValidStandardExitCode()
         throws Exception
     {
@@ -78,6 +84,7 @@ public class LauncherTest
         assertEquals( "check exit code", 15, launcher.getExitCode() );
     }
 
+    @Test
     public void testLaunch_ValidEnhanced()
         throws Exception
     {
@@ -86,6 +93,7 @@ public class LauncherTest
         launcher.launch( new String[]{} );
     }
 
+    @Test
     public void testLaunch_ValidEnhancedExitCode()
         throws Exception
     {
@@ -96,6 +104,7 @@ public class LauncherTest
         assertEquals( "check exit code", 45, launcher.getExitCode() );
     }
 
+    @Test
     public void testLaunch_NoSuchMethod()
         throws Exception
     {
@@ -112,6 +121,7 @@ public class LauncherTest
         }
     }
 
+    @Test
     public void testLaunch_ClassNotFound()
         throws Exception
     {


=====================================
src/test/java/org/codehaus/plexus/classworlds/realm/ClassRealmImplTest.java
=====================================
@@ -15,6 +15,10 @@ package org.codehaus.plexus.classworlds.realm;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
 
 import java.net.URL;
 import java.util.ArrayList;
@@ -25,27 +29,28 @@ import java.util.List;
 
 import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
 import org.codehaus.plexus.classworlds.ClassWorld;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class ClassRealmImplTest
     extends AbstractClassWorldsTestCase
 {
     private ClassWorld world;
 
-    public ClassRealmImplTest( String name )
-    {
-        super( name );
-    }
-
+    @Before
     public void setUp()
     {
         this.world = new ClassWorld();
     }
 
+    @After
     public void tearDown()
     {
         this.world = null;
     }
 
+    @Test
     public void testNewRealm()
         throws Exception
     {
@@ -58,6 +63,7 @@ public class ClassRealmImplTest
         assertEquals( "foo", realm.getId() );
     }
 
+    @Test
     public void testLocateSourceRealm_NoImports()
         throws Exception
     {
@@ -66,6 +72,7 @@ public class ClassRealmImplTest
         assertSame( null, realm.getImportClassLoader( "com.werken.Stuff" ) );
     }
 
+    @Test
     public void testLocateSourceRealm_SimpleImport()
         throws Exception
     {
@@ -88,6 +95,7 @@ public class ClassRealmImplTest
         assertSame( null, mainRealm.getImportClassLoader( "NoviceProgrammerClass" ) );
     }
 
+    @Test
     public void testLocateSourceRealm_MultipleImport()
         throws Exception
     {
@@ -114,6 +122,7 @@ public class ClassRealmImplTest
         assertSame( null, mainRealm.getImportClassLoader( "NoviceProgrammerClass" ) );
     }
 
+    @Test
     public void testLocateSourceRealm_Hierachy()
         throws Exception
     {
@@ -148,6 +157,7 @@ public class ClassRealmImplTest
         assertSame( null, mainRealm.getImportClassLoader( "NoviceProgrammerClass" ) );
     }
 
+    @Test
     public void testLocateSourceRealm_Hierachy_Reverse()
         throws Exception
     {
@@ -182,6 +192,7 @@ public class ClassRealmImplTest
         assertSame( null, mainRealm.getImportClassLoader( "NoviceProgrammerClass" ) );
     }
 
+    @Test
     public void testLoadClass_SystemClass()
         throws Exception
     {
@@ -192,6 +203,7 @@ public class ClassRealmImplTest
         assertNotNull( cls );
     }
 
+    @Test
     public void testLoadClass_NonSystemClass()
         throws Exception
     {
@@ -211,6 +223,7 @@ public class ClassRealmImplTest
         }
     }
 
+    @Test
     public void testLoadClass_ClassWorldsClass()
         throws Exception
     {
@@ -223,6 +236,7 @@ public class ClassRealmImplTest
         assertSame( ClassWorld.class, cls );
     }
 
+    @Test
     public void testLoadClass_Local()
         throws Exception
     {
@@ -255,6 +269,7 @@ public class ClassRealmImplTest
         }
     }
 
+    @Test
     public void testLoadClass_Imported()
         throws Exception
     {
@@ -303,6 +318,7 @@ public class ClassRealmImplTest
         assertSame( classA, classMain );
     }
 
+    @Test
     public void testLoadClass_Package()
         throws Exception
     {
@@ -319,6 +335,7 @@ public class ClassRealmImplTest
     }
 
 
+    @Test
     public void testLoadClass_Complex()
         throws Exception
     {
@@ -411,6 +428,7 @@ public class ClassRealmImplTest
         }
     }
 
+    @Test
     public void testLoadClass_ClassWorldsClassRepeatedly()
         throws Exception
     {
@@ -426,6 +444,15 @@ public class ClassRealmImplTest
         }
     }
 
+    @Test
+    public void testLoadClass_Java11()
+    {
+        final ExtendedClassRealm mainRealm = new ExtendedClassRealm(world);
+        mainRealm.addURL( getJarUrl( "a.jar" ) );
+        assertNotNull(mainRealm.simulateLoadClassFromModule( "a.A" ));
+    }
+
+    @Test
     public void testGetResources_BaseBeforeSelf()
         throws Exception
     {
@@ -455,6 +482,7 @@ public class ClassRealmImplTest
         assertEquals( Arrays.asList( new String[] { "/a.jar!/common.properties", "/b.jar!/common.properties" } ), urls );
     }
 
+    @Test
     public void testGetResources_SelfBeforeParent()
         throws Exception
     {
@@ -477,4 +505,25 @@ public class ClassRealmImplTest
         assertEquals( Arrays.asList( new URL[] { childUrl, parentUrl } ), urls );
     }
 
+    // simulate new loadClass(Module,String) from java11
+    // it is reversed in terms of inheritance but enables to simulate the same behavior in these tests
+    private class ExtendedClassRealm extends ClassRealm
+    {
+        public ExtendedClassRealm(final ClassWorld world)
+        {
+            super( world, "java11", Thread.currentThread().getContextClassLoader() );
+        }
+
+        public Class<?> simulateLoadClassFromModule(final String name)
+        {
+            synchronized (getClassLoadingLock(name))
+            {
+                Class<?> c = findLoadedClass(name);
+                if (c == null) {
+                    c = findClass(null, name);
+                }
+                return c;
+            }
+        }
+    }
 }


=====================================
src/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java
=====================================
@@ -16,6 +16,7 @@ package org.codehaus.plexus.classworlds.realm;
  * limitations under the License.
  */
 
+import static org.junit.Assert.*;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Collections;
@@ -24,19 +25,16 @@ import java.util.concurrent.CountDownLatch;
 import org.codehaus.classworlds.ClassRealmAdapter;
 import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
 import org.codehaus.plexus.classworlds.ClassWorld;
+import org.junit.Test;
 
 public class DefaultClassRealmTest
     extends AbstractClassWorldsTestCase
 {
-    public DefaultClassRealmTest( String name )
-    {
-        super( name );
-    }
-
     // ----------------------------------------------------------------------
     // Class testing
     // ----------------------------------------------------------------------
 
+    @Test
     public void testLoadClassFromRealm()
         throws Exception
     {
@@ -47,6 +45,7 @@ public class DefaultClassRealmTest
         loadClass( mainRealm, "org.codehaus.plexus.Component0" );
     }
 
+    @Test
     public void testLoadClassFromChildRealmWhereClassIsLocatedInParentRealm()
         throws Exception
     {
@@ -59,6 +58,7 @@ public class DefaultClassRealmTest
         loadClass( childRealm, "org.codehaus.plexus.Component0" );
     }
 
+    @Test
     public void testLoadClassFromChildRealmWhereClassIsLocatedInGrantParentRealm()
         throws Exception
     {
@@ -73,6 +73,7 @@ public class DefaultClassRealmTest
         loadClass( grandchildRealm, "org.codehaus.plexus.Component0" );
     }
 
+    @Test
     public void testLoadClassFromChildRealmWhereClassIsLocatedInBothChildRealmAndParentRealm()
         throws Exception
     {
@@ -91,6 +92,7 @@ public class DefaultClassRealmTest
         assertEquals( "printNew", cls.getMethods()[0].getName() );
     }
 
+    @Test
     public void testLoadNonExistentClass()
         throws Exception
     {
@@ -110,6 +112,7 @@ public class DefaultClassRealmTest
         }
     }
 
+    @Test
     public void testImport()
         throws Exception
     {
@@ -126,6 +129,7 @@ public class DefaultClassRealmTest
         loadClass( r1, "org.codehaus.plexus.Component0" );
     }
 
+    @Test
     public void testParentImport()
         throws Exception
     {
@@ -150,6 +154,7 @@ public class DefaultClassRealmTest
         assertSame( type, loadClass( child, "org.codehaus.plexus.Component0" ) );
     }
 
+    @Test
     public void testLoadClassFromBaseClassLoaderBeforeSelf()
         throws Exception
     {
@@ -171,6 +176,7 @@ public class DefaultClassRealmTest
         assertSame( baseClass, childClass );
     }
 
+    @Test
     public void testLoadClassFromRealmWithCircularClassReferences()
         throws Exception
     {
@@ -189,6 +195,7 @@ public class DefaultClassRealmTest
     // Resource testing
     // ----------------------------------------------------------------------
 
+    @Test
     public void testResource()
         throws Exception
     {
@@ -199,6 +206,7 @@ public class DefaultClassRealmTest
         getResource( mainRealm, "META-INF/plexus/components.xml" );
     }
 
+    @Test
     public void testMalformedResource()
         throws Exception
     {
@@ -233,6 +241,7 @@ public class DefaultClassRealmTest
         assertTrue( legacyRealm.findResources( "/" + resource ).hasMoreElements() );
     }
 
+    @Test
     public void testFindResourceOnlyScansSelf()
         throws Exception
     {
@@ -252,6 +261,7 @@ public class DefaultClassRealmTest
         assertNotNull( childRealm.findResource( "b.properties" ) );
     }
 
+    @Test
     public void testFindResourcesOnlyScansSelf()
         throws Exception
     {
@@ -272,6 +282,7 @@ public class DefaultClassRealmTest
     }
 
     /** Should never deadlock. Ever */
+    @Test
     public void testParallelDeadlockClassRealm()
         throws InterruptedException
     {


=====================================
src/test/java/org/codehaus/plexus/classworlds/realm/EntryTest.java
=====================================
@@ -15,9 +15,12 @@ package org.codehaus.plexus.classworlds.realm;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
 import org.codehaus.plexus.classworlds.ClassWorld;
+import org.junit.Test;
 
 /**
  * @author <a href="bwalding at jakarta.org">Ben Walding</a>
@@ -26,16 +29,7 @@ public class EntryTest
     extends AbstractClassWorldsTestCase
 {
 
-    /**
-     * Constructor for EntryTest.
-     *
-     * @param name
-     */
-    public EntryTest( String name )
-    {
-        super( name );
-    }
-
+    @Test
     public void testCompareTo()
         throws Exception
     {
@@ -53,6 +47,7 @@ public class EntryTest
      *
      * @throws Exception
      */
+    @Test
     public void testEquals()
         throws Exception
     {
@@ -67,6 +62,7 @@ public class EntryTest
         assertTrue( "entry1.hashCode() == entry2.hashCode()", entry1.hashCode() == entry2.hashCode() );
     }
 
+    @Test
     public void testMatchesClassByPackageImport()
         throws Exception
     {
@@ -82,6 +78,7 @@ public class EntryTest
         assertFalse( entry.matches( "org.tests.AnotherClass" ) );
     }
 
+    @Test
     public void testMatchesClassByClassImport()
         throws Exception
     {
@@ -96,6 +93,7 @@ public class EntryTest
         assertFalse( entry.matches( "org.test.AnotherClass" ) );
     }
 
+    @Test
     public void testMatchesResourceByPackageImport()
         throws Exception
     {
@@ -111,6 +109,7 @@ public class EntryTest
         assertFalse( entry.matches( "org/tests/AnotherClass.class" ) );
     }
 
+    @Test
     public void testMatchesResourceByClassImport()
         throws Exception
     {
@@ -125,6 +124,7 @@ public class EntryTest
         assertFalse( entry.matches( "org/test/AnotherClass" ) );
     }
 
+    @Test
     public void testMatchesAllImport()
         throws Exception
     {
@@ -139,6 +139,7 @@ public class EntryTest
         assertTrue( entry.matches( "org/test/MyClass.properties" ) );
     }
 
+    @Test
     public void testMatchesResourceByResourceImport()
         throws Exception
     {
@@ -156,6 +157,7 @@ public class EntryTest
         assertFalse( entry2.matches( "org/test/other.properties" ) );
     }
 
+    @Test
     public void testMatchesClassByExactPackageImport()
         throws Exception
     {
@@ -171,6 +173,7 @@ public class EntryTest
         assertFalse( entry.matches( "org.tests.AnotherClass" ) );
     }
 
+    @Test
     public void testMatchesResourceByExactPackageImport()
         throws Exception
     {


=====================================
src/test/java/org/codehaus/plexus/classworlds/strategy/StrategyTest.java
=====================================
@@ -15,6 +15,11 @@ package org.codehaus.plexus.classworlds.strategy;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
 
 import java.io.InputStream;
 import java.net.URL;
@@ -23,6 +28,8 @@ import java.util.Enumeration;
 import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
 import org.codehaus.plexus.classworlds.ClassWorld;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.junit.Before;
+import org.junit.Test;
 
 // jars within jars
 // hierarchy vs graph
@@ -36,11 +43,7 @@ public class StrategyTest
 
     private Strategy strategy;
 
-    public StrategyTest( String name )
-    {
-        super( name );
-    }
-
+    @Before
     public void setUp()
         throws Exception
     {
@@ -53,6 +56,7 @@ public class StrategyTest
         realm.addURL( getJarUrl( "component0-1.0.jar" ) );
     }
 
+    @Test
     public void testLoadingOfApplicationClass()
         throws Exception
     {
@@ -61,6 +65,7 @@ public class StrategyTest
         assertNotNull( c );
     }
 
+    @Test
     public void testLoadingOfApplicationClassThenDoingItAgain()
         throws Exception
     {
@@ -74,6 +79,7 @@ public class StrategyTest
     }
 
 
+    @Test
     public void testLoadingOfSystemClass()
         throws Exception
     {
@@ -82,6 +88,7 @@ public class StrategyTest
         assertNotNull( c );
     }
 
+    @Test
     public void testLoadingOfNonExistentClass()
         throws Exception
     {
@@ -97,6 +104,7 @@ public class StrategyTest
         }
     }
 
+    @Test
     public void testGetApplicationResource()
         throws Exception
     {
@@ -109,15 +117,19 @@ public class StrategyTest
         assertTrue( content.startsWith( "<component-set>" ) );
     }
 
+    @Test
     public void testGetSystemResource()
         throws Exception
     {
+        assumeTrue( "Due to strong encapsulation you cannot get the java/lang/Object.class as resource since Java 9",
+                    getJavaVersion() < 9.0 );
+        
         URL resource = strategy.getRealm().getResource( "java/lang/Object.class" );
 
         assertNotNull( resource );
     }
 
-
+    @Test
     public void testFindResources()
         throws Exception
     {
@@ -155,4 +167,9 @@ public class StrategyTest
 
         return content.toString();
     }
+    
+    private double getJavaVersion()
+    {
+        return Double.parseDouble( System.getProperty( "java.specification.version" ) );
+    }
 }



View it on GitLab: https://salsa.debian.org/java-team/plexus-classworlds/commit/1414c620d71d99104ba0fd27f04de811083936a5

-- 
View it on GitLab: https://salsa.debian.org/java-team/plexus-classworlds/commit/1414c620d71d99104ba0fd27f04de811083936a5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20190111/ccc74518/attachment.html>


More information about the pkg-java-commits mailing list