use of com.archimatetool.model.IDiagramModelArchimateObject in project archi by archimatetool.
the class ArchimateDiagramConnectionPolicyTests method testIsValidConnection_DiagramModelConnection.
@Test
public void testIsValidConnection_DiagramModelConnection() {
EClass relationshipType = IArchimatePackage.eINSTANCE.getDiagramModelConnection();
IDiagramModelGroup group = IArchimateFactory.eINSTANCE.createDiagramModelGroup();
IDiagramModelNote note = IArchimateFactory.eINSTANCE.createDiagramModelNote();
IDiagramModelArchimateObject dmao1 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
IDiagramModelArchimateObject dmao2 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
IDiagramModelReference dmRef = IArchimateFactory.eINSTANCE.createDiagramModelReference();
// Source == Target
assertFalse(ArchimateDiagramConnectionPolicy.isValidConnection(group, group, relationshipType));
// Both ArchiMate types
assertFalse(ArchimateDiagramConnectionPolicy.isValidConnection(dmao1, dmao2, relationshipType));
// Target ArchiMate type
assertFalse(ArchimateDiagramConnectionPolicy.isValidConnection(group, dmao2, relationshipType));
// Target ArchiMate type
assertFalse(ArchimateDiagramConnectionPolicy.isValidConnection(dmRef, dmao2, relationshipType));
// Source ArchiMate type to Note
assertTrue(ArchimateDiagramConnectionPolicy.isValidConnection(dmao1, note, relationshipType));
// OK
assertTrue(ArchimateDiagramConnectionPolicy.isValidConnection(note, group, relationshipType));
}
use of com.archimatetool.model.IDiagramModelArchimateObject in project archi by archimatetool.
the class ArchimateDiagramConnectionPolicyTests method testIsValidConnection_ArchimateDiagramModelConnection_To_Another.
@Test
public void testIsValidConnection_ArchimateDiagramModelConnection_To_Another() {
EClass relationshipType = IArchimatePackage.eINSTANCE.getAssociationRelationship();
IDiagramModelArchimateObject dmao1 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
dmao1.setArchimateElement(IArchimateFactory.eINSTANCE.createBusinessActor());
IDiagramModelArchimateConnection conn1 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
conn1.setArchimateRelationship(IArchimateFactory.eINSTANCE.createAssociationRelationship());
IDiagramModelArchimateConnection conn2 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
conn2.setArchimateRelationship(IArchimateFactory.eINSTANCE.createAssociationRelationship());
// OK from object to connection
assertTrue(ArchimateDiagramConnectionPolicy.isValidConnection(dmao1, conn1, relationshipType));
// OK from connection to object
assertTrue(ArchimateDiagramConnectionPolicy.isValidConnection(conn1, dmao1, relationshipType));
// OK if relationshipType is null (magic connector)
assertTrue(ArchimateDiagramConnectionPolicy.isValidConnection(dmao1, conn1, null));
// Not OK from Conn -> Conn
assertFalse(ArchimateDiagramConnectionPolicy.isValidConnection(conn1, conn2, relationshipType));
assertFalse(ArchimateDiagramConnectionPolicy.isValidConnection(conn2, conn1, relationshipType));
}
use of com.archimatetool.model.IDiagramModelArchimateObject in project archi by archimatetool.
the class FormatPainterInfoTests method testIsFat.
@Test
public void testIsFat() {
assertFalse(info.isFat());
IDiagramModelArchimateObject sourceComponent = ArchimateTestModel.createDiagramModelArchimateObject(IArchimateFactory.eINSTANCE.createBusinessActor());
info.updatePaintFormat(sourceComponent);
assertTrue(info.isFat());
}
use of com.archimatetool.model.IDiagramModelArchimateObject in project archi by archimatetool.
the class FormatPainterInfoTests method testReset.
@Test
public void testReset() {
PaintFormat pf = info.getPaintFormat();
assertNull(pf);
IDiagramModelArchimateObject sourceComponent = ArchimateTestModel.createDiagramModelArchimateObject(IArchimateFactory.eINSTANCE.createBusinessActor());
info.updatePaintFormat(sourceComponent);
pf = info.getPaintFormat();
assertNotNull(pf);
info.reset();
pf = info.getPaintFormat();
assertNull(pf);
}
use of com.archimatetool.model.IDiagramModelArchimateObject in project archi by archimatetool.
the class FormatPainterToolTests method isPaintableObject.
@Test
public void isPaintableObject() {
FormatPainterTool tool = new FormatPainterTool();
assertTrue(tool.isPaintableObject(IArchimateFactory.eINSTANCE.createDiagramModelConnection()));
assertTrue(tool.isPaintableObject(IArchimateFactory.eINSTANCE.createDiagramModelNote()));
assertTrue(tool.isPaintableObject(IArchimateFactory.eINSTANCE.createDiagramModelGroup()));
assertFalse(tool.isPaintableObject(IArchimateFactory.eINSTANCE.createDiagramModelImage()));
IDiagramModelArchimateObject dmao = ArchimateTestModel.createDiagramModelArchimateObject(IArchimateFactory.eINSTANCE.createBusinessActor());
assertTrue(tool.isPaintableObject(dmao));
dmao = ArchimateTestModel.createDiagramModelArchimateObject(IArchimateFactory.eINSTANCE.createJunction());
assertFalse(tool.isPaintableObject(dmao));
}
Aggregations