private void verifyNic(NIC nic) { assertNotNull(nic); assertEquals(nic.getId(), NIC_ID); assertNotNull(nic.getVm()); assertEquals(nic.getVm().getId(), VM_ID); verifyLinks(nic); }
@Test public void testNicAdd() throws Exception { PowerShellNicsResource nicResource = new PowerShellNicsResource(VM_ID, poolMap, parser, "get-vm", uriProvider); NIC nic = new NIC(); nic.setName(NIC_NAME); nic.setInterface(NicInterface.E1000.value()); nic.setNetwork(new Network()); nic.getNetwork().setId(NETWORK_ID); String[] commands = { MessageFormat.format(ADD_NIC_COMMAND, VM_ID, NETWORK_ID, NIC_NAME), LOOKUP_NETWORK_ID_COMMAND }; String[] returns = {formatNic(NIC_NAME), formatNetwork(NETWORK_NAME)}; setUriInfo(setUpCmdExpectations(commands, returns, "nics", NIC_ID)); verifyNic((NIC) nicResource.add(nic).getEntity()); }