aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-02-08 15:07:23 -0800
committerAndy Clement <aclement@pivotal.io>2019-02-08 15:07:23 -0800
commitce1533d8493277d1111005e890f076ef90b32eab (patch)
tree33a21d3dae587a98245d784525d74a284b7dafab /testing
parent635f0ed47ffe11e93d96e4d24e4411eedfa1ddc9 (diff)
downloadaspectj-ce1533d8493277d1111005e890f076ef90b32eab.tar.gz
aspectj-ce1533d8493277d1111005e890f076ef90b32eab.zip
Fix getSpecFile() to work with URLs and adjust installer unpacker
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java3
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java9
-rw-r--r--testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java4
3 files changed, 10 insertions, 6 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java
index 467d9f236..0fbbd125e 100644
--- a/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java
+++ b/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java
@@ -59,7 +59,8 @@ public abstract class AutowiredXMLBasedAjcTestCase extends XMLBasedAjcTestCase {
System.out.println("LOADING SUITE: " + wired.getSpecFile().getPath());
Digester d = wired.getDigester();
try {
- InputStreamReader isr = new InputStreamReader(new FileInputStream(wired.getSpecFile()));
+ InputStreamReader isr = new InputStreamReader(wired.getSpecFile().openStream());
+// InputStreamReader isr = new InputStreamReader(new FileInputStream(wired.getSpecFile()));
d.parse(isr);
} catch (Exception ex) {
fail("Unable to load suite " + wired.getSpecFile().getPath() + " : " + ex);
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java
index ff448647b..44c4ed5d8 100644
--- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java
@@ -18,6 +18,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.InputStreamReader;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -100,7 +101,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase {
/**
* The file containing the XML specification for the tests.
*/
- protected abstract File getSpecFile();
+ protected abstract URL getSpecFile();
/*
* Return a map from (String) test title -> AjcTest
@@ -272,7 +273,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase {
System.out.println("LOADING SUITE: " + getSpecFile().getPath());
Digester d = getDigester();
try {
- InputStreamReader isr = new InputStreamReader(new FileInputStream(getSpecFile()));
+ InputStreamReader isr = new InputStreamReader(getSpecFile().openConnection().getInputStream());
d.parse(isr);
} catch (Exception ex) {
fail("Unable to load suite " + getSpecFile().getPath() + " : " + ex);
@@ -486,8 +487,8 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase {
return null;
}
- protected File getClassResource(String resourceName) {
- return new File(getClass().getResource(resourceName).getFile());
+ protected URL getClassResource(String resourceName) {
+ return getClass().getResource(resourceName);
}
protected Method findMethod(JavaClass jc, String string) {
diff --git a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java
index 42a2063a4..253184c8d 100644
--- a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java
+++ b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java
@@ -14,6 +14,7 @@ package org.aspectj.testing.taskdefs;
import java.io.File;
import java.util.ArrayList;
+import java.util.Arrays;
import org.aspectj.bridge.*;
import org.aspectj.bridge.MessageHandler;
@@ -138,7 +139,8 @@ public class AjcTaskCompileCommandTest extends TestCase {
final boolean pass = (result == expectPass);
if (!pass) {
String m = expectPass ? "pass" : "fail";
- assertTrue("expected " + m + ": " + args, false);
+
+ assertTrue("expected " + m + ": " + args+"\n Messages:"+handler.getUnmodifiableListView(), false);
}
}