use of com.archimatetool.testingtools.ArchimateTestModel 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.testingtools.ArchimateTestModel 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.testingtools.ArchimateTestModel in project archi by archimatetool.
the class JasperReportsExporterTests method runOnceBeforeAllTests.
@BeforeClass
public static void runOnceBeforeAllTests() throws JRException, IOException {
// Load ArchiMate model
ArchimateTestModel tm = new ArchimateTestModel(TestData.TEST_MODEL_FILE_ARCHISURANCE);
model = tm.loadModel();
// Setup some folders
exportFolder = TestUtils.createTempFolder("export");
tmpFolder = new File(exportFolder, "tmp");
tmpFolder.mkdirs();
// Create exporter
exporter = new JasperReportsExporter(model, exportFolder, exportFileName, mainTemplateFile, reportTitle, null, 0);
// Set up diagrams and Jasper Print once (expensive operation)
exporter.writeDiagrams(tmpFolder);
jasperPrint = exporter.createJasperPrint(null, tmpFolder);
}
use of com.archimatetool.testingtools.ArchimateTestModel in project archi by archimatetool.
the class ElementsDataSourceTests method runOnceBeforeAllTests.
@BeforeClass
public static void runOnceBeforeAllTests() throws IOException {
// Load ArchiMate model
ArchimateTestModel tm = new ArchimateTestModel(TestData.TEST_MODEL_FILE_ARCHISURANCE);
model = tm.loadModel();
}
use of com.archimatetool.testingtools.ArchimateTestModel in project archi by archimatetool.
the class ValidatorTests method runOnceBeforeAllTests.
@BeforeClass
public static void runOnceBeforeAllTests() throws IOException {
// Need to do this if running only these tests
TestUtils.ensureDefaultDisplay();
ArchimateTestModel tm = new ArchimateTestModel(TestData.TEST_MODEL_FILE_ARCHISURANCE);
model = tm.loadModel();
validator = new Validator(model);
}
Aggregations