diff --git a/.gitignore b/.gitignore index 89c3b89..a00a90c 100644 --- a/.gitignore +++ b/.gitignore @@ -74,8 +74,5 @@ hs_err_pid* *.iml *.iws -# Linkedin stuff -.doppelganger - # files generated by maven -*/target +**/target diff --git a/cytodynamics-test-container/pom.xml b/cytodynamics-test/cytodynamics-integ-test/pom.xml similarity index 90% rename from cytodynamics-test-container/pom.xml rename to cytodynamics-test/cytodynamics-integ-test/pom.xml index d07a5c2..7b8d784 100644 --- a/cytodynamics-test-container/pom.xml +++ b/cytodynamics-test/cytodynamics-integ-test/pom.xml @@ -11,15 +11,15 @@ 4.0.0 - cytodynamics-parent + cytodynamics-test com.linkedin.cytodynamics 0.2.0 - cytodynamics-test-container + cytodynamics-integ-test 0.2.0 - Cytodynamics Test Container + Cytodynamics integration tests diff --git a/cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/nucleus/TestLoadClassResolve.java b/cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/nucleus/TestLoadClassResolve.java similarity index 94% rename from cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/nucleus/TestLoadClassResolve.java rename to cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/nucleus/TestLoadClassResolve.java index 41590e5..789f585 100644 --- a/cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/nucleus/TestLoadClassResolve.java +++ b/cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/nucleus/TestLoadClassResolve.java @@ -32,15 +32,15 @@ public class TestLoadClassResolve { @Before public void setup() throws Exception { - URL cytodynamics = getJarUri("cytodynamics-nucleus").toURL(); - URL testApiJarURL = getJarUri("cytodynamics-test-api").toURL(); + URL cytodynamics = getNucleusUri().toURL(); + URL testApiJarURL = getTestJarUri("cytodynamics-test-api").toURL(); ClassLoader parent = new URLClassLoader(new URL[]{cytodynamics, testApiJarURL}, null); ClassLoader fallback = - new URLClassLoader(new URL[]{cytodynamics, testApiJarURL, getJarUri("cytodynamics-test-a").toURL()}, null); + new URLClassLoader(new URL[]{cytodynamics, testApiJarURL, getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-b"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-b"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(parent) .withIsolationLevel(IsolationLevel.FULL) diff --git a/cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/test/TestDynamicLoad.java b/cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/test/TestDynamicLoad.java similarity index 88% rename from cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/test/TestDynamicLoad.java rename to cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/test/TestDynamicLoad.java index 0be7348..6e6315b 100644 --- a/cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/test/TestDynamicLoad.java +++ b/cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/test/TestDynamicLoad.java @@ -64,7 +64,7 @@ public void testLoadA() throws Exception { ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) @@ -86,11 +86,11 @@ public void testLoadA() throws Exception { @Test public void testLoadResourcesFullIsolation() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.FULL) @@ -102,11 +102,11 @@ public void testLoadResourcesFullIsolation() throws IOException { @Test public void testLoadResourcesFullIsolationNoneFound() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.FULL) @@ -119,11 +119,11 @@ public void testLoadResourcesFullIsolationNoneFound() throws IOException { @Test public void testLoadResourcesNoneIsolation() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.NONE) @@ -135,11 +135,11 @@ public void testLoadResourcesNoneIsolation() throws IOException { @Test public void testLoadResourcesNoneIsolationNoneFound() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.NONE) @@ -152,11 +152,11 @@ public void testLoadResourcesNoneIsolationNoneFound() throws IOException { @Test public void testLoadResourcesNoneIsolationOnlyInParent() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.NONE) @@ -168,11 +168,11 @@ public void testLoadResourcesNoneIsolationOnlyInParent() throws IOException { @Test public void testLoadResourcesWithDelegatePreferredFullIsolation() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.FULL) @@ -186,11 +186,11 @@ public void testLoadResourcesWithDelegatePreferredFullIsolation() throws IOExcep @Test public void testLoadResourcesWithDelegatePreferredFullIsolationOnlyInParent() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.FULL) @@ -204,11 +204,11 @@ public void testLoadResourcesWithDelegatePreferredFullIsolationOnlyInParent() th @Test public void testLoadResourcesWithDelegatePreferredNoneIsolation() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.NONE) @@ -222,11 +222,11 @@ public void testLoadResourcesWithDelegatePreferredNoneIsolation() throws IOExcep @Test public void testLoadResourcesWithDelegatePreferredNoneIsolationOnlyInParent() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.NONE) @@ -240,11 +240,11 @@ public void testLoadResourcesWithDelegatePreferredNoneIsolationOnlyInParent() th @Test public void testLoadResourcesWithWhitelist() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.FULL) @@ -256,12 +256,12 @@ public void testLoadResourcesWithWhitelist() throws IOException { @Test public void testLoadResourcesWithFallback() throws IOException { - ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-api").toURL()}, null); - ClassLoader fallbackClassLoaderA = new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-a").toURL()}, null); + ClassLoader apiClassLoader = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-api").toURL()}, null); + ClassLoader fallbackClassLoaderA = new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-b"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-b"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.NONE) @@ -280,7 +280,7 @@ public void testLoadB() throws Exception { ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-b"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-b"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) @@ -297,14 +297,14 @@ public void testLoadB() throws Exception { */ @Test public void testLoadAsParent() throws Exception { - URI apiJarUri = getJarUri("cytodynamics-test-api"); + URI apiJarUri = getTestJarUri("cytodynamics-test-api"); // need cytodynamics-nucleus for Api annotation in parent - URL cytodynamics = getJarUri("cytodynamics-nucleus").toURL(); + URL cytodynamics = getNucleusUri().toURL(); ClassLoader apiClassLoader = new URLClassLoader(new URL[]{cytodynamics, apiJarUri.toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Arrays.asList(apiJarUri, getJarUri("cytodynamics-test-a"))) + .withClasspath(Arrays.asList(apiJarUri, getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(apiClassLoader) .withIsolationLevel(IsolationLevel.FULL) @@ -330,7 +330,7 @@ public void testIsolation() throws Exception { ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) @@ -349,7 +349,7 @@ public void testIsolationLevels() throws Exception { ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.lang.*")) @@ -364,7 +364,7 @@ public void testIsolationLevels() throws Exception { loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.TRANSITIONAL) .build()) @@ -377,7 +377,7 @@ public void testIsolationLevels() throws Exception { loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.NONE) .build()) @@ -393,7 +393,7 @@ public void testBlacklist() throws Exception { ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) @@ -409,7 +409,7 @@ public void testBlacklist() throws Exception { loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.TRANSITIONAL) .addBlacklistedClassPredicate(new GlobMatcher("java.util.*")) @@ -423,7 +423,7 @@ public void testBlacklist() throws Exception { loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.NONE) .addBlacklistedClassPredicate(new GlobMatcher("java.util.Set")) @@ -440,7 +440,7 @@ public void testLoadAandB() throws Exception { ClassLoader loaderA = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) @@ -451,7 +451,7 @@ public void testLoadAandB() throws Exception { ClassLoader loaderB = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-b"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-b"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) @@ -472,11 +472,11 @@ public void testLoadAandB() throws Exception { */ @Test public void testLoadFromParentNotFallback() throws Exception { - URL testApiJarURL = getJarUri("cytodynamics-test-api").toURL(); + URL testApiJarURL = getTestJarUri("cytodynamics-test-api").toURL(); ClassLoader parentClassLoaderA = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-a").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader fallbackClassLoaderB = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-b").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-b").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) @@ -505,13 +505,13 @@ public void testLoadFromParentNotFallback() throws Exception { */ @Test public void testLoadFromFallback() throws Exception { - URL testApiJarURL = getJarUri("cytodynamics-test-api").toURL(); + URL testApiJarURL = getTestJarUri("cytodynamics-test-api").toURL(); ClassLoader parentClassLoaderA = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-a").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader fallbackClassLoaderA = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-a").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader fallbackClassLoaderB = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-b").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-b").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) @@ -546,13 +546,13 @@ public void testLoadFromFallback() throws Exception { */ @Test public void testLoadFromFinalFallback() throws Exception { - URL testApiJarURL = getJarUri("cytodynamics-test-api").toURL(); + URL testApiJarURL = getTestJarUri("cytodynamics-test-api").toURL(); ClassLoader parentClassLoaderB = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-b").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-b").toURL()}, null); ClassLoader fallbackClassLoaderB = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-b").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-b").toURL()}, null); ClassLoader fallbackClassLoaderA = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-a").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) @@ -587,11 +587,11 @@ public void testLoadFromFinalFallback() throws Exception { */ @Test(expected = CytodynamicsClassNotFoundException.class) public void testIsolationForFallback() throws Exception { - URL testApiJarURL = getJarUri("cytodynamics-test-api").toURL(); + URL testApiJarURL = getTestJarUri("cytodynamics-test-api").toURL(); ClassLoader parentClassLoaderA = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-a").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader fallbackClassLoaderA = - new URLClassLoader(new URL[]{testApiJarURL, getJarUri("cytodynamics-test-a").toURL()}, null); + new URLClassLoader(new URL[]{testApiJarURL, getTestJarUri("cytodynamics-test-a").toURL()}, null); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) @@ -640,16 +640,16 @@ public void testIsolationForFallback() throws Exception { */ @Test public void testGraphRelationshipWithCommonParent() throws Exception { - URL apiJarUrl = getJarUri("cytodynamics-test-api").toURL(); + URL apiJarUrl = getTestJarUri("cytodynamics-test-api").toURL(); // need cytodynamics-nucleus for Api annotation in parent - URL cytodynamics = getJarUri("cytodynamics-nucleus").toURL(); + URL cytodynamics = getNucleusUri().toURL(); ClassLoader commonParent = new URLClassLoader(new URL[]{cytodynamics, apiJarUrl}, null); ClassLoader partialDelegation = - new URLClassLoader(new URL[]{getJarUri("cytodynamics-test-a").toURL()}, commonParent); + new URLClassLoader(new URL[]{getTestJarUri("cytodynamics-test-a").toURL()}, commonParent); ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-b"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-b"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withDelegateClassLoader(commonParent) .withIsolationLevel(IsolationLevel.FULL) @@ -699,7 +699,7 @@ public void testParentPreferred() throws Exception { ClassLoader loader = LoaderBuilder .anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri(jarToUse))) + .withClasspath(Collections.singletonList(getTestJarUri(jarToUse))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) @@ -718,7 +718,7 @@ public void testParentPreferred() throws Exception { public void testParentPreferredBootstrapClass() throws Exception { ClassLoader loader = LoaderBuilder.anIsolatingLoader() .withOriginRestriction(OriginRestriction.allowByDefault()) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new BootstrapClassPredicate()) @@ -733,7 +733,7 @@ public void testParentPreferredBootstrapClass() throws Exception { @Test public void testSecurity() throws Exception { File tempDir = new File(System.getProperty("java.io.tmpdir")); - Path sourcePath = new File(getJarUri("cytodynamics-test-a")).toPath(); + Path sourcePath = new File(getTestJarUri("cytodynamics-test-a")).toPath(); File destinationFile = new File(tempDir, "a.jar"); if (destinationFile.exists()) { @@ -749,7 +749,7 @@ public void testSecurity() throws Exception { LoaderBuilder .anIsolatingLoader() .withOriginRestriction(onlyTmpOriginRestriction) - .withClasspath(Collections.singletonList(getJarUri("cytodynamics-test-a"))) + .withClasspath(Collections.singletonList(getTestJarUri("cytodynamics-test-a"))) .withParentRelationship(DelegateRelationshipBuilder.builder() .withIsolationLevel(IsolationLevel.FULL) .addWhitelistedClassPredicate(new GlobMatcher("java.*")) diff --git a/cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/util/JarUtil.java b/cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/util/JarUtil.java similarity index 61% rename from cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/util/JarUtil.java rename to cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/util/JarUtil.java index a408ee3..451f9cd 100644 --- a/cytodynamics-test-container/src/test/java/com/linkedin/cytodynamics/util/JarUtil.java +++ b/cytodynamics-test/cytodynamics-integ-test/src/test/java/com/linkedin/cytodynamics/util/JarUtil.java @@ -13,11 +13,23 @@ public class JarUtil { + private static final String CYTODYNAMICS_NUCLEUS = "cytodynamics-nucleus"; + + public static URI getNucleusUri() throws IOException { + return getJarUri(findBaseDirectory(), CYTODYNAMICS_NUCLEUS); + } + /** - * Find the {@link URI} corersponding to the JAR for a module. + * Find the {@link URI} corresponding to the JAR for a test module. + * This assumes that the test module is inside a module "cytodynamics-test", which is inside the top-level module. */ - public static URI getJarUri(String moduleName) throws IOException { - File targetDir = new File(new File(findBaseDirectory(), moduleName), "target"); + public static URI getTestJarUri(String moduleName) throws IOException { + File testDir = new File(findBaseDirectory(), "cytodynamics-test"); + return getJarUri(testDir, moduleName); + } + + private static URI getJarUri(File moduleParent, String moduleName) { + File targetDir = new File(new File(moduleParent, moduleName), "target"); if (!targetDir.exists()) { throw new IllegalStateException(String.format("No target directory exists for module %s", moduleName)); @@ -44,16 +56,16 @@ public static URI getJarUri(String moduleName) throws IOException { private static File findBaseDirectory() throws IOException { File currentDirectory = new File(".").getCanonicalFile(); - File testADirectory = new File(currentDirectory, "cytodynamics-test-a"); - if (testADirectory.exists() && testADirectory.isDirectory()) { + File nucleusDirectory = new File(currentDirectory, CYTODYNAMICS_NUCLEUS); + if (nucleusDirectory.exists() && nucleusDirectory.isDirectory()) { return currentDirectory; } while (currentDirectory.getParentFile() != null) { currentDirectory = currentDirectory.getParentFile(); - testADirectory = new File(currentDirectory, "cytodynamics-test-a"); - if (testADirectory.exists() && testADirectory.isDirectory()) { + nucleusDirectory = new File(currentDirectory, CYTODYNAMICS_NUCLEUS); + if (nucleusDirectory.exists() && nucleusDirectory.isDirectory()) { return currentDirectory; } } diff --git a/cytodynamics-test-a/pom.xml b/cytodynamics-test/cytodynamics-test-a/pom.xml similarity index 94% rename from cytodynamics-test-a/pom.xml rename to cytodynamics-test/cytodynamics-test-a/pom.xml index de882a3..d4745d7 100644 --- a/cytodynamics-test-a/pom.xml +++ b/cytodynamics-test/cytodynamics-test-a/pom.xml @@ -11,7 +11,7 @@ 4.0.0 - cytodynamics-parent + cytodynamics-test com.linkedin.cytodynamics 0.2.0 diff --git a/cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceAOnlyImpl.java b/cytodynamics-test/cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceAOnlyImpl.java similarity index 100% rename from cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceAOnlyImpl.java rename to cytodynamics-test/cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceAOnlyImpl.java diff --git a/cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java b/cytodynamics-test/cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java similarity index 100% rename from cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java rename to cytodynamics-test/cytodynamics-test-a/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java diff --git a/cytodynamics-test-a/src/main/resources/data.txt b/cytodynamics-test/cytodynamics-test-a/src/main/resources/data.txt similarity index 100% rename from cytodynamics-test-a/src/main/resources/data.txt rename to cytodynamics-test/cytodynamics-test-a/src/main/resources/data.txt diff --git a/cytodynamics-test-api/pom.xml b/cytodynamics-test/cytodynamics-test-api/pom.xml similarity index 94% rename from cytodynamics-test-api/pom.xml rename to cytodynamics-test/cytodynamics-test-api/pom.xml index 3a6583e..4ea1813 100644 --- a/cytodynamics-test-api/pom.xml +++ b/cytodynamics-test/cytodynamics-test-api/pom.xml @@ -11,7 +11,7 @@ 4.0.0 - cytodynamics-parent + cytodynamics-test com.linkedin.cytodynamics 0.2.0 diff --git a/cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/NonApiTestInterface.java b/cytodynamics-test/cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/NonApiTestInterface.java similarity index 100% rename from cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/NonApiTestInterface.java rename to cytodynamics-test/cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/NonApiTestInterface.java diff --git a/cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/TestInterface.java b/cytodynamics-test/cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/TestInterface.java similarity index 100% rename from cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/TestInterface.java rename to cytodynamics-test/cytodynamics-test-api/src/main/java/com/linkedin/cytodynamics/test/TestInterface.java diff --git a/cytodynamics-test-api/src/main/resources/api-only.txt b/cytodynamics-test/cytodynamics-test-api/src/main/resources/api-only.txt similarity index 100% rename from cytodynamics-test-api/src/main/resources/api-only.txt rename to cytodynamics-test/cytodynamics-test-api/src/main/resources/api-only.txt diff --git a/cytodynamics-test-api/src/main/resources/data.txt b/cytodynamics-test/cytodynamics-test-api/src/main/resources/data.txt similarity index 100% rename from cytodynamics-test-api/src/main/resources/data.txt rename to cytodynamics-test/cytodynamics-test-api/src/main/resources/data.txt diff --git a/cytodynamics-test-b/pom.xml b/cytodynamics-test/cytodynamics-test-b/pom.xml similarity index 94% rename from cytodynamics-test-b/pom.xml rename to cytodynamics-test/cytodynamics-test-b/pom.xml index 629e4dc..efffcc1 100644 --- a/cytodynamics-test-b/pom.xml +++ b/cytodynamics-test/cytodynamics-test-b/pom.xml @@ -11,7 +11,7 @@ 4.0.0 - cytodynamics-parent + cytodynamics-test com.linkedin.cytodynamics 0.2.0 diff --git a/cytodynamics-test-b/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java b/cytodynamics-test/cytodynamics-test-b/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java similarity index 100% rename from cytodynamics-test-b/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java rename to cytodynamics-test/cytodynamics-test-b/src/main/java/com/linkedin/cytodynamics/test/TestInterfaceImpl.java diff --git a/cytodynamics-test-b/src/main/resources/data.txt b/cytodynamics-test/cytodynamics-test-b/src/main/resources/data.txt similarity index 100% rename from cytodynamics-test-b/src/main/resources/data.txt rename to cytodynamics-test/cytodynamics-test-b/src/main/resources/data.txt diff --git a/cytodynamics-test/pom.xml b/cytodynamics-test/pom.xml new file mode 100644 index 0000000..dffd886 --- /dev/null +++ b/cytodynamics-test/pom.xml @@ -0,0 +1,36 @@ + + + + 4.0.0 + com.linkedin.cytodynamics + cytodynamics-test + 0.2.0 + pom + Cytodynamics testing modules + + + cytodynamics-parent + com.linkedin.cytodynamics + 0.2.0 + + + + true + + + + cytodynamics-test-api + cytodynamics-test-a + cytodynamics-test-b + cytodynamics-integ-test + + + diff --git a/pom.xml b/pom.xml index ad751e2..df4fc37 100644 --- a/pom.xml +++ b/pom.xml @@ -48,10 +48,7 @@ cytodynamics-nucleus - cytodynamics-test-a - cytodynamics-test-b - cytodynamics-test-container - cytodynamics-test-api + cytodynamics-test