cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1101590 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilderTest.java
Date Tue, 10 May 2011 18:39:22 GMT
Author: aadamchik
Date: Tue May 10 18:39:21 2011
New Revision: 1101590

URL: http://svn.apache.org/viewvc?rev=1101590&view=rev
Log:
CAY-1563 CayenneCase unit tests conversion(3)

patch by Dzmitry Kazimirchyk - UpdateBatchQueryBuilderTest

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilderTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilderTest.java?rev=1101590&r1=1101589&r2=1101590&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilderTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/UpdateBatchQueryBuilderTest.java
Tue May 10 18:39:21 2011
@@ -24,16 +24,24 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.cayenne.configuration.server.ServerRuntime;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.query.UpdateBatchQuery;
 import org.apache.cayenne.testdo.locking.SimpleLockingTestEntity;
-import org.apache.cayenne.unit.LockingCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-/**
- */
-public class UpdateBatchQueryBuilderTest extends LockingCase {
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class UpdateBatchQueryBuilderTest extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
+
+    @Inject
+    private DbAdapter adapter;
 
     public void testConstructor() throws Exception {
         DbAdapter adapter = new JdbcAdapter();
@@ -42,7 +50,7 @@ public class UpdateBatchQueryBuilderTest
     }
 
     public void testCreateSqlString() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
 
         List idAttributes = Collections.singletonList(entity
@@ -65,7 +73,7 @@ public class UpdateBatchQueryBuilderTest
     }
 
     public void testCreateSqlStringWithNulls() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
 
         List idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"), entity
@@ -94,7 +102,7 @@ public class UpdateBatchQueryBuilderTest
     }
 
     public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
         try {
 
@@ -110,28 +118,28 @@ public class UpdateBatchQueryBuilderTest
                     updatedAttributes,
                     null,
                     1);
-            JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter().getAdapter();
-            
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
             UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
             String generatedSql = builder.createSqlString(updateQuery);
-  
+
             String charStart = adapter.getIdentifiersStartQuote();
             String charEnd = adapter.getIdentifiersEndQuote();
-            
+
             assertNotNull(generatedSql);
-             assertEquals("UPDATE "
-             + charStart
-             + entity.getName()
-             + charEnd
-             + " SET "
-             + charStart
-             + "DESCRIPTION"
-             + charEnd
-             + " = ? WHERE "
-             + charStart
-             + "LOCKING_TEST_ID"
-             + charEnd
-             + " = ?", generatedSql);
+            assertEquals("UPDATE "
+                    + charStart
+                    + entity.getName()
+                    + charEnd
+                    + " SET "
+                    + charStart
+                    + "DESCRIPTION"
+                    + charEnd
+                    + " = ? WHERE "
+                    + charStart
+                    + "LOCKING_TEST_ID"
+                    + charEnd
+                    + " = ?", generatedSql);
 
         }
         finally {
@@ -140,7 +148,7 @@ public class UpdateBatchQueryBuilderTest
     }
 
     public void testCreateSqlStringWithNullsWithIdentifiersQuote() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
         try {
 
@@ -160,12 +168,12 @@ public class UpdateBatchQueryBuilderTest
                     updatedAttributes,
                     nullAttributes,
                     1);
-            JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter().getAdapter();
-            
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
             UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
             String generatedSql = builder.createSqlString(updateQuery);
             assertNotNull(generatedSql);
-  
+
             String charStart = adapter.getIdentifiersStartQuote();
             String charEnd = adapter.getIdentifiersEndQuote();
             assertEquals("UPDATE "



Mime
View raw message