@Test
public void testGetNetwork() {
CookieCache.put("Cookie","JSESSIONID=2AAF431F59ACEE1CC68B43C87772C54F");
ObjectMapper mapper = new ObjectMapper();
NetworkRead networkRead1 = new NetworkRead();
networkRead1.setName("name1");
networkRead1.setPortGroup("portGroup1");
networkRead1.setDhcp(false);
networkRead1.setDns1("192.1.1.1");
networkRead1.setDns2("192.1.2.1");
List<IpBlock> allIpBlocks = new ArrayList<IpBlock>();
IpBlock ip1 = new IpBlock();
ip1.setBeginIp("192.1.1.2");
ip1.setEndIp("192.1.1.5");
IpBlock ip2 = new IpBlock();
ip2.setBeginIp("192.1.1.8");
ip2.setEndIp("192.1.1.8");
IpBlock ip3 = new IpBlock();
ip3.setBeginIp("192.1.1.10");
ip3.setEndIp("192.1.1.100");
allIpBlocks.add(ip1);
allIpBlocks.add(ip2);
allIpBlocks.add(ip3);
List<IpBlock> freeIpBlocks = new ArrayList<IpBlock>();
freeIpBlocks.add(ip1);
List<IpBlock> assignedIpBlocks = new ArrayList<IpBlock>();
assignedIpBlocks.add(ip2);
networkRead1.setAllIpBlocks(allIpBlocks);
networkRead1.setFreeIpBlocks(freeIpBlocks);
networkRead1.setAssignedIpBlocks(assignedIpBlocks);
networkRead1.setGateway("192.1.1.0");
networkRead1.setNetmask("255.255.0.0");
List<IpAllocEntryRead> ipAllocEntries1 =
new ArrayList<IpAllocEntryRead>();
IpAllocEntryRead ipAllocEntry1 = new IpAllocEntryRead();
ipAllocEntry1.setIpAddress("192.1.1.3");
ipAllocEntry1.setNodeName("nodeName1");
ipAllocEntry1.setNodeGroupName("nodeGroupName1");
ipAllocEntry1.setClusterName("clusterName1");
IpAllocEntryRead ipAllocEntry2 = new IpAllocEntryRead();
ipAllocEntry2.setIpAddress("192.1.1.7");
ipAllocEntry2.setNodeName("nodeName2");
ipAllocEntry2.setNodeGroupName("nodeGroupName1");
ipAllocEntry2.setClusterName("clusterName1");
ipAllocEntries1.add(ipAllocEntry1);
ipAllocEntries1.add(ipAllocEntry2);
networkRead1.setIpAllocEntries(ipAllocEntries1);
NetworkRead networkRead2 = new NetworkRead();
networkRead2.setName("name2");
networkRead2.setPortGroup("portGroup2");
networkRead2.setDhcp(true);
List<IpAllocEntryRead> ipAllocEntries2 =
new ArrayList<IpAllocEntryRead>();
IpAllocEntryRead ipAllocEntry3 = new IpAllocEntryRead();
ipAllocEntry3.setIpAddress("192.1.10.3");
ipAllocEntry3.setNodeName("nodeName3");
ipAllocEntry3.setNodeGroupName("nodeGroupName2");
ipAllocEntry3.setClusterName("clusterName2");
IpAllocEntryRead ipAllocEntry4 = new IpAllocEntryRead();
ipAllocEntry4.setIpAddress("192.1.10.7");
ipAllocEntry4.setNodeName("nodeName4");
ipAllocEntry4.setNodeGroupName("nodeGroupName2");
ipAllocEntry4.setClusterName("clusterName2");
ipAllocEntries2.add(ipAllocEntry3);
ipAllocEntries2.add(ipAllocEntry4);
networkRead2.setIpAllocEntries(ipAllocEntries2);
getListNetwork(mapper, new NetworkRead[] { networkRead1, networkRead2 },
true);
CookieCache.clear();
}