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 | |
parent | 50e1d8e5a1c66197dc7aadc4a12c8abf294e673e (diff) | |
download | aspectj-8fb374ceba1832e5beb77f707f5709ae32d04907.tar.gz aspectj-8fb374ceba1832e5beb77f707f5709ae32d04907.zip |
lets have maven fail if those tests fail...
Diffstat (limited to 'ajde')
-rw-r--r-- | ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java | 65 |
1 files changed, 42 insertions, 23 deletions
diff --git a/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java b/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java index 09d794191..ef70388ad 100644 --- a/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java +++ b/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java @@ -1,17 +1,16 @@ /******************************************************************** - * 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 (bug 148190) *******************************************************************/ package org.aspectj.ajde.ui.utils; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.aspectj.ajde.core.IBuildProgressMonitor; @@ -23,20 +22,24 @@ import org.aspectj.ajde.core.IBuildProgressMonitor; */ public class TestBuildProgressMonitor implements IBuildProgressMonitor { + private final static boolean verbose = System.getProperty("aspectj.tests.verbose", "true") + .equalsIgnoreCase("false"); private static boolean debugTests = false; - + public int numWovenClassMessages = 0; public int numWovenAspectMessages = 0; public int numCompiledMessages = 0; - + private String programmableString; private int count; - private List messagesReceived = new ArrayList(); + private List<String> messagesReceived = new ArrayList<>(); private int currentVal; private boolean isCancelRequested = false; - + public void finish(boolean wasFullBuild) { - System.out.println("build finished. Was full build: " + wasFullBuild); + if (verbose) { + System.out.println("build finished. Was full build: " + wasFullBuild); + } } public boolean isCancelRequested() { @@ -44,21 +47,33 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { } public void setProgress(double percentDone) { - System.out.println("progress. Completed " + percentDone + " percent"); + if (verbose) { + System.out.println("progress. Completed " + percentDone + " percent"); + } } public void setProgressText(String text) { - System.out.println("progress text: " + text); + if (verbose) { + System.out.println("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,7 +81,9 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { } public void begin() { - System.out.println("build started"); + if (verbose) { + System.out.println("build started"); + } currentVal = 0; } @@ -75,16 +92,18 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { programmableString = string; this.count = count; } - + public boolean containsMessage(String prefix,String distinguishingMarks) { for (Object o : messagesReceived) { String element = (String) o; if (element.startsWith(prefix) && - element.contains(distinguishingMarks)) return true; + element.contains(distinguishingMarks)) { + return true; + } } return false; } - + public void dumpMessages() { System.out.println("ProgressMonitorMessages"); for (Object o : messagesReceived) { |