/** * Move a {@link Dataset} identified by the given dataset URI string to trash. * <p> * When you call this method using a dataset URI, both data and metadata are * removed. After you call this method, the dataset no longer exists, unless * an exception is thrown. * <p> * When you call this method using a view URI, data in that view is moved to trash. * The dataset's metadata is not changed. This can throw an * {@code UnsupportedOperationException} if the move to trash requires additional * work. For example, if some, but not all, of the data in an underlying data * file must be removed, then the implementation is allowed to reject the * move to trash rather than copy the remaining records to a new file. * An implementation must document under what conditions it accepts moves to trash, * and under what conditions it rejects them. * <p> * URIs must begin with {@code dataset:}. The remainder of * the URI is implementation specific, depending on the dataset scheme. * * @param uri a {@code Dataset} URI string * @return {@code true} if any data or metadata is removed, {@code false} * otherwise * @throws NullPointerException if {@code uri} is null * @throws IllegalArgumentException if {@code uri} is not a dataset URI */ public static boolean moveToTrash(String uri) { return moveToTrash(URI.create(uri)); }
@Override public void run() { Datasets.moveToTrash(datasetUri); } });
@Test public void testMoveToTrashStringUri() { URI datasetUri = new URIBuilder(repoUri, "ns", "test").build(); Datasets.moveToTrash(datasetUri.toString()); verify(repo).moveToTrash("ns", "test"); verifyNoMoreInteractions(repo); }
@Test public void testMoveToTrash() { URI datasetUri = new URIBuilder(repoUri, "ns", "test").build(); Datasets.moveToTrash(datasetUri); verify(repo).moveToTrash("ns", "test"); verifyNoMoreInteractions(repo); }