summaryrefslogtreecommitdiffstats
path: root/ajde/testsrc
diff options
context:
space:
mode:
Diffstat (limited to 'ajde/testsrc')
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java2
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java19
-rw-r--r--ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java6
-rw-r--r--ajde/testsrc/org/aspectj/ajde/StructureModelTest.java2
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java6
5 files changed, 17 insertions, 18 deletions
diff --git a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java
index b0d854238..8b815224b 100644
--- a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java
@@ -20,7 +20,7 @@ import org.aspectj.asm.IProgramElement.Kind;
// TODO: add tests for java kinds
public class AsmDeclarationsTest extends AjdeTestCase {
- private StructureModel model = null;
+ private AspectJModel model = null;
private static final String CONFIG_FILE_PATH = "../examples/coverage/coverage.lst";
private static final int DEC_MESSAGE_LENGTH = AsmNodeFormatter.MAX_MESSAGE_LENGTH;
diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
index 3714da143..f2a005670 100644
--- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
@@ -16,7 +16,6 @@ import java.util.List;
import org.aspectj.asm.*;
import org.aspectj.asm.internal.ProgramElement;
-
// TODO: check for return types
public class AsmRelationshipsTest extends AjdeTestCase {
@@ -28,32 +27,32 @@ public class AsmRelationshipsTest extends AjdeTestCase {
}
// public void testInterTypeDeclarations() {
-// checkMapping("InterTypeDecCoverage", "Point", "Point.xxx:", "xxx");
+// checkMapping("InterTypeDecCoverage", "Point", "Point.xxx:", "xxx", "declared on", "aspect declarations");
// }
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)");
+ checkMapping("AdvisesRelationshipCoverage", "Point", "before(): methodExecutionP..", "setX(int)", "advises", "advised by");
+ checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): getP..", "field-get(int Point.x)", "advises");
+ checkUniDirectionalMapping("AdvisesRelationshipCoverage", "Point", "before(): setP..", "field-set(int Point.xxx)", "advises");
}
- private void checkUniDirectionalMapping(String fromType, String toType, String from, String to) {
+ private void checkUniDirectionalMapping(String fromType, String toType, String from, String to, String relName) {
IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType);
assertNotNull(aspect);
String beforeExec = from;
IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec);
assertNotNull(beforeExecNode);
- IRelationship rel = manager.getMapper().get(beforeExecNode);
+ IRelationship rel = manager.getMapper().get(beforeExecNode, IRelationship.Kind.ADVICE, relName);
assertEquals(((IProgramElement)rel.getTargets().get(0)).getName(), to);
}
- private void checkMapping(String fromType, String toType, String from, String to) {
+ private void checkMapping(String fromType, String toType, String from, String to, String forwardRelName, String backRelName) {
IProgramElement aspect = AsmManager.getDefault().getModel().findNodeForType(null, fromType);
assertNotNull(aspect);
String beforeExec = from;
IProgramElement beforeExecNode = manager.getModel().findNode(aspect, IProgramElement.Kind.ADVICE, beforeExec);
assertNotNull(beforeExecNode);
- IRelationship rel = manager.getMapper().get(beforeExecNode);
+ IRelationship rel = manager.getMapper().get(beforeExecNode, IRelationship.Kind.ADVICE, forwardRelName);
assertEquals(((IProgramElement)rel.getTargets().get(0)).getName(), to);
IProgramElement clazz = AsmManager.getDefault().getModel().findNodeForType(null, toType);
@@ -61,7 +60,7 @@ public class AsmRelationshipsTest extends AjdeTestCase {
String set = to;
IProgramElement setNode = manager.getModel().findNode(clazz, IProgramElement.Kind.METHOD, set);
assertNotNull(setNode);
- IRelationship rel2 = manager.getMapper().get(setNode);
+ IRelationship rel2 = manager.getMapper().get(setNode, IRelationship.Kind.ADVICE, backRelName);
assertEquals(((IProgramElement)rel2.getTargets().get(0)).getName(), from);
}
diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java
index d7c1038aa..cae44a403 100644
--- a/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/StructureModelRegressionTest.java
@@ -45,11 +45,11 @@ public class StructureModelRegressionTest extends AjdeTestCase {
public boolean verifyAgainstSavedModel(String lstFile) {
File modelFile = new File(genStructureModelExternFilePath(lstFile));
- StructureModel model = getModelForFile(lstFile);
+ AspectJModel model = getModelForFile(lstFile);
if (modelFile.exists()) {
Ajde.getDefault().getStructureModelManager().readStructureModel(lstFile);
- StructureModel savedModel = Ajde.getDefault().getStructureModelManager().getModel();
+ AspectJModel savedModel = Ajde.getDefault().getStructureModelManager().getModel();
// 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
@@ -89,7 +89,7 @@ public class StructureModelRegressionTest extends AjdeTestCase {
return equal;
}
- private StructureModel getModelForFile(String lstFile) {
+ private AspectJModel getModelForFile(String lstFile) {
Ajde.getDefault().getConfigurationManager().setActiveConfigFile(lstFile);
Ajde.getDefault().getBuildManager().build(); // was buildStructure...
while(!testerBuildListener.getBuildFinished()) {
diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java
index ba451fcfa..674895e41 100644
--- a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java
@@ -115,7 +115,7 @@ public class StructureModelTest extends AjdeTestCase {
* @todo add negative test to make sure things that aren't runnable aren't annotated
*/
public void testMainClassNodeInfo() throws IOException {
- StructureModel model = Ajde.getDefault().getStructureModelManager().getModel();
+ AspectJModel model = Ajde.getDefault().getStructureModelManager().getModel();
assertTrue("model exists", model != null);
assertTrue("root exists", model.getRoot() != null);
File testFile = openFile("figures-coverage/figures/Main.java");
diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java
index dad5bf240..99ff905f4 100644
--- a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java
@@ -66,7 +66,7 @@ public class StructureViewManagerTest extends AjdeTestCase {
assertTrue(
"no structure",
currentView.getRootNode().getStructureNode().getChildren().get(0)
- == StructureModel.NO_STRUCTURE
+ == AspectJModel.NO_STRUCTURE
);
}
@@ -87,7 +87,7 @@ public class StructureViewManagerTest extends AjdeTestCase {
assertTrue(
"no structure",
//currentView.getRootNode().getIProgramElement().getChildren().get(0)
- n == StructureModel.NO_STRUCTURE
+ n == AspectJModel.NO_STRUCTURE
);
}
@@ -125,7 +125,7 @@ public class StructureViewManagerTest extends AjdeTestCase {
assertTrue(
"no structure",
currentView.getRootNode().getStructureNode()
- == StructureModel.NO_STRUCTURE
+ == AspectJModel.NO_STRUCTURE
);
}