diff options
author | Andy Clement <aclement@pivotal.io> | 2019-11-25 10:40:44 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-11-25 10:40:44 -0800 |
commit | 2704db20ecca12d3bbe514a4f7b84d297937de86 (patch) | |
tree | 2938cb6c560d2ea220272af703452ccd096702ca /testing/src | |
parent | 41c7347b064093b531b04004d42665582ba0fff0 (diff) | |
download | aspectj-2704db20ecca12d3bbe514a4f7b84d297937de86.tar.gz aspectj-2704db20ecca12d3bbe514a4f7b84d297937de86.zip |
Java 13 support
Diffstat (limited to 'testing/src')
-rw-r--r-- | testing/src/test/java/org/aspectj/testing/AjcTest.java | 35 | ||||
-rw-r--r-- | testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java | 31 |
2 files changed, 50 insertions, 16 deletions
diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java index 0384e775d..14eda67b5 100644 --- a/testing/src/test/java/org/aspectj/testing/AjcTest.java +++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java @@ -1,10 +1,10 @@ /* ******************************************************************* * Copyright (c) 2004,2019 IBM Corporation, 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 + * 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 * ******************************************************************/ package org.aspectj.testing; @@ -19,7 +19,7 @@ import org.aspectj.util.LangUtil; * @author Andy Clement */ public class AjcTest { - + // private static boolean is13VMOrGreater = true; private static boolean is14VMOrGreater = true; private static boolean is15VMOrGreater = false; @@ -30,7 +30,8 @@ public class AjcTest { private static boolean is10VMOrGreater = false; private static boolean is11VMOrGreater = false; private static boolean is12VMOrGreater = false; - + private static boolean is13VMOrGreater = false; + static { // matching logic is also in org.aspectj.util.LangUtil is14VMOrGreater = LangUtil.is14VMOrGreater(); is15VMOrGreater = LangUtil.is15VMOrGreater(); @@ -41,10 +42,11 @@ public class AjcTest { is10VMOrGreater = LangUtil.is10VMOrGreater(); is11VMOrGreater = LangUtil.is11VMOrGreater(); is12VMOrGreater = LangUtil.is12VMOrGreater(); + is13VMOrGreater = LangUtil.is13VMOrGreater(); } private List<ITestStep> testSteps = new ArrayList<ITestStep>(); - + private String dir; private String pr; private String title; @@ -54,16 +56,16 @@ public class AjcTest { public AjcTest() { } - + public void addTestStep(ITestStep step) { testSteps.add(step); step.setTest(this); } - + public boolean runTest(AjcTestCase testCase) { if (!canRunOnThisVM()) return false; try { - System.out.print("TEST: " + getTitle() + "\t"); + System.out.print("TEST: " + getTitle() + "\t"); for (ITestStep step: testSteps) { step.setBaseDir(getDir()); System.out.print("."); @@ -74,8 +76,8 @@ public class AjcTest { } return true; } - - public boolean canRunOnThisVM() { + + public boolean canRunOnThisVM() { if (vmLevel.equals("1.3")) return true; boolean canRun = true; if (vmLevel.equals("1.4")) canRun = is14VMOrGreater; @@ -87,13 +89,14 @@ public class AjcTest { if (vmLevel.equals("10")) canRun = is10VMOrGreater; if (vmLevel.equals("11")) canRun = is11VMOrGreater; if (vmLevel.equals("12")) canRun = is12VMOrGreater; + if (vmLevel.equals("13")) canRun = is13VMOrGreater; if (!canRun) { - System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel() + System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel() + ", currently running on " + System.getProperty("java.vm.version")); } return canRun; } - + /** * @return Returns the comment. */ @@ -162,7 +165,7 @@ public class AjcTest { public void setVm(String vmLevel) { this.vmLevel = vmLevel; } - + /** * @return Returns the vmLevel. */ diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java new file mode 100644 index 000000000..92193f540 --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java @@ -0,0 +1,31 @@ +/* ******************************************************************* + * Copyright (c) 2019 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; + +import org.aspectj.util.LangUtil; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Andy Clement + */ +public abstract class XMLBasedAjcTestCaseForJava13OrLater extends XMLBasedAjcTestCase { + + @Override + public void runTest(String title) { + if (!LangUtil.is13VMOrGreater()) { + throw new IllegalStateException("These tests should be run on Java 13 or later"); + } + super.runTest(title); + } + +} |