From: <sc...@hy...> - 2009-12-17 00:00:05
|
Author: scottmf Date: 2009-12-16 15:59:51 -0800 (Wed, 16 Dec 2009) New Revision: 14099 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14099 Modified: trunk/unittest/src/org/hyperic/hq/measurement/server/session/AvailabilityManager_testEJBImpl.java Log: [HHQ-3505] added clearing of the session in the setup() method. This is because our in-container tests only use one session for all the tests. Modified: trunk/unittest/src/org/hyperic/hq/measurement/server/session/AvailabilityManager_testEJBImpl.java =================================================================== --- trunk/unittest/src/org/hyperic/hq/measurement/server/session/AvailabilityManager_testEJBImpl.java 2009-12-16 08:53:11 UTC (rev 14098) +++ trunk/unittest/src/org/hyperic/hq/measurement/server/session/AvailabilityManager_testEJBImpl.java 2009-12-16 23:59:51 UTC (rev 14099) @@ -53,7 +53,6 @@ import org.apache.commons.logging.LogFactory; import org.hyperic.dao.DAOFactory; import org.hyperic.hq.common.SystemException; -import org.hyperic.hq.measurement.MeasurementConstants; import org.hyperic.hq.measurement.TimingVoodoo; import org.hyperic.hq.measurement.shared.AvailabilityManagerLocal; import org.hyperic.hq.measurement.shared.AvailabilityManager_testLocal; @@ -149,10 +148,14 @@ server.invoke(objName, "hitWithDate", obj, str); } + private long now() { + return System.currentTimeMillis(); + } + private void testOverlap() throws Exception { AvailabilityManagerLocal avail = AvailabilityManagerEJBImpl.getOne(); List list = new ArrayList(); - long now = System.currentTimeMillis(); + long now = now(); long baseTime = TimingVoodoo.roundDownTime(now, 60000); DataPoint pt = new DataPoint(PLAT_MEAS_ID, new MetricValue(1.0, baseTime)); pt = new DataPoint(PLAT_MEAS_ID, new MetricValue(0.5, baseTime)); @@ -166,7 +169,7 @@ setupAvailabilityTable(); AvailabilityManagerLocal avail = AvailabilityManagerEJBImpl.getOne(); ArrayList list = new ArrayList(); - long now = System.currentTimeMillis(); + long now = now(); long baseTime = TimingVoodoo.roundDownTime(now, 60000); long incrTime = 60000; long tmpTime = baseTime; @@ -190,7 +193,7 @@ private void stressTest1() throws Exception { setupAvailabilityTable(); - long now = System.currentTimeMillis(); + long now = now(); long baseTime = TimingVoodoo.roundDownTime(now, 60000); long incrTime = 60000; DataPoint pt = testCatchup(PLAT_MEAS_ID, baseTime, incrTime); @@ -206,7 +209,7 @@ Measurement meas = mMan.getMeasurement(measId); long interval = meas.getInterval(); - long now = System.currentTimeMillis(); + long now = now(); long baseTime = TimingVoodoo.roundDownTime(now, 60000); DataPoint pt; invokeBackfiller(baseTime); @@ -297,7 +300,7 @@ Measurement meas = mMan.getMeasurement(measId); long interval = meas.getInterval(); - long now = System.currentTimeMillis(); + long now = now(); long baseTime = TimingVoodoo.roundDownTime(now, 600000); DataPoint pt; List list = new ArrayList(); @@ -345,14 +348,15 @@ } private void testAvailabilityForService(Integer measId) throws Exception{ - setupAvailabilityTable(); - setupAvailabilityTable(measId); + setupAvailabilityTable(); + setupAvailabilityTable(measId); AvailabilityManagerLocal avail = AvailabilityManagerEJBImpl.getOne(); + MeasurementManagerLocal mMan = MeasurementManagerEJBImpl.getOne(); Measurement meas = mMan.getMeasurement(measId); long interval = meas.getInterval(); - long now = System.currentTimeMillis(); + long now = now(); long baseTime = TimingVoodoo.roundDownTime(now, 600000); DataPoint pt; List list = new ArrayList(); @@ -410,7 +414,7 @@ private void testNonOneorZeroDupPtInsertAtBegin() throws Exception { setupAvailabilityTable(); long INCRTIME = 60000; - long baseTime = System.currentTimeMillis(); + long baseTime = now(); baseTime = TimingVoodoo.roundDownTime(baseTime, 60000); long tmpTime = baseTime; @@ -436,7 +440,7 @@ private void testPrependWithDupValue() throws Exception { setupAvailabilityTable(); - long baseTime = System.currentTimeMillis(); + long baseTime = now(); baseTime = TimingVoodoo.roundDownTime(baseTime, 60000); long tmpTime = baseTime; @@ -463,7 +467,7 @@ private void testPrepend() throws Exception { setupAvailabilityTable(); - long baseTime = System.currentTimeMillis(); + long baseTime = now(); baseTime = TimingVoodoo.roundDownTime(baseTime, 60000); long tmpTime = baseTime; @@ -493,7 +497,7 @@ setupAvailabilityTable(); int INCRTIME = 240000; - long baseTime = System.currentTimeMillis(); + long baseTime = now(); baseTime = TimingVoodoo.roundDownTime(baseTime, 60000); long tmpTime = baseTime; @@ -580,6 +584,7 @@ AvailabilityCache cache = AvailabilityCache.getInstance(); cache.clear(); AvailabilityDataDAO dao = getAvailabilityDataDAO(); + dao.getSession().clear(); boolean descending = false; long start = 0l; long end = AvailabilityDataRLE.getLastTimestamp(); @@ -598,6 +603,7 @@ AvailabilityCache cache = AvailabilityCache.getInstance(); cache.clear(); AvailabilityDataDAO dao = getAvailabilityDataDAO(); + dao.getSession().clear(); boolean descending = false; long start = 0l; long end = AvailabilityDataRLE.getLastTimestamp(); |