summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-02-25 11:55:31 (EST)
committerEike Stepper2008-02-25 11:55:31 (EST)
commit6c2e92fdedff724786ab87a6d4242b3cfd506167 (patch)
tree9d1fcf054cc182d61113ecb0d57175d7855d6ca6
parent2583036dd2450ae5cfd62ea66ec8f7a4dd947e3e (diff)
downloadcdo-6c2e92fdedff724786ab87a6d4242b3cfd506167.zip
cdo-6c2e92fdedff724786ab87a6d4242b3cfd506167.tar.gz
cdo-6c2e92fdedff724786ab87a6d4242b3cfd506167.tar.bz2
[217117] Develop a HibernateStore
https://bugs.eclipse.org/bugs/show_bug.cgi?id=217117
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/CDO2 TDD.launch15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateTest.java31
2 files changed, 18 insertions, 28 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/CDO2 TDD.launch b/plugins/org.eclipse.emf.cdo.tests.hibernate/CDO2 TDD.launch
deleted file mode 100644
index d7e8b31..0000000
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/CDO2 TDD.launch
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TDD.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;folder nest=&amp;quot;false&amp;quot; path=&amp;quot;/org.eclipse.emf.cdo.weaver.ajdt/ecore&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.folder&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.TDD"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Ddebug=true&#13;&#10;-Xms256m&#13;&#10;-Xmx1024m"/>
-</launchConfiguration>
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateTest.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateTest.java
index 7764280..e092db5 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateTest.java
@@ -28,6 +28,7 @@ import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.internal.util.om.log.PrintLogHandler;
import org.eclipse.net4j.internal.util.om.trace.PrintTraceHandler;
import org.eclipse.net4j.jvm.JVMUtil;
+import org.eclipse.net4j.tests.AbstractOMTest;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.om.OMPlatform;
@@ -48,34 +49,38 @@ import java.util.Properties;
/**
* @author Eike Stepper
*/
-public class HibernateTest
+public class HibernateTest extends AbstractOMTest
{
private static final String REPOSITORY_NAME = "repo1";
- public static void main(String[] args) throws Exception
+ public void testHibernate() throws Exception
{
IManagedContainer container = initContainer();
-
- // Start the transport and create a repository
JVMUtil.getAcceptor(container, "default"); // Start the JVM transport
CDOServerUtil.addRepository(container, createRepository()); // Start a CDO respository
-
- // Establish a communications connection and open a session with the repository
IConnector connector = JVMUtil.getConnector(container, "default"); // Open a JVM connection
- CDOSession session = CDOUtil.openSession(connector, REPOSITORY_NAME, true);// Open a CDO
- // session
- session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);// Not needed after
- // first
- // commit!!!
- // Open a transaction, and create a new resource
+ CDOSession session = CDOUtil.openSession(connector, REPOSITORY_NAME, true);// Open a CDO session
+ session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);// Not needed after first commit!!!
CDOTransaction transaction = session.openTransaction();
Resource resource = transaction.createResource("/my/big/resource");
resource.getContents().add(getInputModel());
transaction.commit();
+ session.close();
+
+ CDOSession session2 = CDOUtil.openSession(connector, REPOSITORY_NAME, true);// Open a CDO session
+ CDOTransaction transaction2 = session2.openTransaction();
+ Resource resource2 = transaction2.getResource("/my/big/resource");
+ Category category = (Category)resource2.getContents().get(0);
+ assertEquals("CAT1", category.getName());
+ assertEquals("CAT2", category.getCategories().get(0).getName());
+ assertEquals("P1", category.getProducts().get(0).getName());
+ assertEquals("P2", category.getProducts().get(1).getName());
+ assertEquals("P3", category.getCategories().get(0).getProducts().get(0).getName());
+ transaction.close();
// Cleanup
- session.close();
+ session2.close();
connector.disconnect();
}