aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-14 00:09:02 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-14 00:11:47 +0700
commit2fd6804db8aebfe6634e4df7d5e5c71fe856d4f6 (patch)
tree542e1f1feb804342b7a17ec7851dfec2f5575790 /testing
parentcd83adc724c3779cc688405cc475ca5bd1e13bfe (diff)
downloadaspectj-2fd6804db8aebfe6634e4df7d5e5c71fe856d4f6.tar.gz
aspectj-2fd6804db8aebfe6634e4df7d5e5c71fe856d4f6.zip
Fix 'ajdoc' tests for Java 15 build
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing')
-rw-r--r--testing/src/test/java/org/aspectj/testing/AjcTest.java2
-rw-r--r--testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java20
-rw-r--r--testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java74
3 files changed, 48 insertions, 48 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java
index e9eeafc2f..5f39368a6 100644
--- a/testing/src/test/java/org/aspectj/testing/AjcTest.java
+++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java
@@ -39,7 +39,7 @@ public class AjcTest {
is16VMOrGreater = true;
is17VMOrGreater = true;
is18VMOrGreater = true;
- is19VMOrGreater = LangUtil.is19VMOrGreater();
+ is19VMOrGreater = LangUtil.is9VMOrGreater();
is10VMOrGreater = LangUtil.is10VMOrGreater();
is11VMOrGreater = LangUtil.is11VMOrGreater();
is12VMOrGreater = LangUtil.is12VMOrGreater();
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java
index 205b55273..19e80c474 100644
--- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java
+++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java
@@ -1,12 +1,12 @@
/* *******************************************************************
* Copyright (c) 2018 Contributors
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
* Andy Clement
* ******************************************************************/
package org.aspectj.testing;
@@ -15,7 +15,7 @@ import org.aspectj.util.LangUtil;
/**
* Makes sure tests are running on the right level of JDK.
- *
+ *
* @author Andy Clement
*/
public abstract class XMLBasedAjcTestCaseForJava9OrLater extends XMLBasedAjcTestCase {
@@ -23,10 +23,10 @@ public abstract class XMLBasedAjcTestCaseForJava9OrLater extends XMLBasedAjcTest
@Override
public void runTest(String title) {
// Check we are on Java9 or later
- if (!LangUtil.is19VMOrGreater()) {
+ if (!LangUtil.is9VMOrGreater()) {
throw new IllegalStateException("These tests should be run on Java 9 or later");
}
super.runTest(title);
}
-
+
}
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 b20a5650a..645a9c7df 100644
--- a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java
+++ b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2003 Contributors.
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wes Isberg initial implementation
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wes Isberg initial implementation
* ******************************************************************/
package org.aspectj.testing.taskdefs;
@@ -35,7 +35,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
static boolean loggedWarning = false;
static boolean runAllTests = true;
static List<File> tempFiles = new ArrayList<>();
-
+
private static File getClassesDir() {
File tempDir = FileUtil.getTempDir("AjcTaskCompileCommandTest-classes");
tempFiles.add(tempDir);
@@ -48,7 +48,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
list.add("-classpath");
StringBuilder classpath = new StringBuilder();
classpath.append(Globals.F_aspectjrt_jar.getAbsolutePath());
- if (LangUtil.is19VMOrGreater()) {
+ if (LangUtil.is9VMOrGreater()) {
classpath.append(File.pathSeparator).append(LangUtil.getJrtFsFilePath());
}
list.add(classpath.toString());
@@ -56,7 +56,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
static boolean doWait(IMessageHolder holder, int seconds, int timeout) {
return AjcTaskCompileCommand
- .waitUntilMessagesQuiet(holder, seconds, timeout);
+ .waitUntilMessagesQuiet(holder, seconds, timeout);
}
public AjcTaskCompileCommandTest(String name) {
@@ -85,30 +85,30 @@ public class AjcTaskCompileCommandTest extends TestCase {
public void testDefaultList() {
runSimpleTest("../taskdefs/testdata/default.lst", 0);
}
-
+
public void testCompileErrorList() {
runSimpleTest("../taskdefs/testdata/compileError.lst", 1);
}
-
+
public void testWaitUntilMessagesQuiet_1_2() {
if (runAllTests) checkWait(1, 2, 0, 0);
}
-
+
public void testWaitUntilMessagesQuiet_1_10() {
if (runAllTests) checkWait(1, 10, 0, 0);
}
-
+
public void testWaitUntilMessagesQuiet_8_10() {
checkWait(8, 10, 0, 0);
}
-
+
// XXX two async tests might fail if adder thread starved
-
+
public void testWaitUntilMessagesQuiet_1_10_4_1() {
if (runAllTests) checkWait(1, 10, 4, 1);
}
-
+
public void testWaitUntilMessagesQuiet_8_10_2_1() {
if (runAllTests) checkWait(8, 20, 2, 1);
}
@@ -129,7 +129,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
}
runTest(list, expectedErrors);
}
-
+
void runTest(ArrayList<String> args, int expectedErrors) {
AjcTaskCompileCommand command =
new AjcTaskCompileCommand();
@@ -140,14 +140,14 @@ public class AjcTaskCompileCommandTest extends TestCase {
final boolean pass = (result == expectPass);
if (!pass) {
String m = expectPass ? "pass" : "fail";
-
+
assertTrue("expected " + m + ": " + args+"\n Messages:"+handler.getUnmodifiableListView(), false);
}
}
void checkWait(final int seconds, final int timeout, int toAdd, int addInterval) {
- final String testCase = "checkWait(seconds="
- + seconds + ", timeout=" + timeout;
+ final String testCase = "checkWait(seconds="
+ + seconds + ", timeout=" + timeout;
final MessageHandler mhandler = new MessageHandler();
final long startTime = System.currentTimeMillis();
final long testTimeout = startTime + (timeout * 2000l);
@@ -160,7 +160,7 @@ public class AjcTaskCompileCommandTest extends TestCase {
System.out.println("warning - test will fail if adder thread starved");
loggedWarning = true;
}
- final MessageAdder adder
+ final MessageAdder adder
= new MessageAdder(mhandler, toAdd, addInterval);
final String label = testCase + " wait(" + toAdd + ", " + addInterval + ")";
class Result {
@@ -173,15 +173,15 @@ public class AjcTaskCompileCommandTest extends TestCase {
waitResult.addedThread
= new Thread(adder, label + "-child");
waitResult.addedThread.start();
- waitResult.result =
+ waitResult.result =
AjcTaskCompileCommandTest.doWait(mhandler, seconds, timeout);
}
}, label);
-
+
testThread.start();
-
+
try {
- testThread.join(testTimeout - startTime);
+ testThread.join(testTimeout - startTime);
} catch (InterruptedException e) {
// ignore
}
@@ -190,13 +190,13 @@ public class AjcTaskCompileCommandTest extends TestCase {
long wait = testTimeout - System.currentTimeMillis();
if (0 < wait) {
waitResult.addedThread.join(wait);
- }
+ }
}
} catch (InterruptedException e) {
// ignore
}
result = waitResult.result;
- int added = adder.getNumAdded();
+ int added = adder.getNumAdded();
assertEquals(testCase + " added", added, toAdd);
if (!result) {
assertTrue(testCase + " result " + adder, false);
@@ -215,12 +215,12 @@ class MessageAdder implements Runnable {
public static long MAX_MILLIS = 1000 * 30;
public boolean stop;
public boolean wait;
-
+
private final IMessageHolder messages;
private final int numToAdd;
private final int interval;
private int numAdded;
-
+
/**
* @param holder the IMessageHolder to add to
* @param num the int number of messages to add
@@ -242,7 +242,7 @@ class MessageAdder implements Runnable {
final long timeout = curTime + MAX_MILLIS;
// final Thread thread = Thread.currentThread();
int numAdded = 0;
- while (!stop && (timeout > curTime)
+ while (!stop && (timeout > curTime)
&& (numAdded < numToAdd)) {
long targetTime = curTime + waitBetweenAdds;
while (!stop && (curTime < timeout)
@@ -264,7 +264,7 @@ class MessageAdder implements Runnable {
int getNumAdded() {
return numAdded;
}
-
+
public String toString() {
return "MessageAdder("
+ "numAdded=" + numAdded
@@ -273,9 +273,9 @@ class MessageAdder implements Runnable {
+ ", stop=" + stop
+ ", wait=" + wait
+ ", numMessages="
- + (null == messages
- ? 0
+ + (null == messages
+ ? 0
: messages.numMessages(null, true))
+ ")";
- }
-} \ No newline at end of file
+ }
+}