Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-12-14 03:06:34 -0500
committerEike Stepper2016-12-14 03:06:34 -0500
commite06ec8c3a7c6a8cfa334752f3435264d5dc6dd7c (patch)
tree7a87ada54a771b2207bbe48b8a5a8d71502305e8 /plugins/org.eclipse.emf.cdo.tests/src
parent5986b206d25da8e5d040cc042cba11fa1581b272 (diff)
downloadcdo-e06ec8c3a7c6a8cfa334752f3435264d5dc6dd7c.tar.gz
cdo-e06ec8c3a7c6a8cfa334752f3435264d5dc6dd7c.tar.xz
cdo-e06ec8c3a7c6a8cfa334752f3435264d5dc6dd7c.zip
[509149] Provide an EmbeddedRepository
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509149
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsMEMEmbedded.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/ISessionConfig.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java113
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestRevisionManager.java7
6 files changed, 116 insertions, 73 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsMEMEmbedded.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsMEMEmbedded.java
index 609d634dfb..a88b0bcaae 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsMEMEmbedded.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsMEMEmbedded.java
@@ -15,9 +15,7 @@ import junit.framework.TestSuite;
/**
* @author Eike Stepper
- * @deprecated Not yet supported.
*/
-@Deprecated
public class AllTestsMEMEmbedded extends AllConfigs
{
public static Test suite()
@@ -28,6 +26,6 @@ public class AllTestsMEMEmbedded extends AllConfigs
@Override
protected void initConfigSuites(TestSuite parent)
{
- addScenario(parent, MEM, EMBEDDED, NATIVE);
+ addScenario(parent, MEM_EMBEDDED_BRANCHES, EMBEDDED, 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 754df5d5e7..d3ad3ce1ca 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
@@ -33,11 +33,9 @@ public interface IConstants
public static final RepositoryConfig MEM_OFFLINE = new MEMOfflineConfig(IDGenerationLocation.CLIENT);
- /**
- * @deprecated Not yet supported.
- */
- @Deprecated
- public static final SessionConfig EMBEDDED = SessionConfig.Embedded.INSTANCE;
+ public static final RepositoryConfig MEM_EMBEDDED_BRANCHES = new MEMConfig.Embedded(true, true, IDGenerationLocation.STORE);
+
+ public static final SessionConfig EMBEDDED = Net4j.JVM.Embedded.INSTANCE;
public static final SessionConfig JVM = Net4j.JVM.INSTANCE;
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/ISessionConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/ISessionConfig.java
index a62ea8a6f8..f8bc572c5c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/ISessionConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/ISessionConfig.java
@@ -30,6 +30,8 @@ public interface ISessionConfig extends IConfig
public static final String CAPABILITY_NET4J_SSL = "session.net4j.ssl";
+ public static final String CAPABILITY_NET4J_EMBEDDED = "session.net4j.embedded";
+
public IManagedContainer getClientContainer();
public boolean hasClientContainer();
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 be7e359a55..ad9f618b85 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
@@ -39,12 +39,16 @@ import org.eclipse.emf.cdo.server.IStoreAccessor.CommitContext;
import org.eclipse.emf.cdo.server.ITransaction;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
import org.eclipse.emf.cdo.server.admin.CDOAdminServerUtil;
+import org.eclipse.emf.cdo.server.internal.embedded.ServerBranchLoader;
+import org.eclipse.emf.cdo.server.internal.embedded.ServerRevisionLoader;
import org.eclipse.emf.cdo.server.mem.MEMStoreUtil;
import org.eclipse.emf.cdo.server.net4j.CDONet4jServerUtil;
import org.eclipse.emf.cdo.server.ocl.OCLQueryHandler;
import org.eclipse.emf.cdo.server.security.ISecurityManager;
import org.eclipse.emf.cdo.server.spi.security.InternalSecurityManager;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
@@ -71,6 +75,7 @@ import org.eclipse.net4j.util.concurrent.DelegatingExecutorService;
import org.eclipse.net4j.util.concurrent.ExecutorServiceFactory;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.event.ThrowableEvent;
@@ -355,8 +360,12 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
}
}
- IManagedContainer serverContainer = getServerContainer();
- repository.setContainer(serverContainer);
+ if (repository.getContainer() == IPluginContainer.INSTANCE)
+ {
+ IManagedContainer serverContainer = getServerContainer();
+ repository.setContainer(serverContainer);
+ }
+
registerRepository(repository);
if (activate)
@@ -596,7 +605,7 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
IStore store = createStore(name);
Map<String, String> repoProps = getRepositoryProperties();
- InternalRepository repository = (InternalRepository)CDOServerUtil.createRepository(name, store, repoProps);
+ InternalRepository repository = createRepository(name, store, repoProps);
if (hasAnnotation(CountedTime.class))
{
@@ -655,6 +664,11 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
return repository;
}
+ protected InternalRepository createRepository(String name, IStore store, Map<String, String> props)
+ {
+ return (InternalRepository)CDOServerUtil.createRepository(name, store, props);
+ }
+
protected InternalRepository getTestRepository()
{
return (InternalRepository)getTestProperty(PROP_TEST_REPOSITORY);
@@ -1075,9 +1089,14 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
private static final long serialVersionUID = 1L;
+ public MEMConfig(String name, boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ {
+ super(name, supportingAudits, supportingBranches, idGenerationLocation);
+ }
+
public MEMConfig(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
{
- super(STORE_NAME, supportingAudits, supportingBranches, idGenerationLocation);
+ this(STORE_NAME, supportingAudits, supportingBranches, idGenerationLocation);
}
@Override
@@ -1096,6 +1115,34 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
{
return MEMStoreUtil.createMEMStore();
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Embedded extends MEMConfig
+ {
+ private static final long serialVersionUID = 1L;
+
+ public Embedded(boolean supportingAudits, boolean supportingBranches, IDGenerationLocation idGenerationLocation)
+ {
+ super(STORE_NAME + "Embedded", supportingAudits, supportingBranches, idGenerationLocation);
+ }
+
+ @Override
+ protected InternalRepository createRepository(String name)
+ {
+ InternalRepository repository = super.createRepository(name);
+
+ InternalCDORevisionManager revisionManager = repository.getRevisionManager();
+ revisionManager.setRevisionLoader(new ServerRevisionLoader(repository));
+
+ InternalCDOBranchManager branchManager = CDOBranchUtil.createBranchManager();
+ branchManager.setBranchLoader(new ServerBranchLoader(repository));
+ repository.setBranchManager(branchManager);
+
+ return repository;
+ }
+ }
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java
index 573a0f9e80..be01b4d04f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java
@@ -11,14 +11,18 @@
*/
package org.eclipse.emf.cdo.tests.config.impl;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDONet4jViewProvider;
-import org.eclipse.emf.cdo.server.CDOServerUtil;
-import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.internal.embedded.ClientBranchManager;
+import org.eclipse.emf.cdo.server.internal.embedded.ClientRevisionManager;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
import org.eclipse.emf.cdo.spi.common.CDOLobStoreImpl;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
import org.eclipse.emf.cdo.tests.config.ISessionConfig;
import org.eclipse.emf.cdo.tests.util.TestRevisionManager;
@@ -315,56 +319,6 @@ public abstract class SessionConfig extends Config implements ISessionConfig
/**
* @author Eike Stepper
- * @deprecated Not yet supported.
- */
- @Deprecated
- public static final class Embedded extends SessionConfig
- {
- public static final String NAME = "Embedded";
-
- public static final Embedded INSTANCE = new Embedded();
-
- private static final long serialVersionUID = 1L;
-
- public Embedded()
- {
- super(NAME);
- }
-
- public void initCapabilities(Set<String> capabilities)
- {
- capabilities.add(CAPABILITY_EMBEDDED);
- }
-
- public String getURIProtocol()
- {
- throw new UnsupportedOperationException();
- }
-
- public String getURIPrefix()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public CDOSessionConfiguration createSessionConfiguration(String repositoryName)
- {
- IRepository repository = getCurrentTest().getRepository(repositoryName);
-
- org.eclipse.emf.cdo.server.embedded.CDOSessionConfiguration configuration = CDOServerUtil.createSessionConfiguration();
- configuration.setRepository(repository);
- return configuration;
- }
-
- @Override
- protected boolean usesServerContainer()
- {
- return true;
- }
- }
-
- /**
- * @author Eike Stepper
*/
public static abstract class Net4j extends SessionConfig
{
@@ -620,7 +574,7 @@ public abstract class SessionConfig extends Config implements ISessionConfig
/**
* @author Eike Stepper
*/
- public static final class JVM extends SessionConfig.Net4j
+ public static class JVM extends SessionConfig.Net4j
{
public static final String NAME = "JVM";
@@ -630,9 +584,14 @@ public abstract class SessionConfig extends Config implements ISessionConfig
private static final long serialVersionUID = 1L;
+ public JVM(String name)
+ {
+ super(name);
+ }
+
public JVM()
{
- super(NAME);
+ this(NAME);
}
@Override
@@ -684,6 +643,52 @@ public abstract class SessionConfig extends Config implements ISessionConfig
}
};
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Embedded extends SessionConfig.Net4j.JVM
+ {
+ public static final String NAME = "JVMEmbedded";
+
+ public static final Embedded INSTANCE = new Embedded();
+
+ private static final long serialVersionUID = 1L;
+
+ public Embedded()
+ {
+ super(NAME);
+ }
+
+ @Override
+ public void initCapabilities(Set<String> capabilities)
+ {
+ super.initCapabilities(capabilities);
+ capabilities.add(CAPABILITY_NET4J_EMBEDDED);
+ }
+
+ @Override
+ public CDOSessionConfiguration createSessionConfiguration(String repositoryName)
+ {
+ InternalRepository repository = getCurrentTest().getRepository(repositoryName);
+ CDOBranchManager branchManager = new ClientBranchManager(repository.getBranchManager());
+ CDORevisionManager revisionManager = new ClientRevisionManager(repository.getRevisionManager());
+
+ CDONet4jSessionConfiguration configuration = (CDONet4jSessionConfiguration)super.createSessionConfiguration(repositoryName);
+ configuration.setBranchManager(branchManager);
+ configuration.setRevisionManager(revisionManager);
+ configuration.setSignalTimeout(Integer.MAX_VALUE);
+
+ return configuration;
+ }
+
+ @Override
+ public void configureSession(CDOSession session)
+ {
+ super.configureSession(session);
+ ((CDONet4jSession)session).options().setCommitTimeout(Integer.MAX_VALUE);
+ }
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestRevisionManager.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestRevisionManager.java
index 942106285a..f1ec3372e8 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestRevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/util/TestRevisionManager.java
@@ -19,7 +19,6 @@ import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
import org.eclipse.emf.cdo.spi.common.revision.SyntheticCDORevision;
import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
-import org.eclipse.net4j.util.event.IListener;
import java.util.List;
@@ -71,12 +70,6 @@ public class TestRevisionManager extends CDORevisionManagerImpl
return super.getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics);
}
- @Override
- public void addListener(IListener listener)
- {
- super.addListener(listener);
- }
-
public void resetLoadCounter()
{
synchronized (lock)

Back to the top