diff options
author | mkersten <mkersten> | 2003-08-12 10:29:59 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-08-12 10:29:59 +0000 |
commit | 11d7649fc3219af5a71d3bf0b9fe004c075c2b4f (patch) | |
tree | 11280a5298e3169aba7086e69b0512dc4c99f7ff /ajde/testsrc | |
parent | 1e0113299d9eea6272c7b83b40d95b808076a028 (diff) | |
download | aspectj-11d7649fc3219af5a71d3bf0b9fe004c075c2b4f.tar.gz aspectj-11d7649fc3219af5a71d3bf0b9fe004c075c2b4f.zip |
Minor improvements to structure model generation, clean up of test suite output, and port of AJDT to new ASM APIs.
Diffstat (limited to 'ajde/testsrc')
15 files changed, 26 insertions, 52 deletions
diff --git a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java index 9e99b7221..b0d854238 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java @@ -47,7 +47,7 @@ public class AsmDeclarationsTest extends AjdeTestCase { IProgramElement node = (IProgramElement)model.getRoot(); assertNotNull(node); - IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage"); + IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "DeclareCoverage"); assertNotNull(aspect); String decErrMessage = "declare error: \"Illegal construct..\""; @@ -90,7 +90,7 @@ public class AsmDeclarationsTest extends AjdeTestCase { IProgramElement node = (IProgramElement)model.getRoot(); assertNotNull(node); - IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage"); + IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "InterTypeDecCoverage"); assertNotNull(aspect); String fieldMsg = "Point.xxx"; @@ -114,7 +114,7 @@ public class AsmDeclarationsTest extends AjdeTestCase { IProgramElement node = (IProgramElement)model.getRoot(); assertNotNull(node); - IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage"); + IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage"); assertNotNull(aspect); String ptct = "named()"; @@ -134,7 +134,7 @@ public class AsmDeclarationsTest extends AjdeTestCase { IProgramElement node = (IProgramElement)model.getRoot(); assertNotNull(node); - IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AbstractAspect"); + IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AbstractAspect"); assertNotNull(aspect); String abst = "abPtct()"; @@ -147,7 +147,7 @@ public class AsmDeclarationsTest extends AjdeTestCase { IProgramElement node = (IProgramElement)model.getRoot(); assertNotNull(node); - IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage"); + IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, "AdviceNamingCoverage"); assertNotNull(aspect); String anon = "before(): <anonymous pointcut>"; @@ -189,7 +189,7 @@ public class AsmDeclarationsTest extends AjdeTestCase { protected void setUp() throws Exception { super.setUp("examples"); assertTrue("build success", doSynchronousBuild(CONFIG_FILE_PATH)); - model = StructureModelManager.getDefault().getModel(); + model = AsmManager.getDefault().getModel(); } protected void tearDown() throws Exception { diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java index e50ee51cd..3714da143 100644 --- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java +++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java @@ -14,29 +14,31 @@ package org.aspectj.ajde; import java.util.List; import org.aspectj.asm.*; +import org.aspectj.asm.internal.ProgramElement; // TODO: check for return types public class AsmRelationshipsTest extends AjdeTestCase { - private StructureModelManager manager = null; + private AsmManager manager = null; private static final String CONFIG_FILE_PATH = "../examples/coverage/coverage.lst"; public AsmRelationshipsTest(String name) { super(name); } - public void testAdvice() { - IProgramElement node = (IProgramElement)manager.getModel().getRoot(); - assertNotNull(node); - +// public void testInterTypeDeclarations() { +// checkMapping("InterTypeDecCoverage", "Point", "Point.xxx:", "xxx"); +// } + + public void testAdvice() { checkMapping("AdvisesRelationshipCoverage", "Point", "before(): methodExecutionP..", "setX(int)"); checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): getP..", "field-get(int Point.x)"); checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): setP..", "field-set(int Point.xxx)"); } private void checkUniDirectionalMapping(String fromType, String toType, String from, String to) { - IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, fromType); + IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType); assertNotNull(aspect); String beforeExec = from; IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec); @@ -46,7 +48,7 @@ public class AsmRelationshipsTest extends AjdeTestCase { } private void checkMapping(String fromType, String toType, String from, String to) { - IProgramElement aspect = StructureModelManager.getDefault().getModel().findNodeForType(null, fromType); + IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType); assertNotNull(aspect); String beforeExec = from; IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec); @@ -54,7 +56,7 @@ public class AsmRelationshipsTest extends AjdeTestCase { IRelationship rel = manager.getMapper().get(beforeExecNode); assertEquals(((IProgramElement)rel.getTargets().get(0)).getName(), to); - IProgramElement clazz = StructureModelManager.getDefault().getModel().findNodeForType(null, toType); + IProgramElement clazz = AsmManager.getDefault().getModel().findNodeForType(null, toType); assertNotNull(clazz); String set = to; IProgramElement setNode = manager.getModel().findNode(clazz, IProgramElement.Kind.METHOD, set); @@ -66,7 +68,7 @@ public class AsmRelationshipsTest extends AjdeTestCase { protected void setUp() throws Exception { super.setUp("examples"); assertTrue("build success", doSynchronousBuild(CONFIG_FILE_PATH)); - manager = StructureModelManager.getDefault(); + manager = AsmManager.getDefault(); } protected void tearDown() throws Exception { diff --git a/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java b/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java index d6c7f1013..b631642f8 100644 --- a/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java +++ b/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java @@ -479,8 +479,6 @@ public class BuildConfigurationTests extends AjdeTestCase { null, null, null); - - //Ajde.getDefault().enableLogging( System.out ); } catch (Throwable t) { String s = "Unable to initialize AJDE " + LangUtil.renderException(t); diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java b/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java index 35a8e74d4..d2ccf2596 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeErrorHandler.java @@ -15,15 +15,15 @@ package org.aspectj.ajde; public class NullIdeErrorHandler implements ErrorHandler { public void handleWarning(String message) { - System.out.println("NullIde warning: " + message); + System.out.println("NullIde> warning: " + message); } public void handleError(String message) { - System.out.println("NullIde error: " + message); + System.out.println("NullIde> error: " + message); } public void handleError(String message, Throwable t) { - System.out.println("NullIde error: " + message); + System.out.println("NullIde> error: " + message); t.printStackTrace(System.out); } } diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java b/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java index afd31cbeb..2a761ca47 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeProgressMonitor.java @@ -15,7 +15,7 @@ package org.aspectj.ajde; public class NullIdeProgressMonitor implements BuildProgressMonitor { public void start(String configFile) { -// System.out.println("> compiling: " + configFile); + } public void setProgressText(String text) { diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java index 17e4f4722..199a763c3 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java @@ -45,11 +45,11 @@ public class NullIdeTaskListManager implements TaskListManager { } /* Guard against null source locations e.g. JAR file messages */ if (null != message.getSourceLocation()) { - System.out.println("> added sourceline task: " + message + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath() + System.out.println("NullIde> task: " + message.getMessage() + ", file: " + message.getSourceLocation().getSourceFile().getAbsolutePath() + ": " + message.getSourceLocation().getLine()); } else { - System.out.println("> added sourceline task: " + message); + System.out.println("NullIde> task: " + message); } } diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java index e31d021a7..5d344e754 100644 --- a/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java +++ b/ajde/testsrc/org/aspectj/ajde/NullIdeUIAdapter.java @@ -18,7 +18,7 @@ import org.aspectj.ajde.ui.*; public class NullIdeUIAdapter implements IdeUIAdapter { public void displayStatusInformation(String message) { - System.out.println("NullIde> " + message); + System.out.println("NullIde>" + message); } public void resetGUI() { diff --git a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java index 8aa11f668..c7d23bf40 100644 --- a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java +++ b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java @@ -141,7 +141,6 @@ public class ResourceCopyTestCase extends AjdeTestCase { /* Ensure we didn't copy any JAR manifests */ if (fileName.toLowerCase().startsWith("meta-inf")) { byte[] outManifest = FileUtil.readAsByteArray(outjar); -// System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(outManifest) + "'"); assertFalse("Manifest has been copied",Arrays.equals(inManifest,outManifest)); } @@ -206,7 +205,6 @@ public class ResourceCopyTestCase extends AjdeTestCase { /* Ensure we didn't copy any JAR manifests */ if (fileName.toLowerCase().startsWith("meta-inf")) { byte[] outManifest = FileUtil.readAsByteArray(toResources[i]); -// System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(outManifest) + "'"); assertFalse("Manifest has been copied",Arrays.equals(inManifest,outManifest)); } boolean b = resources.remove(fileName); @@ -244,7 +242,6 @@ public class ResourceCopyTestCase extends AjdeTestCase { /* JAR manifests shouldn't be copied */ if (fileName.toLowerCase().startsWith("meta-inf")) { manifest = FileUtil.readAsByteArray(injar); -// System.err.println("? compareJars() fileName='" + fileName + "', manifest='" + new String(manifest) + "'"); } else { resources.add(fileName); diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java index fa097c8dc..d7c1038aa 100644 --- a/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java +++ b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java @@ -46,13 +46,10 @@ public class StructureModelRegressionTest extends AjdeTestCase { public boolean verifyAgainstSavedModel(String lstFile) { File modelFile = new File(genStructureModelExternFilePath(lstFile)); StructureModel model = getModelForFile(lstFile); - System.out.println(">> model: " + model.getRoot()); if (modelFile.exists()) { Ajde.getDefault().getStructureModelManager().readStructureModel(lstFile); StructureModel savedModel = Ajde.getDefault().getStructureModelManager().getModel(); - //System.err.println( savedModel.getRoot().getClass() + ", " + savedModel.getRoot()); - // AMC This test will not pass as written until IProgramElement defines // equals. The equals loic is commented out in the IProgramElement // class - adding it back in could have unforeseen system-wide diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java index 5777715cb..ba451fcfa 100644 --- a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java +++ b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java @@ -50,7 +50,6 @@ public class StructureModelTest extends AjdeTestCase { // ProgramElementNode pNode = (ProgramElementNode)node; // ProgramElementNode foundNode = null; // final List list = pNode.getRelations(); -// //System.err.println(">>>> " + pNode + ", " + list); // assertNotNull("pNode.getRelations()", list); // for (Iterator it = list.iterator(); it.hasNext(); ) { // RelationNode relation = (RelationNode)it.next(); @@ -88,10 +87,8 @@ public class StructureModelTest extends AjdeTestCase { public void testPointcutName() throws IOException { File testFile = openFile("figures-coverage/figures/Main.java"); - //System.err.println("PointcutName, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists()); IProgramElement node = Ajde.getDefault().getStructureModelManager().getModel().findRootNodeForSourceFile( testFile.getCanonicalPath()); - //System.err.println(" node: " + node); assertTrue("find result", node != null) ; IProgramElement pNode = (IProgramElement)((IProgramElement)node).getChildren().get(1); IProgramElement pointcut = (IProgramElement)pNode.getChildren().get(0); @@ -106,10 +103,8 @@ public class StructureModelTest extends AjdeTestCase { public void testFileNodeFind() throws IOException { File testFile = openFile("figures-coverage/figures/Main.java"); - //System.err.println("NodeFind, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists()); IProgramElement node = Ajde.getDefault().getStructureModelManager().getModel().findNodeForSourceLine( testFile.getCanonicalPath(), 1); - //System.err.println(" node: " + node); assertTrue("find result", node != null) ; assertEquals("find result has children", 2, node.getChildren().size()) ; IProgramElement pNode = (IProgramElement)node; diff --git a/ajde/testsrc/org/aspectj/ajde/VersionTest.java b/ajde/testsrc/org/aspectj/ajde/VersionTest.java index 6e8617005..d6f42d420 100644 --- a/ajde/testsrc/org/aspectj/ajde/VersionTest.java +++ b/ajde/testsrc/org/aspectj/ajde/VersionTest.java @@ -35,7 +35,6 @@ public class VersionTest extends AjdeTestCase { public void testVersionMatch() { String ajdeVersion = Ajde.getDefault().getVersion(); String compilerVersion = Version.text; - System.out.println("> ajde version: " + ajdeVersion + " <-> compiler version: " + compilerVersion); assertTrue("version check", ajdeVersion.equals(compilerVersion)); } diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java index 0a5b8c1a6..c68cb9d15 100644 --- a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java @@ -96,9 +96,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase { Iterator it = list.iterator(); while (st.hasMoreElements()) { String s1 = (String)st.nextElement(); - System.out.print("comparing: " + s1 + " <-> "); String s2 = (String)it.next(); - System.out.println(s2); if (!s1.equals(s2)) return false; } if (it.hasNext()) { diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java index 3f41e5e52..9098c7a5f 100644 --- a/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java +++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureModelUtilTest.java @@ -45,27 +45,22 @@ public class StructureModelUtilTest extends AjdeTestCase { List packages = StructureModelUtil.getPackagesInModel(); assertTrue("packages list not null", packages != null); assertTrue("packages list not empty", !packages.isEmpty()); - // System.err.println("> packages: " + packages); IProgramElement packageNode = (IProgramElement)((Object[])packages.get(0))[0]; assertTrue("package node not null", packageNode != null); - // System.err.println("> package node: " + packageNode); List files = StructureModelUtil.getFilesInPackage(packageNode); assertTrue("fle list not null", files != null); - // System.err.println("> file list: " + files); // TODO: re-enable // Map lineAdviceMap = StructureModelUtil.getLinesToAspectMap( // ((IProgramElement)files.get(0)).getSourceLocation().getSourceFile().getAbsolutePath() // ); // -// assertTrue("line->advice map not null", lineAdviceMap != null); -// // System.err.println("> line->advice map: " + lineAdviceMap); +// assertTrue("line->advice map not null", lineAdviceMap != null); // // Set aspects = StructureModelUtil.getAspectsAffectingPackage(packageNode); -// assertTrue("aspect list not null", aspects != null); -// // System.err.println("> aspects affecting package: " + aspects); +// assertTrue("aspect list not null", aspects != null); } diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java index a27630d55..70763dfd5 100644 --- a/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureSearchManagerTest.java @@ -47,7 +47,6 @@ public class StructureSearchManagerTest extends AjdeTestCase { "Point", null ); - System.err.println(matches); assertTrue("non existent node", true); } @@ -56,7 +55,6 @@ public class StructureSearchManagerTest extends AjdeTestCase { "Point", IProgramElement.Kind.CONSTRUCTOR ); - System.err.println(matches); assertTrue("non existent node", true); } diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java index 680b0ffc9..dad5bf240 100644 --- a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java @@ -77,12 +77,10 @@ public class StructureViewManagerTest extends AjdeTestCase { renderer.setHasBeenNotified(false); String modelPath = genStructureModelExternFilePath(CONFIG_FILE_PATH); openFile(modelPath).delete(); - //System.err.println("> path: " + modelPath); Ajde.getDefault().getStructureModelManager().readStructureModel(CONFIG_FILE_PATH); assertTrue("notified", renderer.getHasBeenNotified()); - //System.err.println(">>>>>> " + currentView.getRootNode().getIProgramElement()); // AMC should this be currentView, or should we recreate the root... do the latter //IProgramElement n = currentView.getRootNode().getIProgramElement(); IProgramElement n = Ajde.getDefault().getStructureModelManager().getModel().getRoot(); @@ -146,7 +144,6 @@ public class StructureViewManagerTest extends AjdeTestCase { } // public void testViewListenerRegistrations() { -// System.err.println("> starting..."); // Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst"); // while(!testerBuildListener.getBuildFinished()) { // try { @@ -154,7 +151,6 @@ public class StructureViewManagerTest extends AjdeTestCase { // } catch (InterruptedException ie) { } // } // List renderers = Ajde.getDefault().getStructureViewManager().getDefaultFileStructureView().getRenderers(); -// System.err.println("> renderers (1): " + renderers); // // testerBuildListener.reset(); // Ajde.getDefault().getBuildManager().build("C:/Dev/aspectj/tests/ajde/examples/coverage-figures/src/AllFiles.lst"); @@ -163,7 +159,6 @@ public class StructureViewManagerTest extends AjdeTestCase { // Thread.sleep(300); // } catch (InterruptedException ie) { } // } -// System.err.println("> renderers (2): " + renderers); // assertTrue("checking renderers", true); // } } |