*/
@Test
public void testSessionScoping() throws Exception
{
// Lookup 2 Instances
MyStatefulLocalBusiness bean1 = (MyStatefulLocalBusiness) ProxyStatefulSession30OnlyTestCase.context
.lookup("MyStateful30OnlyBean/local");
MyStatefulLocalBusiness bean2 = (MyStatefulLocalBusiness) ProxyStatefulSession30OnlyTestCase.context
.lookup("MyStateful30OnlyBean/local");
// Invoke continuously on instance one 10 times to ensure that the SFSB counter increments properly
for (int counter = 0; counter < 10; counter++)
{
// Invoke
int result = bean1.getNextCounter();
TestCase.assertEquals("SFSB invocations should have memory of the session", counter, result);
}
// Invoke once on instance two to ensure its scope is separate from that of instance one
TestCase
.assertEquals("SFSB Session Scopes must not be shared between Proxy instances", 0, bean2.getNextCounter());
}