use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class HTMLReportExporterTests method testCreateReport.
@Test
public void testCreateReport() throws Exception {
// Create test model
ArchimateTestModel tm = new ArchimateTestModel(TestData.TEST_MODEL_FILE_ARCHISURANCE);
IArchimateModel model = tm.loadModel();
// Create Exporter and output folder
HTMLReportExporter exporter = new HTMLReportExporter(model);
File targetFolder = TestUtils.createTempFolder("archi-html-report");
File outputFile = exporter.createReport(targetFolder, "index.html");
// Check main file and folders exist
assertTrue(outputFile.exists());
File modelFolder = new File(targetFolder, model.getId());
assertTrue(modelFolder.exists());
File elementsFolder = new File(modelFolder, "elements");
assertTrue(elementsFolder.exists());
File imagesFolder = new File(modelFolder, "images");
assertTrue(imagesFolder.exists());
File viewsFolder = new File(modelFolder, "views");
assertTrue(viewsFolder.exists());
assertTrue(new File(targetFolder, "css").exists());
assertTrue(new File(targetFolder, "elements").exists());
assertTrue(new File(targetFolder, "hints").exists());
assertTrue(new File(targetFolder, "js").exists());
assertTrue(new File(targetFolder, "lib").exists());
// Check element and view files created
assertTrue(new File(elementsFolder, "model.html").exists());
for (Iterator<EObject> iter = model.eAllContents(); iter.hasNext(); ) {
EObject eObject = iter.next();
// Concepts
if (eObject instanceof IArchimateConcept) {
assertTrue(new File(elementsFolder, ((IArchimateConcept) eObject).getId() + ".html").exists());
}
// Views & Images
if (eObject instanceof IArchimateDiagramModel) {
assertTrue(new File(imagesFolder, ((IArchimateDiagramModel) eObject).getId() + ".png").exists());
assertTrue(new File(viewsFolder, ((IArchimateDiagramModel) eObject).getId() + ".html").exists());
}
}
// Clean up
FileUtils.deleteFolder(TestUtils.TMP_FOLDER);
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class CreateMapViewCheatSheetActionTests method testNewMapViewCommand.
@Test
public void testNewMapViewCommand() throws IOException {
// Load ArchiMate model
ArchimateTestModel tm = new ArchimateTestModel(TestData.TEST_MODEL_FILE_ARCHISURANCE);
IArchimateModel model = tm.loadModel();
// Has 17 diagrams
assertEquals(17, model.getDiagramModels().size());
NewMapViewCommand cmd = new NewMapViewCommand(model);
cmd.execute();
assertNotNull(cmd.diagramModel);
assertNotNull(cmd.diagramModel.eContainer());
// Model now has 18 diagrams
assertEquals(18, model.getDiagramModels().size());
// New diagram has 17 children...
assertEquals(17, cmd.diagramModel.getChildren().size());
// ...all of which are IDiagramModelReference types with IDs
for (IDiagramModelObject dmo : cmd.diagramModel.getChildren()) {
assertTrue(dmo instanceof IDiagramModelReference);
assertNotNull(dmo.getId());
}
// Undo
cmd.undo();
assertEquals(17, model.getDiagramModels().size());
assertNull(cmd.diagramModel.eContainer());
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class FieldDataFactoryTests method testGetFieldValue_Purpose.
@Test
public void testGetFieldValue_Purpose() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setPurpose("Purpose");
Object o = FieldDataFactory.getFieldValue(model, "purpose");
assertEquals("Purpose", o);
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class FieldDataFactoryTests method testGetFieldValue_Name.
@Test
public void testGetFieldValue_Name() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setName("Pogo");
Object o = FieldDataFactory.getFieldValue(model, "name");
assertEquals("Pogo", o);
}
use of com.archimatetool.model.IArchimateModel in project archi by archimatetool.
the class DiagramModelConnectionTests method testGetID.
@Test
public void testGetID() {
assertNull(component.getId());
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.getDefaultFolderForObject(dm).getElements().add(dm);
IDiagramModelGroup dmo = IArchimateFactory.eINSTANCE.createDiagramModelGroup();
dm.getChildren().add(dmo);
connection.connect(dmo, dmo);
assertNotNull(connection.getId());
}
Aggregations