]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Changed database driver of TestSCLOsgi to acorn 89/89/3
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Fri, 23 Sep 2016 12:48:32 +0000 (15:48 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Fri, 23 Sep 2016 13:04:29 +0000 (16:04 +0300)
Change-Id: Ie8d92025bb3976a210a8f4d36a0e2d74eea5eb09

tests/org.simantics.scl.osgi.tests/src/org/simantics/scl/osgi/tests/TestSCLOsgi.java

index 35a74c4f62c9189ed6712606ad7247de16d04f07..4554294272ae1b0b07f356477cb44a5d92e06183 100644 (file)
@@ -1,75 +1,76 @@
-package org.simantics.scl.osgi.tests;\r
-\r
-import java.util.ArrayList;\r
-import java.util.concurrent.atomic.AtomicInteger;\r
-\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.NullProgressMonitor;\r
-import org.junit.AfterClass;\r
-import org.junit.Assert;\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-import org.simantics.PlatformException;\r
-import org.simantics.Simantics;\r
-import org.simantics.application.arguments.Arguments;\r
-import org.simantics.application.arguments.IArgumentFactory;\r
-import org.simantics.application.arguments.IArguments;\r
-import org.simantics.application.arguments.SimanticsArguments;\r
-import org.simantics.scl.compiler.errors.DoesNotExist;\r
-import org.simantics.scl.compiler.errors.Failable;\r
-import org.simantics.scl.compiler.module.Module;\r
-import org.simantics.scl.osgi.SCLOsgi;\r
-\r
-import gnu.trove.procedure.TObjectProcedure;\r
-\r
-\r
-public class TestSCLOsgi {\r
-    private static IProgressMonitor progress = new NullProgressMonitor();\r
-    \r
-    @BeforeClass\r
-    public static void setupDatabase() throws PlatformException {\r
-        String[] args = new String[0];\r
-        IArgumentFactory<?>[] accepted = {\r
-                SimanticsArguments.RECOVERY_POLICY_FIX_ERRORS,\r
-                SimanticsArguments.ONTOLOGY_RECOVERY_POLICY_REINSTALL,\r
-                SimanticsArguments.SERVER,\r
-                SimanticsArguments.LOCAL_SERVER_PORT,\r
-        };\r
-        IArguments arguments = Arguments.parse(args, accepted);\r
-        Simantics.startUpHeadless(arguments, progress);\r
-    }\r
-    \r
-    @AfterClass\r
-    public static void teardownDatabase() throws PlatformException {\r
-        Simantics.shutdown(progress);\r
-    }\r
-    \r
-    @Test\r
-    public void testDataJsonExists() {\r
-        ArrayList<String> modulesWithErrors = new ArrayList<String>(); \r
-        SCLOsgi.SOURCE_REPOSITORY.forAllModules(new TObjectProcedure<String>() {\r
-            @Override\r
-            public boolean execute(String moduleName) {\r
-                System.out.print(moduleName);\r
-                System.out.print(" - ");\r
-                Failable<Module> module = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName);\r
-                if(module.didSucceed())\r
-                    System.out.println("succeeded");\r
-                else if(module == DoesNotExist.INSTANCE)\r
-                    System.out.println("does not exist"); // should not happen\r
-                else {\r
-                    System.out.println("error");\r
-                    modulesWithErrors.add(moduleName);\r
-                }\r
-                return true;\r
-            }\r
-        });\r
-        if(!modulesWithErrors.isEmpty()) {\r
-            StringBuilder b = new StringBuilder();\r
-            b.append("Some SCL modules failed to compile:");\r
-            for(String module : modulesWithErrors)\r
-                b.append(' ').append(module);\r
-            Assert.fail(b.toString());\r
-        }\r
-    }\r
-}\r
+package org.simantics.scl.osgi.tests;
+
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.simantics.PlatformException;
+import org.simantics.Simantics;
+import org.simantics.application.arguments.Arguments;
+import org.simantics.application.arguments.IArgumentFactory;
+import org.simantics.application.arguments.IArguments;
+import org.simantics.application.arguments.SimanticsArguments;
+import org.simantics.scl.compiler.errors.DoesNotExist;
+import org.simantics.scl.compiler.errors.Failable;
+import org.simantics.scl.compiler.module.Module;
+import org.simantics.scl.osgi.SCLOsgi;
+
+import gnu.trove.procedure.TObjectProcedure;
+
+
+public class TestSCLOsgi {
+    private static IProgressMonitor progress = new NullProgressMonitor();
+    
+    @BeforeClass
+    public static void setupDatabase() throws PlatformException {
+        String[] args = new String[0];
+        IArgumentFactory<?>[] accepted = {
+                SimanticsArguments.RECOVERY_POLICY_FIX_ERRORS,
+                SimanticsArguments.ONTOLOGY_RECOVERY_POLICY_REINSTALL,
+                SimanticsArguments.SERVER,
+                SimanticsArguments.LOCAL_SERVER_PORT,
+        };
+        IArguments arguments = Arguments.parse(args, accepted);
+        Simantics.setDefaultDatabaseDriver("acorn");
+        Simantics.startUpHeadless(arguments, progress);
+    }
+    
+    @AfterClass
+    public static void teardownDatabase() throws PlatformException {
+        Simantics.shutdown(progress);
+    }
+    
+    @Test
+    public void testDataJsonExists() {
+        ArrayList<String> modulesWithErrors = new ArrayList<String>(); 
+        SCLOsgi.SOURCE_REPOSITORY.forAllModules(new TObjectProcedure<String>() {
+            @Override
+            public boolean execute(String moduleName) {
+                System.out.print(moduleName);
+                System.out.print(" - ");
+                Failable<Module> module = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName);
+                if(module.didSucceed())
+                    System.out.println("succeeded");
+                else if(module == DoesNotExist.INSTANCE)
+                    System.out.println("does not exist"); // should not happen
+                else {
+                    System.out.println("error");
+                    modulesWithErrors.add(moduleName);
+                }
+                return true;
+            }
+        });
+        if(!modulesWithErrors.isEmpty()) {
+            StringBuilder b = new StringBuilder();
+            b.append("Some SCL modules failed to compile:");
+            for(String module : modulesWithErrors)
+                b.append(' ').append(module);
+            Assert.fail(b.toString());
+        }
+    }
+}