cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1099055 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java
Date Tue, 03 May 2011 13:53:07 GMT
Author: aadamchik
Date: Tue May  3 13:53:07 2011
New Revision: 1099055

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

patches by Dzmitry Kazimirchyk:
BatchActionLockingTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java?rev=1099055&r1=1099054&r2=1099055&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BatchActionLockingTest.java
Tue May  3 13:53:07 2011
@@ -29,22 +29,28 @@ import java.util.Map;
 import org.apache.cayenne.access.MockOperationObserver;
 import org.apache.cayenne.access.OptimisticLockException;
 import org.apache.cayenne.access.trans.DeleteBatchQueryBuilder;
+import org.apache.cayenne.configuration.server.ServerRuntime;
 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.map.EntityResolver;
 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;
 
 import com.mockrunner.jdbc.PreparedStatementResultSetHandler;
 import com.mockrunner.mock.jdbc.MockConnection;
 
-/**
- */
-public class BatchActionLockingTest extends LockingCase {
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class BatchActionLockingTest extends ServerCase {
+
+    @Inject
+    protected ServerRuntime runtime;
 
     public void testRunAsIndividualQueriesSuccess() throws Exception {
-        EntityResolver resolver = getDomain().getEntityResolver();
+        EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
 
         // test with adapter that supports keys...
         JdbcAdapter adapter = buildAdapter(true);
@@ -53,11 +59,13 @@ public class BatchActionLockingTest exte
                 .lookupObjEntity(SimpleLockingTestEntity.class)
                 .getDbEntity();
 
-        List qualifierAttributes = Arrays.asList(dbEntity.getAttribute("LOCKING_TEST_ID"),
dbEntity.getAttribute("NAME"));
+        List<DbAttribute> qualifierAttributes = Arrays.asList((DbAttribute) dbEntity
+                .getAttribute("LOCKING_TEST_ID"), (DbAttribute) dbEntity
+                .getAttribute("NAME"));
 
-        Collection nullAttributeNames = Collections.singleton("NAME");
+        Collection<String> nullAttributeNames = Collections.singleton("NAME");
 
-        Map qualifierSnapshot = new HashMap();
+        Map<String, Object> qualifierSnapshot = new HashMap<String, Object>();
         qualifierSnapshot.put("LOCKING_TEST_ID", new Integer(1));
 
         DeleteBatchQuery batchQuery = new DeleteBatchQuery(
@@ -90,7 +98,7 @@ public class BatchActionLockingTest exte
     }
 
     public void testRunAsIndividualQueriesOptimisticLockingFailure() throws Exception {
-        EntityResolver resolver = getDomain().getEntityResolver();
+        EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
 
         // test with adapter that supports keys...
         JdbcAdapter adapter = buildAdapter(true);
@@ -99,11 +107,13 @@ public class BatchActionLockingTest exte
                 .lookupObjEntity(SimpleLockingTestEntity.class)
                 .getDbEntity();
 
-        List qualifierAttributes = Arrays.asList(dbEntity.getAttribute("LOCKING_TEST_ID"),
dbEntity.getAttribute("NAME"));
+        List<DbAttribute> qualifierAttributes = Arrays.asList((DbAttribute) dbEntity
+                .getAttribute("LOCKING_TEST_ID"), (DbAttribute) dbEntity
+                .getAttribute("NAME"));
 
-        Collection nullAttributeNames = Collections.singleton("NAME");
+        Collection<String> nullAttributeNames = Collections.singleton("NAME");
 
-        Map qualifierSnapshot = new HashMap();
+        Map<String, Object> qualifierSnapshot = new HashMap<String, Object>();
         qualifierSnapshot.put("LOCKING_TEST_ID", new Integer(1));
 
         DeleteBatchQuery batchQuery = new DeleteBatchQuery(



Mime
View raw message