use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class EditorModelManagerTests method loadModel_File_Null.
@Test
public void loadModel_File_Null() {
IArchimateModel model = editorModelManager.loadModel(null);
assertNull(model);
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class EditorModelManagerTests method createNewArchiveManager_Created.
@Test
public void createNewArchiveManager_Created() throws Exception {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
IArchiveManager archiveManager = (IArchiveManager) TestUtils.invokePrivateMethod(editorModelManager, "createNewArchiveManager", new Class[] { IArchimateModel.class }, new Object[] { model });
assertNotNull(archiveManager);
assertTrue(model.getAdapter(IArchiveManager.class) instanceof IArchiveManager);
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class EditorModelManagerTests method saveModel.
@Test
public void saveModel() throws Exception {
File file = TestData.TEST_MODEL_FILE_ARCHISURANCE;
IArchimateModel model = editorModelManager.loadModel(file);
assertNotNull(model);
File tmpFile = TestUtils.createTempFile(".archimate");
model.setFile(tmpFile);
Preferences.STORE.setValue(IPreferenceConstants.BACKUP_ON_SAVE, false);
boolean result = editorModelManager.saveModel(model);
assertTrue(result);
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class UnusedElementsCheckerTests method testGetIssues.
@Test
public void testGetIssues() {
ArchimateTestModel tm = new ArchimateTestModel();
IArchimateModel model = tm.createNewModel();
List<IArchimateElement> elements = new ArrayList<IArchimateElement>();
IArchimateElement element = (IArchimateElement) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getBusinessActor());
elements.add(element);
UnusedElementsChecker checker = new UnusedElementsChecker(elements);
// Should not be OK
List<IIssue> issues = checker.getIssues();
assertEquals(1, issues.size());
assertSame(element, issues.get(0).getObject());
// Add it to a diagram
IDiagramModelArchimateObject dmo = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
dmo.setArchimateElement(element);
model.getDefaultDiagramModel().getChildren().add(dmo);
// Should be OK
issues = checker.getIssues();
assertEquals(0, issues.size());
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class UnusedRelationsCheckerTests method testGetIssues.
@Test
public void testGetIssues() {
ArchimateTestModel tm = new ArchimateTestModel();
IArchimateModel model = tm.createNewModel();
List<IArchimateRelationship> relations = new ArrayList<IArchimateRelationship>();
IArchimateRelationship relation = (IArchimateRelationship) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getAssociationRelationship());
relations.add(relation);
IArchimateElement e1 = (IArchimateElement) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getBusinessActor());
IArchimateElement e2 = (IArchimateElement) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getBusinessActor());
relation.connect(e1, e2);
UnusedRelationsChecker checker = new UnusedRelationsChecker(relations);
// Should not be OK
List<IIssue> issues = checker.getIssues();
assertEquals(1, issues.size());
assertSame(relation, issues.get(0).getObject());
// Add it to a diagram
IDiagramModelArchimateObject dmo1 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
dmo1.setArchimateElement(e1);
model.getDefaultDiagramModel().getChildren().add(dmo1);
IDiagramModelArchimateObject dmo2 = IArchimateFactory.eINSTANCE.createDiagramModelArchimateObject();
dmo2.setArchimateElement(e2);
model.getDefaultDiagramModel().getChildren().add(dmo2);
IDiagramModelArchimateConnection conn = IArchimateFactory.eINSTANCE.createDiagramModelArchimateConnection();
conn.setArchimateRelationship(relation);
conn.connect(dmo1, dmo2);
// Should be OK
issues = checker.getIssues();
assertEquals(0, issues.size());
}
Aggregations