@Test public final void testUserAbortedUnsafeDropBeforeWarning() throws IOException { setUserDropConfirm(false); drop.execute("drop", MEMORY_MEMBER_ID1); verify(mockConsoleIO, never()).askProceed(startsWith("WARNING: dropping this repository may break"), anyBoolean()); verify(mockConsoleIO).writeln("Drop aborted"); }
@Override public void execute(String... tokens) throws IOException { if (tokens.length < 2) { consoleIO.writeln(getHelpLong()); } else { final String repoID = tokens[1]; try { dropRepository(repoID); } catch (RepositoryConfigException e) { consoleIO.writeError("Unable to drop repository '" + repoID + "': " + e.getMessage()); LOGGER.warn("Unable to drop repository '" + repoID + "'", e); } catch (RepositoryReadOnlyException e) { try { if (LockRemover.tryToRemoveLock(state.getManager().getSystemRepository(), consoleIO)) { execute(tokens); } else { consoleIO.writeError("Failed to drop repository"); LOGGER.error("Failed to drop repository", e); } } catch (RepositoryException e2) { consoleIO.writeError("Failed to restart system: " + e2.getMessage()); LOGGER.error("Failed to restart system", e2); } } catch (RepositoryException e) { consoleIO.writeError("Failed to update configuration in system repository: " + e.getMessage()); LOGGER.warn("Failed to update configuration in system repository", e); } } }
Drop extends ConsoleCommand { @Override public void execute(String... tokens) throws IOException { if (tokens.length < 2) { consoleIO.writeln(getHelpLong()); } else { final String repoID = tokens[1]; try { dropRepository(repoID); } catch (RepositoryConfigException e) { consoleIO.writeError("Unable to drop repository '" + repoID + "': " + e.getMessage()); LOGGER.warn("Unable to drop repository '" + repoID + "'", e); } catch (RepositoryReadOnlyException e) { try { if (LockRemover.tryToRemoveLock(state.getManager().getSystemRepository(), consoleIO)) { execute(tokens); } else { consoleIO.writeError("Failed to drop repository"); LOGGER.error("Failed to drop repository", e); } } catch (RepositoryException e2) { consoleIO.writeError("Failed to restart system: " + e2.getMessage()); LOGGER.error("Failed to restart system", e2); } } catch (RepositoryException e) { consoleIO.writeError("Failed to update configuration in system repository: " + e.getMessage()); LOGGER.warn("Failed to update configuration in system repository", e); } } } }
Drop extends ConsoleCommand { @Override public void execute(String... tokens) throws IOException { if (tokens.length < 2) { consoleIO.writeln(getHelpLong()); } else { final String repoID = tokens[1]; try { dropRepository(repoID); } catch (RepositoryConfigException e) { consoleIO.writeError("Unable to drop repository '" + repoID + "': " + e.getMessage()); LOGGER.warn("Unable to drop repository '" + repoID + "'", e); } catch (RepositoryReadOnlyException e) { try { if (LockRemover.tryToRemoveLock(state.getManager().getSystemRepository(), consoleIO)) { execute(tokens); } else { consoleIO.writeError("Failed to drop repository"); LOGGER.error("Failed to drop repository", e); } } catch (RepositoryException e2) { consoleIO.writeError("Failed to restart system: " + e2.getMessage()); LOGGER.error("Failed to restart system", e2); } } catch (RepositoryException e) { consoleIO.writeError("Failed to update configuration in system repository: " + e.getMessage()); LOGGER.warn("Failed to update configuration in system repository", e); } } } Drop(ConsoleIO consoleIO, ConsoleState state, Close close); }
Drop extends ConsoleCommand { @Override public void execute(String... tokens) throws IOException { if (tokens.length < 2) { consoleIO.writeln(getHelpLong()); } else { final String repoID = tokens[1]; try { dropRepository(repoID); } catch (RepositoryConfigException e) { consoleIO.writeError("Unable to drop repository '" + repoID + "': " + e.getMessage()); LOGGER.warn("Unable to drop repository '" + repoID + "'", e); } catch (RepositoryReadOnlyException e) { try { if (LockRemover.tryToRemoveLock(state.getManager().getSystemRepository(), consoleIO)) { execute(tokens); } else { consoleIO.writeError("Failed to drop repository"); LOGGER.error("Failed to drop repository", e); } } catch (RepositoryException e2) { consoleIO.writeError("Failed to restart system: " + e2.getMessage()); LOGGER.error("Failed to restart system", e2); } } catch (RepositoryException e) { consoleIO.writeError("Failed to update configuration in system repository: " + e.getMessage()); LOGGER.warn("Failed to update configuration in system repository", e); } } } Drop(ConsoleIO consoleIO, ConsoleState state, Close close); @Override String getName(); @Override String getHelpShort(); @Override String getHelpLong(); @Override void execute(String... tokens); }
Drop extends ConsoleCommand { @Override public void execute(String... tokens) throws IOException { if (tokens.length < 2) { consoleIO.writeln(getHelpLong()); } else { final String repoID = tokens[1]; try { dropRepository(repoID); } catch (RepositoryConfigException e) { consoleIO.writeError("Unable to drop repository '" + repoID + "': " + e.getMessage()); LOGGER.warn("Unable to drop repository '" + repoID + "'", e); } catch (RepositoryReadOnlyException e) { try { if (LockRemover.tryToRemoveLock(state.getManager().getSystemRepository(), consoleIO)) { execute(tokens); } else { consoleIO.writeError("Failed to drop repository"); LOGGER.error("Failed to drop repository", e); } } catch (RepositoryException e2) { consoleIO.writeError("Failed to restart system: " + e2.getMessage()); LOGGER.error("Failed to restart system", e2); } } catch (RepositoryException e) { consoleIO.writeError("Failed to update configuration in system repository: " + e.getMessage()); LOGGER.warn("Failed to update configuration in system repository", e); } } } Drop(ConsoleIO consoleIO, ConsoleState state, Close close); @Override String getName(); @Override String getHelpShort(); @Override String getHelpLong(); @Override void execute(String... tokens);  }