diff options
Diffstat (limited to 'tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/PKeyJoinAction.java')
-rwxr-xr-x | tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/PKeyJoinAction.java | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/PKeyJoinAction.java b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/PKeyJoinAction.java new file mode 100755 index 000000000..60e6fcc59 --- /dev/null +++ b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/PKeyJoinAction.java @@ -0,0 +1,89 @@ +/** + * <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: PKeyJoinAction.java,v 1.6 2008/07/06 16:23:25 mtaal Exp $ + */ + +package org.eclipse.emf.teneo.test.emf.annotations; + +import java.util.List; + +import org.eclipse.emf.teneo.samples.emf.annotations.primarykeyjoin.Body; +import org.eclipse.emf.teneo.samples.emf.annotations.primarykeyjoin.Head; +import org.eclipse.emf.teneo.samples.emf.annotations.primarykeyjoin.PrimarykeyjoinFactory; +import org.eclipse.emf.teneo.samples.emf.annotations.primarykeyjoin.PrimarykeyjoinPackage; +import org.eclipse.emf.teneo.test.AbstractTestAction; +import org.eclipse.emf.teneo.test.stores.TestStore; + +/** + * Testcase + * + * @author <a href="mailto:mtaal@elver.org">Martin Taal</a> + * @version $Revision: 1.6 $ + */ +public class PKeyJoinAction extends AbstractTestAction { + /** + * Constructor for ClassHierarchyParsing. + * + * @param arg0 + */ + public PKeyJoinAction() { + super(PrimarykeyjoinPackage.eINSTANCE); + } + + /** Creates an item, an address and links them to a po. */ + @Override + public void doAction(TestStore store) { + final PrimarykeyjoinFactory factory = PrimarykeyjoinFactory.eINSTANCE; + { + store.beginTransaction(); + final Body bd = factory.createBody(); + bd.setTheID(5); + final Head hd = factory.createHead(); + hd.setMyID(5); + bd.setHead(hd); + store.store(bd); + store.store(hd); + store.commitTransaction(); + } + { + store.beginTransaction(); + final Body bd = store.getObject(Body.class); + assertEquals(5, bd.getHead().getMyID()); + assertEquals(5, bd.getTheID()); + store.commitTransaction(); + } + + { + store.beginTransaction(); + final Body bd = factory.createBody(); + bd.setTheID(6); + final Head hd = factory.createHead(); + hd.setMyID(7); + bd.setHead(hd); + store.store(bd); + store.store(hd); + store.commitTransaction(); + } + { + store.beginTransaction(); + final List<?> bds = store.getObjects(Body.class); + for (Object o : bds) { + final Body b = (Body) o; + assertTrue(b.getTheID() == 5 || b.getTheID() == 7); + } + store.commitTransaction(); + } + + } +}
\ No newline at end of file |