use of com.archimatetool.model.IDiagramModelArchimateConnection in project archi by archimatetool.
the class PropertiesLabelProviderTests method testGetImageRelation.
@Test
public void testGetImageRelation() {
IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
// Image for relation
Image image1 = provider.getImage(new StructuredSelection(relation));
assertNotNull(image1);
// Image for DiagramModelArchimateConnection
IDiagramModelArchimateConnection connection = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
connection.setArchimateRelationship(relation);
Image image2 = provider.getImage(new StructuredSelection(connection));
assertSame(image1, image2);
// Image for EditPart
EditPart editPart = new ArchimateRelationshipEditPart(AssignmentConnectionFigure.class);
editPart.setModel(connection);
Image image3 = provider.getImage(new StructuredSelection(editPart));
assertSame(image1, image3);
}
use of com.archimatetool.model.IDiagramModelArchimateConnection in project archi by archimatetool.
the class TextRendererTests method createDiagramModelConnection.
static IDiagramModelArchimateConnection createDiagramModelConnection() {
// Model
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setName("Model Name");
model.setPurpose("Model Purpose");
model.setDefaults();
// Profiles
IProfile profile1 = IArchimateFactory.eINSTANCE.createProfile();
profile1.setName("Profile 3");
profile1.setConceptType(IArchimatePackage.eINSTANCE.getBusinessActor().getName());
model.getProfiles().add(profile1);
IProfile profile2 = IArchimateFactory.eINSTANCE.createProfile();
profile2.setName("Profile 4");
profile2.setConceptType(IArchimatePackage.eINSTANCE.getBusinessRole().getName());
model.getProfiles().add(profile2);
// Diagram Model
IDiagramModel dm = IArchimateFactory.eINSTANCE.createArchimateDiagramModel();
dm.setName("View Name");
dm.setDocumentation("View Documentation");
model.getDefaultFolderForObject(dm).getElements().add(dm);
IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
relation.setName("Relation Name");
relation.setDocumentation("Relation Documentation");
model.getDefaultFolderForObject(relation).getElements().add(relation);
IArchimateConcept sourceConcept = IArchimateFactory.eINSTANCE.createBusinessActor();
sourceConcept.setName("Source Concept");
sourceConcept.setDocumentation("Source Documentation");
sourceConcept.getProfiles().add(profile1);
addProperty(sourceConcept, "k1", "sconcept_v1");
addProperty(sourceConcept, "k2", "sconcept_v2");
addProperty(sourceConcept, "k3", "sconcept_v3");
// Dupe
addProperty(sourceConcept, "k3", "sconcept_v4");
model.getDefaultFolderForObject(sourceConcept).getElements().add(sourceConcept);
IArchimateConcept targetConcept = IArchimateFactory.eINSTANCE.createBusinessRole();
targetConcept.setName("Target Concept");
targetConcept.setDocumentation("Target Documentation");
targetConcept.getProfiles().add(profile2);
addProperty(targetConcept, "k1", "tconcept_v1");
addProperty(targetConcept, "k2", "tconcept_v2");
addProperty(targetConcept, "k3", "tconcept_v3");
// Dupe
addProperty(targetConcept, "k3", "tconcept_v4");
model.getDefaultFolderForObject(targetConcept).getElements().add(targetConcept);
relation.connect(sourceConcept, targetConcept);
IDiagramModelArchimateObject dmo1 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
dmo1.setArchimateConcept(sourceConcept);
dm.getChildren().add(dmo1);
IDiagramModelArchimateObject dmo2 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
dmo2.setArchimateConcept(targetConcept);
dm.getChildren().add(dmo2);
IDiagramModelArchimateConnection dmc = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
dmc.setArchimateConcept(relation);
dmc.connect(dmo1, dmo2);
return dmc;
}
use of com.archimatetool.model.IDiagramModelArchimateConnection in project archi by archimatetool.
the class PropertiesRendererTests method render_PropertyKey_Target.
@Test
public void render_PropertyKey_Target() {
IDiagramModelArchimateConnection dmc = TextRendererTests.createDiagramModelConnection();
assertEquals("tconcept_v1", renderer.render(dmc, "$target{property:k1}"));
assertEquals("tconcept_v2", renderer.render(dmc, "$target{property:k2}"));
assertEquals("tconcept_v3", renderer.render(dmc, "$target{property:k3}"));
assertEquals("tconcept_v1 tconcept_v2", renderer.render(dmc, "$target{property:k1} $target{property:k2}"));
assertEquals("tconcept_v1\ntconcept_v2", renderer.render(dmc, "$target{property:k1}\n$target{property:k2}"));
}
use of com.archimatetool.model.IDiagramModelArchimateConnection in project archi by archimatetool.
the class PropertiesRendererTests method render_PropertyKey_ConnectedTarget.
@Test
public void render_PropertyKey_ConnectedTarget() {
IDiagramModelArchimateConnection dmc = TextRendererTests.createDiagramModelConnection();
assertEquals("tconcept_v1", renderer.render(dmc.getSource(), "$assignment:target{property:k1}"));
assertEquals("tconcept_v2", renderer.render(dmc.getSource(), "$assignment:target{property:k2}"));
assertEquals("tconcept_v3", renderer.render(dmc.getSource(), "$assignment:target{property:k3}"));
assertEquals("tconcept_v1 tconcept_v2", renderer.render(dmc.getSource(), "$assignment:target{property:k1} $assignment:target{property:k2}"));
assertEquals("tconcept_v1\ntconcept_v2", renderer.render(dmc.getSource(), "$assignment:target{property:k1}\n$assignment:target{property:k2}"));
}
use of com.archimatetool.model.IDiagramModelArchimateConnection in project archi by archimatetool.
the class RelationshipRendererTests method render_Strength.
@Test
public void render_Strength() {
IInfluenceRelationship relation = IArchimateFactory.eINSTANCE.createInfluenceRelationship();
relation.setStrength("+++");
IDiagramModelArchimateConnection dmc = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
dmc.setArchimateConcept(relation);
String result = renderer.render(dmc, "${strength}");
assertEquals("+++", result);
}
Aggregations