Changed scldoc output directory to target/scldoc
[simantics/platform.git] / tests / org.simantics.scl.osgi.tests / src / org / simantics / scl / osgi / tests / TestSCLOsgi.java
1 package org.simantics.scl.osgi.tests;
2
3 import java.io.IOException;
4 import java.nio.file.Files;
5 import java.nio.file.Path;
6 import java.nio.file.Paths;
7
8 import org.eclipse.core.runtime.IProgressMonitor;
9 import org.eclipse.core.runtime.NullProgressMonitor;
10 import org.junit.AfterClass;
11 import org.junit.Assert;
12 import org.junit.BeforeClass;
13 import org.junit.Test;
14 import org.simantics.PlatformException;
15 import org.simantics.Simantics;
16 import org.simantics.application.arguments.Arguments;
17 import org.simantics.application.arguments.IArgumentFactory;
18 import org.simantics.application.arguments.IArguments;
19 import org.simantics.application.arguments.SimanticsArguments;
20 import org.simantics.scl.compiler.markdown.html.GenerateAllHtmlDocumentation;
21 import org.simantics.scl.osgi.SCLOsgi;
22
23 public class TestSCLOsgi {
24     private static IProgressMonitor progress = new NullProgressMonitor();
25     
26     @BeforeClass
27     public static void setupDatabase() throws PlatformException {
28         String[] args = new String[0];
29         IArgumentFactory<?>[] accepted = {
30                 SimanticsArguments.RECOVERY_POLICY_FIX_ERRORS,
31                 SimanticsArguments.ONTOLOGY_RECOVERY_POLICY_REINSTALL,
32                 SimanticsArguments.SERVER,
33                 SimanticsArguments.LOCAL_SERVER_PORT,
34         };
35         IArguments arguments = Arguments.parse(args, accepted);
36         Simantics.setDefaultDatabaseDriver("acorn");
37         Simantics.startUpHeadless(arguments, progress);
38     }
39     
40     @AfterClass
41     public static void teardownDatabase() throws PlatformException {
42         Simantics.shutdown(progress);
43     }
44     
45     @Test
46     public void testDataJsonExists() {
47         String possibleError = SCLOsgi.compileAllModules();
48         if(possibleError != null) {
49             Assert.fail(possibleError);
50         }
51     }
52     
53     @Test
54     public void exportAllSCLDocumentation() throws IOException {
55         // "./scldoc" evaluates to "tests/org.simantics.scl.osgi.tests/scldoc" when these tests are ran with Tycho/Maven
56         Path dir = Paths.get("./target/scldoc");
57         Files.createDirectories(dir);
58         GenerateAllHtmlDocumentation.generate(SCLOsgi.MODULE_REPOSITORY, dir);
59     }
60 }