Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2011-02-28 10:03:10 +0000
committerCaspar De Groot2011-02-28 10:03:10 +0000
commit94b6f046e0d550d56d0dc94261cc97028bc4c641 (patch)
tree91656d066e7bad603d6a3cceb0159bf543df8b25 /plugins/org.eclipse.emf.cdo.tests.db
parent689c04c6a5770de5c2df3bcfaec2743016fc00e1 (diff)
downloadcdo-94b6f046e0d550d56d0dc94261cc97028bc4c641.tar.gz
cdo-94b6f046e0d550d56d0dc94261cc97028bc4c641.tar.xz
cdo-94b6f046e0d550d56d0dc94261cc97028bc4c641.zip
[Bug 335653] Optimize unit tests w.r.t. store setup/teardown
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335653
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.db')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Derby).launch2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 branching).launch2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Mysql).launch2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBHsqldb.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreRepositoryConfig.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DISABLE_XATransactionTest.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/SQLQueryTest.java2
10 files changed, 50 insertions, 21 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Derby).launch b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Derby).launch
index 51197391ad..2d77c0f926 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Derby).launch
+++ b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Derby).launch
@@ -12,5 +12,5 @@
<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.db.AllTestsDBDerby"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx512m"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m&#13;&#10;-Xmx1024m"/>
</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 branching).launch b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 branching).launch
index a4a6a1f689..6809e15f53 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 branching).launch
+++ b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 branching).launch
@@ -12,5 +12,5 @@
<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.db.AllTestsDBH2Branching"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx1024m&#13;&#10;-Dorg.eclipse.net4j.util.om.trace.disable=true"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m&#13;&#10;-Xmx1536m"/>
</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Mysql).launch b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Mysql).launch
index 0ead333209..23aa7d1ffa 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Mysql).launch
+++ b/plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (Mysql).launch
@@ -12,5 +12,5 @@
<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.db.AllTestsDBMysql"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests.db"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx512m"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m&#13;&#10;-Xmx1024m"/>
</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java
index ed841631b1..bde8a0f19e 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBDerby.java
@@ -120,14 +120,14 @@ public class AllTestsDBDerby extends DBConfigs
}
@Override
- public void tearDown() throws Exception
+ protected void deactivateRepositories()
{
for (File folder : getDbFolders())
{
tearDownClean(folder);
}
- super.tearDown();
+ super.deactivateRepositories();
}
protected void tearDownClean(File dbFolder)
@@ -161,21 +161,25 @@ public class AllTestsDBDerby extends DBConfigs
@Override
protected DataSource createDataSource(String repoName)
{
- EmbeddedDataSource dataSource = new EmbeddedDataSource();
File reusableFolder = dbFolders.get(repoName);
- if (reusableFolder == null)
+ boolean needsNewFolder = reusableFolder == null;
+ if (needsNewFolder)
{
reusableFolder = createDBFolder(repoName);
IOUtil.delete(reusableFolder);
dbFolders.put(repoName, reusableFolder);
}
+ EmbeddedDataSource dataSource = new EmbeddedDataSource();
dataSource.setDatabaseName(reusableFolder.getAbsolutePath());
dataSource.setCreateDatabase("create");
dataSources.put(reusableFolder, dataSource);
- tearDownClean(reusableFolder);
+ if (!needsNewFolder)
+ {
+ tearDownClean(reusableFolder);
+ }
return dataSource;
}
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 f5c170c41a..a9b4a29075 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
@@ -24,6 +24,8 @@ 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;
@@ -85,7 +87,7 @@ public class AllTestsDBHsqldb extends DBConfigs
public static boolean USE_VERIFIER = false;
- private transient ArrayList<HSQLDBDataSource> dataSources = new ArrayList<HSQLDBDataSource>();
+ private transient ArrayList<HSQLDBDataSource> dataSources;
public Hsqldb(String name)
{
@@ -120,6 +122,10 @@ public class AllTestsDBHsqldb extends DBConfigs
OM.LOG.warn(ex.getMessage());
}
+ if (dataSources == null)
+ {
+ dataSources = new ArrayList<HSQLDBDataSource>();
+ }
dataSources.add(dataSource);
return dataSource;
}
@@ -140,14 +146,24 @@ public class AllTestsDBHsqldb extends DBConfigs
}
finally
{
- try
- {
- super.tearDown();
- }
- finally
- {
- shutDownHsqldb();
- }
+ super.tearDown();
+ }
+ }
+
+ @Override
+ protected void deactivateRepositories()
+ {
+ try
+ {
+ shutDownHsqldb();
+ }
+ catch (SQLException e)
+ {
+ throw new WrappedException(e);
+ }
+ finally
+ {
+ super.deactivateRepositories();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java
index 6818e56e8b..bef117fc35 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBMysql.java
@@ -125,9 +125,9 @@ public class AllTestsDBMysql extends DBConfigs
}
@Override
- public void tearDown() throws Exception
+ protected void deactivateRepositories()
{
- super.tearDown();
+ super.deactivateRepositories();
for (String dbName : databases)
{
dropDatabase(dbName);
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java
index c7bc50aacd..7664db294b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBPsql.java
@@ -126,9 +126,9 @@ public class AllTestsDBPsql extends DBConfigs
}
@Override
- public void tearDown() throws Exception
+ protected void deactivateRepositories()
{
- super.tearDown();
+ super.deactivateRepositories();
dataSource = null;
setupDataSource = null;
dropDatabase();
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreRepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreRepositoryConfig.java
index e54429a3db..b229875ec0 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreRepositoryConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreRepositoryConfig.java
@@ -47,6 +47,12 @@ public abstract class DBStoreRepositoryConfig extends RepositoryConfig
}
@Override
+ protected boolean isOptimizing()
+ {
+ return true;
+ }
+
+ @Override
public IStore createStore(String repoName)
{
IMappingStrategy mappingStrategy = createMappingStrategy();
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DISABLE_XATransactionTest.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DISABLE_XATransactionTest.java
index b0031009d1..fe297f244a 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DISABLE_XATransactionTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DISABLE_XATransactionTest.java
@@ -31,6 +31,7 @@ public class DISABLE_XATransactionTest extends XATransactionTest
super.testCommitFromTransactionDisabled();
}
+ @NeedsCleanRepo
@Override
public void test_ExceptionInReadingStream() throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/SQLQueryTest.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/SQLQueryTest.java
index 47b76c6d05..1c7402a730 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/SQLQueryTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/SQLQueryTest.java
@@ -96,6 +96,7 @@ public class SQLQueryTest extends AbstractCDOTest
enableConsole();
}
+ @NeedsCleanRepo
public void testFunctions() throws Exception
{
msg("Opening session");
@@ -135,6 +136,7 @@ public class SQLQueryTest extends AbstractCDOTest
enableConsole();
}
+ @NeedsCleanRepo
public void testComplexQuerySalesOrderJoinCustomerProduct() throws Exception
{
msg("Opening session");

Back to the top