use of org.finos.legend.pure.m3.coreinstance.meta.pure.diagram.AssociationView in project legend-pure by finos.
the class TestSourceMutation method testAssociationViewWithNonExistentAssociation.
@Test
public void testAssociationViewWithNonExistentAssociation() {
compileTestSource("testModel.pure", "Class test::pure::TestClass1 {}\n" + "Class test::pure::TestClass2 {}\n");
SourceMutation m = compileTestSource("testDiagram.pure", "###Diagram\n" + "Diagram test::pure::TestDiagram(width=10.0, height=10.0)\n" + "{\n" + " TypeView TestClass1(type=test::pure::TestClass1, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(874.0, 199.46875), width=353.0, height=57.1875)\n" + " TypeView TestClass2(type=test::pure::TestClass2, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(75.0, 97.1875), width=113.0, height=57.1875)\n" + " AssociationView TestAssociation(association=test::pure::TestAssociation, stereotypesVisible=true, nameVisible=false,\n" + " color=#000000, lineWidth=1.0,\n" + " lineStyle=SIMPLE, points=[(132.5, 77.0), (155.2, 77.0)],\n" + " label='TestAssociation',\n" + " source=TestClass1,\n" + " target=TestClass2,\n" + " sourcePropertyPosition=(132.5, 76.2),\n" + " sourceMultiplicityPosition=(132.5, 80.0),\n" + " targetPropertyPosition=(155.2, 76.2),\n" + " targetMultiplicityPosition=(155.2, 80.0))\n" + "}\n");
Verify.assertSetsEqual(Sets.mutable.with("testDiagram.pure"), m.getModifiedFiles().toSet());
Verify.assertSize(1, m.getLineRangesToRemoveByFile().get("testDiagram.pure"));
Assert.assertEquals(12, m.getLineRangesToRemoveByFile().get("testDiagram.pure").get(0).getOne());
Assert.assertEquals(21, m.getLineRangesToRemoveByFile().get("testDiagram.pure").get(0).getTwo());
CoreInstance testDiagram = this.runtime.getCoreInstance("test::pure::TestDiagram");
Assert.assertNotNull(testDiagram);
Verify.assertSize(2, Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.typeViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.associationViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.propertyViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.generalizationViews, this.processorSupport));
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.diagram.AssociationView in project legend-pure by finos.
the class TestSourceMutation method testAssociationViewWithNonExistentTypeViewId.
@Test
public void testAssociationViewWithNonExistentTypeViewId() {
compileTestSource("testModel.pure", "Class test::pure::TestClass1 {}\n" + "Class test::pure::TestClass2 {}\n" + "Association test::pure::TestAssociation\n" + "{\n" + " prop1:test::pure::TestClass1[0..1];\n" + " prop2:test::pure::TestClass2[1..*];\n" + "}\n");
SourceMutation m = compileTestSource("testDiagram.pure", "###Diagram\n" + "Diagram test::pure::TestDiagram(width=10.0, height=10.0)\n" + "{\n" + " TypeView TestClass1(type=test::pure::TestClass1, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(874.0, 199.46875), width=353.0, height=57.1875)\n" + " TypeView TestClass2(type=test::pure::TestClass2, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(75.0, 97.1875), width=113.0, height=57.1875)\n" + " AssociationView TestAssociation(association=test::pure::TestAssociation, stereotypesVisible=true, nameVisible=false,\n" + " color=#000000, lineWidth=1.0,\n" + " lineStyle=SIMPLE, points=[(132.5, 77.0), (155.2, 77.0)],\n" + " label='TestAssociation',\n" + " source=TestClass1,\n" + " target=TestClass3,\n" + " sourcePropertyPosition=(132.5, 76.2),\n" + " sourceMultiplicityPosition=(132.5, 80.0),\n" + " targetPropertyPosition=(155.2, 76.2),\n" + " targetMultiplicityPosition=(155.2, 80.0))\n" + "}\n");
// TODO consider whether this is the correct behavior
Verify.assertSetsEqual(Sets.mutable.with("testDiagram.pure"), m.getModifiedFiles().toSet());
Verify.assertSize(1, m.getLineRangesToRemoveByFile().get("testDiagram.pure"));
Assert.assertEquals(12, m.getLineRangesToRemoveByFile().get("testDiagram.pure").get(0).getOne());
Assert.assertEquals(21, m.getLineRangesToRemoveByFile().get("testDiagram.pure").get(0).getTwo());
CoreInstance testDiagram = this.runtime.getCoreInstance("test::pure::TestDiagram");
Assert.assertNotNull(testDiagram);
Verify.assertSize(2, Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.typeViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.associationViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.propertyViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.generalizationViews, this.processorSupport));
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.diagram.AssociationView in project legend-pure by finos.
the class TestSourceMutation method testAssociationViewWithSourceViewWithNonExistentTypeInTheSameFile.
@Test
public void testAssociationViewWithSourceViewWithNonExistentTypeInTheSameFile() {
SourceMutation m1 = compileTestSource("testFile.pure", "Class test::pure::TestClass1 {}\n" + "Class test::pure::TestClass2 {}\n" + "Association test::pure::TestAssociation\n" + "{\n" + " toTC1_1 : test::pure::TestClass1[*];\n" + " toTC2_1 : test::pure::TestClass2[*];\n" + "}\n" + "" + "###Diagram\n" + "Diagram test::pure::TestDiagram(width=10.0, height=10.0)\n" + "{\n" + " TypeView TestClass1(type=test::pure::TestClass1, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(874.0, 199.46875), width=353.0, height=57.1875)\n" + " TypeView TestClass2(type=test::pure::TestClass2, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(75.0, 97.1875), width=113.0, height=57.1875)\n" + " AssociationView TestAssociation(association=test::pure::TestAssociation, stereotypesVisible=true, nameVisible=false,\n" + " color=#000000, lineWidth=1.0,\n" + " lineStyle=SIMPLE, points=[(132.5, 77.0), (155.2, 77.0)],\n" + " label='TestAssociation',\n" + " source=TestClass1,\n" + " target=TestClass2,\n" + " sourcePropertyPosition=(132.5, 76.2),\n" + " sourceMultiplicityPosition=(132.5, 80.0),\n" + " targetPropertyPosition=(155.2, 76.2),\n" + " targetMultiplicityPosition=(155.2, 80.0))\n" + "}\n");
Verify.assertEmpty(m1.getLineRangesToRemoveByFile());
Verify.assertEmpty(m1.getMarkedForDeletion());
Verify.assertEmpty(m1.getModifiedFiles());
this.runtime.modify("testFile.pure", "Class test::pure::TestClass1 {}\n" + "Class test::pure::TestClass3 {}\n" + "Association test::pure::TestAssociation\n" + "{\n" + " toTC1_1 : test::pure::TestClass1[*];\n" + " toTC2_1 : test::pure::TestClass3[*];\n" + "}\n" + "\n" + "###Diagram\n" + "Diagram test::pure::TestDiagram(width=10.0, height=10.0)\n" + "{\n" + " TypeView TestClass1(type=test::pure::TestClass1, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(874.0, 199.46875), width=353.0, height=57.1875)\n" + " TypeView TestClass2(type=test::pure::TestClass2, stereotypesVisible=true, attributesVisible=true,\n" + " attributeStereotypesVisible=true, attributeTypesVisible=true,\n" + " color=#FFFFCC, lineWidth=1.0,\n" + " position=(75.0, 97.1875), width=113.0, height=57.1875)\n" + " AssociationView TestAssociation(association=test::pure::TestAssociation, stereotypesVisible=true, nameVisible=false,\n" + " color=#000000, lineWidth=1.0,\n" + " lineStyle=SIMPLE, points=[(132.5, 77.0), (155.2, 77.0)],\n" + " label='TestAssociation',\n" + " source=TestClass1,\n" + " target=TestClass2,\n" + " sourcePropertyPosition=(132.5, 76.2),\n" + " sourceMultiplicityPosition=(132.5, 80.0),\n" + " targetPropertyPosition=(155.2, 76.2),\n" + " targetMultiplicityPosition=(155.2, 80.0))\n" + "}\n");
SourceMutation m2 = this.runtime.compile();
Verify.assertSetsEqual(Sets.mutable.with("testFile.pure"), m2.getModifiedFiles().toSet());
Verify.assertSize(2, m2.getLineRangesToRemoveByFile().get("testFile.pure"));
Assert.assertEquals(16, m2.getLineRangesToRemoveByFile().get("testFile.pure").get(0).getOne());
Assert.assertEquals(19, m2.getLineRangesToRemoveByFile().get("testFile.pure").get(0).getTwo());
Assert.assertEquals(20, m2.getLineRangesToRemoveByFile().get("testFile.pure").get(1).getOne());
Assert.assertEquals(29, m2.getLineRangesToRemoveByFile().get("testFile.pure").get(1).getTwo());
CoreInstance testDiagram = this.runtime.getCoreInstance("test::pure::TestDiagram");
Assert.assertNotNull(testDiagram);
Verify.assertSize(1, Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.typeViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.associationViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.propertyViews, this.processorSupport));
Verify.assertEmpty(Instance.getValueForMetaPropertyToManyResolved(testDiagram, M3Properties.generalizationViews, this.processorSupport));
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.diagram.AssociationView in project legend-pure by finos.
the class DiagramUnbind method run.
@Override
public void run(Diagram diagram, MatcherState state, Matcher matcher, ModelRepository modelRepository, Context context) throws PureCompilationException {
ProcessorSupport processorSupport = state.getProcessorSupport();
RichIterable<? extends CoreInstance> typeViews = diagram._typeViewsCoreInstance();
RichIterable<? extends AssociationView> associationViews = diagram._associationViews();
RichIterable<? extends PropertyView> propertyViews = diagram._propertyViews();
RichIterable<? extends GeneralizationView> generalizationViews = diagram._generalizationViews();
typeViews.forEachWith(CLEAN_UP_TYPE_VIEW_REFERENCE, processorSupport);
associationViews.forEachWith(CLEAN_UP_ASSOCIATION_VIEW_REFERENCE, processorSupport);
propertyViews.forEachWith(CLEAN_UP_PROPERTY_VIEW_REFERENCE, processorSupport);
associationViews.forEachWith(RESET_PATH_VIEW_SOURCE_TARGET, processorSupport);
propertyViews.forEachWith(RESET_PATH_VIEW_SOURCE_TARGET, processorSupport);
generalizationViews.forEachWith(RESET_PATH_VIEW_SOURCE_TARGET, processorSupport);
}
use of org.finos.legend.pure.m3.coreinstance.meta.pure.diagram.AssociationView in project legend-pure by finos.
the class TestDiagramParsing method testDiagramModelDiagram.
@Test
public void testDiagramModelDiagram() {
final String source = "###Diagram\n" + "Diagram meta::pure::diagram::DiagramDiagram(width=924.0, height=798.0)\n" + "{\n" + " TypeView AbstractPathView(type=meta::pure::diagram::AbstractPathView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(599.0, 278.0),\n" + " width=123.0,\n" + " height=57.1875)\n" + " TypeView AssociationView(type=meta::pure::diagram::AssociationView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(402.0, 476.0),\n" + " width=115.0,\n" + " height=42.09375)\n" + " TypeView Diagram(type=meta::pure::diagram::Diagram,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(37.5, 476.0),\n" + " width=68.0,\n" + " height=42.09375)\n" + " TypeView DiagramNode(type=meta::pure::diagram::DiagramNode,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(310.0, 124.0),\n" + " width=299.0,\n" + " height=57.1875)\n" + " TypeView GeneralizationView(type=meta::pure::diagram::GeneralizationView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(599.0, 476.0),\n" + " width=129.0,\n" + " height=42.09375)\n" + " TypeView PropertyView(type=meta::pure::diagram::PropertyView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(786.0, 476.0),\n" + " width=97.0,\n" + " height=42.09375)\n" + " TypeView TypeView(type=meta::pure::diagram::TypeView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(216.0, 286.0),\n" + " width=75.0,\n" + " height=42.09375)\n" + " PropertyView AbstractPathView_source(property=meta::pure::diagram::AbstractPathView.source,\n" + " stereotypesVisible=true,\n" + " nameVisible=true,\n" + " color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(600.23, 320.0), (290.25, 320.0)],\n" + " label='',\n" + " source=AbstractPathView,\n" + " target=TypeView,\n" + " propertyPosition=(297.5, 320.453125),\n" + " multiplicityPosition=(356.0, 320.453125))\n" + " PropertyView AbstractPathView_target(property=meta::pure::diagram::AbstractPathView.target,\n" + " stereotypesVisible=true,\n" + " nameVisible=true,\n" + " color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(600.23, 292.0), (424.0, 292.0), (290.0, 293.0)],\n" + " label='',\n" + " source=AbstractPathView,\n" + " target=TypeView,\n" + " propertyPosition=(299.13357281145454, 278.2436741823325),\n" + " multiplicityPosition=(358.8651741778389, 278.31183889983697))\n" + " GeneralizationView AbstractPathView_DiagramNode(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(459.5, 152.59375), (459.5, 229.59375), (660.5, 229.59375), (660.5, 306.59375)],\n" + " label='',\n" + " source=AbstractPathView,\n" + " target=DiagramNode)\n" + " GeneralizationView AssociationView_AbstractPathView(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(660.5, 306.59375), (660.5, 405.59375), (459.5, 405.59375), (459.5, 497.046875)],\n" + " label='',\n" + " source=AssociationView,\n" + " target=AbstractPathView)\n" + " GeneralizationView GeneralizationView_AbstractPathView(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(660.5, 306.59375), (660.5, 405.59375), (663.5, 405.59375), (663.5, 497.046875)],\n" + " label='',\n" + " source=GeneralizationView,\n" + " target=AbstractPathView)\n" + " GeneralizationView PropertyView_AbstractPathView(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(660.5, 306.59375), (660.5, 405.59375), (834.5, 405.59375), (834.5, 497.046875)],\n" + " label='',\n" + " source=PropertyView,\n" + " target=AbstractPathView)\n" + " GeneralizationView TypeView_DiagramNode(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(459.5, 152.59375), (459.5, 229.59375), (253.5, 229.59375), (253.5, 307.046875)],\n" + " label='',\n" + " source=TypeView,\n" + " target=DiagramNode)\n" + "}\n" + "Diagram meta::pure::diagram::DiagramDiagram1(width=924.0, height=798.0)\n" + "{\n" + " TypeView AbstractPathView(type=meta::pure::diagram::AbstractPathView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(599.0, 278.0),\n" + " width=123.0,\n" + " height=57.1875)\n" + " TypeView AssociationView(type=meta::pure::diagram::AssociationView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(402.0, 476.0),\n" + " width=115.0,\n" + " height=42.09375)\n" + " TypeView Diagram(type=meta::pure::diagram::Diagram,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(37.5, 476.0),\n" + " width=68.0,\n" + " height=42.09375)\n" + " TypeView DiagramNode(type=meta::pure::diagram::DiagramNode,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(310.0, 124.0),\n" + " width=299.0,\n" + " height=57.1875)\n" + " TypeView GeneralizationView(type=meta::pure::diagram::GeneralizationView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(599.0, 476.0),\n" + " width=129.0,\n" + " height=42.09375)\n" + " TypeView PropertyView(type=meta::pure::diagram::PropertyView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(786.0, 476.0),\n" + " width=97.0,\n" + " height=42.09375)\n" + " TypeView TypeView(type=meta::pure::diagram::TypeView,\n" + " stereotypesVisible=true,\n" + " attributesVisible=true,\n" + " attributeStereotypesVisible=true,\n" + " attributeTypesVisible=true,\n" + " color=#FFFFCC,\n" + " lineWidth=1.0,\n" + " position=(216.0, 286.0),\n" + " width=75.0,\n" + " height=42.09375)\n" + " PropertyView AbstractPathView_source(property=meta::pure::diagram::AbstractPathView.source,\n" + " stereotypesVisible=true,\n" + " nameVisible=true,\n" + " color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(600.23, 320.0), (290.25, 320.0)],\n" + " label='',\n" + " source=AbstractPathView,\n" + " target=TypeView,\n" + " propertyPosition=(297.5, 320.453125),\n" + " multiplicityPosition=(356.0, 320.453125))\n" + " PropertyView AbstractPathView_target(property=meta::pure::diagram::AbstractPathView.target,\n" + " stereotypesVisible=true,\n" + " nameVisible=true,\n" + " color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(600.23, 292.0), (424.0, 292.0), (290.0, 293.0)],\n" + " label='',\n" + " source=AbstractPathView,\n" + " target=TypeView,\n" + " propertyPosition=(299.13357281145454, 278.2436741823325),\n" + " multiplicityPosition=(358.8651741778389, 278.31183889983697))\n" + " GeneralizationView AbstractPathView_DiagramNode(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(459.5, 152.59375), (459.5, 229.59375), (660.5, 229.59375), (660.5, 306.59375)],\n" + " label='',\n" + " source=AbstractPathView,\n" + " target=DiagramNode)\n" + " GeneralizationView AssociationView_AbstractPathView(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(660.5, 306.59375), (660.5, 405.59375), (459.5, 405.59375), (459.5, 497.046875)],\n" + " label='',\n" + " source=AssociationView,\n" + " target=AbstractPathView)\n" + " GeneralizationView GeneralizationView_AbstractPathView(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(660.5, 306.59375), (660.5, 405.59375), (663.5, 405.59375), (663.5, 497.046875)],\n" + " label='',\n" + " source=GeneralizationView,\n" + " target=AbstractPathView)\n" + " GeneralizationView PropertyView_AbstractPathView(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(660.5, 306.59375), (660.5, 405.59375), (834.5, 405.59375), (834.5, 497.046875)],\n" + " label='',\n" + " source=PropertyView,\n" + " target=AbstractPathView)\n" + " GeneralizationView TypeView_DiagramNode(color=#000000,\n" + " lineWidth=-1.0,\n" + " lineStyle=SIMPLE,\n" + " points=[(459.5, 152.59375), (459.5, 229.59375), (253.5, 229.59375), (253.5, 307.046875)],\n" + " label='',\n" + " source=TypeView,\n" + " target=DiagramNode)\n" + "}";
compileTestSource("testDiagram.pure", source);
Class typeViewClass = (Class) this.runtime.getCoreInstance("meta::pure::diagram::TypeView");
RichIterable<? extends ReferenceUsage> typeViewReferenceUsages = typeViewClass._referenceUsages().select(new Predicate<ReferenceUsage>() {
@Override
public boolean accept(ReferenceUsage usage) {
return usage._owner() instanceof TypeView;
}
});
String[] lines = source.split("\n");
for (ReferenceUsage referenceUsage : typeViewReferenceUsages) {
SourceInformation sourceInformation = referenceUsage.getSourceInformation();
Assert.assertEquals("TypeView", lines[sourceInformation.getLine() - 1].substring(sourceInformation.getColumn() - 1, sourceInformation.getColumn() + "TypeView".length() - 1));
}
}
Aggregations