@Test public void testNicRemove() throws Exception { PowerShellNicsResource nicResource = new PowerShellNicsResource(VM_ID, poolMap, parser, "get-vm", uriProvider); String command = MessageFormat.format(REMOVE_NIC_COMMAND, VM_ID, NIC_ID); setUpCmdExpectations(command, ""); nicResource.remove(NIC_ID); }
@Test public void testNicList() throws Exception { PowerShellNicsResource nicResource = new PowerShellNicsResource(VM_ID, poolMap, parser, "get-vm", uriProvider); String[] commands = {GET_NICS_CMD, LOOKUP_NETWORK_ID_COMMAND}; String[] returns = {formatNic(NIC_NAME), formatNetwork(NETWORK_NAME)}; setUriInfo(setUpBasicUriExpectations()); setUpCmdExpectations(commands, returns); verifyNics(nicResource.list()); }
@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()); }