Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-07-21 05:36:09 +0000
committerEike Stepper2011-07-21 05:36:09 +0000
commit64cfda3a65168e961b20afaafc7b629261bce605 (patch)
tree46713cd6f781ad76638da81e5422b4da565c0f4c /plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java
parentaf719ba16912427971a462cf41f6245cde962ab6 (diff)
downloadcdo-64cfda3a65168e961b20afaafc7b629261bce605.tar.gz
cdo-64cfda3a65168e961b20afaafc7b629261bce605.tar.xz
cdo-64cfda3a65168e961b20afaafc7b629261bce605.zip
[352696] [Tests] Cleanup RepositoryConfigs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352696
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java168
1 files changed, 5 insertions, 163 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java
index a9b4a29075..70a02ef481 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java
@@ -10,31 +10,12 @@
*/
package org.eclipse.emf.cdo.tests.db;
-import org.eclipse.emf.cdo.server.IRepository;
-import org.eclipse.emf.cdo.server.IRepository.Props;
-import org.eclipse.emf.cdo.server.db.CDODBUtil;
-import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_266982_Test;
+import org.eclipse.emf.cdo.tests.config.IScenario;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
-import org.eclipse.emf.cdo.tests.db.bundle.OM;
-import org.eclipse.emf.cdo.tests.db.verifier.DBStoreVerifier;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.hsqldb.HSQLDBAdapter;
-import org.eclipse.net4j.db.hsqldb.HSQLDBDataSource;
-
-import org.eclipse.emf.common.util.WrappedException;
-
-import javax.sql.DataSource;
-
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -52,154 +33,15 @@ public class AllTestsDBHsqldb extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, COMBINED, AllTestsDBHsqldb.Hsqldb.INSTANCE, JVM, NATIVE);
- }
-
- @Override
- protected boolean hasAuditSupport()
- {
- return true;
+ addScenario(parent, COMBINED, new HsqldbConfig(true, false, IDGenerationLocation.STORE), JVM, NATIVE);
}
@Override
- protected boolean hasBranchingSupport()
+ protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
{
- return false;
- }
-
- @Override
- protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses)
- {
- super.initTestClasses(testClasses);
+ super.initTestClasses(testClasses, scenario);
// this takes ages ...
testClasses.remove(Bugzilla_266982_Test.class);
}
-
- /**
- * @author Eike Stepper
- */
- public static class Hsqldb extends DBStoreRepositoryConfig
- {
- private static final long serialVersionUID = 1L;
-
- public static final AllTestsDBHsqldb.Hsqldb INSTANCE = new Hsqldb("HSQLDB");
-
- public static boolean USE_VERIFIER = false;
-
- private transient ArrayList<HSQLDBDataSource> dataSources;
-
- public Hsqldb(String name)
- {
- super(name);
- }
-
- @Override
- protected IMappingStrategy createMappingStrategy()
- {
- return CDODBUtil.createHorizontalMappingStrategy(true);
- }
-
- @Override
- protected IDBAdapter createDBAdapter()
- {
- return new HSQLDBAdapter();
- }
-
- @Override
- protected DataSource createDataSource(String repoName)
- {
- HSQLDBDataSource dataSource = new HSQLDBDataSource();
- dataSource.setDatabase("jdbc:hsqldb:mem:" + repoName);
- dataSource.setUser("sa");
-
- try
- {
- dataSource.setLogWriter(new PrintWriter(System.err));
- }
- catch (SQLException ex)
- {
- OM.LOG.warn(ex.getMessage());
- }
-
- if (dataSources == null)
- {
- dataSources = new ArrayList<HSQLDBDataSource>();
- }
- dataSources.add(dataSource);
- return dataSource;
- }
-
- @Override
- public void tearDown() throws Exception
- {
- try
- {
- if (USE_VERIFIER)
- {
- IRepository testRepository = getRepository(REPOSITORY_NAME);
- if (testRepository != null)
- {
- getVerifier(testRepository).verify();
- }
- }
- }
- finally
- {
- super.tearDown();
- }
- }
-
- @Override
- protected void deactivateRepositories()
- {
- try
- {
- shutDownHsqldb();
- }
- catch (SQLException e)
- {
- throw new WrappedException(e);
- }
- finally
- {
- super.deactivateRepositories();
- }
- }
-
- protected DBStoreVerifier getVerifier(IRepository repository)
- {
- return new DBStoreVerifier.Audit(repository);
- }
-
- private void shutDownHsqldb() throws SQLException
- {
- for (HSQLDBDataSource ds : dataSources)
- {
- Connection connection = null;
- Statement statement = null;
-
- try
- {
- connection = ds.getConnection();
- statement = connection.createStatement();
- statement.execute("SHUTDOWN");
- }
- finally
- {
- DBUtil.close(statement);
- DBUtil.close(connection);
- }
- }
-
- dataSources.clear();
- }
-
- @Override
- protected void initRepositoryProperties(Map<String, String> props)
- {
- super.initRepositoryProperties(props);
- props.put(Props.SUPPORTING_AUDITS, "true");
- }
- }
}

Back to the top