@Test public void testInsufficientOptions() throws Exception { DestroyClusterCommand command = new DestroyClusterCommand(); Map<String, File> keys = KeyPair.generateTemporaryFiles(); int rc = command.run(null, null, err, Lists.<String>newArrayList( "--private-key-file", keys.get("private").getAbsolutePath()) ); assertThat(rc, is(-1)); assertThat(errBytes.toString(), containsString("Option 'cluster-name' not set")); }
@Override public int run(InputStream in, PrintStream out, PrintStream err, List<String> args) throws Exception { OptionSet optionSet = parser.parse(args.toArray(new String[args.size()])); if (!optionSet.nonOptionArguments().isEmpty()) { printUsage(err); return -1; } try { ClusterSpec clusterSpec = getClusterSpec(optionSet); printProviderInfo(out, err, clusterSpec, optionSet); return run(in, out, err, clusterSpec); } catch (IllegalArgumentException e) { printErrorAndHelpHint(err, e); return -1; } }
DestroyClusterCommand extends AbstractClusterCommand { @Override public int run(InputStream in, PrintStream out, PrintStream err, List<String> args) throws Exception { OptionSet optionSet = parser.parse(args.toArray(new String[args.size()])); if (!optionSet.nonOptionArguments().isEmpty()) { printUsage(err); return -1; } try { ClusterSpec clusterSpec = getClusterSpec(optionSet); printProviderInfo(out, err, clusterSpec, optionSet); return run(in, out, err, clusterSpec); } catch (IllegalArgumentException e) { printErrorAndHelpHint(err, e); return -1; } } }
DestroyClusterCommand extends AbstractClusterCommand { @Override public int run(InputStream in, PrintStream out, PrintStream err, List<String> args) throws Exception { OptionSet optionSet = parser.parse(args.toArray(new String[args.size()])); if (!optionSet.nonOptionArguments().isEmpty()) { printUsage(err); return -1; } try { ClusterSpec clusterSpec = getClusterSpec(optionSet); printProviderInfo(out, err, clusterSpec, optionSet); return run(in, out, err, clusterSpec); } catch (IllegalArgumentException e) { printErrorAndHelpHint(err, e); return -1; } } DestroyClusterCommand();  DestroyClusterCommand(ClusterControllerFactory factory); }
DestroyClusterCommand extends AbstractClusterCommand { @Override public int run(InputStream in, PrintStream out, PrintStream err, List<String> args) throws Exception { OptionSet optionSet = parser.parse(args.toArray(new String[args.size()])); if (!optionSet.nonOptionArguments().isEmpty()) { printUsage(err); return -1; } try { ClusterSpec clusterSpec = getClusterSpec(optionSet); printProviderInfo(out, err, clusterSpec, optionSet); return run(in, out, err, clusterSpec); } catch (IllegalArgumentException e) { printErrorAndHelpHint(err, e); return -1; } } DestroyClusterCommand();  DestroyClusterCommand(ClusterControllerFactory factory); @Override int run(InputStream in, PrintStream out, PrintStream err,
                 List<String> args); int run(InputStream in, PrintStream out, PrintStream err,
                 ClusterSpec clusterSpec); }
DestroyClusterCommand extends AbstractClusterCommand { @Override public int run(InputStream in, PrintStream out, PrintStream err, List<String> args) throws Exception { OptionSet optionSet = parser.parse(args.toArray(new String[args.size()])); if (!optionSet.nonOptionArguments().isEmpty()) { printUsage(err); return -1; } try { ClusterSpec clusterSpec = getClusterSpec(optionSet); printProviderInfo(out, err, clusterSpec, optionSet); return run(in, out, err, clusterSpec); } catch (IllegalArgumentException e) { printErrorAndHelpHint(err, e); return -1; } } DestroyClusterCommand();  DestroyClusterCommand(ClusterControllerFactory factory); @Override int run(InputStream in, PrintStream out, PrintStream err,
                 List<String> args); int run(InputStream in, PrintStream out, PrintStream err,
                 ClusterSpec clusterSpec);  }