cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1098750 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DateTimeTypesTest.java
Date Mon, 02 May 2011 19:15:20 GMT
Author: aadamchik
Date: Mon May  2 19:15:20 2011
New Revision: 1098750

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

patches by Dzmitry Kazimirchyk:
DateTimeTypesTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DateTimeTypesTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DateTimeTypesTest.java?rev=1098750&r1=1098749&r2=1098750&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DateTimeTypesTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DateTimeTypesTest.java
Mon May  2 19:15:20 2011
@@ -24,25 +24,31 @@ import java.util.Calendar;
 import java.util.Date;
 
 import org.apache.cayenne.DataRow;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.NamedQuery;
 import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.testdo.testmap.CalendarEntity;
 import org.apache.cayenne.testdo.testmap.DateTestEntity;
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
 /**
  * Tests Date handling in Cayenne.
  */
-public class DateTimeTypesTest extends CayenneCase {
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class DateTimeTypesTest extends ServerCase {
 
-    protected DataContext context;
+    @Inject
+    private DataContext context;
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Inject
+    private DBHelper dbHelper;
 
-        deleteTestData();
-        context = createDataContext();
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("CALENDAR_TEST");
+        dbHelper.deleteAll("DATE_TEST");
     }
 
     public void testCalendar() throws Exception {
@@ -66,7 +72,7 @@ public class DateTimeTypesTest extends C
     }
 
     public void testDate() throws Exception {
-        DateTestEntity test = (DateTestEntity) context.newObject("DateTestEntity");
+        DateTestEntity test = context.newObject(DateTestEntity.class);
 
         Calendar cal = Calendar.getInstance();
         cal.clear();
@@ -83,7 +89,7 @@ public class DateTimeTypesTest extends C
     }
 
     public void testTime() throws Exception {
-        DateTestEntity test = (DateTestEntity) context.newObject("DateTestEntity");
+        DateTestEntity test = context.newObject(DateTestEntity.class);
 
         Calendar cal = Calendar.getInstance();
         cal.clear();
@@ -107,7 +113,7 @@ public class DateTimeTypesTest extends C
     }
 
     public void testTimestamp() throws Exception {
-        DateTestEntity test = (DateTestEntity) context.newObject("DateTestEntity");
+        DateTestEntity test = context.newObject(DateTestEntity.class);
 
         Calendar cal = Calendar.getInstance();
         cal.clear();
@@ -127,7 +133,7 @@ public class DateTimeTypesTest extends C
     }
 
     public void testSQLTemplateTimestamp() throws Exception {
-        DateTestEntity test = (DateTestEntity) context.newObject("DateTestEntity");
+        DateTestEntity test = context.newObject(DateTestEntity.class);
 
         Calendar cal = Calendar.getInstance();
         cal.clear();



Mime
View raw message