cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1099023 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextValidationTest.java
Date Tue, 03 May 2011 11:48:49 GMT
Author: aadamchik
Date: Tue May  3 11:48:49 2011
New Revision: 1099023

URL: http://svn.apache.org/viewvc?rev=1099023&view=rev
Log:
CAY-1562 CayenneCase unit tests conversion

patches by Dzmitry Kazimirchyk:
DataContextValidationTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextValidationTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextValidationTest.java?rev=1099023&r1=1099022&r2=1099023&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextValidationTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextValidationTest.java
Tue May  3 11:48:49 2011
@@ -19,20 +19,38 @@
 
 package org.apache.cayenne.access;
 
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.apache.cayenne.testdo.testmap.Painting;
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.apache.cayenne.unit.util.ValidationDelegate;
 import org.apache.cayenne.validation.ValidationResult;
 
 /**
  */
-public class DataContextValidationTest extends CayenneCase {
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class DataContextValidationTest extends ServerCase {
 
-    public void testValidatingObjectsOnCommitProperty() throws Exception {
-        DataContext context = createDataContext();
+    @Inject
+    private DataContext context;
+
+    @Inject
+    private DBHelper dbHelper;
+
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("PAINTING_INFO");
+        dbHelper.deleteAll("PAINTING");
+        dbHelper.deleteAll("PAINTING1");
+        dbHelper.deleteAll("ARTIST_EXHIBIT");
+        dbHelper.deleteAll("ARTIST_GROUP");
+        dbHelper.deleteAll("ARTIST");
+    }
 
+    public void testValidatingObjectsOnCommitProperty() throws Exception {
         context.setValidatingObjectsOnCommit(true);
         assertTrue(context.isValidatingObjectsOnCommit());
 
@@ -41,8 +59,6 @@ public class DataContextValidationTest e
     }
 
     public void testValidatingObjectsOnCommit() throws Exception {
-        DataContext context = createDataContext();
-
         // test that validation is called properly
 
         context.setValidatingObjectsOnCommit(true);
@@ -59,7 +75,6 @@ public class DataContextValidationTest e
     }
 
     public void testValidationModifyingContext() throws Exception {
-        deleteTestData();
 
         ValidationDelegate delegate = new ValidationDelegate() {
 
@@ -72,8 +87,6 @@ public class DataContextValidationTest e
             }
         };
 
-        DataContext context = createDataContext();
-
         context.setValidatingObjectsOnCommit(true);
         Artist a1 = context.newObject(Artist.class);
         a1.setValidationDelegate(delegate);



Mime
View raw message