summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2008-03-14 06:33:54 (EDT)
committerMartin Taal2008-03-14 06:33:54 (EDT)
commit41a0b326a113a46e444cdd69636e433d6ede649d (patch)
tree56d1b1180f3c8dc394109efe1e22258f45cf3375
parent9ebf163cd9bbdf6dfdd8f782fc131e11d279a056 (diff)
downloadcdo-41a0b326a113a46e444cdd69636e433d6ede649d.zip
cdo-41a0b326a113a46e444cdd69636e433d6ede649d.tar.gz
cdo-41a0b326a113a46e444cdd69636e433d6ede649d.tar.bz2
Solved some issues related to the cdo test cases
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbStoreRepositoryProvider.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbTransactionDeadLockTest.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/teneo.properties27
11 files changed, 205 insertions, 51 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
index fc9df34..4f6fd2e 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java
@@ -72,15 +72,17 @@ public class HibernatePackageHandler
public void writePackages(CDOPackage... cdoPackages)
{
+ readPackages();
TRACER.trace("Persisting new CDOPackages");
final Session session = getSessionFactory().openSession();
final Transaction tx = session.beginTransaction();
boolean err = true;
+ boolean updated = false;
try
{
for (CDOPackage cdoPackage : cdoPackages)
{
- if (null != getCDOPackage(cdoPackage.getPackageURI()))
+ if (cdoPackageExistsAndIsUnchanged(cdoPackage))
{
OM.LOG.warn("CDOPackage " + cdoPackage.getPackageURI() + " already exists not persisting it again!");
continue;
@@ -88,6 +90,7 @@ public class HibernatePackageHandler
TRACER.trace("Persisting CDOPackage " + cdoPackage.getPackageURI());
session.saveOrUpdate(cdoPackage);
+ updated = true;
}
tx.commit();
err = false;
@@ -100,13 +103,27 @@ public class HibernatePackageHandler
}
session.close();
}
- reset();
- hibernateStore.reInitialize();
+ if (updated)
+ {
+ reset();
+ hibernateStore.reInitialize();
+ }
+ }
+
+ protected boolean cdoPackageExistsAndIsUnchanged(CDOPackage newCDOPackage)
+ {
+ final CDOPackage currentCDOPackage = getCDOPackage(newCDOPackage.getPackageURI());
+ if (currentCDOPackage == null)
+ {
+ return false;
+ }
+ return currentCDOPackage.getEcore().compareTo(newCDOPackage.getEcore()) == 0;
}
public void writePackage(CDOPackage cdoPackage)
{
- if (null != getCDOPackage(cdoPackage.getPackageURI()))
+ readPackages();
+ if (cdoPackageExistsAndIsUnchanged(cdoPackage))
{
OM.LOG.warn("CDOPackage " + cdoPackage.getPackageURI() + " already exists not persisting it again!");
return;
@@ -136,6 +153,7 @@ public class HibernatePackageHandler
public CDOPackage getCDOPackage(String uri)
{
+ readPackages();
TRACER.trace("Getting CDOPackage using uri: " + uri);
for (CDOPackage cdoPackage : cdoPackages)
{
@@ -163,7 +181,7 @@ public class HibernatePackageHandler
protected void readPackages()
{
- if (cdoPackageInfos == null)
+ if (cdoPackageInfos == null || cdoPackageInfos.size() == 0)
{
TRACER.trace("Reading CDOPackages from db");
Collection<CDOPackageInfo> result = new ArrayList<CDOPackageInfo>();
@@ -178,7 +196,8 @@ public class HibernatePackageHandler
{
CDOPackage cdoPackage = (CDOPackage)object;
TRACER.trace("Read CDOPackage: " + cdoPackage.getName());
- result.add(new CDOPackageInfo(cdoPackage.getPackageURI(), cdoPackage.isDynamic(), null));
+ result
+ .add(new CDOPackageInfo(cdoPackage.getPackageURI(), cdoPackage.isDynamic(), cdoPackage.getMetaIDRange()));
((InternalCDOPackage)cdoPackage).setPackageManager(hibernateStore.getRepository().getPackageManager());
resultPackages.add(cdoPackage);
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
index 8858f53..96ead98 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
@@ -11,11 +11,18 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.hibernate;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy;
+import org.eclipse.emf.cdo.internal.protocol.model.InternalCDOClass;
+import org.eclipse.emf.cdo.internal.protocol.model.InternalCDOFeature;
+import org.eclipse.emf.cdo.internal.protocol.model.InternalCDOPackage;
import org.eclipse.emf.cdo.protocol.id.CDOID;
+import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
+import org.eclipse.emf.cdo.protocol.model.CDOModelUtil;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.protocol.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.protocol.model.CDOType;
import org.eclipse.emf.cdo.protocol.model.resource.CDOResourceClass;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.server.ISession;
@@ -79,7 +86,56 @@ public class HibernateStoreReader extends HibernateStoreAccessor implements IHib
public void readPackage(CDOPackage cdoPackage)
{
- // Does nothing, assumes that the packages have been read
+ final CDOPackage dbPackage = getStore().getPackageHandler().getCDOPackage(cdoPackage.getPackageURI());
+ ((InternalCDOPackage)cdoPackage).setServerInfo(dbPackage.getServerInfo());
+ ((InternalCDOPackage)cdoPackage).setName(dbPackage.getName());
+ ((InternalCDOPackage)cdoPackage).setEcore(dbPackage.getEcore());
+
+ ((InternalCDOPackage)cdoPackage).setMetaIDRange(cdoPackage.getMetaIDRange());
+ copyCDOClasses(dbPackage, cdoPackage);
+ }
+
+ protected void copyCDOClasses(CDOPackage dbPackage, CDOPackage cdoPackage)
+ {
+ for (CDOClass dbCDOClass : dbPackage.getClasses())
+ {
+ final CDOClass cdoClass = CDOModelUtil.createClass(cdoPackage, dbCDOClass.getClassifierID(),
+ dbCDOClass.getName(), dbCDOClass.isAbstract());
+ ((InternalCDOClass)cdoClass).setServerInfo(dbCDOClass.getServerInfo());
+ ((InternalCDOPackage)cdoPackage).addClass(cdoClass);
+ for (CDOClass dbSuperCDOClass : dbCDOClass.getSuperTypes())
+ {
+ ((InternalCDOClass)cdoClass).addSuperType(CDOModelUtil.createClassRef(dbSuperCDOClass.getContainingPackage()
+ .getPackageURI(), dbSuperCDOClass.getClassifierID()));
+ }
+
+ for (CDOFeature dbCDOFeature : dbCDOClass.getFeatures())
+ {
+ int featureID = dbCDOFeature.getFeatureID();
+ String name = dbCDOFeature.getName();
+ CDOType type = dbCDOFeature.getType();
+ boolean many = dbCDOFeature.isMany();
+
+ CDOFeature feature;
+ if (type == CDOType.OBJECT)
+ {
+ String packageURI = dbCDOFeature.getReferenceType().getContainingPackage().getPackageURI();
+ int classifierID = dbCDOFeature.getReferenceType().getClassifierID();
+ boolean containment = dbCDOFeature.isContainment();
+ CDOClassRef classRef = CDOModelUtil.createClassRef(packageURI, classifierID);
+ CDOClassProxy referenceType = new CDOClassProxy(classRef, cdoClass.getPackageManager());
+ feature = CDOModelUtil.createReference(cdoClass, featureID, name, referenceType, many, containment);
+ }
+ else
+ {
+ feature = CDOModelUtil.createAttribute(cdoClass, featureID, name, type, many);
+ }
+
+ ((InternalCDOFeature)feature).setServerInfo(dbCDOFeature.getServerInfo());
+ ((InternalCDOClass)cdoClass).addFeature(feature);
+ }
+ }
+ ;
}
public Collection<CDOPackageInfo> readPackageInfos()
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
index 6804178..03c18f5 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreWriter.java
@@ -171,13 +171,11 @@ public class HibernateStoreWriter extends HibernateStoreReader implements IHiber
@Override
protected void writeRevisionDelta(CDORevisionDelta revisionDelta)
{
- throw new UnsupportedOperationException("Should not be called");
}
@Override
protected void writeRevisionDeltas(CDORevisionDelta[] revisionDeltas)
{
- throw new UnsupportedOperationException("Should not be called");
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java
index 51b7ae7..3f06276 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDMetaRangeUserType.java
@@ -75,8 +75,12 @@ public class CDOIDMetaRangeUserType implements UserType
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws SQLException
{
final Integer start = (Integer)Hibernate.INTEGER.nullSafeGet(rs, names[0]);
+ if (rs.wasNull())
+ {
+ return null;
+ }
final Integer size = (Integer)Hibernate.INTEGER.nullSafeGet(rs, names[1]);
- if (size == null || start == null)
+ if (rs.wasNull())
{
return null;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java
index 1c14778..56cc28c 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOReferenceSetter.java
@@ -30,7 +30,14 @@ public class CDOReferenceSetter extends CDOPropertySetter
@Override
public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException
{
- final CDORevision cdoValue = (CDORevision)value;
- super.set(target, cdoValue.getID(), factory);
+ if (value == null)
+ {
+ super.set(target, null, factory);
+ }
+ else
+ {
+ final CDORevision cdoValue = (CDORevision)value;
+ super.set(target, cdoValue.getID(), factory);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java
index dcfacaf..b6a1307 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java
@@ -11,12 +11,12 @@
package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
import org.eclipse.emf.cdo.internal.protocol.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.protocol.id.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.server.IPackageManager;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IRevisionManager;
+import org.eclipse.emf.cdo.server.hibernate.internal.id.CDOIDHibernateFactoryImpl;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.tuple.Instantiator;
@@ -50,7 +50,8 @@ public class CDORevisionInstantiator implements Instantiator
public Object instantiate(Serializable id)
{
- return CDORevisionUtil.create(revisionManager, cdoClass, (CDOID)id);// TODO Is simply casting ok?
+ return CDORevisionUtil.create(revisionManager, cdoClass, CDOIDHibernateFactoryImpl.getInstance().createCDOID(id,
+ cdoClass.getName()));
}
public boolean isInstance(Object object)
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java
index ffdf3b1..6cd2b72 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTests.java
@@ -12,18 +12,20 @@ package org.eclipse.emf.cdo.tests.hibernate;
import org.eclipse.emf.cdo.tests.ContainmentTest;
import org.eclipse.emf.cdo.tests.CrossReferenceTest;
+import org.eclipse.emf.cdo.tests.EMFTest;
import org.eclipse.emf.cdo.tests.EnumTest;
import org.eclipse.emf.cdo.tests.IndexReconstructionTest;
import org.eclipse.emf.cdo.tests.InitialTest;
import org.eclipse.emf.cdo.tests.InvalidationTest;
+import org.eclipse.emf.cdo.tests.MangoTest;
import org.eclipse.emf.cdo.tests.NoLegacyTest;
import org.eclipse.emf.cdo.tests.PackageRegistryTest;
import org.eclipse.emf.cdo.tests.ResourceTest;
import org.eclipse.emf.cdo.tests.RevisionDeltaTest;
+import org.eclipse.emf.cdo.tests.RevisionHolderTest;
import org.eclipse.emf.cdo.tests.RollbackTest;
import org.eclipse.emf.cdo.tests.StateMachineTest;
import org.eclipse.emf.cdo.tests.StoreRepositoryProvider;
-import org.eclipse.emf.cdo.tests.TransactionDeadLockTest;
import org.eclipse.emf.cdo.tests.ViewTest;
import junit.framework.Test;
@@ -39,27 +41,28 @@ public class AllTests
StoreRepositoryProvider.setInstance(HbStoreRepositoryProvider.getInstance());
TestSuite suite = new TestSuite("Tests for CDO using Hibernate");
-
- // PASS>>>
+ suite.addTestSuite(RevisionDeltaTest.class);
+ suite.addTestSuite(HbTransactionDeadLockTest.class);
+ suite.addTestSuite(RollbackTest.class);
+ suite.addTestSuite(StateMachineTest.class);
+ suite.addTestSuite(RevisionHolderTest.class);
+ suite.addTestSuite(CrossReferenceTest.class);
+ suite.addTestSuite(MangoTest.class);
suite.addTestSuite(EnumTest.class);
- suite.addTestSuite(InitialTest.class);
+ suite.addTestSuite(NoLegacyTest.class);
suite.addTestSuite(ResourceTest.class);
- suite.addTestSuite(RollbackTest.class);
+ suite.addTestSuite(InvalidationTest.class);
suite.addTestSuite(ContainmentTest.class);
- suite.addTestSuite(StateMachineTest.class);
+ suite.addTestSuite(InitialTest.class);
suite.addTestSuite(ViewTest.class);
- suite.addTestSuite(CrossReferenceTest.class);
- suite.addTestSuite(PackageRegistryTest.class);
suite.addTestSuite(IndexReconstructionTest.class);
- suite.addTestSuite(NoLegacyTest.class);
+ suite.addTestSuite(PackageRegistryTest.class);
- // FAIL>>>
- suite.addTestSuite(InvalidationTest.class);
- // failures: testSeparateView, testSeparateViewNotification, testSeparateSession
- suite.addTestSuite(TransactionDeadLockTest.class);
- // failures: testCreateManySession, testCreateManyTransaction
- suite.addTestSuite(RevisionDeltaTest.class);
- // Remark: I don't think hibernate won't support this.
+ // These fail for standard cdo >>>
+ // suite.addTestSuite(DymamicEcoreTest.class);
+ // suite.addTestSuite(ContentAdapterTest.class);
+ // suite.addTestSuite(FetchRuleAnalyzerTest.class);
+ // suite.addTestSuite(GeneratedEcoreTest.class);
// Chunking is not supported by Hibernate
// suite.addTestSuite(ChunkingTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbStoreRepositoryProvider.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbStoreRepositoryProvider.java
index 4e493ad..8d821bc 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbStoreRepositoryProvider.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbStoreRepositoryProvider.java
@@ -20,15 +20,11 @@ import org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore;
import org.eclipse.emf.cdo.tests.StoreRepositoryProvider;
import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.om.OMPlatform;
-import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.MySQLInnoDBDialect;
-
-import java.io.PrintWriter;
-import java.sql.Driver;
-import java.sql.DriverManager;
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
/**
* @author Eike Stepper
@@ -49,8 +45,10 @@ public class HbStoreRepositoryProvider extends StoreRepositoryProvider
}
@Override
- public IRepository createRepository(String name)
+ public IRepository createRepository(String name, Map<String, String> testProperties)
{
+ setLogging();
+
Map<String, String> props = new HashMap<String, String>();
props.put(Props.PROP_OVERRIDE_UUID, "f8188187-65de-4c8a-8e75-e0ce5949837a");
props.put(Props.PROP_SUPPORTING_AUDITS, "false");
@@ -60,6 +58,9 @@ public class HbStoreRepositoryProvider extends StoreRepositoryProvider
props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
addHibernateTeneoProperties(props);
+ // override with the test properties
+ props.putAll(testProperties);
+
return CDOServerUtil.createRepository(name, createStore(), props);
}
@@ -67,19 +68,12 @@ public class HbStoreRepositoryProvider extends StoreRepositoryProvider
{
try
{
- DriverManager.setLogWriter(new PrintWriter(System.out));
- Driver driver = new com.mysql.jdbc.Driver();
- DriverManager.registerDriver(driver);
- String driverName = driver.getClass().getName();
- String dialectName = MySQLInnoDBDialect.class.getName();
-
- props.put(Environment.DRIVER, driverName);
- props.put(Environment.URL, "jdbc:mysql://localhost/cdohibernate");
- props.put(Environment.USER, "cdo");
- // props.setProperty(Environment.PASS, "root");
- props.put(Environment.DIALECT, dialectName);
- props.put(Environment.SHOW_SQL, "false");
- props.put("hibernate.hbm2ddl.auto", "create-drop");
+ final Properties teneoProperties = new Properties();
+ teneoProperties.load(getClass().getResourceAsStream("/teneo.properties"));
+ for (Object key : teneoProperties.keySet())
+ {
+ props.put((String)key, teneoProperties.getProperty((String)key));
+ }
}
catch (Exception e)
{
@@ -95,4 +89,12 @@ public class HbStoreRepositoryProvider extends StoreRepositoryProvider
// IHibernateMappingProvider mappingProvider = new HibernateFileMappingProvider("/mappings/product.hbm.xml");
return new HibernateStore(mappingProvider);
}
+
+ protected void setLogging()
+ {
+ OMPlatform.INSTANCE.setDebugging(false);
+ // OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ // OMPlatform.INSTANCE.addTraceHandler(new PrintTraceHandler(new PrintStream("trace.txt")));
+ // OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbTransactionDeadLockTest.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbTransactionDeadLockTest.java
new file mode 100644
index 0000000..6fe3db0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbTransactionDeadLockTest.java
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * 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:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests.hibernate;
+
+import org.eclipse.emf.cdo.tests.TransactionDeadLockTest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=213782
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=201366
+ * @author Simon McDuff
+ */
+public class HbTransactionDeadLockTest extends TransactionDeadLockTest
+{
+
+ // allows a testcase to pass specific properties
+ @Override
+ protected Map<String, String> getTestProperties()
+ {
+ final Map<String, String> testProperties = new HashMap<String, String>();
+ testProperties.put("hibernate.hbm2ddl.auto", "update");
+ return testProperties;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java
index f6ee2d1..80d2395 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateServer.java
@@ -25,6 +25,7 @@ import org.eclipse.net4j.util.om.OMPlatform;
import java.io.FileNotFoundException;
import java.io.PrintStream;
+import java.util.HashMap;
/**
* @author Eike Stepper
@@ -45,7 +46,8 @@ public class HibernateServer
{
IManagedContainer container = initContainer();
TCPUtil.getAcceptor(container, "0.0.0.0:2036"); // Start the JVM transport
- CDOServerUtil.addRepository(container, HbStoreRepositoryProvider.getInstance().createRepository(REPOSITORY_NAME));
+ CDOServerUtil.addRepository(container, HbStoreRepositoryProvider.getInstance().createRepository(REPOSITORY_NAME,
+ new HashMap<String, String>()));
IOUtil.OUT().println();
IOUtil.OUT().println("Hit any key to shut down...");
while (System.in.read() == -1)
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/teneo.properties b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/teneo.properties
new file mode 100644
index 0000000..928f7b6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/teneo.properties
@@ -0,0 +1,27 @@
+hibernate.hbm2ddl.auto=create-drop
+hibernate.show_sql=false
+hibernate.connection.pool_size=10
+
+# -----------------------------------------------------------
+# DEFAULT SETTINGS FOR IN MEMORY HSQLDB DATABASE.
+#
+hibernate.dialect=org.hibernate.dialect.HSQLDialect
+hibernate.connection.driver_class=org.hsqldb.jdbcDriver
+hibernate.connection.url=jdbc:hsqldb:mem:cdohibernate
+hibernate.connection.username=sa
+hibernate.connection.password=
+hibernate.connection.autocommit=true
+hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
+
+#--------------------------------------------------------------
+# EXAMPLE SETTING FOR MYSQL DATABASE. UNCOMMENT AND EDIT TO USE.
+#
+#hibernate.connection.driver_class=com.mysql.jdbc.Driver
+#hibernate.connection.url=jdbc:mysql://localhost:3306/cdohibernate
+#hibernate.connection.username=cdo
+#hibernate.connection.password=
+#hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
+
+#-----------------------------------------------------------
+# FIXED SETTING BELOW - ADVANCED USERS ONLY.
+# See Hibernate documentation for further info: http://www.hibernate.org/