use of com.archimatetool.testingtools.ArchimateTestModel in project archi by archimatetool.
the class CopySnapshotTests method testCopiedObjectsHaveIdentifiersAndParentsWhenPastedToNewArchimateModel.
@Test
public void testCopiedObjectsHaveIdentifiersAndParentsWhenPastedToNewArchimateModel() throws IOException {
loadTestModel1();
ArchimateTestModel tm = new ArchimateTestModel();
IArchimateModel newModel = tm.createNewModel();
targetDiagramModel = newModel.getDefaultDiagramModel();
testCopiedObjectsHaveIdentifiersAndParents(targetDiagramModel);
}
use of com.archimatetool.testingtools.ArchimateTestModel in project archi by archimatetool.
the class CopySnapshotTests method loadTestModel2.
private void loadTestModel2() throws IOException {
tm = new ArchimateTestModel(new File(TestSupport.getTestDataFolder(), "models/testCopySnapshot.archimate"));
model = tm.loadModelWithCommandStack();
sourceDiagramModel = model.getDiagramModels().get(0);
targetDiagramModel = tm.addNewArchimateDiagramModel();
}
use of com.archimatetool.testingtools.ArchimateTestModel in project archi by archimatetool.
the class SelectAllActionTests method testSelectAll.
@Test
public void testSelectAll() throws Exception {
ArchimateTestEditor editor = new ArchimateTestEditor();
ArchimateTestModel tm = new ArchimateTestModel(TestData.TEST_MODEL_FILE_ARCHISURANCE);
IArchimateModel model = tm.loadModelWithCommandStack();
IArchimateDiagramModel dm = (IArchimateDiagramModel) ArchimateModelUtils.getObjectByID(model, "4165");
editor.setDiagramModel(dm);
SelectAllAction action = new SelectAllAction(mock(IWorkbenchPart.class));
Set<GraphicalEditPart> selected = action.getSelectableEditParts(editor.getGraphicalViewer().getContents());
assertEquals(47, selected.size());
editor.dispose();
}
use of com.archimatetool.testingtools.ArchimateTestModel in project archi by archimatetool.
the class CreateDiagramArchimateConnectionWithDialogCommandTests method testGetExistingRelationshipOfType.
@Test
public void testGetExistingRelationshipOfType() {
ArchimateTestModel tm = new ArchimateTestModel();
tm.createSimpleModel();
IArchimateElement source = (IArchimateElement) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getBusinessActor());
IArchimateElement target = (IArchimateElement) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getBusinessActor());
IArchimateRelationship relation1 = (IArchimateRelationship) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getAssignmentRelationship());
IArchimateRelationship relation2 = (IArchimateRelationship) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getFlowRelationship());
assertNull(cmd.getExistingRelationshipOfType(IArchimatePackage.eINSTANCE.getAssignmentRelationship(), source, target));
relation1.setSource(source);
relation1.setTarget(target);
relation2.setSource(source);
relation2.setTarget(target);
assertEquals(relation1, cmd.getExistingRelationshipOfType(IArchimatePackage.eINSTANCE.getAssignmentRelationship(), source, target));
assertEquals(relation2, cmd.getExistingRelationshipOfType(IArchimatePackage.eINSTANCE.getFlowRelationship(), source, target));
}
use of com.archimatetool.testingtools.ArchimateTestModel in project archi by archimatetool.
the class CreateDiagramArchimateConnectionWithDialogCommandTests method testCreationOfConnectionAndRelationship.
@Test
public void testCreationOfConnectionAndRelationship() {
ArchimateTestModel tm = new ArchimateTestModel();
IArchimateModel model = tm.createNewModel();
IDiagramModelArchimateObject dmo1 = tm.createDiagramModelArchimateObjectAndAddToModel(IArchimateFactory.eINSTANCE.createBusinessActor());
IDiagramModelArchimateObject dmo2 = tm.createDiagramModelArchimateObjectAndAddToModel(IArchimateFactory.eINSTANCE.createBusinessRole());
model.getDefaultDiagramModel().getChildren().add(dmo1);
model.getDefaultDiagramModel().getChildren().add(dmo2);
cmd.setSource(dmo1);
cmd.setTarget(dmo2);
cmd.execute();
IDiagramModelConnection connection = cmd.fConnection;
assertTrue(connection instanceof IDiagramModelArchimateConnection);
assertSame(dmo1, connection.getSource());
assertSame(dmo2, connection.getTarget());
IArchimateRelationship relationship = ((IDiagramModelArchimateConnection) connection).getArchimateRelationship();
assertTrue(relationship instanceof IAssignmentRelationship);
assertNotNull(relationship.eContainer());
cmd.undo();
assertNull(relationship.eContainer());
}
Aggregations