Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-04-16 06:29:04 +0000
committerEike Stepper2010-04-16 06:29:04 +0000
commitd997013583581556e4bbe725c4cfed7aa4c16ae5 (patch)
tree068e3ccadd22505d0ae9e1bfd13286f33df1be15
parente6a5d49183f630c497cccd2c6e9cf74c6318fb66 (diff)
downloadcdo-d997013583581556e4bbe725c4cfed7aa4c16ae5.tar.gz
cdo-d997013583581556e4bbe725c4cfed7aa4c16ae5.tar.xz
cdo-d997013583581556e4bbe725c4cfed7aa4c16ae5.zip
[256936] Support for Offline Mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256936
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractSyncingTest.java184
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FailoverTest.java77
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java159
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java37
4 files changed, 299 insertions, 158 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractSyncingTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractSyncingTest.java
new file mode 100644
index 0000000000..5a6e1f5851
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractSyncingTest.java
@@ -0,0 +1,184 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.server.mem.MEMStore;
+import org.eclipse.emf.cdo.server.IMEMStore;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.spi.server.InternalStore;
+import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
+import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig.OfflineConfig;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractSyncingTest extends AbstractCDOTest
+{
+ protected static final long SLEEP_MILLIS = 100;
+
+ public OfflineConfig getOfflineConfig()
+ {
+ return (OfflineConfig)getRepositoryConfig();
+ }
+
+ @Override
+ public boolean isValid()
+ {
+ IRepositoryConfig repositoryConfig = getRepositoryConfig();
+ return repositoryConfig instanceof OfflineConfig;
+ }
+
+ @Override
+ public synchronized Map<String, Object> getTestProperties()
+ {
+ Map<String, Object> testProperties = super.getTestProperties();
+ testProperties.put(OfflineConfig.PROP_TEST_SQUEEZE_COMMIT_INFOS, isSqueezedCommitInfos());
+ testProperties.put(OfflineConfig.PROP_TEST_FAILOVER, isFailover());
+ return testProperties;
+ }
+
+ protected abstract boolean isSqueezedCommitInfos();
+
+ protected abstract boolean isFailover();
+
+ protected static void checkEvent(TestListener listener, int newPackageUnits, int newObjects, int changedObjects,
+ int detachedObjects)
+ {
+ IEvent[] events = listener.getEvents();
+ assertEquals(1, events.length);
+
+ IEvent event = events[0];
+ if (event instanceof CDOSessionInvalidationEvent)
+ {
+ CDOSessionInvalidationEvent e = (CDOSessionInvalidationEvent)event;
+ assertEquals(newPackageUnits, e.getNewPackageUnits().size());
+ assertEquals(newObjects, e.getNewObjects().size());
+ assertEquals(changedObjects, e.getChangedObjects().size());
+ assertEquals(detachedObjects, e.getDetachedObjects().size());
+ }
+ else
+ {
+ fail("Invalid event: " + event);
+ }
+
+ listener.clearEvents();
+ }
+
+ protected static void checkRevision(EObject object, InternalRepository repository, String location)
+ {
+ // Check if revision arrived in cache
+ checkRevision(object, repository.getRevisionManager().getCache().getAllRevisions(), location + " cache");
+
+ // Check if revision arrived in store
+ InternalStore store = repository.getStore();
+ if (store instanceof IMEMStore)
+ {
+ checkRevision(object, ((IMEMStore)store).getAllRevisions(), location + " store");
+ }
+ }
+
+ protected static void checkRevision(EObject object, Map<CDOBranch, List<CDORevision>> allRevisions, String location)
+ {
+ CDORevision revision = CDOUtil.getCDOObject(object).cdoRevision();
+ List<CDORevision> revisions = allRevisions.get(revision.getBranch());
+ for (CDORevision rev : revisions)
+ {
+ if (revision.equals(rev))
+ {
+ return;
+ }
+ }
+
+ fail("Revision missing from " + location + ": " + revision);
+ }
+
+ protected static void checkRevisions(InternalRepository repository, long timeStamp, int expectedRevisions)
+ throws InterruptedException
+ {
+ long lastCommitTimeStamp = repository.getLastCommitTimeStamp();
+ while (lastCommitTimeStamp < timeStamp)
+ {
+ lastCommitTimeStamp = repository.waitForCommit(DEFAULT_TIMEOUT);
+ }
+
+ InternalStore store = repository.getStore();
+ if (store instanceof MEMStore)
+ {
+ Map<CDOBranch, List<CDORevision>> allRevisions = ((MEMStore)store).getAllRevisions();
+ System.out.println("\n\n\n\n\n\n\n\n\n\n" + CDORevisionUtil.dumpAllRevisions(allRevisions));
+
+ List<CDORevision> revisions = allRevisions.get(repository.getBranchManager().getMainBranch());
+ assertEquals(expectedRevisions, revisions.size());
+ }
+ }
+
+ protected static void waitForOnline(CDOCommonRepository repository)
+ {
+ while (repository.getState() != CDOCommonRepository.State.ONLINE)
+ {
+ System.out.println("Waiting for ONLINE...");
+ sleep(SLEEP_MILLIS);
+ }
+ }
+
+ protected static void waitForOffline(CDOCommonRepository repository)
+ {
+ while (repository.getState() == CDOCommonRepository.State.ONLINE)
+ {
+ System.out.println("Waiting for OFFLINE...");
+ sleep(SLEEP_MILLIS);
+ }
+ }
+
+ protected static CDOCommitInfo commitAndWaitForArrival(CDOTransaction transaction, CDOSession receiver)
+ {
+ CDOCommitInfo commitInfo = transaction.commit();
+ long timeStamp = commitInfo.getTimeStamp();
+ while (receiver.getLastUpdateTime() < timeStamp)
+ {
+ System.out.println("Waiting for arrival of commit " + CDOCommonUtil.formatTimeStamp(timeStamp));
+ sleep(SLEEP_MILLIS);
+ }
+
+ return commitInfo;
+ }
+
+ protected static CDOCommitInfo commitAndWaitForArrival(CDOTransaction transaction, IRepository receiver)
+ {
+ CDOCommitInfo commitInfo = transaction.commit();
+ long timeStamp = commitInfo.getTimeStamp();
+ while (receiver.getLastCommitTimeStamp() < timeStamp)
+ {
+ System.out.println("Waiting for arrival of commit " + CDOCommonUtil.formatTimeStamp(timeStamp));
+ sleep(SLEEP_MILLIS);
+ }
+
+ return commitInfo;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FailoverTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FailoverTest.java
new file mode 100644
index 0000000000..617a915613
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FailoverTest.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+/**
+ * @author Eike Stepper
+ */
+public class FailoverTest extends AbstractSyncingTest
+{
+ @Override
+ protected boolean isSqueezedCommitInfos()
+ {
+ return false;
+ }
+
+ @Override
+ protected boolean isFailover()
+ {
+ return true;
+ }
+
+ public void testMasterCommits_ArrivalInClone() throws Exception
+ {
+ CDOSession session = openSession(getRepository().getName() + "_master");
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/my/resource");
+
+ Company company = getModel1Factory().createCompany();
+ company.setName("Test");
+
+ // 2 * Root resource + folder + resource + company
+ int expectedRevisions = 2 + 1 + 1 + 1;
+
+ resource.getContents().add(company);
+ long timeStamp = transaction.commit().getTimeStamp();
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
+
+ for (int i = 0; i < 10; i++)
+ {
+ company.setName("Test" + i);
+ timeStamp = transaction.commit().getTimeStamp();
+ expectedRevisions += 1; // Changed company
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
+ }
+
+ for (int i = 0; i < 10; i++)
+ {
+ company.getCategories().add(getModel1Factory().createCategory());
+ timeStamp = transaction.commit().getTimeStamp();
+ expectedRevisions += 2; // Changed company + new category
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
+ }
+
+ for (int i = 0; i < 10; i++)
+ {
+ company.getCategories().remove(0);
+ timeStamp = transaction.commit().getTimeStamp();
+ expectedRevisions += 2; // Changed company + detached category
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
+ }
+
+ session.close();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java
index 9eef4d0fd9..aa0cd0a6e5 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OfflineTest.java
@@ -11,69 +11,39 @@
package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.server.mem.MEMStore;
import org.eclipse.emf.cdo.internal.server.syncing.OfflineClone;
-import org.eclipse.emf.cdo.server.IMEMStore;
-import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
-import org.eclipse.emf.cdo.spi.server.InternalStore;
-import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
-import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig.OfflineConfig;
import org.eclipse.emf.cdo.tests.model1.Company;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.spi.cdo.DefaultCDOMerger;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
/**
* @author Eike Stepper
*/
-public class OfflineTest extends AbstractCDOTest
+public class OfflineTest extends AbstractSyncingTest
{
- protected static final int SLEEP_MILLIS = 1000;
-
- public OfflineConfig getOfflineConfig()
- {
- return (OfflineConfig)getRepositoryConfig();
- }
-
@Override
- public boolean isValid()
- {
- IRepositoryConfig repositoryConfig = getRepositoryConfig();
- return repositoryConfig instanceof OfflineConfig;
- }
-
protected boolean isSqueezedCommitInfos()
{
return false;
}
@Override
- public synchronized Map<String, Object> getTestProperties()
+ protected boolean isFailover()
{
- Map<String, Object> testProperties = super.getTestProperties();
- testProperties.put(OfflineConfig.PROP_TEST_SQUEEZE_COMMIT_INFOS, isSqueezedCommitInfos());
- return testProperties;
+ return false;
}
public void testMasterCommits_ArrivalInClone() throws Exception
@@ -90,14 +60,14 @@ public class OfflineTest extends AbstractCDOTest
resource.getContents().add(company);
long timeStamp = transaction.commit().getTimeStamp();
- checkClone(timeStamp, expectedRevisions);
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
for (int i = 0; i < 10; i++)
{
company.setName("Test" + i);
timeStamp = transaction.commit().getTimeStamp();
expectedRevisions += 1; // Changed company
- checkClone(timeStamp, expectedRevisions);
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
}
for (int i = 0; i < 10; i++)
@@ -105,7 +75,7 @@ public class OfflineTest extends AbstractCDOTest
company.getCategories().add(getModel1Factory().createCategory());
timeStamp = transaction.commit().getTimeStamp();
expectedRevisions += 2; // Changed company + new category
- checkClone(timeStamp, expectedRevisions);
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
}
for (int i = 0; i < 10; i++)
@@ -113,32 +83,12 @@ public class OfflineTest extends AbstractCDOTest
company.getCategories().remove(0);
timeStamp = transaction.commit().getTimeStamp();
expectedRevisions += 2; // Changed company + detached category
- checkClone(timeStamp, expectedRevisions);
+ checkRevisions(getRepository(), timeStamp, expectedRevisions);
}
session.close();
}
- protected void checkClone(final long timeStamp, int expectedRevisions) throws InterruptedException
- {
- final InternalRepository repository = getRepository();
- long lastCommitTimeStamp = repository.getLastCommitTimeStamp();
- while (lastCommitTimeStamp < timeStamp)
- {
- lastCommitTimeStamp = repository.waitForCommit(DEFAULT_TIMEOUT);
- }
-
- InternalStore store = repository.getStore();
- if (store instanceof MEMStore)
- {
- Map<CDOBranch, List<CDORevision>> allRevisions = ((MEMStore)store).getAllRevisions();
- System.out.println("\n\n\n\n\n\n\n\n\n\n" + CDORevisionUtil.dumpAllRevisions(allRevisions));
-
- List<CDORevision> revisions = allRevisions.get(repository.getBranchManager().getMainBranch());
- assertEquals(expectedRevisions, revisions.size());
- }
- }
-
public void testMasterCommits_NotificationsFromClone() throws Exception
{
CDOSession masterSession = openSession(getRepository().getName() + "_master");
@@ -185,29 +135,6 @@ public class OfflineTest extends AbstractCDOTest
masterSession.close();
}
- protected void checkEvent(TestListener listener, int newPackageUnits, int newObjects, int changedObjects,
- int detachedObjects)
- {
- IEvent[] events = listener.getEvents();
- assertEquals(1, events.length);
-
- IEvent event = events[0];
- if (event instanceof CDOSessionInvalidationEvent)
- {
- CDOSessionInvalidationEvent e = (CDOSessionInvalidationEvent)event;
- assertEquals(newPackageUnits, e.getNewPackageUnits().size());
- assertEquals(newObjects, e.getNewObjects().size());
- assertEquals(changedObjects, e.getChangedObjects().size());
- assertEquals(detachedObjects, e.getDetachedObjects().size());
- }
- else
- {
- fail("Invalid event: " + event);
- }
-
- listener.clearEvents();
- }
-
public void testClientCommits() throws Exception
{
InternalRepository clone = getRepository();
@@ -236,34 +163,6 @@ public class OfflineTest extends AbstractCDOTest
checkRevision(company, clone, "clone");
}
- protected void checkRevision(EObject object, InternalRepository repository, String location)
- {
- // Check if revision arrived in cache
- checkRevision(object, repository.getRevisionManager().getCache().getAllRevisions(), location + " cache");
-
- // Check if revision arrived in store
- InternalStore store = repository.getStore();
- if (store instanceof IMEMStore)
- {
- checkRevision(object, ((IMEMStore)store).getAllRevisions(), location + " store");
- }
- }
-
- protected void checkRevision(EObject object, Map<CDOBranch, List<CDORevision>> allRevisions, String location)
- {
- CDORevision revision = CDOUtil.getCDOObject(object).cdoRevision();
- List<CDORevision> revisions = allRevisions.get(revision.getBranch());
- for (CDORevision rev : revisions)
- {
- if (revision.equals(rev))
- {
- return;
- }
- }
-
- fail("Revision missing from " + location + ": " + revision);
- }
-
public void testDisconnectAndSyncAddition() throws Exception
{
TestListener listener = new TestListener();
@@ -517,48 +416,4 @@ public class OfflineTest extends AbstractCDOTest
assertEquals(12, result.size());
}
}
-
- protected static void waitForOnline(CDOCommonRepository repository)
- {
- while (repository.getState() != CDOCommonRepository.State.ONLINE)
- {
- System.out.println("Waiting for ONLINE...");
- sleep(SLEEP_MILLIS);
- }
- }
-
- protected static void waitForOffline(CDOCommonRepository repository)
- {
- while (repository.getState() == CDOCommonRepository.State.ONLINE)
- {
- System.out.println("Waiting for OFFLINE...");
- sleep(SLEEP_MILLIS);
- }
- }
-
- protected static CDOCommitInfo commitAndWaitForArrival(CDOTransaction transaction, CDOSession receiver)
- {
- CDOCommitInfo commitInfo = transaction.commit();
- long timeStamp = commitInfo.getTimeStamp();
- while (receiver.getLastUpdateTime() < timeStamp)
- {
- System.out.println("Waiting for arrival of commit " + CDOCommonUtil.formatTimeStamp(timeStamp));
- sleep(SLEEP_MILLIS);
- }
-
- return commitInfo;
- }
-
- protected static CDOCommitInfo commitAndWaitForArrival(CDOTransaction transaction, IRepository receiver)
- {
- CDOCommitInfo commitInfo = transaction.commit();
- long timeStamp = commitInfo.getTimeStamp();
- while (receiver.getLastCommitTimeStamp() < timeStamp)
- {
- System.out.println("Waiting for arrival of commit " + CDOCommonUtil.formatTimeStamp(timeStamp));
- sleep(SLEEP_MILLIS);
- }
-
- return commitInfo;
- }
}
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 5c4518d045..00e04d843b 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
@@ -28,6 +28,7 @@ import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.spi.server.InternalRepositorySynchronizer;
import org.eclipse.emf.cdo.spi.server.InternalSessionManager;
import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
@@ -206,6 +207,8 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
{
public static final String PROP_TEST_SQUEEZE_COMMIT_INFOS = "test.squeeze.commit.infos";
+ public static final String PROP_TEST_FAILOVER = "test.backup.tests";
+
private static final long serialVersionUID = 1L;
private transient IAcceptor masterAcceptor;
@@ -240,30 +243,43 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
@Override
protected InternalRepository createRepository(String name)
{
+ boolean failover = getTestFailover();
Map<String, String> props = getRepositoryProperties();
final String masterName = name + "_master";
IStore masterStore = createStore(masterName);
- InternalRepository master = (InternalRepository)CDOServerUtil.createRepository(masterName, masterStore, props);
+
+ InternalRepository master = (InternalRepository)(failover ? CDOServerUtil.createFailoverParticipant(masterName,
+ masterStore, props, createSynchronizer("backup", name), true) : CDOServerUtil.createRepository(masterName,
+ masterStore, props));
repositories.put(masterName, master);
LifecycleUtil.activate(master);
startMasterTransport();
+ InternalRepositorySynchronizer synchronizer = createSynchronizer("master", masterName);
+ IStore store = createStore(name);
+
+ return (InternalRepository)(failover ? CDOServerUtil.createFailoverParticipant(name, store, props, synchronizer,
+ false) : CDOServerUtil.createOfflineClone(name, store, props, synchronizer));
+ }
+
+ protected InternalRepositorySynchronizer createSynchronizer(final String acceptorName, final String repositoryName)
+ {
CDOSessionConfigurationFactory masterFactory = new CDOSessionConfigurationFactory()
{
public org.eclipse.emf.cdo.session.CDOSessionConfiguration createSessionConfiguration()
{
IManagedContainer container = getCurrentTest().getServerContainer();
- IConnector connector = (IConnector)container.getElement("org.eclipse.net4j.connectors", "jvm", "master");
+ IConnector connector = (IConnector)container.getElement("org.eclipse.net4j.connectors", "jvm", acceptorName);
InternalCDORevisionManager revisionManager = new CDORevisionManagerImpl();
revisionManager.setCache(new NOOPRevisionCache());
CDOSessionConfiguration config = CDONet4jUtil.createSessionConfiguration();
config.setConnector(connector);
- config.setRepositoryName(masterName);
+ config.setRepositoryName(repositoryName);
config.setRevisionManager(revisionManager);
return config;
}
@@ -273,9 +289,7 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
synchronizer.setRemoteSessionConfigurationFactory(masterFactory);
synchronizer.setRetryInterval(1);
synchronizer.setSqueezeCommitInfos(getTestSqueezeCommitInfos());
-
- IStore store = createStore(name);
- return (InternalRepository)CDOServerUtil.createOfflineClone(name, store, props, synchronizer);
+ return synchronizer;
}
protected boolean getTestSqueezeCommitInfos()
@@ -289,6 +303,17 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
return result;
}
+ protected boolean getTestFailover()
+ {
+ Boolean result = (Boolean)getTestProperty(PROP_TEST_FAILOVER);
+ if (result == null)
+ {
+ result = false;
+ }
+
+ return result;
+ }
+
public void startMasterTransport()
{
if (masterAcceptor == null)

Back to the top