Search in sources :

Example 66 with IArchimateModel

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);
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel) ArchimateTestModel(com.archimatetool.testingtools.ArchimateTestModel) Test(org.junit.Test)

Example 67 with IArchimateModel

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();
}
Also used : IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ArchimateTestEditor(com.archimatetool.testingtools.ArchimateTestEditor) IArchimateModel(com.archimatetool.model.IArchimateModel) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) ArchimateTestModel(com.archimatetool.testingtools.ArchimateTestModel) IArchimateDiagramModel(com.archimatetool.model.IArchimateDiagramModel) Test(org.junit.Test)

Example 68 with IArchimateModel

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());
}
Also used : IAssignmentRelationship(com.archimatetool.model.IAssignmentRelationship) IDiagramModelArchimateConnection(com.archimatetool.model.IDiagramModelArchimateConnection) IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IDiagramModelArchimateObject(com.archimatetool.model.IDiagramModelArchimateObject) IArchimateModel(com.archimatetool.model.IArchimateModel) ArchimateTestModel(com.archimatetool.testingtools.ArchimateTestModel) Test(org.junit.Test)

Example 69 with IArchimateModel

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;
}
Also used : IArchiveManager(com.archimatetool.editor.model.IArchiveManager) File(java.io.File) IArchimateModel(com.archimatetool.model.IArchimateModel)

Example 70 with IArchimateModel

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);
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel) Before(org.junit.Before)

Aggregations

IArchimateModel (com.archimatetool.model.IArchimateModel)124 Test (org.junit.Test)51 File (java.io.File)35 IOException (java.io.IOException)22 IArchimateElement (com.archimatetool.model.IArchimateElement)14 EObject (org.eclipse.emf.ecore.EObject)14 IArchiveManager (com.archimatetool.editor.model.IArchiveManager)13 ArchimateTestModel (com.archimatetool.testingtools.ArchimateTestModel)13 IDiagramModel (com.archimatetool.model.IDiagramModel)12 CommandStack (org.eclipse.gef.commands.CommandStack)11 IFolder (com.archimatetool.model.IFolder)10 ArrayList (java.util.ArrayList)10 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)9 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)9 IArchimateModelObject (com.archimatetool.model.IArchimateModelObject)7 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)6 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)6 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)5 IIdentifier (com.archimatetool.model.IIdentifier)5 GraficoModelLoader (org.archicontribs.modelrepository.grafico.GraficoModelLoader)5