deploySessionEjb(PassivatingStatefulBean.class);
}
@Test
public void testPassivateTwice() throws Exception {
PassivatingStatefulLocal bean = lookup("PassivatingStatefulBean/local", PassivatingStatefulLocal.class);
Assert.assertNotNull(bean);
PassivatingStatefulBean.barrier.await(10, TimeUnit.SECONDS);
synchronized (TestCache.passivationCompleteNotification) {
TestCache.passivationCompleteNotification.wait(10000);
}
assertEquals(0, PassivatingStatefulBean.postActivations.get());
bean.activate();
assertEquals(1, PassivatingStatefulBean.postActivations.get());
PassivatingStatefulBean.barrier.await(10, TimeUnit.SECONDS);
synchronized (TestCache.passivationCompleteNotification) {
TestCache.passivationCompleteNotification.wait(10000);
}
bean.activate();
assertEquals(2, PassivatingStatefulBean.postActivations.get());
}