@Test(expected = AssertionError.class) public void listVersionsThrowsIfSecretDoesNotExist() throws Exception { listVersionsActionConfig.name = secretV2.getDisplayName(); when(keywhizClient.getSanitizedSecretByName(secretV2.getDisplayName())).thenThrow( new KeywhizClient.NotFoundException()); listVersionsAction.run(); }
@Override public void run() { if (listVersionsActionConfig.name == null || !validName(listVersionsActionConfig.name)) { throw new IllegalArgumentException(format("Invalid name, must match %s", VALID_NAME_PATTERN)); } try { SanitizedSecret sanitizedSecret = keywhizClient.getSanitizedSecretByName(listVersionsActionConfig.name); List<SanitizedSecret> versions = keywhizClient.listSecretVersions(sanitizedSecret.name(), listVersionsActionConfig.idx, listVersionsActionConfig.number); printing.printSecretVersions(versions, sanitizedSecret.version()); } catch (NotFoundException e) { throw new AssertionError("Secret does not exist: " + listVersionsActionConfig.name); } catch (IOException e) { throw Throwables.propagate(e); } }
ListVersionsAction implements Runnable { @Override public void run() { if (listVersionsActionConfig.name == null || !validName(listVersionsActionConfig.name)) { throw new IllegalArgumentException(format("Invalid name, must match %s", VALID_NAME_PATTERN)); } try { SanitizedSecret sanitizedSecret = keywhizClient.getSanitizedSecretByName(listVersionsActionConfig.name); List<SanitizedSecret> versions = keywhizClient.listSecretVersions(sanitizedSecret.name(), listVersionsActionConfig.idx, listVersionsActionConfig.number); printing.printSecretVersions(versions, sanitizedSecret.version()); } catch (NotFoundException e) { throw new AssertionError("Secret does not exist: " + listVersionsActionConfig.name); } catch (IOException e) { throw Throwables.propagate(e); } } }
ListVersionsAction implements Runnable { @Override public void run() { if (listVersionsActionConfig.name == null || !validName(listVersionsActionConfig.name)) { throw new IllegalArgumentException(format("Invalid name, must match %s", VALID_NAME_PATTERN)); } try { SanitizedSecret sanitizedSecret = keywhizClient.getSanitizedSecretByName(listVersionsActionConfig.name); List<SanitizedSecret> versions = keywhizClient.listSecretVersions(sanitizedSecret.name(), listVersionsActionConfig.idx, listVersionsActionConfig.number); printing.printSecretVersions(versions, sanitizedSecret.version()); } catch (NotFoundException e) { throw new AssertionError("Secret does not exist: " + listVersionsActionConfig.name); } catch (IOException e) { throw Throwables.propagate(e); } } ListVersionsAction(ListVersionsActionConfig listVersionsActionConfig, KeywhizClient client, Printing printing); }
ListVersionsAction implements Runnable { @Override public void run() { if (listVersionsActionConfig.name == null || !validName(listVersionsActionConfig.name)) { throw new IllegalArgumentException(format("Invalid name, must match %s", VALID_NAME_PATTERN)); } try { SanitizedSecret sanitizedSecret = keywhizClient.getSanitizedSecretByName(listVersionsActionConfig.name); List<SanitizedSecret> versions = keywhizClient.listSecretVersions(sanitizedSecret.name(), listVersionsActionConfig.idx, listVersionsActionConfig.number); printing.printSecretVersions(versions, sanitizedSecret.version()); } catch (NotFoundException e) { throw new AssertionError("Secret does not exist: " + listVersionsActionConfig.name); } catch (IOException e) { throw Throwables.propagate(e); } } ListVersionsAction(ListVersionsActionConfig listVersionsActionConfig, KeywhizClient client, Printing printing); @Override void run(); }
ListVersionsAction implements Runnable { @Override public void run() { if (listVersionsActionConfig.name == null || !validName(listVersionsActionConfig.name)) { throw new IllegalArgumentException(format("Invalid name, must match %s", VALID_NAME_PATTERN)); } try { SanitizedSecret sanitizedSecret = keywhizClient.getSanitizedSecretByName(listVersionsActionConfig.name); List<SanitizedSecret> versions = keywhizClient.listSecretVersions(sanitizedSecret.name(), listVersionsActionConfig.idx, listVersionsActionConfig.number); printing.printSecretVersions(versions, sanitizedSecret.version()); } catch (NotFoundException e) { throw new AssertionError("Secret does not exist: " + listVersionsActionConfig.name); } catch (IOException e) { throw Throwables.propagate(e); } } ListVersionsAction(ListVersionsActionConfig listVersionsActionConfig, KeywhizClient client, Printing printing); @Override void run();  }