Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-09-03 06:29:06 +0000
committerEike Stepper2013-09-03 06:29:06 +0000
commit2a1ed30cf78e6e419b28d754f5d3f210b2cd4d64 (patch)
tree14ca17252ade013909e162043e575abb19c27e5d
parent9bdc4361abbf3b73dd9bb713629b6fb57d06dc34 (diff)
downloadcdo-2a1ed30cf78e6e419b28d754f5d3f210b2cd4d64.tar.gz
cdo-2a1ed30cf78e6e419b28d754f5d3f210b2cd4d64.tar.xz
cdo-2a1ed30cf78e6e419b28d754f5d3f210b2cd4d64.zip
[416392] [Releng] Each ConfigScenario in a MainSuite should start with
clean repositories https://bugs.eclipse.org/bugs/show_bug.cgi?id=416392
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java43
1 files changed, 42 insertions, 1 deletions
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 b9ea2c0655..e33643bbc6 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
@@ -52,6 +52,7 @@ import org.eclipse.emf.cdo.spi.server.InternalSessionManager;
import org.eclipse.emf.cdo.spi.server.InternalStore;
import org.eclipse.emf.cdo.spi.server.InternalSynchronizableRepository;
import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
+import org.eclipse.emf.cdo.tests.config.IScenario;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesAfter;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
import org.eclipse.emf.cdo.tests.util.TestRevisionManager;
@@ -82,8 +83,12 @@ import java.io.FileOutputStream;
import java.io.PrintStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -118,6 +123,8 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
private static String lastRepoProps;
+ private static IScenario lastScenario;
+
private boolean supportingAudits;
private boolean supportingBranches;
@@ -232,6 +239,30 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
return repositoryProperties;
}
+ public String getRepositoryPropertiesDigest()
+ {
+ Map<String, String> repositoryProperties = getRepositoryProperties();
+ List<Map.Entry<String, String>> list = new ArrayList<Map.Entry<String, String>>(repositoryProperties.entrySet());
+ Collections.sort(list, new Comparator<Map.Entry<String, String>>()
+ {
+ public int compare(Entry<String, String> o1, Entry<String, String> o2)
+ {
+ return o1.getKey().compareTo(o2.getKey());
+ }
+ });
+
+ StringBuilder builder = new StringBuilder();
+ for (Map.Entry<String, String> entry : list)
+ {
+ builder.append(entry.getKey());
+ builder.append("=");
+ builder.append(entry.getValue());
+ builder.append("\n");
+ }
+
+ return builder.toString();
+ }
+
public synchronized InternalRepository[] getRepositories()
{
if (repositories == null)
@@ -596,7 +627,17 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
protected boolean needsCleanRepos()
{
- String repoProps = getRepositoryProperties().toString();
+ IScenario scenario = getCurrentTest().getScenario();
+ boolean sameScenario = scenario == lastScenario;
+ lastScenario = scenario;
+ if (!sameScenario)
+ {
+ // New scenario is an indication for a new TestSuite with a similar set of test cases.
+ // Same test cases would probably use duplicate resource paths, so start with fresh repos.
+ return true;
+ }
+
+ String repoProps = getRepositoryPropertiesDigest();
boolean sameProps = repoProps.equals(lastRepoProps);
lastRepoProps = repoProps;
if (!sameProps)

Back to the top