Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-02-16 03:07:32 -0500
committerEike Stepper2010-02-16 03:07:32 -0500
commit6783a53f997e97d9d6f1055918c1f8f83b97ba97 (patch)
tree5bbf1c085a8daaa3f27dbeabdf81f61946c50f35
parent28c1f8ef0437785a471570673ae4dcff529eb9f9 (diff)
downloadcdo-committers/estepper/commit-notification.tar.gz
cdo-committers/estepper/commit-notification.tar.xz
cdo-committers/estepper/commit-notification.zip
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256936
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java66
4 files changed, 82 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
index 1c80d315b4..2bd41536ce 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
@@ -186,19 +186,14 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader
public synchronized InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
{
- if (getRepository().isSupportingAudits())
+ Object listKey = getListKey(id, branchVersion.getBranch());
+ List<InternalCDORevision> list = revisions.get(listKey);
+ if (list == null)
{
- Object listKey = getListKey(id, branchVersion.getBranch());
- List<InternalCDORevision> list = revisions.get(listKey);
- if (list != null)
- {
- return getRevisionByVersion(list, branchVersion.getVersion());
- }
-
return null;
}
- throw new UnsupportedOperationException();
+ return getRevisionByVersion(list, branchVersion.getVersion());
}
/**
@@ -210,12 +205,12 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader
if (branchPoint.getTimeStamp() == CDORevision.UNSPECIFIED_DATE)
{
List<InternalCDORevision> list = revisions.get(listKey);
- if (list != null)
+ if (list == null)
{
- return list.get(list.size() - 1);
+ return null;
}
- return null;
+ return list.get(list.size() - 1);
}
if (!getRepository().isSupportingAudits())
@@ -224,12 +219,12 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader
}
List<InternalCDORevision> list = revisions.get(listKey);
- if (list != null)
+ if (list == null)
{
- return getRevision(list, branchPoint);
+ return null;
}
- return null;
+ return getRevision(list, branchPoint);
}
public synchronized void addRevision(InternalCDORevision revision)
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
index d637b6bb87..d3251d2438 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
@@ -27,5 +27,7 @@ public class AllTests extends AllTestsAllConfigs
protected void initConfigSuites(TestSuite parent)
{
addScenario(parent, COMBINED, MEM, JVM, NATIVE);
+ addScenario(parent, COMBINED, MEM_AUDITS, JVM, NATIVE);
+ addScenario(parent, COMBINED, MEM_BRANCHES, JVM, NATIVE);
}
}
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 52ca735dca..5e7a37d206 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
@@ -26,6 +26,10 @@ public interface IConstants
public static final RepositoryConfig.MEM MEM = RepositoryConfig.MEM.INSTANCE;
+ public static final RepositoryConfig.MEMAudits MEM_AUDITS = RepositoryConfig.MEMAudits.INSTANCE;
+
+ public static final RepositoryConfig.MEMBranches MEM_BRANCHES = RepositoryConfig.MEMBranches.INSTANCE;
+
public static final RepositoryConfig.MEMOffline MEM_OFFLINE = RepositoryConfig.MEMOffline.INSTANCE;
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 f99001b25a..9899eb8d82 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
@@ -215,6 +215,72 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
{
return MEMStoreUtil.createMEMStore();
}
+
+ @Override
+ protected void initRepositoryProperties(Map<String, String> props)
+ {
+ super.initRepositoryProperties(props);
+ props.put(Props.SUPPORTING_AUDITS, "false");
+ props.put(Props.SUPPORTING_BRANCHES, "false");
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class MEMAudits extends RepositoryConfig
+ {
+ public static final MEMAudits INSTANCE = new MEMAudits();
+
+ private static final long serialVersionUID = 1L;
+
+ public MEMAudits()
+ {
+ super("MEMAudits");
+ }
+
+ @Override
+ protected IStore createStore(String repoName)
+ {
+ return MEMStoreUtil.createMEMStore();
+ }
+
+ @Override
+ protected void initRepositoryProperties(Map<String, String> props)
+ {
+ super.initRepositoryProperties(props);
+ props.put(Props.SUPPORTING_AUDITS, "true");
+ props.put(Props.SUPPORTING_BRANCHES, "false");
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class MEMBranches extends RepositoryConfig
+ {
+ public static final MEMBranches INSTANCE = new MEMBranches();
+
+ private static final long serialVersionUID = 1L;
+
+ public MEMBranches()
+ {
+ super("MEMBranches");
+ }
+
+ @Override
+ protected IStore createStore(String repoName)
+ {
+ return MEMStoreUtil.createMEMStore();
+ }
+
+ @Override
+ protected void initRepositoryProperties(Map<String, String> props)
+ {
+ super.initRepositoryProperties(props);
+ props.put(Props.SUPPORTING_AUDITS, "true");
+ props.put(Props.SUPPORTING_BRANCHES, "true");
+ }
}
/**

Back to the top