cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1103409 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java
Date Sun, 15 May 2011 14:48:05 GMT
Author: aadamchik
Date: Sun May 15 14:48:05 2011
New Revision: 1103409

URL: http://svn.apache.org/viewvc?rev=1103409&view=rev
Log:
CAY-1564 CayenneCase unit tests conversion(4)

patch by Dzmitry Kazimirchyk - StatementFetchSizeTest

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java?rev=1103409&r1=1103408&r2=1103409&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java
Sun May 15 14:48:05 2011
@@ -18,38 +18,56 @@
  ****************************************************************/
 package org.apache.cayenne.query;
 
+import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.ObjectId;
-import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.testdo.testmap.Artist;
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class StatementFetchSizeTest extends ServerCase {
+
+    @Inject
+    private ObjectContext context;
 
-public class StatementFetchSizeTest extends CayenneCase {
     public void test() {
-        DataContext dataContext = createDataContext();
-        
         SelectQuery query = new SelectQuery(Artist.class);
         query.setStatementFetchSize(10);
-        
-        assertEquals(10, query.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
-        dataContext.performQuery(query);
-        
-        SQLTemplate template = new SQLTemplate(Artist.class, "SELECT ARTIST_ID FROM ARTIST");
+
+        assertEquals(10, query
+                .getMetaData(context.getEntityResolver())
+                .getStatementFetchSize());
+        context.performQuery(query);
+
+        SQLTemplate template = new SQLTemplate(
+                Artist.class,
+                "SELECT ARTIST_ID FROM ARTIST");
         template.setStatementFetchSize(10);
-        
-        assertEquals(10, template.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
-        dataContext.performQuery(template);
-        
+
+        assertEquals(10, template
+                .getMetaData(context.getEntityResolver())
+                .getStatementFetchSize());
+        context.performQuery(template);
+
         EJBQLQuery ejbql = new EJBQLQuery("select a from Artist a");
         ejbql.setStatementFetchSize(10);
-        
-        assertEquals(10, ejbql.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
-        dataContext.performQuery(ejbql);
-        
+
+        assertEquals(10, ejbql
+                .getMetaData(context.getEntityResolver())
+                .getStatementFetchSize());
+        context.performQuery(ejbql);
+
         ObjectId id = new ObjectId("Artist", Artist.ARTIST_ID_PK_COLUMN, 1);
-        RelationshipQuery relationshipQuery = new RelationshipQuery(id, Artist.PAINTING_ARRAY_PROPERTY,
true);
+        RelationshipQuery relationshipQuery = new RelationshipQuery(
+                id,
+                Artist.PAINTING_ARRAY_PROPERTY,
+                true);
         relationshipQuery.setStatementFetchSize(10);
-        
-        assertEquals(10, relationshipQuery.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
-        dataContext.performQuery(relationshipQuery);
+
+        assertEquals(10, relationshipQuery
+                .getMetaData(context.getEntityResolver())
+                .getStatementFetchSize());
+        context.performQuery(relationshipQuery);
     }
 }



Mime
View raw message