Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtaal2008-11-15 21:37:37 +0000
committermtaal2008-11-15 21:37:37 +0000
commitb2c7040538f85926756ec1cc3418fdfc22ee5270 (patch)
tree78e843ab948c2a0192288893b1f122faee287601 /tests/org.eclipse.emf.teneo.commontest
parenta5269185533b6f7c940e45f6ae557710669fc845 (diff)
downloadorg.eclipse.emf.teneo-b2c7040538f85926756ec1cc3418fdfc22ee5270.tar.gz
org.eclipse.emf.teneo-b2c7040538f85926756ec1cc3418fdfc22ee5270.tar.xz
org.eclipse.emf.teneo-b2c7040538f85926756ec1cc3418fdfc22ee5270.zip
[253799]
[255059] [255443]
Diffstat (limited to 'tests/org.eclipse.emf.teneo.commontest')
-rw-r--r--tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/sample/LibraryResourceVisitTreeAction.java99
-rw-r--r--tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/issues/BZ253799Action.java52
2 files changed, 151 insertions, 0 deletions
diff --git a/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/sample/LibraryResourceVisitTreeAction.java b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/sample/LibraryResourceVisitTreeAction.java
new file mode 100644
index 000000000..93d5bbc61
--- /dev/null
+++ b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/sample/LibraryResourceVisitTreeAction.java
@@ -0,0 +1,99 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2006, 2007, 2008 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: LibraryResourceVisitTreeAction.java,v 1.1 2008/11/15 21:37:37 mtaal Exp $
+ */
+
+package org.eclipse.emf.teneo.test.emf.sample;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.teneo.TeneoException;
+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.samples.emf.sample.library.impl.LibraryImpl;
+import org.eclipse.emf.teneo.test.AbstractTestAction;
+import org.eclipse.emf.teneo.test.stores.TestStore;
+
+/**
+ * Tests how children are added to a resource.
+ *
+ * @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
+ * @version $Revision: 1.1 $
+ */
+public class LibraryResourceVisitTreeAction extends AbstractTestAction {
+ public LibraryResourceVisitTreeAction() {
+ super(LibraryPackage.eINSTANCE);
+ }
+
+ /** Creates an item, an address and links them to a po. */
+ @Override
+ public void doAction(TestStore store) {
+ final LibraryFactory factory = LibraryFactory.eINSTANCE;
+
+ // create a book, writer and library
+ try {
+ {
+ Resource res = store.getResource();
+ res.load(null);
+
+ final Writer writer = factory.createWriter();
+ writer.setName("JRR Tolkien");
+
+ final Book book = factory.createBook();
+ book.setAuthor(writer);
+ book.setPages(510);
+ book.setTitle("Fellowship of the Ring");
+ book.setCategory(BookCategory.SCIENCE_FICTION_LITERAL);
+ final Book book2 = factory.createBook();
+ book2.setAuthor(writer);
+ book2.setPages(500);
+ book2.setTitle("The Hobbit");
+ book2.setCategory(BookCategory.SCIENCE_FICTION_LITERAL);
+
+ // sorry george making a mistake here, will correct this below
+ final Book book3 = factory.createBook();
+ book3.setAuthor(writer);
+ book3.setPages(500);
+ book3.setTitle("1984");
+ book3.setCategory(BookCategory.SCIENCE_FICTION_LITERAL);
+ final Library library = factory.createLibrary();
+ library.setName("Science Fiction");
+ library.getBooks().add(book);
+ library.getBooks().add(book2);
+ library.getBooks().add(book3);
+ library.getWriters().add(writer);
+
+ res.getContents().add(library);
+ res.save(null);
+ res.unload();
+ }
+
+ {
+ Resource res = store.getResource("query1=From " + LibraryImpl.class.getName());
+
+// res.setTrackingModification(true);
+ res.load(null);
+
+ Library lib = (Library) res.getContents().get(0);
+
+ res.unload();
+ }
+ } catch (Exception e) {
+ throw new TeneoException(e.getMessage(), e);
+ }
+ }
+}
diff --git a/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/issues/BZ253799Action.java b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/issues/BZ253799Action.java
new file mode 100644
index 000000000..3484168b5
--- /dev/null
+++ b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/issues/BZ253799Action.java
@@ -0,0 +1,52 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2006, 2007, 2008 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: BZ253799Action.java,v 1.1 2008/11/15 21:37:37 mtaal Exp $
+ */
+
+package org.eclipse.emf.teneo.test.issues;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.teneo.samples.issues.bz253799.Bz253799Factory;
+import org.eclipse.emf.teneo.samples.issues.bz253799.Bz253799Package;
+import org.eclipse.emf.teneo.samples.issues.bz253799.One;
+import org.eclipse.emf.teneo.test.AbstractTestAction;
+import org.eclipse.emf.teneo.test.stores.TestStore;
+
+/**
+ * Testcase for bugzilla 253799
+ *
+ * @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
+ * @version $Revision: 1.1 $
+ */
+public class BZ253799Action extends AbstractTestAction {
+ public BZ253799Action() {
+ super(new EPackage[] { Bz253799Package.eINSTANCE });
+ }
+
+ @Override
+ public void doAction(TestStore store) {
+ final Bz253799Factory factory = Bz253799Factory.eINSTANCE;
+ {
+ store.beginTransaction();
+ final One one = factory.createOne();
+ try {
+ store.store(one);
+ store.commitTransaction();
+ fail();
+ } catch (Exception e) {
+ // successfull
+ }
+ }
+ }
+} \ No newline at end of file

Back to the top