cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r566144 - in /cayenne/main/trunk/itests/cayenne-api/src: main/java/org/apache/cayenne/itest/cpa/defaults/client/ main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/ main/resources/ test/java/org/apache/cayenne/itest/cpa/conf/
Date Wed, 15 Aug 2007 13:35:12 GMT
Author: aadamchik
Date: Wed Aug 15 06:35:11 2007
New Revision: 566144

URL: http://svn.apache.org/viewvc?view=rev&rev=566144
Log:
CAY-843 Remove arbitrary reverse relationship mapping limitations
(adding client uint tests - still some work to be done to make client one-way relationships
work like the server)

Added:
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable1.java
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable2.java
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable3.java
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable4.java
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable1.java
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable2.java
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable3.java
    cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable4.java
    cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateClientDefaultsLoadingTest.java
Modified:
    cayenne/main/trunk/itests/cayenne-api/src/main/resources/defaults-mapping-map.map.xml
    cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateDefaultsLoadingTest.java

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable1.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable1.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable1.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,10 @@
+package org.apache.cayenne.itest.cpa.defaults.client;
+
+import org.apache.cayenne.itest.cpa.defaults.client.auto._DefaultsTable1;
+
+/**
+ * A persistent class mapped as "DefaultsTable1" Cayenne entity.
+ */
+public class DefaultsTable1 extends _DefaultsTable1 {
+
+}

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable2.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable2.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable2.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable2.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,10 @@
+package org.apache.cayenne.itest.cpa.defaults.client;
+
+import org.apache.cayenne.itest.cpa.defaults.client.auto._DefaultsTable2;
+
+/**
+ * A persistent class mapped as "DefaultsTable2" Cayenne entity.
+ */
+public class DefaultsTable2 extends _DefaultsTable2 {
+
+}

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable3.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable3.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable3.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable3.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,10 @@
+package org.apache.cayenne.itest.cpa.defaults.client;
+
+import org.apache.cayenne.itest.cpa.defaults.client.auto._DefaultsTable3;
+
+/**
+ * A persistent class mapped as "DefaultsTable3" Cayenne entity.
+ */
+public class DefaultsTable3 extends _DefaultsTable3 {
+
+}

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable4.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable4.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable4.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/DefaultsTable4.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,10 @@
+package org.apache.cayenne.itest.cpa.defaults.client;
+
+import org.apache.cayenne.itest.cpa.defaults.client.auto._DefaultsTable4;
+
+/**
+ * A persistent class mapped as "DefaultsTable4" Cayenne entity.
+ */
+public class DefaultsTable4 extends _DefaultsTable4 {
+
+}

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable1.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable1.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable1.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,38 @@
+package org.apache.cayenne.itest.cpa.defaults.client.auto;
+
+import org.apache.cayenne.PersistentObject;
+
+/**
+ * A generated persistent class mapped as "DefaultsTable1" Cayenne entity. It is a good idea
to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _DefaultsTable1 extends PersistentObject {
+
+    public static final String NAME_PROPERTY = "name";
+
+    protected String name;
+
+    public String getName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name", false);
+        }
+        
+        return name;
+    }
+    public void setName(String name) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name", false);
+        }
+        
+        Object oldValue = this.name;
+        this.name = name;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "name", oldValue, name);
+        }
+    }
+    
+    
+}

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable2.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable2.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable2.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable2.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,33 @@
+package org.apache.cayenne.itest.cpa.defaults.client.auto;
+
+import org.apache.cayenne.PersistentObject;
+import org.apache.cayenne.ValueHolder;
+import org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable1;
+
+/**
+ * A generated persistent class mapped as "DefaultsTable2" Cayenne entity. It is a good idea
to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _DefaultsTable2 extends PersistentObject {
+
+    public static final String TO_TABLE1_PROPERTY = "toTable1";
+
+    protected ValueHolder toTable1;
+
+    public DefaultsTable1 getToTable1() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "toTable1", true);
+        }
+        
+        return (DefaultsTable1) toTable1.getValue();
+    }
+    public void setToTable1(DefaultsTable1 toTable1) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "toTable1", true);
+        }
+        
+        this.toTable1.setValue(toTable1);
+    }
+    
+}

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable3.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable3.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable3.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable3.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,65 @@
+package org.apache.cayenne.itest.cpa.defaults.client.auto;
+
+import java.util.List;
+
+import org.apache.cayenne.PersistentObject;
+import org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable4;
+
+/**
+ * A generated persistent class mapped as "DefaultsTable3" Cayenne entity. It is a good idea
to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _DefaultsTable3 extends PersistentObject {
+
+    public static final String NAME_PROPERTY = "name";
+    public static final String DEFAULT_TABLE4S_PROPERTY = "defaultTable4s";
+
+    protected String name;
+    protected List defaultTable4s;
+
+    public String getName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name", false);
+        }
+        
+        return name;
+    }
+    public void setName(String name) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name", false);
+        }
+        
+        Object oldValue = this.name;
+        this.name = name;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "name", oldValue, name);
+        }
+    }
+    
+    
+    public List getDefaultTable4s() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "defaultTable4s", true);
+        }
+        
+        return defaultTable4s;
+    }
+    public void addToDefaultTable4s(DefaultsTable4 object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "defaultTable4s", true);
+        }
+        
+        this.defaultTable4s.add(object);
+    }
+    public void removeFromDefaultTable4s(DefaultsTable4 object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "defaultTable4s", true);
+        }
+        
+        this.defaultTable4s.remove(object);
+    }
+    
+}

Added: cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable4.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable4.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable4.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/java/org/apache/cayenne/itest/cpa/defaults/client/auto/_DefaultsTable4.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,14 @@
+package org.apache.cayenne.itest.cpa.defaults.client.auto;
+
+import org.apache.cayenne.PersistentObject;
+
+/**
+ * A generated persistent class mapped as "DefaultsTable4" Cayenne entity. It is a good idea
to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _DefaultsTable4 extends PersistentObject {
+
+
+
+}

Modified: cayenne/main/trunk/itests/cayenne-api/src/main/resources/defaults-mapping-map.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/main/resources/defaults-mapping-map.map.xml?view=diff&rev=566144&r1=566143&r2=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/main/resources/defaults-mapping-map.map.xml
(original)
+++ cayenne/main/trunk/itests/cayenne-api/src/main/resources/defaults-mapping-map.map.xml
Wed Aug 15 06:35:11 2007
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <data-map project-version="2.0">
 	<property name="defaultPackage" value="org.apache.cayenne.itest.cpa.defaults"/>
+	<property name="clientSupported" value="true"/>
+	<property name="defaultClientPackage" value="org.apache.cayenne.itest.cpa.defaults.client"/>
 	<db-entity name="defaults_table1">
 		<db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 		<db-attribute name="name" type="VARCHAR" length="100"/>
@@ -17,15 +19,15 @@
 		<db-attribute name="defaults_table3_id" type="INTEGER"/>
 		<db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 	</db-entity>
-	<obj-entity name="DefaultsTable1" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable1"
dbEntityName="defaults_table1">
+	<obj-entity name="DefaultsTable1" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable1"
clientClassName="org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable1" dbEntityName="defaults_table1">
 		<obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
 	</obj-entity>
-	<obj-entity name="DefaultsTable2" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable2"
dbEntityName="defaults_table2">
+	<obj-entity name="DefaultsTable2" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable2"
clientClassName="org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable2" dbEntityName="defaults_table2">
 	</obj-entity>
-	<obj-entity name="DefaultsTable3" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable3"
dbEntityName="defaults_table3">
+	<obj-entity name="DefaultsTable3" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable3"
clientClassName="org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable3" dbEntityName="defaults_table3">
 		<obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
 	</obj-entity>
-	<obj-entity name="DefaultsTable4" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable4"
dbEntityName="defaults_table4">
+	<obj-entity name="DefaultsTable4" className="org.apache.cayenne.itest.cpa.defaults.DefaultsTable4"
clientClassName="org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable4" dbEntityName="defaults_table4">
 	</obj-entity>
 	<db-relationship name="to_table1" source="defaults_table2" target="defaults_table1" toMany="false">
 		<db-attribute-pair source="defaults_table1_id" target="id"/>

Added: cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateClientDefaultsLoadingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateClientDefaultsLoadingTest.java?view=auto&rev=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateClientDefaultsLoadingTest.java
(added)
+++ cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateClientDefaultsLoadingTest.java
Wed Aug 15 06:35:11 2007
@@ -0,0 +1,66 @@
+package org.apache.cayenne.itest.cpa.conf;
+
+import java.util.Collections;
+
+import org.apache.cayenne.DataObjectUtils;
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.itest.cpa.CPAContextCase;
+import org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable3;
+import org.apache.cayenne.itest.cpa.defaults.client.DefaultsTable4;
+import org.apache.cayenne.query.RefreshQuery;
+
+public class RuntimeLoaderDelegateClientDefaultsLoadingTest extends
+		CPAContextCase {
+
+	/**
+	 * Ensures that one-way mapping can be used from the client.
+	 */
+	public void testUpdateImplicitClientToOne() throws Exception {
+		getDbHelper().deleteAll("defaults_table4");
+		getDbHelper().deleteAll("defaults_table3");
+		getDbHelper().insert("defaults_table3", new String[] { "id", "name" },
+				new Object[] { 1, "X" });
+		getDbHelper().insert("defaults_table3", new String[] { "id", "name" },
+				new Object[] { 2, "Y" });
+		getDbHelper().insert("defaults_table4",
+				new String[] { "id", "defaults_table3_id" },
+				new Object[] { 1, 1 });
+
+		ObjectContext clientContext = getClientContext();
+
+		DefaultsTable4 o = (DefaultsTable4) DataObjectUtils.objectForPK(
+				clientContext, DefaultsTable4.class, Collections.singletonMap(
+						"id", 1));
+		DefaultsTable3 o1 = (DefaultsTable3) DataObjectUtils.objectForPK(
+				clientContext, DefaultsTable3.class, Collections.singletonMap(
+						"id", 1));
+		DefaultsTable3 o2 = (DefaultsTable3) DataObjectUtils.objectForPK(
+				clientContext, DefaultsTable3.class, Collections.singletonMap(
+						"id", 2));
+
+		assertEquals(1, o1.getDefaultTable4s().size());
+		assertEquals(0, o2.getDefaultTable4s().size());
+
+		o2.addToDefaultTable4s(o);
+
+		assertEquals(1, o2.getDefaultTable4s().size());
+		assertFalse(clientContext.modifiedObjects().isEmpty());
+		clientContext.commitChanges();
+		assertEquals(1, o2.getDefaultTable4s().size());
+
+		// there is a bug in RefreshQuery that fails to invalidate to-many on
+		// the client - so working around it be creating a new context; still
+		// running the query though to refresh the server
+		clientContext.performQuery(new RefreshQuery());
+
+		clientContext = getClientContext(true);
+		o1 = (DefaultsTable3) DataObjectUtils.objectForPK(clientContext,
+				DefaultsTable3.class, Collections.singletonMap("id", 1));
+		o2 = (DefaultsTable3) DataObjectUtils.objectForPK(clientContext,
+				DefaultsTable3.class, Collections.singletonMap("id", 2));
+
+		// TODO: andrus 8/15/2007 this fails
+		// assertEquals(1, o2.getDefaultTable4s().size());
+		// assertEquals(0, o1.getDefaultTable4s().size());
+	}
+}

Modified: cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateDefaultsLoadingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateDefaultsLoadingTest.java?view=diff&rev=566144&r1=566143&r2=566144
==============================================================================
--- cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateDefaultsLoadingTest.java
(original)
+++ cayenne/main/trunk/itests/cayenne-api/src/test/java/org/apache/cayenne/itest/cpa/conf/RuntimeLoaderDelegateDefaultsLoadingTest.java
Wed Aug 15 06:35:11 2007
@@ -13,9 +13,9 @@
 
 	public void testLoadedReverseDb() {
 
-		DbEntity table1 = context.getEntityResolver().getDbEntity(
+		DbEntity table1 = getContext().getEntityResolver().getDbEntity(
 				"defaults_table1");
-		DbEntity table2 = context.getEntityResolver().getDbEntity(
+		DbEntity table2 = getContext().getEntityResolver().getDbEntity(
 				"defaults_table2");
 		assertNotNull(table1.getAnyRelationship(table2));
 		assertTrue(table1.getAnyRelationship(table2).isRuntime());
@@ -24,9 +24,9 @@
 
 	public void testLoadedReverseObj() {
 
-		ObjEntity class1 = context.getEntityResolver().getObjEntity(
+		ObjEntity class1 = getContext().getEntityResolver().getObjEntity(
 				"DefaultsTable1");
-		ObjEntity class2 = context.getEntityResolver().getObjEntity(
+		ObjEntity class2 = getContext().getEntityResolver().getObjEntity(
 				"DefaultsTable2");
 		assertNotNull(class1.getAnyRelationship(class2));
 		assertTrue(class1.getAnyRelationship(class2).isRuntime());
@@ -43,12 +43,12 @@
 				new Object[] { 1, 1 });
 
 		DefaultsTable2 o = (DefaultsTable2) DataObjectUtils.objectForPK(
-				context, DefaultsTable2.class, 1);
+				getContext(), DefaultsTable2.class, 1);
 		assertNotNull(o.getToTable1());
 		assertEquals("X", o.getToTable1().getName());
 	}
 
-	public void testUpdateImplicitToMany() throws Exception {
+	public void testUpdateImplicitToOne() throws Exception {
 		getDbHelper().deleteAll("defaults_table4");
 		getDbHelper().deleteAll("defaults_table3");
 		getDbHelper().insert("defaults_table3", new String[] { "id", "name" },
@@ -60,11 +60,11 @@
 				new Object[] { 1, 1 });
 
 		DefaultsTable4 o = (DefaultsTable4) DataObjectUtils.objectForPK(
-				context, DefaultsTable4.class, 1);
+				getContext(), DefaultsTable4.class, 1);
 		DefaultsTable3 o1 = (DefaultsTable3) DataObjectUtils.objectForPK(
-				context, DefaultsTable3.class, 1);
+				getContext(), DefaultsTable3.class, 1);
 		DefaultsTable3 o2 = (DefaultsTable3) DataObjectUtils.objectForPK(
-				context, DefaultsTable3.class, 2);
+				getContext(), DefaultsTable3.class, 2);
 
 		assertEquals(1, o1.getDefaultTable4s().size());
 		assertEquals(0, o2.getDefaultTable4s().size());
@@ -72,10 +72,10 @@
 		o2.addToDefaultTable4s(o);
 
 		assertEquals(1, o2.getDefaultTable4s().size());
-		context.commitChanges();
+		getContext().commitChanges();
 		assertEquals(1, o2.getDefaultTable4s().size());
 
-		context.performQuery(new RefreshQuery());
+		getContext().performQuery(new RefreshQuery());
 
 		// note that the old to-many is only refreshed after invalidation with
 		// RefreshQuery... should this be treated as a bug?



Mime
View raw message