From 45f1f040588862f0100f3844574f3a80afab8e15 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 15 Apr 2005 14:06:41 +0000 Subject: Andys quest to reduce unnecessary test output. --- .../org/aspectj/ajde/BuildCancellingTest.java | 16 ++++--- ajde/testsrc/org/aspectj/ajde/ExtensionTests.java | 8 ++-- .../org/aspectj/ajde/NullIdeTaskListManager.java | 3 ++ .../testsrc/org/aspectj/ajde/NullIdeUIAdapter.java | 4 +- .../org/aspectj/ajde/ReweavableTestCase.java | 50 +++++++++++----------- .../aspectj/ajde/ShowWeaveMessagesTestCase.java | 29 +++++++------ 6 files changed, 59 insertions(+), 51 deletions(-) (limited to 'ajde') diff --git a/ajde/testsrc/org/aspectj/ajde/BuildCancellingTest.java b/ajde/testsrc/org/aspectj/ajde/BuildCancellingTest.java index 5be0b05e1..93e2a5a34 100644 --- a/ajde/testsrc/org/aspectj/ajde/BuildCancellingTest.java +++ b/ajde/testsrc/org/aspectj/ajde/BuildCancellingTest.java @@ -53,6 +53,7 @@ public class BuildCancellingTest extends AjdeTestCase { private CompilerAdapter compilerAdapter; public static final String PROJECT_DIR = "BuildCancelling"; public static final String binDir = "bin"; + private static final boolean debugTests = false; public BuildCancellingTest(String arg0) { super(arg0); @@ -71,7 +72,7 @@ public class BuildCancellingTest extends AjdeTestCase { * message about cancelling the compile and their should be nothing on the disk. */ public void testCancelFirstCompile() { - System.out.println("\n\n\ntestCancelFirstCompile: Building with LoadsaCode.lst"); + if (debugTests) System.out.println("\n\n\ntestCancelFirstCompile: Building with LoadsaCode.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(false); BuildProgMon programmableBPM = new BuildProgMon(); @@ -102,7 +103,7 @@ public class BuildCancellingTest extends AjdeTestCase { * message about cancelling the compile and their should be nothing on the disk. */ public void testCancelThirdCompile() { - System.out.println("\n\n\ntestCancelThirdCompile: Building with LoadsaCode.lst"); + if (debugTests) System.out.println("\n\n\ntestCancelThirdCompile: Building with LoadsaCode.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(false); BuildProgMon programmableBPM = new BuildProgMon(); @@ -132,7 +133,7 @@ public class BuildCancellingTest extends AjdeTestCase { * message about cancelling the weave and their should be nothing on the disk. */ public void testCancelFirstAspectWeave() { - System.out.println("\n\n\ntestCancelFirstAspectWeave: Building with LoadsaCode.lst"); + if (debugTests) System.out.println("\n\n\ntestCancelFirstAspectWeave: Building with LoadsaCode.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(false); BuildProgMon programmableBPM = new BuildProgMon(); @@ -160,7 +161,7 @@ public class BuildCancellingTest extends AjdeTestCase { * message about cancelling the weave and their should be nothing on the disk. */ public void testCancelThirdAspectWeave() { - System.out.println("\n\n\ntestCancelThirdAspectWeave: Building with LoadsaCode.lst"); + if (debugTests) System.out.println("\n\n\ntestCancelThirdAspectWeave: Building with LoadsaCode.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(false); @@ -204,7 +205,7 @@ public class BuildCancellingTest extends AjdeTestCase { * */ public void testCancelFirstClassWeave() { - System.out.println("testCancelFirstClassWeave: Building with EvenMoreCode.lst"); + if (debugTests) System.out.println("testCancelFirstClassWeave: Building with EvenMoreCode.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(false); BuildProgMon programmableBPM = new BuildProgMon(); @@ -245,7 +246,7 @@ public class BuildCancellingTest extends AjdeTestCase { * */ public void testCancelSecondClassWeave() { - System.out.println("testCancelSecondClassWeave: Building with EvenMoreCode.lst"); + if (debugTests) System.out.println("testCancelSecondClassWeave: Building with EvenMoreCode.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(false); BuildProgMon programmableBPM = new BuildProgMon(); @@ -304,7 +305,7 @@ public class BuildCancellingTest extends AjdeTestCase { && text.indexOf(programmableString) != -1) { count--; if (count==0) { - System.out.println("Just got message '"+newText+"' - asking build to cancel"); + if (debugTests) System.out.println("Just got message '"+newText+"' - asking build to cancel"); compilerAdapter.requestCompileExit(); programmableString = null; } @@ -399,6 +400,7 @@ public class BuildCancellingTest extends AjdeTestCase { } private void dumpTaskData() { + if (!debugTests) return; List ll = ideManager.getCompilationSourceLineTasks(); for (Iterator iter = ll.iterator(); iter.hasNext();) { Object element = (Object) iter.next(); diff --git a/ajde/testsrc/org/aspectj/ajde/ExtensionTests.java b/ajde/testsrc/org/aspectj/ajde/ExtensionTests.java index c2a8f2670..a80f4a95e 100644 --- a/ajde/testsrc/org/aspectj/ajde/ExtensionTests.java +++ b/ajde/testsrc/org/aspectj/ajde/ExtensionTests.java @@ -30,7 +30,7 @@ import org.aspectj.org.eclipse.jdt.core.compiler.IProblem; public class ExtensionTests extends AjcTestCase { public static final String PROJECT_DIR = "extensions"; - + private static final boolean debugTests = false; private File baseDir; protected void setUp() throws Exception { @@ -59,7 +59,7 @@ public class ExtensionTests extends AjcTestCase { CompilationResult result = ajc(baseDir,args); List l = result.getWarningMessages(); Properties p = AsmManager.ModelInfo.summarizeModel().getProperties(); - System.out.println("Structure Model for InnerClasses.java:"); + if (debugTests) System.out.println("Structure Model for InnerClasses.java:"); walkit(AsmManager.getDefault().getHierarchy().getRoot(),0); foundNode = null; findChild("main",AsmManager.getDefault().getHierarchy().getRoot()); @@ -115,8 +115,8 @@ public class ExtensionTests extends AjcTestCase { public void walkit(IProgramElement ipe,int indent) { if (ipe!=null) { - for (int i = 0 ;i task: " + message.getMessage() + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath() + ": " + message.getSourceLocation().getLine()); diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java index 5d344e754..17661fb42 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java @@ -16,9 +16,9 @@ package org.aspectj.ajde; import org.aspectj.ajde.ui.*; public class NullIdeUIAdapter implements IdeUIAdapter { - + private final static boolean debugTests = false; public void displayStatusInformation(String message) { - System.out.println("NullIde>" + message); + if (debugTests) System.out.println("NullIde>" + message); } public void resetGUI() { diff --git a/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java b/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java index fd0ef0c73..f678afae6 100644 --- a/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java +++ b/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java @@ -25,6 +25,8 @@ public class ReweavableTestCase extends AjdeTestCase { private CompilerAdapter compilerAdapter; public static final String PROJECT_DIR = "ReweavableTest"; + + private static final boolean debugTests = false; public static final String binDir = "bin"; @@ -73,7 +75,7 @@ public class ReweavableTestCase extends AjdeTestCase { * should not report it is running in reweavable mode. */ public void testNonReweavableCompile() { - System.out.println("testNonReweavableCompile: Building with NonReweavable1.lst"); + if (debugTests) System.out.println("testNonReweavableCompile: Building with NonReweavable1.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(true); compilerAdapter.compile((String) openFile("NonReweavable1.lst").getAbsolutePath(),new BPM(),false); @@ -85,9 +87,9 @@ public class ReweavableTestCase extends AjdeTestCase { File fLog = openFile("bin/Logger.class"); assertTrue("bin/CalculatePI.class should exist?!?",fCalc.exists()); assertTrue("bin/Logger.class should exist?!?",fLog.exists()); - System.out.println("CalculatePI.class is of size: "+fCalc.length()); - System.out.println("Logger.class is of size: "+fLog.length()); - System.out.println("\n\n\n"); + if (debugTests) System.out.println("CalculatePI.class is of size: "+fCalc.length()); + if (debugTests) System.out.println("Logger.class is of size: "+fLog.length()); + if (debugTests) System.out.println("\n\n\n"); nonreweavesize_CalculatePI = (int)fCalc.length(); nonreweavesize_Logger = (int)fLog.length(); } @@ -111,7 +113,7 @@ public class ReweavableTestCase extends AjdeTestCase { * should be larger than those created during the last test. */ public void testReweavableCompile() { - System.out.println("testReweavableCompile: Building with Reweavable1.lst"); + if (debugTests) System.out.println("testReweavableCompile: Building with Reweavable1.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(true); compilerAdapter.compile((String) openFile("Reweavable1.lst").getAbsolutePath(),new BPM(),false); @@ -123,8 +125,8 @@ public class ReweavableTestCase extends AjdeTestCase { File fLog = openFile("bin/Logger.class"); assertTrue("bin/CalculatePI.class should exist?!?",fCalc.exists()); assertTrue("bin/Logger.class should exist?!?",fLog.exists()); - System.out.println("CalculatePI.class is of size: "+fCalc.length()); - System.out.println("Logger.class is of size: "+fLog.length()); + if (debugTests) System.out.println("CalculatePI.class is of size: "+fCalc.length()); + if (debugTests) System.out.println("Logger.class is of size: "+fLog.length()); // Temporarily remove these tests - it seems the order in which the testXXX methods are run cannot be relied upon // so reweavablesize_XXX fields might not have been set yet. // assertTrue("Reweavable version should be larger than non-reweavable version of CalculatePI", @@ -135,7 +137,7 @@ public class ReweavableTestCase extends AjdeTestCase { reweavablesize_CalculatePI = (int)fCalc.length(); reweavablesize_Logger = (int)fLog.length(); - System.out.println("\n\n\n"); + if (debugTests) System.out.println("\n\n\n"); } @@ -158,7 +160,7 @@ public class ReweavableTestCase extends AjdeTestCase { * compression) versions. */ public void testReweavableCompressCompile() { - System.out.println("testReweavableCompressCompile: Building with ReweavableCompress1.lst"); + if (debugTests) System.out.println("testReweavableCompressCompile: Building with ReweavableCompress1.lst"); compilerAdapter = new CompilerAdapter(); compilerAdapter.showInfoMessages(true); compilerAdapter.compile((String) openFile("ReweavableCompress1.lst").getAbsolutePath(),new BPM(),false); @@ -172,8 +174,8 @@ public class ReweavableTestCase extends AjdeTestCase { assertTrue("bin/Logger.class should exist?!?",fLog.exists()); int calclen = (int)fCalc.length(); int loglen = (int)fLog.length(); - System.out.println("CalculatePI.class is of size: "+calclen); - System.out.println("Logger.class is of size: "+loglen); + if (debugTests) System.out.println("CalculatePI.class is of size: "+calclen); + if (debugTests) System.out.println("Logger.class is of size: "+loglen); // Temporarily remove these tests - it seems the order in which the testXXX methods are run cannot be relied upon // so reweavablesize_XXX fields might not have been set yet. // assertTrue("Reweavable version should be larger than non-reweavable version of CalculatePI", @@ -189,7 +191,7 @@ public class ReweavableTestCase extends AjdeTestCase { // " Compressed version:"+loglen+"bytes Non-compressed version:"+reweavablesize_Logger+"bytes", // loglen