cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1099057 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java
Date Tue, 03 May 2011 13:59:36 GMT
Author: aadamchik
Date: Tue May  3 13:59:36 2011
New Revision: 1099057

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

patches by Dzmitry Kazimirchyk:
DeleteBatchQueryBuilderTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java?rev=1099057&r1=1099056&r2=1099057&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/DeleteBatchQueryBuilderTest.java
Tue May  3 13:59:36 2011
@@ -24,16 +24,25 @@ 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.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.query.DeleteBatchQuery;
 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 DeleteBatchQueryBuilderTest extends LockingCase {
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class DeleteBatchQueryBuilderTest extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
+
+    @Inject
+    private DbAdapter adapter;
 
     public void testConstructor() throws Exception {
         DbAdapter adapter = new JdbcAdapter();
@@ -44,10 +53,10 @@ public class DeleteBatchQueryBuilderTest
     }
 
     public void testCreateSqlString() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
 
-        List idAttributes = Collections.singletonList(entity
+        List<DbAttribute> idAttributes = Collections.singletonList((DbAttribute) entity
                 .getAttribute("LOCKING_TEST_ID"));
 
         DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, null, 1);
@@ -60,13 +69,14 @@ public class DeleteBatchQueryBuilderTest
     }
 
     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
+        List<DbAttribute> idAttributes = Arrays.asList((DbAttribute) entity
+                .getAttribute("LOCKING_TEST_ID"), (DbAttribute) entity
                 .getAttribute("NAME"));
 
-        Collection nullAttributes = Collections.singleton("NAME");
+        Collection<String> nullAttributes = Collections.singleton("NAME");
 
         DeleteBatchQuery deleteQuery = new DeleteBatchQuery(
                 entity,
@@ -82,23 +92,23 @@ public class DeleteBatchQueryBuilderTest
     }
 
     public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
         try {
 
             entity.getDataMap().setQuotingSQLIdentifiers(true);
-            List idAttributes = Collections.singletonList(entity
-                    .getAttribute("LOCKING_TEST_ID"));
+            List<DbAttribute> idAttributes = Collections
+                    .singletonList((DbAttribute) entity.getAttribute("LOCKING_TEST_ID"));
 
             DeleteBatchQuery deleteQuery = new DeleteBatchQuery(
                     entity,
                     idAttributes,
                     null,
                     1);
-            JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter().getAdapter();
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
             DeleteBatchQueryBuilder builder = new DeleteBatchQueryBuilder(adapter);
             String generatedSql = builder.createSqlString(deleteQuery);
-            
+
             String charStart = adapter.getIdentifiersStartQuote();
             String charEnd = adapter.getIdentifiersEndQuote();
 
@@ -120,26 +130,26 @@ public class DeleteBatchQueryBuilderTest
     }
 
     public void testCreateSqlStringWithNullsWithIdentifiersQuote() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
         try {
 
             entity.getDataMap().setQuotingSQLIdentifiers(true);
 
-            List idAttributes = Arrays.asList(
-                    entity.getAttribute("LOCKING_TEST_ID"),
-                    entity.getAttribute("NAME"));
+            List<DbAttribute> idAttributes = Arrays.asList((DbAttribute) entity
+                    .getAttribute("LOCKING_TEST_ID"), (DbAttribute) entity
+                    .getAttribute("NAME"));
 
-            Collection nullAttributes = Collections.singleton("NAME");
+            Collection<String> nullAttributes = Collections.singleton("NAME");
 
             DeleteBatchQuery deleteQuery = new DeleteBatchQuery(
                     entity,
                     idAttributes,
                     nullAttributes,
                     1);
-            
-            JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter().getAdapter();
-            
+
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
             DeleteBatchQueryBuilder builder = new DeleteBatchQueryBuilder(adapter);
             String generatedSql = builder.createSqlString(deleteQuery);
 



Mime
View raw message