Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-07-19 08:22:04 +0000
committerEike Stepper2012-07-19 08:22:04 +0000
commit1460904fd3c193ffaf809913b2983a400fce9d94 (patch)
tree72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.eclipse.emf.cdo.tests.db4o
parent5f360965ae87478e0681899bf310a210cafc2c44 (diff)
downloadcdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.db4o')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (DB4O).launch32
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (MEMDB4O).launch32
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/copyright.txt14
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/plugin.properties24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4O.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4OMem.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java264
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/MEMDB4OStore.java134
8 files changed, 339 insertions, 339 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (DB4O).launch b/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (DB4O).launch
index cb9363c0a6..8975fd1ffe 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (DB4O).launch
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (DB4O).launch
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4O.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.db4o.AllTestsDB4O"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db4o"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=128m&#10;-Xmx1024m"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4O.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.db4o.AllTestsDB4O"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db4o"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=128m&#10;-Xmx1024m"/>
+</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (MEMDB4O).launch b/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (MEMDB4O).launch
index 8bcce237fc..f215d2deeb 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (MEMDB4O).launch
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/CDO AllTests (MEMDB4O).launch
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4OMem.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.db4o.AllTestsDB4OMem"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db4o"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=128m&#10;-Xmx1024m"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4OMem.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.db4o.AllTestsDB4OMem"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db4o"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=128m&#10;-Xmx1024m"/>
+</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/copyright.txt b/plugins/org.eclipse.emf.cdo.tests.db4o/copyright.txt
index 3c7ec6bf7c..c8c97bb972 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/copyright.txt
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/copyright.txt
@@ -1,8 +1,8 @@
-Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Eclipse Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/epl-v10.html
-
-Contributors:
+Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
Victor Roldan Betancort - initial API and implementation \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/plugin.properties b/plugins/org.eclipse.emf.cdo.tests.db4o/plugin.properties
index df696f10ad..9a8aee10ae 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/plugin.properties
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/plugin.properties
@@ -1,12 +1,12 @@
-# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Victor Roldan Betancort - initial API and implementation
-# Eike Stepper - maintenance
-
-pluginName = CDO Model Repository Tests DB4O
-providerName = Eclipse Modeling Project
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Victor Roldan Betancort - initial API and implementation
+# Eike Stepper - maintenance
+
+pluginName = CDO Model Repository Tests DB4O
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4O.java b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4O.java
index efbba7326a..331c325b36 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4O.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4O.java
@@ -1,58 +1,58 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Victor Roldan Betancort - initial API and implementation
- */
-package org.eclipse.emf.cdo.tests.db4o;
-
-import org.eclipse.emf.cdo.tests.AllConfigs;
-import org.eclipse.emf.cdo.tests.BranchingSameSessionTest;
-import org.eclipse.emf.cdo.tests.BranchingTest;
-import org.eclipse.emf.cdo.tests.BranchingWithCacheClearTest;
-import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_261218_Test;
-import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_324585_Test;
-import org.eclipse.emf.cdo.tests.config.IScenario;
-import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
-
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class AllTestsDB4O extends AllConfigs
-{
- public static Test suite()
- {
- return new AllTestsDB4O().getTestSuite("CDO Tests (DB4O)");
- }
-
- @Override
- protected void initConfigSuites(TestSuite parent)
- {
- addScenario(parent, COMBINED, new DB4OConfig(false), JVM, NATIVE);
- }
-
- @Override
- protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
- {
- super.initTestClasses(testClasses, scenario);
-
- // Added here testcases to skip
- // takes too much
- testClasses.remove(Bugzilla_261218_Test.class);
- testClasses.remove(Bugzilla_324585_Test.class);
-
- // db4o doesn't support branching
- testClasses.remove(BranchingTest.class);
- testClasses.remove(BranchingSameSessionTest.class);
- testClasses.remove(BranchingWithCacheClearTest.class);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.db4o;
+
+import org.eclipse.emf.cdo.tests.AllConfigs;
+import org.eclipse.emf.cdo.tests.BranchingSameSessionTest;
+import org.eclipse.emf.cdo.tests.BranchingTest;
+import org.eclipse.emf.cdo.tests.BranchingWithCacheClearTest;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_261218_Test;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_324585_Test;
+import org.eclipse.emf.cdo.tests.config.IScenario;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
+
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class AllTestsDB4O extends AllConfigs
+{
+ public static Test suite()
+ {
+ return new AllTestsDB4O().getTestSuite("CDO Tests (DB4O)");
+ }
+
+ @Override
+ protected void initConfigSuites(TestSuite parent)
+ {
+ addScenario(parent, COMBINED, new DB4OConfig(false), JVM, NATIVE);
+ }
+
+ @Override
+ protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
+ {
+ super.initTestClasses(testClasses, scenario);
+
+ // Added here testcases to skip
+ // takes too much
+ testClasses.remove(Bugzilla_261218_Test.class);
+ testClasses.remove(Bugzilla_324585_Test.class);
+
+ // db4o doesn't support branching
+ testClasses.remove(BranchingTest.class);
+ testClasses.remove(BranchingSameSessionTest.class);
+ testClasses.remove(BranchingWithCacheClearTest.class);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4OMem.java b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4OMem.java
index 6eecd1b682..c07b73ee1c 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4OMem.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/AllTestsDB4OMem.java
@@ -1,31 +1,31 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Victor Roldan Betancort - initial API and implementation
- */
-package org.eclipse.emf.cdo.tests.db4o;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class AllTestsDB4OMem extends AllTestsDB4O
-{
- public static Test suite()
- {
- return new AllTestsDB4OMem().getTestSuite("CDO Tests (DB4OMem)");
- }
-
- @Override
- protected void initConfigSuites(TestSuite parent)
- {
- addScenario(parent, COMBINED, new DB4OConfig(true), JVM, NATIVE);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.db4o;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class AllTestsDB4OMem extends AllTestsDB4O
+{
+ public static Test suite()
+ {
+ return new AllTestsDB4OMem().getTestSuite("CDO Tests (DB4OMem)");
+ }
+
+ @Override
+ protected void initConfigSuites(TestSuite parent)
+ {
+ addScenario(parent, COMBINED, new DB4OConfig(true), JVM, NATIVE);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java
index ab5dc898d2..67227fdaea 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/DB4OConfig.java
@@ -1,132 +1,132 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.tests.db4o;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
-import org.eclipse.emf.cdo.server.IStore;
-import org.eclipse.emf.cdo.server.internal.db4o.DB4OStore;
-import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
-
-import org.eclipse.net4j.util.io.TMPUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.Random;
-import java.util.Set;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class DB4OConfig extends RepositoryConfig
-{
- public static final String CAPABILITY_MEM = "DB4O.mem";
-
- public static final String CAPABILITY_NET = "DB4O.net";
-
- private static final Random RANDOM = new Random(System.currentTimeMillis());
-
- private static final long serialVersionUID = 1L;
-
- private boolean mem;
-
- private transient boolean optimizing = true;
-
- public DB4OConfig(boolean mem)
- {
- super("DB4O-" + (mem ? "mem" : "net"), false, false, IDGenerationLocation.STORE);
- this.mem = mem;
- }
-
- @Override
- public void initCapabilities(Set<String> capabilities)
- {
- super.initCapabilities(capabilities);
- if (mem)
- {
- capabilities.add(CAPABILITY_MEM);
- }
- else
- {
- capabilities.add(CAPABILITY_NET);
- }
- }
-
- @Override
- protected String getStoreName()
- {
- return "DB4O";
- }
-
- public boolean isMem()
- {
- return mem;
- }
-
- public IStore createStore(String repoName)
- {
- if (mem)
- {
- if (!isRestarting())
- {
- MEMDB4OStore.clearContainer();
- }
-
- return new MEMDB4OStore();
- }
-
- File tempFolder = TMPUtil.getTempFolder();
- File file = new File(tempFolder, "cdodb_" + repoName + ".db4o");
- if (file.exists() && !isRestarting())
- {
- file.delete();
- }
-
- int port = 0;
- boolean ok = false;
- do
- {
- ServerSocket sock = null;
-
- try
- {
- port = 1024 + RANDOM.nextInt(65536 - 1024);
- sock = new ServerSocket(port);
- ok = true;
- }
- catch (IOException e)
- {
- }
- finally
- {
- try
- {
- if (sock != null)
- {
- sock.close();
- }
- }
- catch (IOException e)
- {
- }
- }
- } while (!ok);
-
- return new DB4OStore(file.getPath(), port);
- }
-
- @Override
- protected boolean isOptimizing()
- {
- // Do NOT replace this with a hardcoded value!
- return optimizing;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.db4o;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
+import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.internal.db4o.DB4OStore;
+import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
+
+import org.eclipse.net4j.util.io.TMPUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.Random;
+import java.util.Set;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class DB4OConfig extends RepositoryConfig
+{
+ public static final String CAPABILITY_MEM = "DB4O.mem";
+
+ public static final String CAPABILITY_NET = "DB4O.net";
+
+ private static final Random RANDOM = new Random(System.currentTimeMillis());
+
+ private static final long serialVersionUID = 1L;
+
+ private boolean mem;
+
+ private transient boolean optimizing = true;
+
+ public DB4OConfig(boolean mem)
+ {
+ super("DB4O-" + (mem ? "mem" : "net"), false, false, IDGenerationLocation.STORE);
+ this.mem = mem;
+ }
+
+ @Override
+ public void initCapabilities(Set<String> capabilities)
+ {
+ super.initCapabilities(capabilities);
+ if (mem)
+ {
+ capabilities.add(CAPABILITY_MEM);
+ }
+ else
+ {
+ capabilities.add(CAPABILITY_NET);
+ }
+ }
+
+ @Override
+ protected String getStoreName()
+ {
+ return "DB4O";
+ }
+
+ public boolean isMem()
+ {
+ return mem;
+ }
+
+ public IStore createStore(String repoName)
+ {
+ if (mem)
+ {
+ if (!isRestarting())
+ {
+ MEMDB4OStore.clearContainer();
+ }
+
+ return new MEMDB4OStore();
+ }
+
+ File tempFolder = TMPUtil.getTempFolder();
+ File file = new File(tempFolder, "cdodb_" + repoName + ".db4o");
+ if (file.exists() && !isRestarting())
+ {
+ file.delete();
+ }
+
+ int port = 0;
+ boolean ok = false;
+ do
+ {
+ ServerSocket sock = null;
+
+ try
+ {
+ port = 1024 + RANDOM.nextInt(65536 - 1024);
+ sock = new ServerSocket(port);
+ ok = true;
+ }
+ catch (IOException e)
+ {
+ }
+ finally
+ {
+ try
+ {
+ if (sock != null)
+ {
+ sock.close();
+ }
+ }
+ catch (IOException e)
+ {
+ }
+ }
+ } while (!ok);
+
+ return new DB4OStore(file.getPath(), port);
+ }
+
+ @Override
+ protected boolean isOptimizing()
+ {
+ // Do NOT replace this with a hardcoded value!
+ return optimizing;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/MEMDB4OStore.java b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/MEMDB4OStore.java
index 37bfdca5d1..be7d99e42b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/MEMDB4OStore.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db4o/src/org/eclipse/emf/cdo/tests/db4o/MEMDB4OStore.java
@@ -1,67 +1,67 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Victor Roldan Betancort - initial API and implementation
- */
-
-package org.eclipse.emf.cdo.tests.db4o;
-
-import org.eclipse.emf.cdo.server.internal.db4o.DB4OStore;
-
-import com.db4o.ObjectContainer;
-import com.db4o.ext.ExtDb4o;
-import com.db4o.ext.MemoryFile;
-
-/**
- * In-memory based DB4OStore. Just meant to be used to accelerate DB4OStore test-cases.
- *
- * @author Victor Roldan Betancort
- */
-public final class MEMDB4OStore extends DB4OStore
-{
-
- private static ObjectContainer objectContainer;
-
- public MEMDB4OStore()
- {
- super(null, 0);
- }
-
- @Override
- public ObjectContainer openClient()
- {
- if (objectContainer == null)
- {
- objectContainer = ExtDb4o.openMemoryFile(new MemoryFile());
- }
- return objectContainer;
- }
-
- @Override
- protected void initObjectServer()
- {
- // no server is defined. Objects are mantained in-memory in ObjectContainer instances
- }
-
- @Override
- protected void tearDownObjectServer()
- {
- // no server is defined. Objects are mantained in-memory in ObjectContainer instances
- }
-
- @Override
- protected void closeClient(ObjectContainer container)
- {
- // no server is defined. Objects are mantained in-memory in ObjectContainer instances
- }
-
- public static void clearContainer()
- {
- objectContainer = ExtDb4o.openMemoryFile(new MemoryFile());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+
+package org.eclipse.emf.cdo.tests.db4o;
+
+import org.eclipse.emf.cdo.server.internal.db4o.DB4OStore;
+
+import com.db4o.ObjectContainer;
+import com.db4o.ext.ExtDb4o;
+import com.db4o.ext.MemoryFile;
+
+/**
+ * In-memory based DB4OStore. Just meant to be used to accelerate DB4OStore test-cases.
+ *
+ * @author Victor Roldan Betancort
+ */
+public final class MEMDB4OStore extends DB4OStore
+{
+
+ private static ObjectContainer objectContainer;
+
+ public MEMDB4OStore()
+ {
+ super(null, 0);
+ }
+
+ @Override
+ public ObjectContainer openClient()
+ {
+ if (objectContainer == null)
+ {
+ objectContainer = ExtDb4o.openMemoryFile(new MemoryFile());
+ }
+ return objectContainer;
+ }
+
+ @Override
+ protected void initObjectServer()
+ {
+ // no server is defined. Objects are mantained in-memory in ObjectContainer instances
+ }
+
+ @Override
+ protected void tearDownObjectServer()
+ {
+ // no server is defined. Objects are mantained in-memory in ObjectContainer instances
+ }
+
+ @Override
+ protected void closeClient(ObjectContainer container)
+ {
+ // no server is defined. Objects are mantained in-memory in ObjectContainer instances
+ }
+
+ public static void clearContainer()
+ {
+ objectContainer = ExtDb4o.openMemoryFile(new MemoryFile());
+ }
+}

Back to the top