8daf95832ecb354e4c1bb0862fed0cfd31d83982
[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 org.eclipse.core.runtime.IProgressMonitor;
4 import org.eclipse.core.runtime.NullProgressMonitor;
5 import org.junit.AfterClass;
6 import org.junit.Assert;
7 import org.junit.BeforeClass;
8 import org.junit.Test;
9 import org.simantics.PlatformException;
10 import org.simantics.Simantics;
11 import org.simantics.application.arguments.Arguments;
12 import org.simantics.application.arguments.IArgumentFactory;
13 import org.simantics.application.arguments.IArguments;
14 import org.simantics.application.arguments.SimanticsArguments;
15 import org.simantics.scl.osgi.SCLOsgi;
16
17 public class TestSCLOsgi {
18     private static IProgressMonitor progress = new NullProgressMonitor();
19     
20     @BeforeClass
21     public static void setupDatabase() throws PlatformException {
22         String[] args = new String[0];
23         IArgumentFactory<?>[] accepted = {
24                 SimanticsArguments.RECOVERY_POLICY_FIX_ERRORS,
25                 SimanticsArguments.ONTOLOGY_RECOVERY_POLICY_REINSTALL,
26                 SimanticsArguments.SERVER,
27                 SimanticsArguments.LOCAL_SERVER_PORT,
28         };
29         IArguments arguments = Arguments.parse(args, accepted);
30         Simantics.setDefaultDatabaseDriver("acorn");
31         Simantics.startUpHeadless(arguments, progress);
32     }
33     
34     @AfterClass
35     public static void teardownDatabase() throws PlatformException {
36         Simantics.shutdown(progress);
37     }
38     
39     @Test
40     public void testDataJsonExists() {
41         String possibleError = SCLOsgi.compileAllModules();
42         if(possibleError != null) {
43             Assert.fail(possibleError);
44         }
45     }
46 }