cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1098609 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test: java/org/apache/cayenne/unit/jira/CAY_191Test.java resources/dml/unit.jira.CAY_191Test.xml
Date Mon, 02 May 2011 14:55:00 GMT
Author: aadamchik
Date: Mon May  2 14:55:00 2011
New Revision: 1098609

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

patches by Dzmitry Kazimirchyk:
CAY_191Test

Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/unit.jira.CAY_191Test.xml
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_191Test.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_191Test.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_191Test.java?rev=1098609&r1=1098608&r2=1098609&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_191Test.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_191Test.java
Mon May  2 14:55:00 2011
@@ -21,19 +21,48 @@ package org.apache.cayenne.unit.jira;
 
 import org.apache.cayenne.Cayenne;
 import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.relationship.FkOfDifferentType;
-import org.apache.cayenne.unit.RelationshipCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-public class CAY_191Test extends RelationshipCase {
+@UseServerRuntime(ServerCase.RELATIONSHIPS_PROJECT)
+public class CAY_191Test extends ServerCase {
+    
+    @Inject
+    protected DataContext context;
+    
+    @Inject
+    protected DBHelper dbHelper;
+    
+    protected TableHelper tRelationshipHelper;
+    protected TableHelper tFkOfDifferentType;
+    
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("FK_OF_DIFFERENT_TYPE");
+        dbHelper.deleteAll("RELATIONSHIP_HELPER");
+        
+        tRelationshipHelper = new TableHelper(dbHelper, "RELATIONSHIP_HELPER");
+        tRelationshipHelper.setColumns("NAME", "RELATIONSHIP_HELPER_ID");
+        
+        tFkOfDifferentType = new TableHelper(dbHelper, "FK_OF_DIFFERENT_TYPE");
+        tFkOfDifferentType.setColumns("ID", "RELATIONSHIP_HELPER_FK");
+    }
+    
+    protected void createTestDataSet() throws Exception {
+        tRelationshipHelper.insert("RH1", 1);
+        tFkOfDifferentType.insert(1, 1);
+    }
 
     public void testResolveToOneOverFKOfDifferentNumType() throws Exception {
         // this is mostly for legacy schemas, as on many dbs you won;t be able to even
         // create the FK constraint...
 
-        deleteTestData();
-        createTestData("testResolveToOneOverFKOfDifferentNumType");
+        createTestDataSet();
 
-        DataContext context = createDataContext();
         FkOfDifferentType root = Cayenne.objectForPK(
                 context,
                 FkOfDifferentType.class,



Mime
View raw message