VmGetMksTicketStepCmd extends StepCommand { @Override protected void execute() throws ApiFeException, InterruptedException, RpcException { try { List<VmEntity> entityList = step.getTransientResourceEntities(Vm.KIND); Preconditions.checkArgument(entityList.size() == 1, "There should be only 1 VM referenced by step %s", step.getId()); VmEntity vm = entityList.get(0); vmId = vm.getId(); MksTicketResponse response = getVmMksTicket(vm); String networkProperties = objectMapper.writeValueAsString(response.getTicket()); taskBackend.setTaskResourceProperties(taskCommand.getTask(), networkProperties); } catch (JsonProcessingException e) { throw new IllegalArgumentException(String.format("Error serializing resourceProperties for vm %s: %s", vmId, e.getMessage())); } catch (RpcException e) { logger.error("failed creating Get VM Networks task for vm {}", vmId, e); throw e; } } VmGetMksTicketStepCmd(TaskCommand taskCommand,
                               StepBackend stepBackend,
                               StepEntity step,
                               TaskBackend taskBackend);   }
@Test public void testVmNotFoundException() throws Exception { VmGetMksTicketStepCmd command = getCommand(); try { command.execute(); fail("should have failed due to VmNotFoundException exception"); } catch (com.vmware.photon.controller.api.frontend.exceptions.external.VmNotFoundException ex) { } }