/**
* Domain shares Admin object.
*/
public void testDomainAndAdmin() throws Exception {
NetworkAdmin admin = new NetworkAdmin();
admin.setId("Benny");
NetworkDomain tempSensorDomain = new NetworkDomain();
tempSensorDomain.setName("Temperature sensors");
tempSensorDomain.setAdmin(admin);
NetworkDomain vibSensorDomain = new NetworkDomain();
vibSensorDomain.setName("Vibration sensors");
vibSensorDomain.setAdmin(admin);
cache1.putObject("/temp", tempSensorDomain);
cache1.putObject("/vib", vibSensorDomain);
NetworkDomain d1 = (NetworkDomain) cache2.getObject("/temp");
NetworkDomain d2 = (NetworkDomain) cache2.getObject("/vib");
assertEquals("Admin should be the same", d1.getAdmin(), d2.getAdmin());
d2.getAdmin().setId("Wen");
assertEquals("New admin id is ", "Wen", d1.getAdmin().getId());
assertEquals("New admin id is ", "Wen", admin.getId());
d1 = (NetworkDomain) cache2.getObject("/vib");
d2 = (NetworkDomain) cache2.getObject("/temp");
assertEquals("Admin should be the same", d1.getAdmin(), d2.getAdmin());
d2.getAdmin().setId("Wen");
assertEquals("New admin id is ", "Wen", d1.getAdmin().getId());
assertEquals("New admin id is ", "Wen", admin.getId());
NetworkDomain temp1 = (NetworkDomain) cache1.removeObject("/temp");
NetworkDomain vib1 = (NetworkDomain) cache1.removeObject("/vib");
assertEquals("Vibration sensor ", vibSensorDomain, vib1);