cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1099008 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access: DataContextFlattenedAttributesTest.java DataContextObjectIdQueryTest.java
Date Tue, 03 May 2011 11:13:28 GMT
Author: aadamchik
Date: Tue May  3 11:13:27 2011
New Revision: 1099008

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

patches by Dzmitry Kazimirchyk:
DataContextObjectIdQueryTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java?rev=1099008&r1=1099007&r2=1099008&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextFlattenedAttributesTest.java
Tue May  3 11:13:27 2011
@@ -39,8 +39,6 @@ import org.apache.cayenne.testdo.testmap
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-/**
- */
 @UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class DataContextFlattenedAttributesTest extends ServerCase {
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextObjectIdQueryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextObjectIdQueryTest.java?rev=1099008&r1=1099007&r2=1099008&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextObjectIdQueryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextObjectIdQueryTest.java
Tue May  3 11:13:27 2011
@@ -23,24 +23,35 @@ import java.util.Date;
 
 import org.apache.cayenne.Cayenne;
 import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.ObjectIdQuery;
 import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.testdo.testmap.Artist;
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-public class DataContextObjectIdQueryTest extends CayenneCase {
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class DataContextObjectIdQueryTest extends ServerCase {
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Inject
+    private DataContext context;
+
+    @Inject
+    private DBHelper dbHelper;
 
-        deleteTestData();
+    @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 testRefreshNullifiedValuesNew() {
 
-        DataContext context = createDataContext();
-
         Artist a = context.newObject(Artist.class);
         a.setArtistName("X");
         a.setDateOfBirth(new Date());
@@ -61,10 +72,8 @@ public class DataContextObjectIdQueryTes
         assertNull(a1.getDateOfBirth());
         assertEquals("X", a1.getArtistName());
     }
-    
-    public void testNoRefreshValuesNew() {
 
-        DataContext context = createDataContext();
+    public void testNoRefreshValuesNew() {
 
         Artist a = context.newObject(Artist.class);
         a.setArtistName("X");
@@ -84,7 +93,6 @@ public class DataContextObjectIdQueryTes
         Artist a1 = (Artist) Cayenne.objectForQuery(context, query);
         assertEquals("X", a1.getArtistName());
     }
-    
 
     public void testRefreshNullifiedValuesExisting() {
 
@@ -93,7 +101,6 @@ public class DataContextObjectIdQueryTes
                 "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME, DATE_OF_BIRTH) VALUES (44, 'X',
#bind($date 'DATE'))");
         insert.setParameters(Collections.singletonMap("date", new Date()));
 
-        DataContext context = createDataContext();
         context.performGenericQuery(insert);
 
         Artist a = Cayenne.objectForPK(context, Artist.class, 44l);



Mime
View raw message