public void testStructureModel() {
// AsmManager.setReporting("c:/debug.txt",true,true,true,true);
runTest("declare all annotations on one class - source weaving");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE,
- "declare at_type: p.q.DeathByAnnotations : @Colored(\"red\")");
- assertTrue("Couldn't find 'declare @type' element in the tree",ipe!=null);
-
- List l = AsmManager.getDefault().getRelationshipMap().get(ipe);
- assertTrue("Should have a relationship but does not ",l.size()>0);
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD,
- "declare at_method: * m*(..) : @Fruit(\"tomato\")");
- assertTrue("Couldn't find 'declare @method element in the tree",ipe!=null);
-
- l = AsmManager.getDefault().getRelationshipMap().get(ipe);
- assertTrue("Should have a relationship but does not ",l.size()>0);
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR,
- "declare at_constructor: p.q.DeathByAnnotations.new(..) : @Fruit(\"tomato\")");
- assertTrue("Couldn't find 'declare @constructor element in the tree",ipe!=null);
- l = AsmManager.getDefault().getRelationshipMap().get(ipe);
- assertTrue("Should have a relationship but does not ",l.size()>0);
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD,
- "declare at_field: * p.q.DeathByAnnotations.* : @Material(\"wood\")");
- assertTrue("Couldn't find 'declare @field element in the tree",ipe!=null);
- l = AsmManager.getDefault().getRelationshipMap().get(ipe);
- assertTrue("Should have a relationship but does not ",l.size()>0);
+ if (getCurrentTest().canRunOnThisVM()) {
+ IHierarchy top = AsmManager.getDefault().getHierarchy();
+
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(),
+ IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE,
+ "declare at_type: p.q.DeathByAnnotations : @Colored(\"red\")");
+ assertTrue("Couldn't find 'declare @type' element in the tree",ipe!=null);
+
+ List l = AsmManager.getDefault().getRelationshipMap().get(ipe);
+ assertTrue("Should have a relationship but does not ",l.size()>0);
+
+ ipe = top.findElementForLabel(top.getRoot(),
+ IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD,
+ "declare at_method: * m*(..) : @Fruit(\"tomato\")");
+ assertTrue("Couldn't find 'declare @method element in the tree",ipe!=null);
+
+ l = AsmManager.getDefault().getRelationshipMap().get(ipe);
+ assertTrue("Should have a relationship but does not ",l.size()>0);
+
+ ipe = top.findElementForLabel(top.getRoot(),
+ IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR,
+ "declare at_constructor: p.q.DeathByAnnotations.new(..) : @Fruit(\"tomato\")");
+ assertTrue("Couldn't find 'declare @constructor element in the tree",ipe!=null);
+ l = AsmManager.getDefault().getRelationshipMap().get(ipe);
+ assertTrue("Should have a relationship but does not ",l.size()>0);
+
+ ipe = top.findElementForLabel(top.getRoot(),
+ IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD,
+ "declare at_field: * p.q.DeathByAnnotations.* : @Material(\"wood\")");
+ assertTrue("Couldn't find 'declare @field element in the tree",ipe!=null);
+ l = AsmManager.getDefault().getRelationshipMap().get(ipe);
+ assertTrue("Should have a relationship but does not ",l.size()>0);
+ }
}
}
\ No newline at end of file