Fixes to test cases
[jabaws.git] / testsrc / compbio / stat / collector / StatDBTester.java
index 4b135dd..509910c 100644 (file)
@@ -22,7 +22,7 @@ public class StatDBTester {
        Timestamp from;\r
        Timestamp to;\r
        \r
-       @BeforeClass(alwaysRun=true)\r
+       @BeforeClass(alwaysRun=true )\r
        public void init() {\r
                try {\r
                        statdb = new StatDB(true);\r
@@ -40,8 +40,8 @@ public class StatDBTester {
                }\r
        }\r
 \r
-       @Test\r
-       public void testReadYearDataAndShutdown() {\r
+       @Test(sequential=true)\r
+       public void testReadYearData() {\r
                Calendar cal = Calendar.getInstance();\r
                cal.set(2010, 4, 1);\r
                try {\r
@@ -57,7 +57,7 @@ public class StatDBTester {
 \r
        }\r
 \r
-       @Test\r
+       @Test(sequential=true)\r
        public void testReadOneMonthData() {\r
                try {\r
                        List<JobStat> jobs = statdb.readData(from, to, Services.TcoffeeWS, false);\r
@@ -71,7 +71,7 @@ public class StatDBTester {
 \r
                        jobs = statdb.readData(from, to, Services.MafftWS,false);\r
                        assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 126);\r
+                       assertEquals(jobs.size(), 136);\r
 \r
                        jobs = statdb.readData(from,to, Services.ProbconsWS,false);\r
                        assertNotNull(jobs);\r
@@ -87,13 +87,12 @@ public class StatDBTester {
                }\r
        }\r
 \r
-       @Test\r
+       @Test(sequential=true)\r
        public void testGetEarliestRecord() {\r
-\r
                try {\r
-                       StatDB db = new StatDB();\r
-                       Date earliestRec = db.getEarliestRecord();\r
-                       // System.out.println(earliestRec);\r
+                       Date earliestRec = statdb.getEarliestRecord();\r
+                       \r
+                       assertEquals(1278543600000L, earliestRec.getTime());\r
                } catch (SQLException e) {\r
                        e.printStackTrace();\r
                        Assert.fail(e.getLocalizedMessage());\r
@@ -101,7 +100,7 @@ public class StatDBTester {
 \r
        }\r
 \r
-       @Test\r
+       @Test(sequential=true)\r
        public void testVerifyJobsCount() {\r
 \r
                try {\r
@@ -113,12 +112,12 @@ public class StatDBTester {
                        StatCollection sc = StatCollection.newStatCollecton(from, to);\r
                        Totals t = Totals.sumStats(sc.getAllStat());\r
 \r
-                       System.out.println(sc.getAllStat());\r
-                       StatDB db = new StatDB();\r
-                       assertEquals(t.getTotal(), db.getTotalJobsCount(from, to));\r
-                       assertEquals(t.getAbandoned(), db.getAbandonedCount(from, to));\r
-                       assertEquals(t.getCancelled(), db.getCancelledCount(from, to));\r
-                       assertEquals(t.getIncomplete(), db.getIncompleteCount(from, to));\r
+                       //System.out.println(sc.getAllStat());\r
+                       \r
+                       assertEquals(t.getTotal(), statdb.getTotalJobsCount(from, to));\r
+                       assertEquals(t.getAbandoned(), statdb.getAbandonedCount(from, to));\r
+                       assertEquals(t.getCancelled(), statdb.getCancelledCount(from, to));\r
+                       assertEquals(t.getIncomplete(), statdb.getIncompleteCount(from, to));\r
 \r
                } catch (SQLException e) {\r
                        e.printStackTrace();\r