From e35df7ed0b31d8ce311110bb072848cd617d87d8 Mon Sep 17 00:00:00 2001 From: pvtroshin Date: Wed, 25 May 2011 17:43:07 +0000 Subject: [PATCH] Further work on statistics display 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 | 24 +++++++++++--- .../compbio/stat/collector/StatManagerTester.java | 22 ------------ .../stat/servlet/util/StatCollectionTester.java | 35 ++++++++++++++++++++ 3 files changed, 54 insertions(+), 27 deletions(-) delete mode 100644 testsrc/compbio/stat/collector/StatManagerTester.java create mode 100644 testsrc/compbio/stat/servlet/util/StatCollectionTester.java diff --git a/testsrc/compbio/stat/collector/StatDBTester.java b/testsrc/compbio/stat/collector/StatDBTester.java index 7f683df..5fcf41a 100644 --- a/testsrc/compbio/stat/collector/StatDBTester.java +++ b/testsrc/compbio/stat/collector/StatDBTester.java @@ -63,36 +63,50 @@ public class StatDBTester { new Timestamp(cal.getTimeInMillis()), new Timestamp( new Date().getTime()), Services.TcoffeeWS, false); assertNotNull(jobs); - assertEquals(jobs.size(), 67); + assertEquals(jobs.size(), 47); jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()), new Timestamp(new Date().getTime()), Services.ClustalWS, false); assertNotNull(jobs); - assertEquals(jobs.size(), 159); + assertEquals(jobs.size(), 144); jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()), new Timestamp(new Date().getTime()), Services.MafftWS, false); assertNotNull(jobs); - assertEquals(jobs.size(), 163); + assertEquals(jobs.size(), 149); jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()), new Timestamp(new Date().getTime()), Services.ProbconsWS, false); assertNotNull(jobs); - assertEquals(jobs.size(), 13); + assertEquals(jobs.size(), 12); jobs = statdb.readData(new Timestamp(cal.getTimeInMillis()), new Timestamp(new Date().getTime()), Services.MuscleWS, false); assertNotNull(jobs); - assertEquals(jobs.size(), 84); + assertEquals(jobs.size(), 76); } catch (SQLException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } } + + @Test + public void testGetEarliestRecord() { + + try { + StatDB db = new StatDB(); + Date earliestRec = db.getEarliestRecord(); + // System.out.println(earliestRec); + } catch (SQLException e) { + e.printStackTrace(); + Assert.fail(e.getLocalizedMessage()); + } + + } } diff --git a/testsrc/compbio/stat/collector/StatManagerTester.java b/testsrc/compbio/stat/collector/StatManagerTester.java deleted file mode 100644 index 68caa53..0000000 --- a/testsrc/compbio/stat/collector/StatManagerTester.java +++ /dev/null @@ -1,22 +0,0 @@ -package compbio.stat.collector; - -import java.util.Date; - -import org.testng.Assert; -import org.testng.annotations.Test; - -import compbio.stat.collector.StatManager.DateRoller; - -public class StatManagerTester { - - @Test - public void testDateRoller() { - DateRoller dr = new DateRoller(new Date()); - int counter = 0; - while (dr.hasNext()) { - dr.next(); - counter++; - } - Assert.assertEquals(12, counter); - } -} diff --git a/testsrc/compbio/stat/servlet/util/StatCollectionTester.java b/testsrc/compbio/stat/servlet/util/StatCollectionTester.java new file mode 100644 index 0000000..efedb07 --- /dev/null +++ b/testsrc/compbio/stat/servlet/util/StatCollectionTester.java @@ -0,0 +1,35 @@ +package compbio.stat.servlet.util; + +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Map; + +import org.testng.Assert; +import org.testng.annotations.Test; + +public class StatCollectionTester { + + @Test + public void testGetStats() { + Map stats; + Calendar cal = GregorianCalendar.getInstance(); + cal.add(Calendar.DAY_OF_MONTH, -25); + + try { + stats = StatCollection.getStats(cal.getTime()); + + // System.out.println(stats); + for (Map.Entry a : StatCollection + .getTotalStats(stats).entrySet()) { + System.out.println(a); + } + } catch (SQLException e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } + + } + +} -- 1.7.10.2