Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,5 @@ hs_err_pid*
*.iml
*.iws

# Linkedin stuff
.doppelganger

# files generated by maven
*/target
**/target
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cytodynamics-parent</artifactId>
<artifactId>cytodynamics-test</artifactId>
<groupId>com.linkedin.cytodynamics</groupId>
<version>0.2.0</version>
</parent>

<artifactId>cytodynamics-test-container</artifactId>
<artifactId>cytodynamics-integ-test</artifactId>
<version>0.2.0</version>

<name>Cytodynamics Test Container</name>
<name>Cytodynamics integration tests</name>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cytodynamics-parent</artifactId>
<artifactId>cytodynamics-test</artifactId>
<groupId>com.linkedin.cytodynamics</groupId>
<version>0.2.0</version>
</parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cytodynamics-parent</artifactId>
<artifactId>cytodynamics-test</artifactId>
<groupId>com.linkedin.cytodynamics</groupId>
<version>0.2.0</version>
</parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cytodynamics-parent</artifactId>
<artifactId>cytodynamics-test</artifactId>
<groupId>com.linkedin.cytodynamics</groupId>
<version>0.2.0</version>
</parent>
Expand Down
36 changes: 36 additions & 0 deletions cytodynamics-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2018-2019 LinkedIn Corporation
All Rights Reserved.

Licensed under the BSD 2-Clause License (the "License").
See LICENSE in the project root for license information.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.linkedin.cytodynamics</groupId>
<artifactId>cytodynamics-test</artifactId>
<version>0.2.0</version>
<packaging>pom</packaging>
<name>Cytodynamics testing modules</name>

<parent>
<artifactId>cytodynamics-parent</artifactId>
<groupId>com.linkedin.cytodynamics</groupId>
<version>0.2.0</version>
</parent>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<modules>
<module>cytodynamics-test-api</module>
<module>cytodynamics-test-a</module>
<module>cytodynamics-test-b</module>
<module>cytodynamics-integ-test</module>
</modules>

</project>
5 changes: 1 addition & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@

<modules>
<module>cytodynamics-nucleus</module>
<module>cytodynamics-test-a</module>
<module>cytodynamics-test-b</module>
<module>cytodynamics-test-container</module>
<module>cytodynamics-test-api</module>
<module>cytodynamics-test</module>
</modules>

<properties>
Expand Down