use of com.archimatetool.model.IArchimateModel 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.model.IArchimateModel 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.model.IArchimateModel 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());
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class SaveArchimateModelAsTemplateWizard method saveModelToTempFile.
private File saveModelToTempFile() throws IOException {
// $NON-NLS-1$
File tmpFile = File.createTempFile("architemplate", null);
tmpFile.deleteOnExit();
// Copy the model
IArchimateModel tempModel = EcoreUtil.copy(fModel);
tempModel.eAdapters().clear();
tempModel.setFile(tmpFile);
// Create a temp Archive Manager to save the temp model
IArchiveManager archiveManager = IArchiveManager.FACTORY.createArchiveManager(tempModel);
archiveManager.saveModel();
archiveManager.dispose();
return tmpFile;
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class CSVExporterTests method runOnceBeforeEachTest.
@Before
public void runOnceBeforeEachTest() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setId("0a9d34ab");
model.setName("The Main Model");
model.setPurpose("This is the Documentation");
exporter = new CSVExporter(model);
}
Aggregations