cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1099054 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/MeaningfulFKTest.java
Date Tue, 03 May 2011 13:52:42 GMT
Author: aadamchik
Date: Tue May  3 13:52:42 2011
New Revision: 1099054

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

patches by Dzmitry Kazimirchyk:
MeaningfulFKTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/MeaningfulFKTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/MeaningfulFKTest.java?rev=1099054&r1=1099053&r2=1099054&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/MeaningfulFKTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/MeaningfulFKTest.java
Tue May  3 13:52:42 2011
@@ -19,18 +19,30 @@
 
 package org.apache.cayenne;
 
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.testdo.relationship.MeaningfulFK;
 import org.apache.cayenne.testdo.relationship.RelationshipHelper;
-import org.apache.cayenne.unit.RelationshipCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.apache.cayenne.validation.ValidationResult;
 
-/**
- */
-public class MeaningfulFKTest extends RelationshipCase {
+@UseServerRuntime(ServerCase.RELATIONSHIPS_PROJECT)
+public class MeaningfulFKTest extends ServerCase {
+
+    @Inject
+    private ObjectContext context;
+
+    @Inject
+    private DBHelper dbHelper;
+
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("MEANINGFUL_FK");
+    }
 
     public void testValidateForSave1() throws Exception {
-        MeaningfulFK testObject = createDataContext().newObject(
-                MeaningfulFK.class);
+        MeaningfulFK testObject = context.newObject(MeaningfulFK.class);
 
         ValidationResult validation = new ValidationResult();
         testObject.validateForSave(validation);
@@ -44,12 +56,10 @@ public class MeaningfulFKTest extends Re
     }
 
     public void testValidateForSave2() throws Exception {
-        MeaningfulFK testObject = createDataContext().newObject(
-                MeaningfulFK.class);
+        MeaningfulFK testObject = context.newObject(MeaningfulFK.class);
 
-        RelationshipHelper related = testObject
-                .getObjectContext()
-                .newObject(RelationshipHelper.class);
+        RelationshipHelper related = testObject.getObjectContext().newObject(
+                RelationshipHelper.class);
         testObject.setToRelationshipHelper(related);
 
         ValidationResult validation = new ValidationResult();



Mime
View raw message