diff options
author | Andy Clement <aclement@pivotal.io> | 2020-08-14 22:45:11 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2020-08-14 22:45:11 -0700 |
commit | 8fb374ceba1832e5beb77f707f5709ae32d04907 (patch) | |
tree | beb2917b744d8352cc92790e29226f1fd9293d97 /ajde.core | |
parent | 50e1d8e5a1c66197dc7aadc4a12c8abf294e673e (diff) | |
download | aspectj-8fb374ceba1832e5beb77f707f5709ae32d04907.tar.gz aspectj-8fb374ceba1832e5beb77f707f5709ae32d04907.zip |
lets have maven fail if those tests fail...
Diffstat (limited to 'ajde.core')
3 files changed, 46 insertions, 32 deletions
diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreModuleTests.java b/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreModuleTests.java index 0e9991eeb..45d70a845 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreModuleTests.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/AjdeCoreModuleTests.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation + * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation * Helen Hawkins - initial version *******************************************************************/ package org.aspectj.ajde.core; @@ -30,6 +30,8 @@ import junit.framework.TestSuite; public class AjdeCoreModuleTests extends TestCase { + static boolean verbose = System.getProperty("aspectj.tests.verbose", "false").equalsIgnoreCase("true"); + public static TestSuite suite() { TestSuite suite = new TestSuite(AjdeCoreModuleTests.class.getName()); suite.addTestSuite(ShowWeaveMessagesTest.class); @@ -49,6 +51,7 @@ public class AjdeCoreModuleTests extends TestCase { return suite; } + public AjdeCoreModuleTests(String name) { super(name); } diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java index 5269a586a..e25632cf9 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java @@ -20,7 +20,6 @@ import java.util.List; */ public class TestBuildProgressMonitor implements IBuildProgressMonitor { - private static boolean verbose = System.getProperty("aspectj.tests.verbose","false").equalsIgnoreCase("true"); private static boolean debugTests = false; public int numWovenClassMessages = 0; @@ -34,31 +33,43 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { private boolean isCancelRequested = false; public void finish(boolean wasFullBuild) { - System.out.println("build finished. Was full build: " + wasFullBuild); + info("build finished. Was full build: " + wasFullBuild); } public boolean isCancelRequested() { return isCancelRequested; } + private void info(String message) { + if (AjdeCoreModuleTests.verbose) { + System.out.println(message); + } + } + public void setProgress(double percentDone) { - System.out.println("progress. Completed " + percentDone + " percent"); + info("progress. Completed " + percentDone + " percent"); } public void setProgressText(String text) { - if (verbose) { - System.out.println("progress text: " + text); - } + info("progress text: " + text); String newText = text+" [Percentage="+currentVal+"%]"; messagesReceived.add(newText); - if (text.startsWith("woven aspect ")) numWovenAspectMessages++; - if (text.startsWith("woven class ")) numWovenClassMessages++; - if (text.startsWith("compiled:")) numCompiledMessages++; + if (text.startsWith("woven aspect ")) { + numWovenAspectMessages++; + } + if (text.startsWith("woven class ")) { + numWovenClassMessages++; + } + if (text.startsWith("compiled:")) { + numCompiledMessages++; + } if (programmableString != null && text.contains(programmableString)) { count--; if (count==0) { - if (debugTests) System.out.println("Just got message '"+newText+"' - asking build to cancel"); + if (debugTests) { + System.out.println("Just got message '"+newText+"' - asking build to cancel"); + } isCancelRequested = true; programmableString = null; } @@ -66,9 +77,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { } public void begin() { - if (verbose) { - System.out.println("build started"); - } + info("build started"); currentVal = 0; } @@ -81,15 +90,15 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { public boolean containsMessage(String prefix,String distinguishingMarks) { for (String element: messagesReceived) { if (element.startsWith(prefix) && - element.contains(distinguishingMarks)) return true; + element.contains(distinguishingMarks)) { + return true; + } } return false; } public void dumpMessages() { - if (verbose) { - System.out.println("ProgressMonitorMessages"); - } + System.out.println("ProgressMonitorMessages"); for (String element: messagesReceived) { System.out.println(element); } diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java index 662971cfe..8b707d1b7 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestMessageHandler.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation + * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation * Helen Hawkins - initial version *******************************************************************/ package org.aspectj.ajde.core; @@ -50,7 +50,9 @@ public class TestMessageHandler implements IBuildMessageHandler { } else if (kind.equals(IMessage.ERROR)) { errors.add(t); } - System.out.println("> " + message); //$NON-NLS-1$ + if (AjdeCoreModuleTests.verbose) { + System.out.println("> " + message); //$NON-NLS-1$ + } return true; } |