Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-07-27 02:58:22 -0400
committerEike Stepper2011-07-27 02:58:22 -0400
commitefe6fc873366ba5a9560c7247c75e813cdbfb8fe (patch)
treec68950ec6124d5dbbdb0ff19f11b4d7e7b275150
parent00290eb0a8dc80527fdf6aa93e6e670124a1e346 (diff)
downloadcdo-efe6fc873366ba5a9560c7247c75e813cdbfb8fe.tar.gz
cdo-efe6fc873366ba5a9560c7247c75e813cdbfb8fe.tar.xz
cdo-efe6fc873366ba5a9560c7247c75e813cdbfb8fe.zip
[352696] [Tests] Cleanup RepositoryConfigs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352696
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2OfflineConfig.java61
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java8
5 files changed, 64 insertions, 18 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
index 262f92e030..80d8ba1087 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.tests.db;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.config.IScenario;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.tests.offline.Bugzilla_319552_Test;
@@ -40,7 +41,8 @@ public class AllTestsDBH2Offline extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, COMBINED, new H2OfflineConfig(), JVM, NATIVE);
+ addScenario(parent, COMBINED, new H2OfflineConfig(false, false, IDGenerationLocation.STORE), JVM, NATIVE);
+ addScenario(parent, COMBINED, new H2OfflineConfig(false, false, IDGenerationLocation.CLIENT), JVM, NATIVE);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
index 5a8cfc148d..907ea8bf89 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfig.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.util.container.IPluginContainer;
import javax.sql.DataSource;
@@ -74,9 +75,13 @@ public abstract class DBConfig extends RepositoryConfig
{
IMappingStrategy mappingStrategy = createMappingStrategy();
mappingStrategy.setProperties(createMappingStrategyProperties());
+
IDBAdapter dbAdapter = createDBAdapter();
+
DataSource dataSource = createDataSource(repoName);
- return CDODBUtil.createStore(mappingStrategy, dbAdapter, DBUtil.createConnectionProvider(dataSource));
+ IDBConnectionProvider connectionProvider = DBUtil.createConnectionProvider(dataSource);
+
+ return CDODBUtil.createStore(mappingStrategy, dbAdapter, connectionProvider);
}
protected Map<String, String> createMappingStrategyProperties()
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2OfflineConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2OfflineConfig.java
index 4a3a8743af..9f851003f5 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2OfflineConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/H2OfflineConfig.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.tests.db;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
@@ -17,6 +18,7 @@ import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig.OfflineConfig;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.h2.H2Adapter;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.container.IPluginContainer;
@@ -30,6 +32,8 @@ import javax.sql.DataSource;
import java.io.File;
import java.sql.Connection;
import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author Eike Stepper
@@ -42,22 +46,64 @@ public class H2OfflineConfig extends OfflineConfig
private static JdbcDataSource defaultDataSource;
- public H2OfflineConfig()
+ private boolean withRanges;
+
+ private boolean copyOnBranch;
+
+ public H2OfflineConfig(boolean withRanges, boolean copyOnBranch, IDGenerationLocation idGenerationLocation)
+ {
+ super("H2Offline", idGenerationLocation);
+ this.withRanges = withRanges;
+ this.copyOnBranch = copyOnBranch;
+ }
+
+ public boolean isWithRanges()
+ {
+ return withRanges;
+ }
+
+ public boolean isCopyOnBranch()
{
- super("H2Offline");
+ return copyOnBranch;
}
public IStore createStore(String repoName)
{
IMappingStrategy mappingStrategy = createMappingStrategy();
+ mappingStrategy.setProperties(createMappingStrategyProperties());
+
IDBAdapter dbAdapter = createDBAdapter();
+
DataSource dataSource = createDataSource(repoName);
- return CDODBUtil.createStore(mappingStrategy, dbAdapter, DBUtil.createConnectionProvider(dataSource));
+ IDBConnectionProvider connectionProvider = DBUtil.createConnectionProvider(dataSource);
+
+ return CDODBUtil.createStore(mappingStrategy, dbAdapter, connectionProvider);
+ }
+
+ @Override
+ public void setUp() throws Exception
+ {
+ CDODBUtil.prepareContainer(IPluginContainer.INSTANCE);
+ super.setUp();
+ }
+
+ protected Map<String, String> createMappingStrategyProperties()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(IMappingStrategy.PROP_QUALIFIED_NAMES, "true");
+ props.put(CDODBUtil.PROP_COPY_ON_BRANCH, Boolean.toString(copyOnBranch));
+ return props;
}
protected IMappingStrategy createMappingStrategy()
{
- return CDODBUtil.createHorizontalMappingStrategy();
+ return CDODBUtil.createHorizontalMappingStrategy(isSupportingAudits(), isSupportingBranches(), withRanges);
+ }
+
+ @Override
+ protected String getMappingStrategySpecialization()
+ {
+ return (withRanges ? "-ranges" : "") + (copyOnBranch ? "-copy" : "");
}
protected IDBAdapter createDBAdapter()
@@ -104,13 +150,6 @@ public class H2OfflineConfig extends OfflineConfig
return dataSource;
}
- @Override
- public void setUp() throws Exception
- {
- CDODBUtil.prepareContainer(IPluginContainer.INSTANCE);
- super.setUp();
- }
-
protected File createDBFolder()
{
return TMPUtil.createTempFolder("h2_", "_test");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java
index e2cd2c416e..1576b402f4 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java
@@ -34,7 +34,7 @@ public interface IConstants
public static final RepositoryConfig MEM_BRANCHES = new MEMConfig(true, true, IDGenerationLocation.STORE);
- public static final RepositoryConfig MEM_OFFLINE = new MEMOfflineConfig();
+ public static final RepositoryConfig MEM_OFFLINE = new MEMOfflineConfig(IDGenerationLocation.CLIENT);
public static final SessionConfig EMBEDDED = SessionConfig.Embedded.INSTANCE;
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
index 3cb0d43a52..4805f310ad 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
@@ -579,9 +579,9 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
private transient IAcceptor masterAcceptor;
- public OfflineConfig(String name)
+ public OfflineConfig(String name, IDGenerationLocation idGenerationLocation)
{
- super(name, true, true, IDGenerationLocation.CLIENT);
+ super(name, true, true, idGenerationLocation);
}
@Override
@@ -808,9 +808,9 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
{
private static final long serialVersionUID = 1L;
- public MEMOfflineConfig()
+ public MEMOfflineConfig(IDGenerationLocation idGenerationLocation)
{
- super("MEMOffline");
+ super("MEMOffline", idGenerationLocation);
}
public IStore createStore(String repoName)

Back to the top