return getDeploySetup(SingletonUnitTestCase.class, "ejb31singleton.jar");
}
public void testSingletonBeanAccess() throws Exception
{
AccountManager accountManager = (AccountManager) this.getInitialContext().lookup(AccountManagerBean.JNDI_NAME);
int initialBalance = accountManager.balance();
assertEquals("Unexpected initial balance", 0, initialBalance);
// credit
accountManager.credit(100);
AccountManager anotherAccountManagerInstance = (AccountManager) this.getInitialContext().lookup(
AccountManagerBean.JNDI_NAME);
int balanceAfterCredit = anotherAccountManagerInstance.balance();
assertEquals("Unexpected balance after credit", 100, balanceAfterCredit);
// debit
anotherAccountManagerInstance.debit(50);
int balanceAfterDebit = accountManager.balance();
assertEquals("Unexpected balance after debit", 50, balanceAfterDebit);
}