diff options
author | mtaal | 2011-02-21 05:23:17 +0000 |
---|---|---|
committer | mtaal | 2011-02-21 05:23:17 +0000 |
commit | 418c0c30c566a67e044cb713fba50769acfadc04 (patch) | |
tree | 9344696ac4290a5338bb5472ae0c1892f6d43ffd | |
parent | a4467885ed2ed4031e4f32b9356107a85165c153 (diff) | |
download | org.eclipse.emf.teneo-418c0c30c566a67e044cb713fba50769acfadc04.tar.gz org.eclipse.emf.teneo-418c0c30c566a67e044cb713fba50769acfadc04.tar.xz org.eclipse.emf.teneo-418c0c30c566a67e044cb713fba50769acfadc04.zip |
[331953]
2 files changed, 73 insertions, 1 deletions
diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java index 19d443980..c4bcc7002 100644 --- a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java +++ b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/AllTests.java @@ -47,7 +47,7 @@ import org.eclipse.emf.teneo.test.issues.TopClassesAction; * All tests * * @author <a href="mailto:mtaal@elver.org">Martin Taal</a> - * @version $Revision: 1.70 $ + * @version $Revision: 1.71 $ */ public class AllTests { @@ -55,6 +55,7 @@ public class AllTests { TestSuite suite = new MultiCfgTestSuite( "Test for org.eclipse.emf.teneo.hibernate.test.issues", HibernateTestbed.instance().getConfigurations()); + suite.addTestSuite(Bz331953Action.class); suite.addTestSuite(LargeMapValueAction.class); suite.addTestSuite(Bz284859Action.class); diff --git a/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/Bz331953Action.java b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/Bz331953Action.java new file mode 100644 index 000000000..c504b9a47 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.hibernate.test/src/org/eclipse/emf/teneo/hibernate/test/issues/Bz331953Action.java @@ -0,0 +1,71 @@ +/** + * <copyright> + * + * Copyright (c) 2011 Springsite BV (The Netherlands) 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 + * </copyright> + * + * $Id: Bz331953Action.java,v 1.1 2011/02/21 05:23:17 mtaal Exp $ + */ + +package org.eclipse.emf.teneo.hibernate.test.issues; + +import org.eclipse.emf.teneo.hibernate.mapping.identifier.IdentifierCacheHandler; +import org.eclipse.emf.teneo.samples.emf.sample.library.Book; +import org.eclipse.emf.teneo.samples.emf.sample.library.BookCategory; +import org.eclipse.emf.teneo.samples.emf.sample.library.Library; +import org.eclipse.emf.teneo.samples.emf.sample.library.LibraryFactory; +import org.eclipse.emf.teneo.samples.emf.sample.library.LibraryPackage; +import org.eclipse.emf.teneo.samples.emf.sample.library.Writer; +import org.eclipse.emf.teneo.test.AbstractTestAction; +import org.eclipse.emf.teneo.test.stores.TestStore; + +/** + * Tests the solution of https://bugs.eclipse.org/bugs/show_bug.cgi?id=331953 + * + * Roll back entity identifiers after unsuccessful resource save + * + * @author <a href="mailto:mtaal@elver.org">Martin Taal</a> + * @version $Revision: 1.1 $ + */ +public class Bz331953Action extends AbstractTestAction { + + public Bz331953Action() { + super(LibraryPackage.eINSTANCE); + } + + @Override + public void doAction(TestStore store) { + final LibraryFactory factory = LibraryFactory.eINSTANCE; + // create a book, writer and library + { + store.beginTransaction(); + + final Writer writer = factory.createWriter(); + final Book book = factory.createBook(); + book.setAuthor(writer); + book.setPages(5); + book.setCategory(BookCategory.SCIENCE_FICTION_LITERAL); + + final Library library = factory.createLibrary(); + library.getBooks().add(book); + library.setName("Science Fiction Library"); + library.getWriters().add(writer); + try { + store.store(library); + store.commitTransaction(); + fail("Expected exception"); + } catch (Throwable t) { + assertTrue(IdentifierCacheHandler.getInstance().getID(book) == null); + assertTrue(IdentifierCacheHandler.getInstance().getID(writer) == null); + } + } + } + +} |