use of com.archimatetool.editor.diagram.editparts.ArchimateRelationshipEditPart 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.editor.diagram.editparts.ArchimateRelationshipEditPart in project archi by archimatetool.
the class PropertiesLabelProviderTests method testGetTextRelation.
@Test
public void testGetTextRelation() {
// Text for relation
IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
relation.setSource(IArchimateFactory.eINSTANCE.createBusinessActor());
relation.setTarget(IArchimateFactory.eINSTANCE.createBusinessRole());
relation.getSource().setName("BA1");
relation.getTarget().setName("BR1");
String expectedText = "Assignment relation (BA1 - BR1)";
String text = provider.getText(new StructuredSelection(relation));
assertEquals(expectedText, text);
text = provider.getText(new StructuredSelection(relation));
assertEquals(expectedText, text);
// Text for DiagramModelArchimateConnection
IDiagramModelArchimateConnection connection = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
connection.setArchimateRelationship(relation);
text = provider.getText(new StructuredSelection(relation));
assertEquals(expectedText, text);
// Text for EditPart
EditPart editPart = new ArchimateRelationshipEditPart(AssignmentConnectionFigure.class);
editPart.setModel(connection);
text = provider.getText(new StructuredSelection(editPart));
assertEquals(expectedText, text);
}
Aggregations