From 7775b5275e07a7079969683cc7e570dd1e046493 Mon Sep 17 00:00:00 2001 From: pvtroshin Date: Thu, 23 Jun 2011 09:15:05 +0000 Subject: [PATCH] Fixes to test cases git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4309 e3abac25-378b-4346-85de-24260fe3988d --- testsrc/compbio/stat/collector/StatDBTester.java | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/testsrc/compbio/stat/collector/StatDBTester.java b/testsrc/compbio/stat/collector/StatDBTester.java index 4b135dd..509910c 100644 --- a/testsrc/compbio/stat/collector/StatDBTester.java +++ b/testsrc/compbio/stat/collector/StatDBTester.java @@ -22,7 +22,7 @@ public class StatDBTester { Timestamp from; Timestamp to; - @BeforeClass(alwaysRun=true) + @BeforeClass(alwaysRun=true ) public void init() { try { statdb = new StatDB(true); @@ -40,8 +40,8 @@ public class StatDBTester { } } - @Test - public void testReadYearDataAndShutdown() { + @Test(sequential=true) + public void testReadYearData() { Calendar cal = Calendar.getInstance(); cal.set(2010, 4, 1); try { @@ -57,7 +57,7 @@ public class StatDBTester { } - @Test + @Test(sequential=true) public void testReadOneMonthData() { try { List jobs = statdb.readData(from, to, Services.TcoffeeWS, false); @@ -71,7 +71,7 @@ public class StatDBTester { jobs = statdb.readData(from, to, Services.MafftWS,false); assertNotNull(jobs); - assertEquals(jobs.size(), 126); + assertEquals(jobs.size(), 136); jobs = statdb.readData(from,to, Services.ProbconsWS,false); assertNotNull(jobs); @@ -87,13 +87,12 @@ public class StatDBTester { } } - @Test + @Test(sequential=true) public void testGetEarliestRecord() { - try { - StatDB db = new StatDB(); - Date earliestRec = db.getEarliestRecord(); - // System.out.println(earliestRec); + Date earliestRec = statdb.getEarliestRecord(); + + assertEquals(1278543600000L, earliestRec.getTime()); } catch (SQLException e) { e.printStackTrace(); Assert.fail(e.getLocalizedMessage()); @@ -101,7 +100,7 @@ public class StatDBTester { } - @Test + @Test(sequential=true) public void testVerifyJobsCount() { try { @@ -113,12 +112,12 @@ public class StatDBTester { StatCollection sc = StatCollection.newStatCollecton(from, to); Totals t = Totals.sumStats(sc.getAllStat()); - System.out.println(sc.getAllStat()); - StatDB db = new StatDB(); - assertEquals(t.getTotal(), db.getTotalJobsCount(from, to)); - assertEquals(t.getAbandoned(), db.getAbandonedCount(from, to)); - assertEquals(t.getCancelled(), db.getCancelledCount(from, to)); - assertEquals(t.getIncomplete(), db.getIncompleteCount(from, to)); + //System.out.println(sc.getAllStat()); + + assertEquals(t.getTotal(), statdb.getTotalJobsCount(from, to)); + assertEquals(t.getAbandoned(), statdb.getAbandonedCount(from, to)); + assertEquals(t.getCancelled(), statdb.getCancelledCount(from, to)); + assertEquals(t.getIncomplete(), statdb.getIncompleteCount(from, to)); } catch (SQLException e) { e.printStackTrace(); -- 1.7.10.2