/**
* Domain shares Admin object, domain also contains a list of Nodes, and each DataNode has sensor elements
*/
public void testAll() throws Exception {
// Construct domains
NetworkDomain tempSensorDomain = new NetworkDomain();
tempSensorDomain.setName("Temperature sensors");
NetworkDomain vibSensorDomain = new NetworkDomain();
vibSensorDomain.setName("Vibration sensors");
// Construct nodes
NetworkNode taipei = new NetworkNode();
taipei.setName("Taipei machine");
taipei.setIpAddress("192.168.1.100");
NetworkNode tainan = new NetworkNode();
tainan.setName("Tainan machine");
tainan.setIpAddress("192.168.1.200");
// Contruct sensor elements
NetworkElement vibSensor1 = new NetworkElement();
vibSensor1.setName("Vibration sensor V10");
NetworkElement vibSensor2 = new NetworkElement();
vibSensor2.setName("Vibration sensor V20");
NetworkElement tempSensor1 = new NetworkElement();
tempSensor1.setName("Temperature sensor T10");
NetworkElement tempSensor2 = new NetworkElement();
tempSensor2.setName("Temperature sensor T20");
// Add sensor element to DataNode
taipei.addElement(vibSensor1);
taipei.addElement(tempSensor1);
tainan.addElement(vibSensor2);
tainan.addElement(tempSensor2);
assertEquals("Element size ", 2, taipei.getElements().size());
// Add elements to domains
vibSensorDomain.addElement(vibSensor1);
vibSensorDomain.addElement(vibSensor2);
tempSensorDomain.addElement(tempSensor1);
tempSensorDomain.addElement(tempSensor2);
// ask cache to manage the domains
cache1.putObject("/vib", vibSensorDomain);
cache1.putObject("/temp", tempSensorDomain);
System.out.println(cache1.printDetails());
NetworkDomain temp1 = (NetworkDomain) cache1.getObject("/temp");
NetworkDomain vib1 = (NetworkDomain) cache1.getObject("/vib");
NetworkNode taipei1 = (NetworkNode) temp1.getNodes().get(0);
// NetworkNode taipei1 = (NetworkNode)temp1.getNodes().get(1); this would fail on equality
NetworkNode taipei2 = (NetworkNode) vib1.getNodes().get(0);
List l1 = temp1.getNodes();
assertEquals("Size is ", 2, l1.size());
l1 = taipei.getElements();