From e0723ff4f1103a4eafd74805be1d22b46f6a3494 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Fri, 23 Sep 2016 15:48:32 +0300 Subject: [PATCH] Changed database driver of TestSCLOsgi to acorn Change-Id: Ie8d92025bb3976a210a8f4d36a0e2d74eea5eb09 --- .../simantics/scl/osgi/tests/TestSCLOsgi.java | 151 +++++++++--------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/tests/org.simantics.scl.osgi.tests/src/org/simantics/scl/osgi/tests/TestSCLOsgi.java b/tests/org.simantics.scl.osgi.tests/src/org/simantics/scl/osgi/tests/TestSCLOsgi.java index 35a74c4f6..455429427 100644 --- a/tests/org.simantics.scl.osgi.tests/src/org/simantics/scl/osgi/tests/TestSCLOsgi.java +++ b/tests/org.simantics.scl.osgi.tests/src/org/simantics/scl/osgi/tests/TestSCLOsgi.java @@ -1,75 +1,76 @@ -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.startUpHeadless(arguments, progress); - } - - @AfterClass - public static void teardownDatabase() throws PlatformException { - Simantics.shutdown(progress); - } - - @Test - public void testDataJsonExists() { - ArrayList modulesWithErrors = new ArrayList(); - SCLOsgi.SOURCE_REPOSITORY.forAllModules(new TObjectProcedure() { - @Override - public boolean execute(String moduleName) { - System.out.print(moduleName); - System.out.print(" - "); - Failable 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()); - } - } -} +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 modulesWithErrors = new ArrayList(); + SCLOsgi.SOURCE_REPOSITORY.forAllModules(new TObjectProcedure() { + @Override + public boolean execute(String moduleName) { + System.out.print(moduleName); + System.out.print(" - "); + Failable 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()); + } + } +} -- 2.47.1