Search in sources :

Example 26 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class ModelCompatibilityTests method testIsLaterModelVersion_IsLater.

@Test
public void testIsLaterModelVersion_IsLater() {
    createResource(file1);
    IArchimateModel model = (IArchimateModel) resource.getContents().get(0);
    assertEquals("10.0.0", model.getVersion());
    assertTrue(mc.isLaterModelVersion("2.6.1"));
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel) Test(org.junit.Test)

Example 27 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class ModelCompatibilityTests method testIsLaterModelVersion_IsNotLater.

@Test
public void testIsLaterModelVersion_IsNotLater() {
    createResource(file1);
    IArchimateModel model = (IArchimateModel) resource.getContents().get(0);
    model.setVersion("3.4.1");
    assertFalse(mc.isLaterModelVersion("10.0.0"));
    model.setVersion("99.9.9");
    assertFalse(mc.isLaterModelVersion("99.9.9"));
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel) Test(org.junit.Test)

Example 28 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class EditorModelManagerTests method createNewModel_IsValid.

@Test
public void createNewModel_IsValid() {
    IArchimateModel model = editorModelManager.createNewModel();
    assertNotNull(model);
    // Has default folders
    assertFalse(model.getFolders().isEmpty());
    // Has One Default View
    // $NON-NLS-1$
    assertTrue(model.getFolder(FolderType.DIAGRAMS).getElements().get(0) instanceof IArchimateDiagramModel);
    // Has a Command Stack
    assertTrue(model.getAdapter(CommandStack.class) instanceof CommandStack);
    // Has an Archive Manager
    assertTrue(model.getAdapter(IArchiveManager.class) instanceof IArchiveManager);
    // Has an ECore Adapter
    assertTrue(hasECoreAdapter(model));
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) IArchiveManager(com.archimatetool.editor.model.IArchiveManager) IArchimateModel(com.archimatetool.model.IArchimateModel) IArchimateDiagramModel(com.archimatetool.model.IArchimateDiagramModel) Test(org.junit.Test)

Example 29 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class EditorModelManagerTests method openModel_File_Null.

@Test
public void openModel_File_Null() {
    IArchimateModel model = editorModelManager.openModel((File) null);
    assertNull(model);
}
Also used : IArchimateModel(com.archimatetool.model.IArchimateModel) Test(org.junit.Test)

Example 30 with IArchimateModel

use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.

the class EditorModelManagerTests method openModel_File.

@Test
public void openModel_File() {
    File file = TestData.TEST_MODEL_FILE_ARCHISURANCE;
    IArchimateModel model = editorModelManager.openModel(file);
    assertNotNull(model);
    // Is registered
    assertEquals(1, editorModelManager.getModels().size());
    assertTrue(editorModelManager.getModels().contains(model));
    // Do it again, should be the same
    IArchimateModel model2 = editorModelManager.openModel(file);
    assertEquals(model2, model);
    // Is not registered twice
    editorModelManager.openModel(model);
    assertEquals(1, editorModelManager.getModels().size());
}
Also used : File(java.io.File) IArchimateModel(com.archimatetool.model.IArchimateModel) Test(org.junit.Test)

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