@Test public void testRemoveDeploymentGroupNotFound() throws Exception { when(client.removeDeploymentGroup(GROUP_NAME)) .thenReturn(immediateFuture( new RemoveDeploymentGroupResponse(Status.DEPLOYMENT_GROUP_NOT_FOUND))); final int ret = command.run(options, client, out, false, null); final String output = baos.toString(); verify(client).removeDeploymentGroup(GROUP_NAME); assertEquals(1, ret); final String expected = format("Failed to remove deployment-group %s, status: %s\n", GROUP_NAME, Status.DEPLOYMENT_GROUP_NOT_FOUND); assertEquals(expected, output); }
@Override int run(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final BufferedReader stdin) throws ExecutionException, InterruptedException, IOException { final String name = options.getString(nameArg.getDest()); final RemoveDeploymentGroupResponse status = client.removeDeploymentGroup(name).get(); if (status == null) { throw new RuntimeException("The Helios master could not remove the given deployment group."); } final boolean failed = status.getStatus() != RemoveDeploymentGroupResponse.Status.REMOVED; if (json) { out.println(status.toJsonString()); } else { if (failed) { out.println(format("Failed to remove deployment-group %s, status: %s", name, status.getStatus())); } else { out.println(format("Deployment-group %s removed", name)); } } return failed ? 1 : 0; }
DeploymentGroupRemoveCommand extends ControlCommand { @Override int run(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final BufferedReader stdin) throws ExecutionException, InterruptedException, IOException { final String name = options.getString(nameArg.getDest()); final RemoveDeploymentGroupResponse status = client.removeDeploymentGroup(name).get(); if (status == null) { throw new RuntimeException("The Helios master could not remove the given deployment group."); } final boolean failed = status.getStatus() != RemoveDeploymentGroupResponse.Status.REMOVED; if (json) { out.println(status.toJsonString()); } else { if (failed) { out.println(format("Failed to remove deployment-group %s, status: %s", name, status.getStatus())); } else { out.println(format("Deployment-group %s removed", name)); } } return failed ? 1 : 0; } }
DeploymentGroupRemoveCommand extends ControlCommand { @Override int run(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final BufferedReader stdin) throws ExecutionException, InterruptedException, IOException { final String name = options.getString(nameArg.getDest()); final RemoveDeploymentGroupResponse status = client.removeDeploymentGroup(name).get(); if (status == null) { throw new RuntimeException("The Helios master could not remove the given deployment group."); } final boolean failed = status.getStatus() != RemoveDeploymentGroupResponse.Status.REMOVED; if (json) { out.println(status.toJsonString()); } else { if (failed) { out.println(format("Failed to remove deployment-group %s, status: %s", name, status.getStatus())); } else { out.println(format("Deployment-group %s removed", name)); } } return failed ? 1 : 0; } DeploymentGroupRemoveCommand(final Subparser parser); }
DeploymentGroupRemoveCommand extends ControlCommand { @Override int run(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final BufferedReader stdin) throws ExecutionException, InterruptedException, IOException { final String name = options.getString(nameArg.getDest()); final RemoveDeploymentGroupResponse status = client.removeDeploymentGroup(name).get(); if (status == null) { throw new RuntimeException("The Helios master could not remove the given deployment group."); } final boolean failed = status.getStatus() != RemoveDeploymentGroupResponse.Status.REMOVED; if (json) { out.println(status.toJsonString()); } else { if (failed) { out.println(format("Failed to remove deployment-group %s, status: %s", name, status.getStatus())); } else { out.println(format("Deployment-group %s removed", name)); } } return failed ? 1 : 0; } DeploymentGroupRemoveCommand(final Subparser parser);  }
DeploymentGroupRemoveCommand extends ControlCommand { @Override int run(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final BufferedReader stdin) throws ExecutionException, InterruptedException, IOException { final String name = options.getString(nameArg.getDest()); final RemoveDeploymentGroupResponse status = client.removeDeploymentGroup(name).get(); if (status == null) { throw new RuntimeException("The Helios master could not remove the given deployment group."); } final boolean failed = status.getStatus() != RemoveDeploymentGroupResponse.Status.REMOVED; if (json) { out.println(status.toJsonString()); } else { if (failed) { out.println(format("Failed to remove deployment-group %s, status: %s", name, status.getStatus())); } else { out.println(format("Deployment-group %s removed", name)); } } return failed ? 1 : 0; } DeploymentGroupRemoveCommand(final Subparser parser);   }