@Test public void testMultipleDatasets() throws Exception { command.targets = Lists.newArrayList("users", "moreusers"); command.run(); verify(repo).moveToTrash("default", "users"); verify(console).debug(contains("Deleted"), eq("users")); verify(repo).moveToTrash("default", "moreusers"); verify(console).debug(contains("Deleted"), eq("moreusers")); }
@Override public int run() throws IOException { if (targets == null || targets.isEmpty()) { throw new IllegalArgumentException("No views or datasets were specified."); } for (String uriOrName : targets) { if (isViewUri(uriOrName)) { View view = Datasets.load(uriOrName); Preconditions.checkArgument(viewMatches(view.getUri(), uriOrName), "Resolved view does not match requested view: " + view.getUri()); if(skipTrash) { view.deleteAll(); }else { view.moveToTrash(); } } else if (isDatasetUri(uriOrName)) { if(skipTrash) { Datasets.delete(uriOrName); }else { Datasets.moveToTrash(uriOrName); } } else { if(skipTrash){ getDatasetRepository().delete(namespace, uriOrName); }else { getDatasetRepository().moveToTrash(namespace, uriOrName); } } console.debug("Deleted {}", uriOrName); } return 0; }
DeleteCommand extends BaseDatasetCommand { @Override public int run() throws IOException { if (targets == null || targets.isEmpty()) { throw new IllegalArgumentException("No views or datasets were specified."); } for (String uriOrName : targets) { if (isViewUri(uriOrName)) { View view = Datasets.load(uriOrName); Preconditions.checkArgument(viewMatches(view.getUri(), uriOrName), "Resolved view does not match requested view: " + view.getUri()); if(skipTrash) { view.deleteAll(); }else { view.moveToTrash(); } } else if (isDatasetUri(uriOrName)) { if(skipTrash) { Datasets.delete(uriOrName); }else { Datasets.moveToTrash(uriOrName); } } else { if(skipTrash){ getDatasetRepository().delete(namespace, uriOrName); }else { getDatasetRepository().moveToTrash(namespace, uriOrName); } } console.debug("Deleted {}", uriOrName); } return 0; } }
DeleteCommand extends BaseDatasetCommand { @Override public int run() throws IOException { if (targets == null || targets.isEmpty()) { throw new IllegalArgumentException("No views or datasets were specified."); } for (String uriOrName : targets) { if (isViewUri(uriOrName)) { View view = Datasets.load(uriOrName); Preconditions.checkArgument(viewMatches(view.getUri(), uriOrName), "Resolved view does not match requested view: " + view.getUri()); if(skipTrash) { view.deleteAll(); }else { view.moveToTrash(); } } else if (isDatasetUri(uriOrName)) { if(skipTrash) { Datasets.delete(uriOrName); }else { Datasets.moveToTrash(uriOrName); } } else { if(skipTrash){ getDatasetRepository().delete(namespace, uriOrName); }else { getDatasetRepository().moveToTrash(namespace, uriOrName); } } console.debug("Deleted {}", uriOrName); } return 0; } DeleteCommand(Logger console); }
DeleteCommand extends BaseDatasetCommand { @Override public int run() throws IOException { if (targets == null || targets.isEmpty()) { throw new IllegalArgumentException("No views or datasets were specified."); } for (String uriOrName : targets) { if (isViewUri(uriOrName)) { View view = Datasets.load(uriOrName); Preconditions.checkArgument(viewMatches(view.getUri(), uriOrName), "Resolved view does not match requested view: " + view.getUri()); if(skipTrash) { view.deleteAll(); }else { view.moveToTrash(); } } else if (isDatasetUri(uriOrName)) { if(skipTrash) { Datasets.delete(uriOrName); }else { Datasets.moveToTrash(uriOrName); } } else { if(skipTrash){ getDatasetRepository().delete(namespace, uriOrName); }else { getDatasetRepository().moveToTrash(namespace, uriOrName); } } console.debug("Deleted {}", uriOrName); } return 0; } DeleteCommand(Logger console); @Override int run(); @Override List<String> getExamples(); }
DeleteCommand extends BaseDatasetCommand { @Override public int run() throws IOException { if (targets == null || targets.isEmpty()) { throw new IllegalArgumentException("No views or datasets were specified."); } for (String uriOrName : targets) { if (isViewUri(uriOrName)) { View view = Datasets.load(uriOrName); Preconditions.checkArgument(viewMatches(view.getUri(), uriOrName), "Resolved view does not match requested view: " + view.getUri()); if(skipTrash) { view.deleteAll(); }else { view.moveToTrash(); } } else if (isDatasetUri(uriOrName)) { if(skipTrash) { Datasets.delete(uriOrName); }else { Datasets.moveToTrash(uriOrName); } } else { if(skipTrash){ getDatasetRepository().delete(namespace, uriOrName); }else { getDatasetRepository().moveToTrash(namespace, uriOrName); } } console.debug("Deleted {}", uriOrName); } return 0; } DeleteCommand(Logger console); @Override int run(); @Override List<String> getExamples();  }