Further work on statistics display
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Wed, 25 May 2011 17:43:07 +0000 (17:43 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Wed, 25 May 2011 17:43:07 +0000 (17:43 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4164 e3abac25-378b-4346-85de-24260fe3988d

testsrc/compbio/stat/collector/StatDBTester.java
testsrc/compbio/stat/collector/StatManagerTester.java [deleted file]
testsrc/compbio/stat/servlet/util/StatCollectionTester.java [new file with mode: 0644]

index 7f683df..5fcf41a 100644 (file)
@@ -63,36 +63,50 @@ public class StatDBTester {
                                        new Timestamp(cal.getTimeInMillis()), new Timestamp(\r
                                                        new Date().getTime()), Services.TcoffeeWS, false);\r
                        assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 67);\r
+                       assertEquals(jobs.size(), 47);\r
 \r
                        jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()),\r
                                        new Timestamp(new Date().getTime()), Services.ClustalWS,\r
                                        false);\r
 \r
                        assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 159);\r
+                       assertEquals(jobs.size(), 144);\r
 \r
                        jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()),\r
                                        new Timestamp(new Date().getTime()), Services.MafftWS,\r
                                        false);\r
                        assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 163);\r
+                       assertEquals(jobs.size(), 149);\r
 \r
                        jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()),\r
                                        new Timestamp(new Date().getTime()), Services.ProbconsWS,\r
                                        false);\r
                        assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 13);\r
+                       assertEquals(jobs.size(), 12);\r
 \r
                        jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()),\r
                                        new Timestamp(new Date().getTime()), Services.MuscleWS,\r
                                        false);\r
                        assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 84);\r
+                       assertEquals(jobs.size(), 76);\r
 \r
                } catch (SQLException e) {\r
                        e.printStackTrace();\r
                        Assert.fail(e.getMessage());\r
                }\r
        }\r
+\r
+       @Test\r
+       public void testGetEarliestRecord() {\r
+\r
+               try {\r
+                       StatDB db = new StatDB();\r
+                       Date earliestRec = db.getEarliestRecord();\r
+                       // System.out.println(earliestRec);\r
+               } catch (SQLException e) {\r
+                       e.printStackTrace();\r
+                       Assert.fail(e.getLocalizedMessage());\r
+               }\r
+\r
+       }\r
 }\r
diff --git a/testsrc/compbio/stat/collector/StatManagerTester.java b/testsrc/compbio/stat/collector/StatManagerTester.java
deleted file mode 100644 (file)
index 68caa53..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package compbio.stat.collector;\r
-\r
-import java.util.Date;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.stat.collector.StatManager.DateRoller;\r
-\r
-public class StatManagerTester {\r
-\r
-       @Test\r
-       public void testDateRoller() {\r
-               DateRoller dr = new DateRoller(new Date());\r
-               int counter = 0;\r
-               while (dr.hasNext()) {\r
-                       dr.next();\r
-                       counter++;\r
-               }\r
-               Assert.assertEquals(12, counter);\r
-       }\r
-}\r
diff --git a/testsrc/compbio/stat/servlet/util/StatCollectionTester.java b/testsrc/compbio/stat/servlet/util/StatCollectionTester.java
new file mode 100644 (file)
index 0000000..efedb07
--- /dev/null
@@ -0,0 +1,35 @@
+package compbio.stat.servlet.util;\r
+\r
+import java.sql.SQLException;\r
+import java.util.Calendar;\r
+import java.util.Date;\r
+import java.util.GregorianCalendar;\r
+import java.util.Map;\r
+\r
+import org.testng.Assert;\r
+import org.testng.annotations.Test;\r
+\r
+public class StatCollectionTester {\r
+\r
+       @Test\r
+       public void testGetStats() {\r
+               Map<Date, StatCollection> stats;\r
+               Calendar cal = GregorianCalendar.getInstance();\r
+               cal.add(Calendar.DAY_OF_MONTH, -25);\r
+\r
+               try {\r
+                       stats = StatCollection.getStats(cal.getTime());\r
+\r
+                       // System.out.println(stats);\r
+                       for (Map.Entry<Date, Totals> a : StatCollection\r
+                                       .getTotalStats(stats).entrySet()) {\r
+                               System.out.println(a);\r
+                       }\r
+               } catch (SQLException e) {\r
+                       e.printStackTrace();\r
+                       Assert.fail(e.getMessage());\r
+               }\r
+\r
+       }\r
+\r
+}\r