Require-Bundle: org.simantics.db.layer0;bundle-version="1.1.0",
org.simantics.graph.db;bundle-version="1.1.5";visibility:=reexport,
org.simantics.project;bundle-version="1.0.1";visibility:=reexport,
- org.apache.log4j;bundle-version="1.2.15",
org.simantics.db.procore;bundle-version="1.1.1",
org.simantics.db.services;bundle-version="1.1.0",
org.eclipse.core.runtime;bundle-version="3.6.0",
org.simantics.workbench;bundle-version="1.1.0",
org.simantics.db.management;bundle-version="1.1.0",
+ org.simantics.db.indexing;bundle-version="1.1.0",
org.simantics;bundle-version="1.0.0";visibility:=reexport,
org.simantics.scl.osgi;bundle-version="1.0.4",
org.junit;bundle-version="4.12.0",
org.simantics.db.server,
- org.apache.commons.math3
+ org.apache.commons.math3,
+ org.slf4j.api;bundle-version="1.7.25"
Export-Package: org.simantics.db.testing.annotation,
org.simantics.db.testing.base,
org.simantics.db.testing.cases,
@Before
public void setUp() throws Exception {
-
TestBase.printStart(this);
TestSettings testSettings = TestSettings.getInstanceUnsafe();
configure(testSettings);
-// state = AcornTests.newSimanticsWorkspace(testSettings, null);
state = Tests.newSimanticsWorkspace(testSettings, null);
-
super.setUp();
-
}
@After
package org.simantics.db.testing.common;
import java.io.File;
+import java.io.IOException;
import java.util.Properties;
import org.eclipse.core.runtime.Platform;
import org.simantics.db.ServerI;
import org.simantics.db.Session;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.indexing.DatabaseIndexing;
/**
* ProCore specific test handler.
void initNew() throws DatabaseException {
Management m = getManagement();
- if (m.exist())
+ if (m.exist()) {
m.delete();
+ }
+ deleteIndexes();
m.create();
}
void initIfNeccessary() throws DatabaseException {
Management m = getManagement();
- if (!m.exist())
+ if (!m.exist()) {
m.create();
+ deleteIndexes();
+ }
+ }
+
+ private void deleteIndexes() throws DatabaseException {
+ try {
+ DatabaseIndexing.deleteAllIndexes();
+ } catch (IOException e) {
+ throw new DatabaseException("Failed to delete all existing indexes", e);
+ }
}
public Session getSession() throws DatabaseException {
import org.simantics.db.WriteGraph;
import org.simantics.db.WriteOnlyGraph;
import org.simantics.db.common.request.WriteOnlyRequest;
-import org.simantics.db.common.utils.Logger;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.exception.ServiceNotFoundException;
import org.simantics.db.management.SessionContext;
import org.simantics.db.testing.impl.Configuration;
import org.simantics.layer0.Layer0;
import org.simantics.utils.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
- * Base class for Simantics Test Cases. Assumes that ProCore is already running.
+ * Base class for Simantics Test Cases.
+ * Assumes that the Simantics database is already running.
*
* @author Marko Luukkainen <marko.luukkainen@vtt.fi>
- *
*/
-abstract public class TestBase /*extends TestCase*/ {
+public abstract class TestBase /*extends TestCase*/ {
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestBase.class);
public static final boolean DEBUG = Configuration.get().debug;
public static final String ROOT_LIBRARY_URI = "http:/";
private NoExitSecurityManager noExitSecurityManager;
static boolean printStart = true;
public static final ArrayList<String> initialWorkspaceFiles = FileUtils.createFileFilter(Platform.getLocation().toFile(), null);
public static void printStart(Object t) {
- if(printStart) System.out.println("Test is " + t.getClass().getName() /*+ "." + t.getName()*/);
+ if(printStart) LOGGER.info("Test is {}", t.getClass().getName());
}
protected static void setPrintStart(boolean value) {
printStart = value;
try {
session.getService(LifecycleSupport.class).close(0, true);
} catch (ServiceNotFoundException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("Failed to find LifecycleSupport service", e);
} catch (DatabaseException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("Failed to close database", e);
}
}
// if (!Thread.currentThread().equals(thread)) {