diff options
author | Martin Taal | 2012-11-25 15:57:21 +0000 |
---|---|---|
committer | Martin Taal | 2012-11-25 15:57:21 +0000 |
commit | d2c6b937b688bd4e5c66d5c54aa7ca6be7c05cb5 (patch) | |
tree | 0b2635483958861a1a4c52101d8ac0e0546da467 /plugins/org.eclipse.emf.cdo.tests.hibernate | |
parent | afd69f07ced375df999e18f251d5a2747cc2a050 (diff) | |
download | cdo-d2c6b937b688bd4e5c66d5c54aa7ca6be7c05cb5.tar.gz cdo-d2c6b937b688bd4e5c66d5c54aa7ca6be7c05cb5.tar.xz cdo-d2c6b937b688bd4e5c66d5c54aa7ca6be7c05cb5.zip |
Support auditing in the hibernate store
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.hibernate')
2 files changed, 76 insertions, 5 deletions
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 587d844899..f80864b3e5 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 @@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.tests.CommitInfoTest; import org.eclipse.emf.cdo.tests.DynamicXSDTest; import org.eclipse.emf.cdo.tests.EMFCompareTest; import org.eclipse.emf.cdo.tests.ExternalReferenceTest; +import org.eclipse.emf.cdo.tests.FeatureMapTest; import org.eclipse.emf.cdo.tests.LockingManagerRestartRepositoryTest; import org.eclipse.emf.cdo.tests.LockingManagerRestartSessionTest; import org.eclipse.emf.cdo.tests.LockingManagerRestartTransactionTest; @@ -77,7 +78,10 @@ public class AllTestsHibernate extends AllConfigs protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario) { // testClasses.clear(); + // testClasses.add(HibernateQueryTest.class); // testClasses.add(AuditTest.class); + // testClasses.add(HibernateBugzilla_373545_Test.class); + // testClasses.add(Bugzilla_308895_Test.class); // if (true) // { // return; @@ -88,13 +92,9 @@ public class AllTestsHibernate extends AllConfigs testClasses.add(HibernateTimeStampTest.class); // removed stalls // testClasses.add(HibernateXATransactionTest.class); - testClasses.add(Hibernate_Bugzilla_279982_Test.class); testClasses.add(HibernateExternalAnnotationTest.class); - testClasses.add(HibernateMultiValuedOfAttributeTest.class); - testClasses.add(HibernateExternalReferenceTest.class); testClasses.add(HibernateQueryTest.class); testClasses.add(HibernateQueryNoCachingTest.class); - testClasses.add(HibernateBugzilla_258933_Test.class); testClasses.add(HibernateBugzilla_301104_Test.class); testClasses.add(HibernateBugzilla_362270_Test.class); @@ -114,7 +114,7 @@ public class AllTestsHibernate extends AllConfigs testClasses.add(CDOObjectHistoryTest.class); // the security model inherits from the ecore model - // not so well supported for now + // not so well supported for now for auditing testClasses.remove(SecurityManagerTest.class); // the package registry count changes when auditing @@ -123,11 +123,18 @@ public class AllTestsHibernate extends AllConfigs testClasses.add(HibernatePackageRegistryTest.class); testClasses.remove(Bugzilla_303466_Test.class); testClasses.add(Hibernate_Bugzilla_303466_Test.class); + + // feature maps are not handled correctly in CDO with auditing + testClasses.remove(FeatureMapTest.class); } else { + // these testcases uses commitinfo + // only supported with auditing testClasses.remove(Bugzilla_329254_Test.class); testClasses.remove(Hibernate_Bugzilla_329254_Test.class); + + // Commit info only works with auditing testClasses.remove(CommitInfoTest.class); } @@ -170,6 +177,8 @@ public class AllTestsHibernate extends AllConfigs // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330212 testClasses.remove(Bugzilla_322804_Test.class); + // overridden because Hibernate will treat all stale references as an exception + testClasses.add(Hibernate_Bugzilla_279982_Test.class); testClasses.remove(Bugzilla_279982_Test.class); // locking not supported @@ -190,6 +199,7 @@ public class AllTestsHibernate extends AllConfigs // testListOfInteger which has a List with a null value // this is not nicely supported by Hibernate // therefore this step is removed + testClasses.add(HibernateMultiValuedOfAttributeTest.class); testClasses.remove(MultiValuedOfAttributeTest.class); // MemStore is not relevant @@ -200,6 +210,7 @@ public class AllTestsHibernate extends AllConfigs // replace test case with one, disabling some non working testcases // see the HibernateExternalReferenceTest for a description + testClasses.add(HibernateExternalReferenceTest.class); testClasses.remove(ExternalReferenceTest.class); // this testcases removes and creates a resource with the @@ -209,6 +220,7 @@ public class AllTestsHibernate extends AllConfigs // override a testcase because the hibernate store // has a different meaning of unset + testClasses.add(HibernateBugzilla_258933_Test.class); testClasses.remove(Bugzilla_258933_Test.class); // replace as unsettable has to be re-visited for the hb store diff --git a/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateBugzilla_373545_Test.java b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateBugzilla_373545_Test.java new file mode 100644 index 0000000000..f8c2446f35 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HibernateBugzilla_373545_Test.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2004 - 2012 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 - initial API and implementation + */ +package org.eclipse.emf.cdo.tests.hibernate; + +import org.eclipse.emf.cdo.CDOObject; +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.legacy.model1.Model1Package; +import org.eclipse.emf.cdo.tests.model1.Category; +import org.eclipse.emf.cdo.transaction.CDOTransaction; + +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EcoreFactory; + +/** + * @author Martin Taal + */ +public class HibernateBugzilla_373545_Test extends AbstractCDOTest +{ + public void testSetId() throws Exception + { + // add the id and generated value annotations + final EAnnotation eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); + eAnnotation.setSource("teneo.jpa"); + eAnnotation.getDetails().put("value", "@Id @GeneratedValue(generator=\"system-uuid\")"); + Model1Package.eINSTANCE.getCategory_Name().getEAnnotations().add(eAnnotation); + + Category category1; + { + final CDOSession session = openSession(); + final CDOTransaction transaction = session.openTransaction(); + + final CDOResource resource = transaction.createResource(getResourcePath("/test1")); + category1 = getModel1Factory().createCategory(); + resource.getContents().add(category1); + + transaction.commit(); + } + { + final CDOSession session = openSession(); + final CDOTransaction transaction = session.openTransaction(); + final CDOResource resource = transaction.getResource(getResourcePath("/test1")); + final Category category2 = (Category)resource.getContents().get(0); + assertNotSame(category1, category2); + System.err.println(((CDOObject)category2).cdoID()); + assertNotNull(category2.getName()); + transaction.commit(); + } + } +} |