Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2014-01-05 16:39:08 -0500
committerMartin Taal2014-01-05 16:44:16 -0500
commit525ad1c07e5f2859393289273eef1f0f6822c28f (patch)
tree3c6b419fdaf9a6feef58c41204afafea97f3948c /plugins/org.eclipse.emf.cdo.tests.hibernate
parentaf88d7127631cdfdfe11bffcbbbc556591bce213 (diff)
downloadcdo-525ad1c07e5f2859393289273eef1f0f6822c28f.tar.gz
cdo-525ad1c07e5f2859393289273eef1f0f6822c28f.tar.xz
cdo-525ad1c07e5f2859393289273eef1f0f6822c28f.zip
[417797] - [Hibernate] Store's problem with Enum serialization and second-level cache enabled
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.hibernate')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateBugzilla_417797_Test.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java2
4 files changed, 92 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.hibernate/META-INF/MANIFEST.MF
index ff1ca36486..188ff36ad3 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/META-INF/MANIFEST.MF
@@ -20,7 +20,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.hsqldb;bundle-version="[2.0.0,3.0.0)",
com.mysql.jdbc;bundle-version="[5.1.7,6.0.0)",
org.dom4j;bundle-version="[1.6.1,2.0.0)",
- javax.persistence;bundle-version="[2.0.0,3.0.0)"
+ javax.persistence;bundle-version="[2.0.0,3.0.0)",
+ org.hibernate;bundle-version="[4.0.0,4.2.0)",
+ org.slf4j.api;bundle-version="[1.7.0,2.0.0)"
Export-Package: org.eclipse.emf.cdo.tests.hibernate;version="4.1.200";x-friends:="org.eclipse.emf.cdo.tests.hudson",
org.eclipse.emf.cdo.tests.hibernate.model.HibernateTest;version="4.1.200",
org.eclipse.emf.cdo.tests.hibernate.model.HibernateTest.impl;version="4.1.200",
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java
index c1197d42c5..89282917b4 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/AllTestsHibernate.java
@@ -86,7 +86,7 @@ public class AllTestsHibernate extends AllConfigs
protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
{
// testClasses.clear();
- // testClasses.add(TransactionTest.class);
+ // testClasses.add(HibernateBugzilla_417797_Test.class);
// if (true)
// {
// return;
@@ -104,6 +104,7 @@ public class AllTestsHibernate extends AllConfigs
testClasses.add(Hibernate_Failure_Test.class);
testClasses.add(Hibernate_Export_Test.class);
testClasses.add(HibernateBugzilla_381013_Test.class);
+ testClasses.add(HibernateBugzilla_417797_Test.class);
testClasses.add(HibernateBugzilla_392653_Test.class);
testClasses.add(HibernateBugzilla_387752_Test.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateBugzilla_417797_Test.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateBugzilla_417797_Test.java
new file mode 100644
index 0000000000..46c6dc9909
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateBugzilla_417797_Test.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2012, 2013 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:
+ * Martin Taal
+ */
+package org.eclipse.emf.cdo.tests.hibernate;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
+import org.eclipse.emf.cdo.tests.mango.MangoParameter;
+import org.eclipse.emf.cdo.tests.mango.ParameterPassing;
+import org.eclipse.emf.cdo.tests.mango.legacy.MangoPackage;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EcoreFactory;
+
+import org.hibernate.cache.ehcache.EhCacheRegionFactory;
+import org.hibernate.cfg.Environment;
+
+/**
+ *
+ * @author Martin Taal
+ */
+public class HibernateBugzilla_417797_Test extends AbstractCDOTest
+{
+
+ @Override
+ protected void doSetUp() throws Exception
+ {
+ final IRepositoryConfig repConfig = getRepositoryConfig();
+ final HibernateConfig hbConfig = (HibernateConfig)repConfig;
+
+ final EAnnotation eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource("teneo.jpa");
+ eAnnotation.getDetails().put("value", "@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)");
+ MangoPackage.eINSTANCE.getMangoParameter().getEAnnotations().add(eAnnotation);
+
+ hbConfig.getAdditionalProperties().put(Environment.USE_SECOND_LEVEL_CACHE, "true");
+ hbConfig.getAdditionalProperties().put(Environment.CACHE_REGION_FACTORY, EhCacheRegionFactory.class.getName());
+ super.doSetUp();
+ }
+
+ @Override
+ protected void doTearDown() throws Exception
+ {
+ final IRepositoryConfig repConfig = getRepositoryConfig();
+ final HibernateConfig hbConfig = (HibernateConfig)repConfig;
+ hbConfig.getAdditionalProperties().clear();
+ super.doTearDown();
+ }
+
+ @CleanRepositoriesBefore(reason = "Start with a fresh repo")
+ public void testBugzilla() throws Exception
+ {
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/test1"));
+
+ MangoParameter createMangoParameter = getMangoFactory().createMangoParameter();
+ createMangoParameter.setName("Mango1");
+ createMangoParameter.setPassing(ParameterPassing.BY_REFERENCE);
+
+ resource.getContents().add(createMangoParameter);
+
+ transaction.commit();
+ session.close();
+ }
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.getResource(getResourcePath("/test1"));
+ System.err.println(resource.getContents().get(0));
+ transaction.commit();
+ session.close();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java
index 677372d118..1dc3448d37 100644
--- a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateConfig.java
@@ -60,8 +60,8 @@ public class HibernateConfig extends RepositoryConfig
{
final Properties teneoProperties = new Properties();
Map<String, String> additionalProperties = getAdditionalProperties();
- teneoProperties.putAll(additionalProperties);
teneoProperties.load(getClass().getResourceAsStream("/app.properties"));
+ teneoProperties.putAll(additionalProperties);
for (Object key : teneoProperties.keySet())
{
props.put((String)key, teneoProperties.getProperty((String)key));

Back to the top