Thread.sleep(500);
}
Assert.assertEquals(1, instances.length);
manager.increment(element2, true, null);
PMEListener listener = new PMEListener(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED);
BasicEventConsumer eventConsumer = new BasicEventConsumer(ProvisionMonitorEvent.getEventDescriptor(), listener);
eventConsumer.register(monitorItems[0]);
testManager.waitForService("DependsOn");
for(int i=0; i<10; i++) {
if(listener.event!=null &&
listener.event.getAction().equals(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED)) {
break;
}
Thread.sleep(500);
}
eventConsumer.terminate();
Assert.assertNotNull(listener.event);
Assert.assertEquals(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED, listener.event.getAction());
instances = cybernode.getServiceBeanInstances(element1);
Assert.assertEquals(0, instances.length);
instances = manager.getServiceBeanInstances(element1);