@Test public void testKeySuccessfulKeyLifecycle() throws Exception { int rc = 0; String keyName = "key1"; KeyShell ks = new KeyShell(); ks.setConf(new Configuration()); outContent.reset(); final String[] args1 = {"create", keyName, "-provider", jceksProvider}; rc = ks.run(args1); assertEquals(0, rc); assertTrue(outContent.toString().contains(keyName + " has been " + "successfully created")); String listOut = listKeys(ks, false); assertTrue(listOut.contains(keyName)); listOut = listKeys(ks, true); assertTrue(listOut.contains(keyName)); assertTrue(listOut.contains("description")); assertTrue(listOut.contains("created")); outContent.reset(); final String[] args2 = {"roll", keyName, "-provider", jceksProvider}; rc = ks.run(args2); assertEquals(0, rc); assertTrue(outContent.toString().contains("key1 has been successfully " + "rolled.")); deleteKey(ks, keyName); listOut = listKeys(ks, false); assertFalse(listOut, listOut.contains(keyName)); }
@Override public int run(String[] args) throws Exception { int exitCode = 0; try { exitCode = init(args); if (exitCode != 0) { return exitCode; } if (command.validate()) { command.execute(); } else { exitCode = 1; } } catch (Exception e) { e.printStackTrace(err); return 1; } return exitCode; }
KeyShell extends Configured implements Tool { @Override public int run(String[] args) throws Exception { int exitCode = 0; try { exitCode = init(args); if (exitCode != 0) { return exitCode; } if (command.validate()) { command.execute(); } else { exitCode = 1; } } catch (Exception e) { e.printStackTrace(err); return 1; } return exitCode; } }
KeyShell extends Configured implements Tool { @Override public int run(String[] args) throws Exception { int exitCode = 0; try { exitCode = init(args); if (exitCode != 0) { return exitCode; } if (command.validate()) { command.execute(); } else { exitCode = 1; } } catch (Exception e) { e.printStackTrace(err); return 1; } return exitCode; }  }
KeyShell extends Configured implements Tool { @Override public int run(String[] args) throws Exception { int exitCode = 0; try { exitCode = init(args); if (exitCode != 0) { return exitCode; } if (command.validate()) { command.execute(); } else { exitCode = 1; } } catch (Exception e) { e.printStackTrace(err); return 1; } return exitCode; }  @Override int run(String[] args); static void main(String[] args); }
KeyShell extends Configured implements Tool { @Override public int run(String[] args) throws Exception { int exitCode = 0; try { exitCode = init(args); if (exitCode != 0) { return exitCode; } if (command.validate()) { command.execute(); } else { exitCode = 1; } } catch (Exception e) { e.printStackTrace(err); return 1; } return exitCode; }  @Override int run(String[] args); static void main(String[] args); public PrintStream out; public PrintStream err; }