summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2010-02-02 08:54:30 (EST)
committerStefan Winkler2010-02-02 08:54:30 (EST)
commit3173f0ae9720c66ad89149ded4452ad4ce654a20 (patch)
tree85c927bdcf7e3e36d9f4f7a53ce1435e18e8a344
parentdc758eb87d5c2f0e802e49de4ca6173d3d94a2c8 (diff)
downloadcdo-3173f0ae9720c66ad89149ded4452ad4ce654a20.zip
cdo-3173f0ae9720c66ad89149ded4452ad4ce654a20.tar.gz
cdo-3173f0ae9720c66ad89149ded4452ad4ce654a20.tar.bz2
[270716] Provide support for branching
https://bugs.eclipse.org/bugs/show_bug.cgi?id=270716
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 branching).launch (renamed from plugins/org.eclipse.emf.cdo.tests.db/CDO AllTests (H2 - branching).launch)0
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java7
4 files changed, 24 insertions, 14 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java
index 6388fd0..6838285 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalAuditClassMapping.java
@@ -244,10 +244,10 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping
long timeStamp = revision.getTimeStamp();
if (timeStamp != CDOBranchPoint.UNSPECIFIED_DATE)
{
- pstmt = accessor.getStatementCache().getPreparedStatement(sqlSelectAttributesByTime, ReuseProbability.MEDIUM);
- pstmt.setLong(1, CDOIDUtil.getLong(revision.getID()));
- pstmt.setLong(2, timeStamp);
- pstmt.setLong(3, timeStamp);
+ pstmt = accessor.getStatementCache().getPreparedStatement(sqlSelectAttributesByTime, ReuseProbability.MEDIUM);
+ pstmt.setLong(1, CDOIDUtil.getLong(revision.getID()));
+ pstmt.setLong(2, timeStamp);
+ pstmt.setLong(3, timeStamp);
}
else
{
@@ -510,8 +510,6 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping
private int oldVersion;
- private int newVersion;
-
private InternalCDORevision newRevision;
public void process(IDBStoreAccessor accessor, InternalCDORevisionDelta delta, long created)
@@ -523,7 +521,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping
if (TRACER.isEnabled())
{
- TRACER.format("FeatureDeltaWriter: old version: {0}, new version: {1}", oldVersion, newVersion); //$NON-NLS-1$
+ TRACER.format("FeatureDeltaWriter: old version: {0}, new version: {1}", oldVersion, oldVersion + 1); //$NON-NLS-1$
}
InternalCDORevision originalRevision = (InternalCDORevision)accessor.getStore().getRepository()
@@ -531,7 +529,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping
newRevision = (InternalCDORevision)originalRevision.copy();
- newRevision.setVersion(newVersion);
+ newRevision.setVersion(oldVersion + 1);
newRevision.setBranchPoint(CDOBranchUtil.createBranchPoint(delta.getBranch(), created));
// process revision delta tree
@@ -571,7 +569,7 @@ public class HorizontalAuditClassMapping extends AbstractHorizontalClassMapping
public void visit(CDOListFeatureDelta delta)
{
IListMappingDeltaSupport listMapping = (IListMappingDeltaSupport)getListMapping(delta.getFeature());
- listMapping.processDelta(accessor, id, oldVersion, newVersion, created, delta);
+ listMapping.processDelta(accessor, id, oldVersion, oldVersion + 1, created, delta);
}
public void visit(CDOClearFeatureDelta delta)
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 00fbd41..00fbd41 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
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java
index 70fb1b9..efc3aff 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Branching.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.tests.db;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.tests.BranchingTest;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.net4j.db.DBUtil;
@@ -50,27 +51,31 @@ public class AllTestsDBH2Branching extends DBConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, COMBINED, AllTestsDBH2Branching.H2NonAudit.ReusableFolder.INSTANCE, JVM, NATIVE);
+ addScenario(parent, COMBINED, AllTestsDBH2Branching.H2Branching.ReusableFolder.INSTANCE, JVM, NATIVE);
}
@Override
protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses)
{
+ // add branching tests for this testsuite
+ testClasses.add(BranchingTest.class);
+ testClasses.add(BranchingTest.SameSession.class);
+
super.initTestClasses(testClasses);
}
/**
* @author Eike Stepper
*/
- public static class H2NonAudit extends DBStoreRepositoryConfig
+ public static class H2Branching extends DBStoreRepositoryConfig
{
private static final long serialVersionUID = 1L;
- public static final AllTestsDBH2Branching.H2NonAudit INSTANCE = new H2NonAudit("DBStore: H2 (non-audit)");
+ public static final AllTestsDBH2Branching.H2Branching INSTANCE = new H2Branching("DBStore: H2 (branching)");
protected transient File dbFolder;
- public H2NonAudit(String name)
+ public H2Branching(String name)
{
super(name);
}
@@ -122,7 +127,7 @@ public class AllTestsDBH2Branching extends DBConfigs
/**
* @author Eike Stepper
*/
- public static class ReusableFolder extends H2NonAudit
+ public static class ReusableFolder extends H2Branching
{
private static final long serialVersionUID = 1L;
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
index de3b57d..2899730 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBConfigs.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests.db;
import org.eclipse.emf.cdo.tests.AllTestsAllConfigs;
import org.eclipse.emf.cdo.tests.AttributeTest;
+import org.eclipse.emf.cdo.tests.BranchingTest;
import org.eclipse.emf.cdo.tests.ExternalReferenceTest;
import org.eclipse.emf.cdo.tests.FeatureMapTest;
import org.eclipse.emf.cdo.tests.XATransactionTest;
@@ -29,6 +30,12 @@ public abstract class DBConfigs extends AllTestsAllConfigs
protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses)
{
super.initTestClasses(testClasses);
+
+ // remove BranchingTests because most mappings do not support it
+ // Subclasses should add Banching tests if supported
+ testClasses.remove(BranchingTest.class);
+ testClasses.remove(BranchingTest.SameSession.class);
+
testClasses.add(DBStoreTest.class);
testClasses.add(SQLQueryTest.class);
testClasses.add(DBAnnotationsTest.class);