{
BeanSet beanSet = getBeanSet();
ShoppingCart cart = beanSet.cart;
NestedXPCMonitor monitor = beanSet.monitor;
Customer customer;
long id = cart.createCustomer();
customer = monitor.find(id);
Assert.assertEquals("Stateless has proper initial name",
"William", customer.getName());
customer = cart.find(id);
Assert.assertEquals("ShoppingCart has proper initial name",
"William", customer.getName());
cart.update();
customer = monitor.find(id);
Assert.assertEquals("Stateless has proper updated name",
"Bill", customer.getName());
customer = cart.find(id);
Assert.assertEquals("ShoppingCart has proper updated name",
"Bill", customer.getName());
cart.update2();
customer = monitor.find(id);
Assert.assertEquals("Stateless has proper update2() name",
"Billy", customer.getName());
customer = cart.find(id);
Assert.assertEquals("ShoppingCart has proper update2() name",
"Billy", customer.getName());
cart.update3();
customer = monitor.find(id);
Assert.assertEquals("Stateless has proper update3() name",
"Bill Jr.", customer.getName());
customer = cart.find(id);
Assert.assertEquals("ShoppingCart has proper update3() name",
"Bill Jr.", customer.getName());
// Tell the contained bean to get the customer
cart.setContainedCustomer();
// Clear the passivation counts
cart.reset();
sleep(getSleepTime()); // passivation
Assert.assertEquals("Contained bean was passivated", 1, monitor.getLocalNestedPassivations());
Assert.assertTrue("Parent and local contained share customer", cart.checkContainedCustomer());
Assert.assertTrue("Contained bean was activated", monitor.getLocalNestedActivations() > 0);
cart.findAndUpdateStateless();
cart.updateContained();
customer = monitor.find(id);
Assert.assertEquals("contained modified", customer.getName());
customer = cart.find(id);
Assert.assertEquals("contained modified", customer.getName());
removeBean(monitor);
removeBean(cart);
}