cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r671530 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test: java/org/apache/cayenne/access/DataContextRefreshQueryTest.java resources/dml/access.DataContextRefreshQueryTest.xml
Date Wed, 25 Jun 2008 12:35:52 GMT
Author: aadamchik
Date: Wed Jun 25 05:35:52 2008
New Revision: 671530

URL: http://svn.apache.org/viewvc?rev=671530&view=rev
Log:
refresh query relationship refreshing test - DataContext

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextRefreshQueryTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextRefreshQueryTest.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextRefreshQueryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextRefreshQueryTest.java?rev=671530&r1=671529&r2=671530&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextRefreshQueryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextRefreshQueryTest.java
Wed Jun 25 05:35:52 2008
@@ -160,6 +160,23 @@
                 .isFault());
     }
 
+    public void testRefreshObjectToMany() throws Exception {
+        deleteTestData();
+        createTestData("testRefreshObjectToMany");
+
+        DataContext context = createDataContext();
+
+        Artist a = DataObjectUtils.objectForPK(context, Artist.class, 33001l);
+        assertEquals(2, a.getPaintingArray().size());
+
+        createTestData("testRefreshObjectToManyUpdate");
+
+        RefreshQuery refresh = new RefreshQuery(a);
+        context.performQuery(refresh);
+        assertEquals(PersistenceState.HOLLOW, a.getPersistenceState());
+        assertEquals(1, a.getPaintingArray().size());
+    }
+
     public void testRefreshQueryResultsLocalCache() throws Exception {
         deleteTestData();
         createTestData("testRefreshCollection");
@@ -176,10 +193,7 @@
         List paints = context.performQuery(q);
 
         // fetch P1 separately from cached query
-        Painting p1 = DataObjectUtils.objectForPK(
-                context,
-                Painting.class,
-                33001);
+        Painting p1 = DataObjectUtils.objectForPK(context, Painting.class, 33001);
 
         Painting p2 = (Painting) paints.get(0);
         Artist a1 = p2.getToArtist();
@@ -236,10 +250,7 @@
         List paints = context.performQuery(q);
 
         // fetch P1 separately from cached query
-        Painting p1 = DataObjectUtils.objectForPK(
-                context,
-                Painting.class,
-                33001);
+        Painting p1 = DataObjectUtils.objectForPK(context, Painting.class, 33001);
 
         Painting p2 = (Painting) paints.get(0);
         Artist a1 = p2.getToArtist();
@@ -296,10 +307,7 @@
         List paints = context.performQuery(q);
 
         // fetch P1 separately from cached query
-        Painting p1 = DataObjectUtils.objectForPK(
-                context,
-                Painting.class,
-                33001);
+        Painting p1 = DataObjectUtils.objectForPK(context, Painting.class, 33001);
 
         Painting p2 = (Painting) paints.get(0);
         Artist a1 = p2.getToArtist();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextRefreshQueryTest.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextRefreshQueryTest.xml?rev=671530&r1=671529&r2=671530&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextRefreshQueryTest.xml
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextRefreshQueryTest.xml
Wed Jun 25 05:35:52 2008
@@ -42,6 +42,13 @@
 		</value></constructor-arg>
 	</bean>
 	
+	<bean id="PU2" class="org.apache.cayenne.unit.util.UpdatingSQLTemplate">
+		<constructor-arg type="java.lang.Class"><value>org.apache.art.Painting</value></constructor-arg>
+		<constructor-arg><value>
+		DELETE FROM PAINTING WHERE PAINTING_ID = 33001
+		</value></constructor-arg>
+	</bean>
+	
 	<!-- ======================================= -->
 	<!-- Data Sets -->
 	<!-- ======================================= -->	
@@ -64,4 +71,22 @@
 			</list>
 		</constructor-arg>
 	</bean>
+	
+	<bean id="testRefreshObjectToMany" class="java.util.ArrayList">
+		<constructor-arg>
+			<list>
+				<ref bean="A1"/>
+				<ref bean="P11"/>
+				<ref bean="P12"/>
+			</list>
+		</constructor-arg>
+	</bean>
+	
+	<bean id="testRefreshObjectToManyUpdate" class="java.util.ArrayList">
+		<constructor-arg>
+			<list>
+				<ref bean="PU2"/>
+			</list>
+		</constructor-arg>
+	</bean>
 </beans>
\ No newline at end of file



Mime
View raw message