use of org.commonjava.indy.model.core.BatchDeleteRequest in project indy by Commonjava.
the class BatchDeleteFromRepositoryTest method removeFilesFromRepository.
@Test
public void removeFilesFromRepository() throws Exception {
for (String path : paths) {
boolean exists = client.content().exists(hosted.getKey(), path);
assertThat("The file does not exists.", exists, equalTo(true));
}
BatchDeleteRequest request = new BatchDeleteRequest();
request.setStoreKey(hosted.getKey());
request.setPaths(paths);
client.maint().deleteFilesFromStore(request);
for (String path : paths) {
boolean exists = client.content().exists(hosted.getKey(), path);
assertThat("The file is not removed.", exists, equalTo(false));
}
}
use of org.commonjava.indy.model.core.BatchDeleteRequest in project indy by Commonjava.
the class RemoveFilesInTrackingReportTest method run.
@Test
public void run() throws Exception {
final String trackingId = newName();
final InputStream stream = new ByteArrayInputStream(("This is a test: " + System.nanoTime()).getBytes());
final String a = "/path/to/1/foo-1.jar";
final String b = "/path/to/2/foo-2.jar";
final String c = "/path/to/3/foo-3.jar";
for (String path : Arrays.asList(a, b)) {
client.module(IndyFoloContentClientModule.class).store(trackingId, hosted, STORE, path, stream);
}
StoreKey key = new StoreKey(PKG_TYPE_MAVEN, hosted, STORE);
client.content().store(key, c, stream);
IndyFoloAdminClientModule adminModule = client.module(IndyFoloAdminClientModule.class);
boolean success = adminModule.sealTrackingRecord(trackingId);
assertThat(success, equalTo(true));
boolean exists;
for (String path : Arrays.asList(a, b)) {
exists = client.content().exists(key, path);
assertThat("The file does not exists.", exists, equalTo(true));
}
exists = client.content().exists(key, c);
assertThat("The file does not exists.", exists, equalTo(true));
BatchDeleteRequest request = new BatchDeleteRequest();
request.setStoreKey(key);
request.setTrackingID(trackingId);
adminModule.deleteFilesFromStoreByTrackingID(request);
for (String path : Arrays.asList(a, b)) {
exists = client.content().exists(key, path);
assertThat("The file is not removed.", exists, equalTo(false));
}
exists = client.content().exists(key, c);
assertThat("The file does not exists.", exists, equalTo(true));
}
Aggregations