"unitTest"
})
public void TestReportData() throws InstanceNotFoundException, MalformedObjectNameException,
NullPointerException, IOException, InterruptedException {
System.out.println("START TestParticipantMonitor");
ParticipantMonitor monitor = new ParticipantMonitor();
int monitorNum = 0;
StateTransitionContext cxt = new StateTransitionContext("cluster", "instance", "db_1", "a-b");
StateTransitionDataPoint data = new StateTransitionDataPoint(1000, 1000, true);
monitor.reportTransitionStat(cxt, data);
data = new StateTransitionDataPoint(1000, 1200, true);
monitor.reportTransitionStat(cxt, data);
ParticipantMonitorListener monitorListener =
new ParticipantMonitorListener("CLMParticipantReport");
Thread.sleep(1000);
AssertJUnit.assertTrue(monitorListener._beanValueMap.size() == monitorNum + 1);
data = new StateTransitionDataPoint(1000, 500, true);
monitor.reportTransitionStat(cxt, data);
Thread.sleep(1000);
AssertJUnit.assertTrue(monitorListener._beanValueMap.size() == monitorNum + 1);
data = new StateTransitionDataPoint(1000, 500, true);
StateTransitionContext cxt2 = new StateTransitionContext("cluster", "instance", "db_2", "a-b");
monitor.reportTransitionStat(cxt2, data);
monitor.reportTransitionStat(cxt2, data);
Thread.sleep(1000);
AssertJUnit.assertTrue(monitorListener._beanValueMap.size() == monitorNum + 2);
AssertJUnit.assertFalse(cxt.equals(cxt2));
AssertJUnit.assertFalse(cxt.equals(new Object()));