cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1099183 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilderTest.java
Date Tue, 03 May 2011 18:41:10 GMT
Author: aadamchik
Date: Tue May  3 18:41:09 2011
New Revision: 1099183

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

patches by Dzmitry Kazimirchyk:
InsertBatchQueryBuilderTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilderTest.java?rev=1099183&r1=1099182&r2=1099183&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilderTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/trans/InsertBatchQueryBuilderTest.java
Tue May  3 18:41:09 2011
@@ -18,17 +18,24 @@
  ****************************************************************/
 package org.apache.cayenne.access.trans;
 
-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.InsertBatchQuery;
 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;
+
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class InsertBatchQueryBuilderTest extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
 
-public class InsertBatchQueryBuilderTest extends LockingCase {
+    @Inject
+    private DbAdapter adapter;
 
     public void testConstructor() throws Exception {
         DbAdapter adapter = new JdbcAdapter();
@@ -39,12 +46,9 @@ public class InsertBatchQueryBuilderTest
     }
 
     public void testCreateSqlString() throws Exception {
-        DbEntity entity = getDomain().getEntityResolver().lookupObjEntity(
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().lookupObjEntity(
                 SimpleLockingTestEntity.class).getDbEntity();
 
-        List idAttributes = Collections.singletonList(entity
-                .getAttribute("LOCKING_TEST_ID"));
-
         InsertBatchQuery deleteQuery = new InsertBatchQuery(entity, 1);
         InsertBatchQueryBuilder builder = new InsertBatchQueryBuilder(new JdbcAdapter());
         String generatedSql = builder.createSqlString(deleteQuery);
@@ -55,16 +59,14 @@ public class InsertBatchQueryBuilderTest
     }
 
     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"));
-           
-            JdbcAdapter adapter = (JdbcAdapter) getAccessStackAdapter().getAdapter();
-            
+
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
             InsertBatchQuery deleteQuery = new InsertBatchQuery(entity, 1);
             InsertBatchQueryBuilder builder = new InsertBatchQueryBuilder(adapter);
             String generatedSql = builder.createSqlString(deleteQuery);



Mime
View raw message