Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/EmbeddedIdAction.java')
-rwxr-xr-xtests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/EmbeddedIdAction.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/EmbeddedIdAction.java b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/EmbeddedIdAction.java
new file mode 100755
index 000000000..650b9f614
--- /dev/null
+++ b/tests/org.eclipse.emf.teneo.commontest/src/org/eclipse/emf/teneo/test/emf/annotations/EmbeddedIdAction.java
@@ -0,0 +1,59 @@
+/**
+ * <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:
+ * EmbeddedIdAction.java,v 1.3 2007/03/20 23:33:38 mtaal Exp $
+ */
+
+package org.eclipse.emf.teneo.test.emf.annotations;
+
+import java.util.List;
+
+import org.eclipse.emf.teneo.samples.emf.annotations.embeddedid.EmbeddedidFactory;
+import org.eclipse.emf.teneo.samples.emf.annotations.embeddedid.EmbeddedidPackage;
+import org.eclipse.emf.teneo.samples.emf.annotations.embeddedid.Name;
+import org.eclipse.emf.teneo.samples.emf.annotations.embeddedid.Person;
+import org.eclipse.emf.teneo.test.AbstractTestAction;
+import org.eclipse.emf.teneo.test.stores.TestStore;
+
+public class EmbeddedIdAction extends AbstractTestAction {
+
+ private static final String ADDRESS = "Amsterdamseweg 123, 4567AZ Amsterdam";
+ private static final String FIRST_NAME = "Jan";
+ private static final String LAST_NAME = "Janssen";
+
+ public EmbeddedIdAction() {
+ super(EmbeddedidPackage.eINSTANCE);
+ }
+
+ @Override
+ public void doAction(TestStore store) {
+ storePerson(store);
+ testPerson(store);
+ }
+
+ private void storePerson(TestStore store) {
+ final Person person = EmbeddedidFactory.eINSTANCE.createPerson();
+ final Name name = EmbeddedidFactory.eINSTANCE.createName();
+ name.setFirstName(FIRST_NAME);
+ name.setLastName(LAST_NAME);
+ person.setName(name);
+ person.setAddress(ADDRESS);
+ store.beginTransaction();
+ store.store(person);
+ store.commitTransaction();
+ }
+
+ private void testPerson(TestStore store) {
+ store.beginTransaction();
+ final List<?> persons = store.query("select p from Person p");
+ assertEquals(1, persons.size());
+ final Person person = (Person) persons.get(0);
+ assertEquals(FIRST_NAME, person.getName().getFirstName());
+ assertEquals(LAST_NAME, person.getName().getLastName());
+ assertEquals(ADDRESS, person.getAddress());
+ store.commitTransaction();
+ }
+
+}

Back to the top