-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continued to refactor tests to avoid interference between tests
- Loading branch information
1 parent
f15c830
commit 5267bfa
Showing
7 changed files
with
113 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ge.java.test.bulk/src/org/emftext/language/java/test/bulk/CustomClasspathInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.emftext.language.java.test.bulk; | ||
|
||
import org.eclipse.emf.ecore.resource.Resource; | ||
import org.emftext.language.java.JavaClasspath; | ||
|
||
public class CustomClasspathInitializer implements JavaClasspath.Initializer { | ||
|
||
private final boolean requiresStdLib; | ||
|
||
public CustomClasspathInitializer(boolean requiresStdLib) { | ||
this.requiresStdLib = requiresStdLib; | ||
} | ||
|
||
@Override | ||
public boolean requiresStdLib() { | ||
return requiresStdLib; | ||
} | ||
|
||
@Override | ||
public boolean requiresLocalClasspath() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void initialize(Resource resource) { | ||
// Do nothing | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...t.language.java.test.bulk/src/org/emftext/language/java/test/bulk/DelegatingTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.emftext.language.java.test.bulk; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class DelegatingTestCase extends TestCase { | ||
|
||
private final ZipFileEntryTestCase zipFileEntryTestCase; | ||
|
||
public DelegatingTestCase(ZipFileEntryTestCase zipFileEntryTestCase) { | ||
super("Parse " + (zipFileEntryTestCase.isExcludeFromReprint() ? "" : "and reprint: ") | ||
+ zipFileEntryTestCase.getZipEntry().getName()); | ||
this.zipFileEntryTestCase = zipFileEntryTestCase; | ||
} | ||
|
||
@Override | ||
protected void runTest() throws Throwable { | ||
zipFileEntryTestCase.runTest(); | ||
} | ||
|
||
@Override | ||
protected void tearDown() throws Exception { | ||
zipFileEntryTestCase.tearDown(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...ext.language.java.test.bulk/src/org/emftext/language/java/test/bulk/IClasspathSetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.emftext.language.java.test.bulk; | ||
|
||
import org.eclipse.emf.ecore.resource.ResourceSet; | ||
|
||
public interface IClasspathSetter { | ||
|
||
public void setUpClasspath(ResourceSet resourceSet) throws Exception; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...nguage.java.test.bulk/src/org/emftext/language/java/test/bulk/ZipFileClasspathSetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.emftext.language.java.test.bulk; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
import java.util.zip.ZipFile; | ||
|
||
import org.eclipse.emf.ecore.resource.ResourceSet; | ||
import org.emftext.language.java.JavaClasspath; | ||
import org.emftext.language.java.JavaClasspath.Initializer; | ||
|
||
public class ZipFileClasspathSetter implements IClasspathSetter { | ||
|
||
private final ZipFile zipFile; | ||
|
||
public ZipFileClasspathSetter(ZipFile zipFile) { | ||
this.zipFile = zipFile; | ||
} | ||
|
||
@Override | ||
public void setUpClasspath(ResourceSet resourceSet) throws Exception { | ||
// Create custom class path setup for resource set | ||
boolean requiresStdLib = false; | ||
Initializer classpathInitializer = new CustomClasspathInitializer(requiresStdLib); | ||
Set<Initializer> classpathInitializers = Collections.singleton(classpathInitializer); | ||
JavaClasspath localClasspath = JavaClasspath.get(resourceSet, classpathInitializers); | ||
String plainZipFileName = zipFile.getName().substring(AbstractZipFileInputTestCase.BULK_INPUT_DIR.length()); | ||
plainZipFileName = plainZipFileName.substring(0, plainZipFileName.length() - File.separator.length() | ||
- "src.zip".length()); | ||
AbstractZipFileInputTestCase.registerLibs("input/" + plainZipFileName, localClasspath, ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters