aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2020-08-15 08:28:46 -0700
committerAndy Clement <aclement@pivotal.io>2020-08-15 08:28:46 -0700
commit591afb3a599dc2b3dd5811c6c7e74e7e5f3c5c01 (patch)
treed8b83ae2b582ab0508e52e73e312b26d00457232 /tests
parentea517776902a0e7def31f8b38f1cfd654ba2c118 (diff)
downloadaspectj-591afb3a599dc2b3dd5811c6c7e74e7e5f3c5c01.tar.gz
aspectj-591afb3a599dc2b3dd5811c6c7e74e7e5f3c5c01.zip
Reduce test output for incremental comp tests
Diffstat (limited to 'tests')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java21
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java2
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java1
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java55
5 files changed, 32 insertions, 49 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java
index dd340c770..0c864c850 100644
--- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java
+++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java
@@ -34,8 +34,6 @@ import org.aspectj.testing.util.FileUtil;
public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeInteractionTestbed {
- public static boolean VERBOSE = false;
-
public static void dumptree(IProgramElement node, int indent) {
for (int i = 0; i < indent; i++) {
System.out.print(" ");
@@ -72,7 +70,6 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
protected void setUp() throws Exception {
super.setUp();
- AjdeInteractionTestbed.VERBOSE = VERBOSE;
AjState.FORCE_INCREMENTAL_DURING_TESTING = true;
}
@@ -104,8 +101,9 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
public void build(String projectName) {
constructUpToDateLstFile(projectName, "build.lst");
doBuild(projectName);
- if (AjdeInteractionTestbed.VERBOSE)
+ if (AjdeInteractionTestbed.VERBOSE) {
printBuildReport(projectName);
+ }
}
public int getRelationshipCount(String project) {
@@ -124,8 +122,9 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
public void fullBuild(String projectName) {
constructUpToDateLstFile(projectName, "build.lst");
doFullBuild(projectName);
- if (AjdeInteractionTestbed.VERBOSE)
+ if (AjdeInteractionTestbed.VERBOSE) {
printBuildReport(projectName);
+ }
}
private void constructUpToDateLstFile(String pname, String configname) {
@@ -148,8 +147,9 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
private void collectUpFiles(File location, File base, List<String> collectionPoint) {
String contents[] = location.list();
- if (contents == null)
+ if (contents == null) {
return;
+ }
for (String string : contents) {
File f = new File(location, string);
if (f.isDirectory()) {
@@ -159,8 +159,9 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
try {
fileFound = f.getCanonicalPath();
String toRemove = base.getCanonicalPath();
- if (!fileFound.startsWith(toRemove))
+ if (!fileFound.startsWith(toRemove)) {
throw new RuntimeException("eh? " + fileFound + " " + toRemove);
+ }
collectionPoint.add(fileFound.substring(toRemove.length() + 1));// +1 captures extra separator
} catch (IOException e) {
e.printStackTrace();
@@ -191,8 +192,9 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
File projectSrc = new File(testdataSrcDir + File.separatorChar + projectName + File.separatorChar + overlayDirectory);
File destination = new File(getWorkingDir(), projectName);
- if (AjdeInteractionTestbed.VERBOSE)
+ if (AjdeInteractionTestbed.VERBOSE) {
System.out.println("Altering project " + projectName);
+ }
copy(projectSrc, destination);
}
@@ -201,8 +203,9 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI
*/
protected void copy(File from, File to) {
String contents[] = from.list();
- if (contents == null)
+ if (contents == null) {
return;
+ }
for (String string : contents) {
File f = new File(from, string);
File t = new File(to, string);
diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
index 5cfb4b1a7..adf4484bf 100644
--- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
+++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
@@ -41,7 +41,7 @@ import junit.framework.TestCase;
*/
public class AjdeInteractionTestbed extends TestCase {
- public static boolean VERBOSE = System.getProperty("aspectj.tests.verbose","true").equalsIgnoreCase("true");
+ public final static boolean VERBOSE = System.getProperty("aspectj.tests.verbose", "true").equalsIgnoreCase("true");
public static String testdataSrcDir = "../tests/multiIncremental";
protected static File sandboxDir;
diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
index 0efff1b99..e0a7c2437 100644
--- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
@@ -131,7 +131,6 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
}
public void testITIT_336147_3() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "pr336147_3";
initialiseProject(p);
build(p);
@@ -841,7 +840,6 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
}
public void testDeletionAnonInnerType_278496_8() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "pr278496_8";
initialiseProject(p);
configureNonStandardCompileOptions(p, "-Xset:minimalModel=true");
diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
index 428c037d8..c4076fc97 100644
--- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
@@ -104,7 +104,6 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
* to check.
*/
public void testBuildingTwoProjects() {
- AjdeInteractionTestbed.VERBOSE = true;
String projA = "Proj64";
String projB = "Dependee";
diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index 30793c396..6a1fc83ce 100644
--- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -66,7 +66,6 @@ import org.aspectj.weaver.World;
public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed {
public void testIncremental_344326() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "pr344326";
initialiseProject(p);
build(p);
@@ -123,7 +122,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testIncrementalITDInners3() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "prInner3";
initialiseProject(p);
build(p);
@@ -316,7 +314,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// found whilst looking at 322446 hence that is the testdata name
public void testAspectInheritance_322664() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "pr322446_3";
initialiseProject(p);
build(p);
@@ -842,7 +839,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testPR265729() {
- AjdeInteractionTestbed.VERBOSE = true;
String lib = "pr265729_lib";
initialiseProject(lib);
// addClasspathEntryChanged(lib, getProjectRelativePath(p1,
@@ -896,9 +892,9 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// @see AsmRelationshipProvider.createIntertypeDeclaredChild()
List<char[]> ptypes = binaryITDM.getParameterTypes();
- assertEquals("int", new String((char[]) ptypes.get(0)));
- assertEquals("java.util.List", new String((char[]) ptypes.get(1)));
- assertEquals("java.io.Serializable", new String((char[]) ptypes.get(2)));
+ assertEquals("int", new String(ptypes.get(0)));
+ assertEquals("java.util.List", new String(ptypes.get(1)));
+ assertEquals("java.io.Serializable", new String(ptypes.get(2)));
// param names not set
// List pnames = binaryITDM.getParameterNames();
@@ -910,7 +906,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testXmlConfiguredProject() {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "xmlone";
initialiseProject(p);
configureNonStandardCompileOptions(p, "-showWeaveInfo");// -xmlConfigured");
@@ -957,7 +952,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
List<String> targets = ir.getTargets();
assertEquals(1, targets.size());
System.out.println(targets.get(0));
- String handle = (String) targets.get(0);
+ String handle = targets.get(0);
assertEquals("Expected the handle for the code node inside the constructor decl",
"=261380<test{C.java[C~C?constructor-call(void test.C.<init>())", handle);
}
@@ -1046,7 +1041,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
checkWasntFullBuild();
List<IMessage> msgs = getErrorMessages(p);
assertEquals("error message should be 'The type C is already defined' ", "The type C is already defined",
- ((IMessage) msgs.get(0)).getMessage());
+ msgs.get(0).getMessage());
alter("PR148285_2", "inc2"); // type C in A.aj is commented out
build("PR148285_2");
checkWasntFullBuild();
@@ -1089,7 +1084,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// class C {}
public void testITDFQNames_pr252702() {
String p = "itdfq";
- AjdeInteractionTestbed.VERBOSE = true;
initialiseProject(p);
build(p);
AsmManager model = getModelFor(p);
@@ -1141,7 +1135,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testNPEIncremental_pr262218() {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "pr262218";
initialiseProject(p);
build(p);
@@ -1154,7 +1147,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testDeclareAnnotationNPE_298504() {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "pr298504";
initialiseProject(p);
build(p);
@@ -1171,7 +1163,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testIncrementalAnnoStyle_pr286341() {
- AjdeInteractionTestbed.VERBOSE = true;
String base = "pr286341_base";
initialiseProject(base);
build(base);
@@ -1214,7 +1205,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testBuildingBrokenCode_pr263323() {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "brokenCode";
initialiseProject(p);
build(p);
@@ -1236,7 +1226,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
*/
public void testItdProb() {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "itdprob";
initialiseProject(p);
build(p);
@@ -1414,7 +1403,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
public void testIncrementalBuildsWithItds_pr259528() {
String p = "pr259528";
- AjdeInteractionTestbed.VERBOSE = true;
initialiseProject(p);
build(p);
checkWasFullBuild();
@@ -1716,7 +1704,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
List<IProgramElement> kids = start.getChildren();
if (kids != null) {
for (IProgramElement kid : kids) {
- IProgramElement found = getChild((IProgramElement) kid, name);
+ IProgramElement found = getChild(kid, name);
if (found != null) {
return found;
}
@@ -2114,7 +2102,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
ZipFile zf = new ZipFile("c:/jvms/jdk1.6.0_06/jre/lib/rt.jar");
Enumeration<? extends ZipEntry> e = zf.entries();
while (e.hasMoreElements()) {
- ZipEntry ze = (ZipEntry) e.nextElement();
+ ZipEntry ze = e.nextElement();
String n = ze.getName();
if (n.endsWith(".class")) {
n = n.replace('/', '.');
@@ -2713,7 +2701,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
checkWasFullBuild();
int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size();
assertTrue("Expected one deleted file to be noticed, but detected: " + l, l == 1);
- String name = (String) AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0);
+ String name = AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0);
assertTrue("Should end with C2.java but is " + name, name.endsWith("C2.java"));
}
@@ -2729,7 +2717,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
checkWasFullBuild();
int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size();
assertTrue("Expected one deleted file to be noticed, but detected: " + l, l == 1);
- String name = (String) AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0);
+ String name = AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0);
assertTrue("Should end with C2.java but is " + name, name.endsWith("C2.java"));
}
@@ -2770,13 +2758,13 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
List<IMessage> errors = getErrorMessages("PR119882");
assertTrue("Should be at least one error, but got none", errors.size() == 1);
assertEquals("error message should be 'i cannot be resolved to a variable' ", "i cannot be resolved to a variable",
- ((IMessage) errors.get(0)).getMessage());
+ errors.get(0).getMessage());
alter("PR119882", "inc2");
build("PR119882");
assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("PR119882"),
getCompilerErrorMessages("PR119882").isEmpty());
assertEquals("error message should be 'i cannot be resolved to a variable' ", "i cannot be resolved to a variable",
- ((IMessage) errors.get(0)).getMessage());
+ errors.get(0).getMessage());
}
@@ -2842,8 +2830,8 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
List<IMessage> secondBuildMessages = getWeavingMessages("pr128655");
// check they are the same
for (int i = 0; i < firstBuildMessages.size(); i++) {
- IMessage m1 = (IMessage) firstBuildMessages.get(i);
- IMessage m2 = (IMessage) secondBuildMessages.get(i);
+ IMessage m1 = firstBuildMessages.get(i);
+ IMessage m2 = secondBuildMessages.get(i);
if (!m1.toString().equals(m2.toString())) {
System.err.println("Message during first build was: " + m1);
System.err.println("Message during second build was: " + m1);
@@ -2866,8 +2854,8 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
List<IMessage> secondBuildMessages = getWeavingMessages("pr128655_2");
// check they are the same
for (int i = 0; i < firstBuildMessages.size(); i++) {
- IMessage m1 = (IMessage) firstBuildMessages.get(i);
- IMessage m2 = (IMessage) secondBuildMessages.get(i);
+ IMessage m1 = firstBuildMessages.get(i);
+ IMessage m2 = secondBuildMessages.get(i);
if (!m1.toString().equals(m2.toString())) {
System.err.println("Message during first build was: " + m1);
System.err.println("Message during second build was: " + m1);
@@ -2909,7 +2897,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testIncrementalIntelligence_Scenario01() {
- AjdeInteractionTestbed.VERBOSE = true;
initialiseProject("Project1");
initialiseProject("Project2");
configureNewProjectDependency("Project2", "Project1");
@@ -3627,7 +3614,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
assertTrue("There should be no errors:\n" + errors, errors.isEmpty());
} else {
String expectedError = "Java 6.0 compliance level is unsupported";
- String found = ((IMessage) errors.get(0)).getMessage();
+ String found = errors.get(0).getMessage();
assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found,
expectedError, found);
// This is because the 'Java 6.0 compliance' error is an 'error'
@@ -3658,7 +3645,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
assertTrue("There should be no errors:\n" + errors, errors.isEmpty());
} else {
String expectedError = "Java 6.0 compliance level is unsupported";
- String found = ((IMessage) errors.get(0)).getMessage();
+ String found = errors.get(0).getMessage();
assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found,
expectedError, found);
// This is because the 'Java 6.0 compliance' error is an 'error'
@@ -3689,7 +3676,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
assertTrue("There should be no errros:\n" + errors, errors.isEmpty());
} else {
String expectedError = "Java 6.0 compliance level is unsupported";
- String found = ((IMessage) errors.get(0)).getMessage();
+ String found = errors.get(0).getMessage();
assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found,
expectedError, found);
// This is because the 'Java 6.0 compliance' error is an 'error'
@@ -3734,7 +3721,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// warning about cant change parents of Object is fine
public void testInpathHandles_271201() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "inpathHandles";
initialiseProject(p);
@@ -3766,7 +3752,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// warning about cant change parents of Object is fine
public void testInpathHandles_IncrementalCompilation_271201() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "inpathHandles";
initialiseProject(p);
@@ -3802,7 +3787,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testInpathHandles_WithInpathMap_271201() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "inpathHandles";
initialiseProject(p);
@@ -3850,7 +3834,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
public void testInpathHandles_IncrementalCompilation_RemovingInpathEntries_271201() throws Exception {
- AjdeInteractionTestbed.VERBOSE = true;
String p = "inpathHandles2";
initialiseProject(p);
@@ -3921,7 +3904,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
private IProgramElement getFirstRelatedElement(AsmManager model, IProgramElement programElement) {
List<String> rels = getRelatedElements(model, programElement, 1);
- return model.getHierarchy().findElementForHandle((String) rels.get(0));
+ return model.getHierarchy().findElementForHandle(rels.get(0));
}
private List<String> getRelatedElements(AsmManager model, IProgramElement advice) {