import org.testng.annotations.BeforeClass;\r
import org.testng.annotations.Test;\r
\r
+import compbio.stat.servlet.util.StatCollection;\r
+import compbio.stat.servlet.util.Totals;\r
import compbio.ws.client.Services;\r
\r
public class StatDBTester {\r
}\r
\r
}\r
+\r
+ @Test\r
+ public void testVerifyJobsCount() {\r
+\r
+ try {\r
+ Calendar cal = Calendar.getInstance();\r
+ cal.add(Calendar.MONTH, -5);\r
+ Timestamp from = new Timestamp(cal.getTimeInMillis());\r
+ cal.add(Calendar.MONTH, 1);\r
+ Timestamp to = new Timestamp(cal.getTimeInMillis());\r
+ 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
+\r
+ } catch (SQLException e) {\r
+ e.printStackTrace();\r
+ Assert.fail(e.getLocalizedMessage());\r
+ }\r
+\r
+ }\r
}\r