Search in sources :

Example 16 with ArchimateTestModel

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

Example 17 with ArchimateTestModel

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();
}
Also used : File(java.io.File) ArchimateTestModel(com.archimatetool.testingtools.ArchimateTestModel)

Example 18 with ArchimateTestModel

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();
}
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 19 with ArchimateTestModel

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

Example 20 with ArchimateTestModel

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());
}
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)

Aggregations

ArchimateTestModel (com.archimatetool.testingtools.ArchimateTestModel)33 Test (org.junit.Test)14 IArchimateModel (com.archimatetool.model.IArchimateModel)13 BeforeClass (org.junit.BeforeClass)11 IArchimateElement (com.archimatetool.model.IArchimateElement)8 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)6 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)6 Before (org.junit.Before)6 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)5 File (java.io.File)4 IDiagramModel (com.archimatetool.model.IDiagramModel)3 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)3 ArchimateTestEditor (com.archimatetool.testingtools.ArchimateTestEditor)3 ArrayList (java.util.ArrayList)3 IIssue (com.archimatetool.hammer.validation.issues.IIssue)2 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)2 IAssignmentRelationship (com.archimatetool.model.IAssignmentRelationship)2 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)2 DuplicateCommandHandler (com.archimatetool.editor.views.tree.commands.DuplicateCommandHandler)1 NewMapViewCommand (com.archimatetool.help.cheatsheets.CreateMapViewCheatSheetAction.NewMapViewCommand)1