use of org.commonjava.maven.galley.cache.iotasks.DeleteTask in project galley by Commonjava.
the class FastLocalCacheProviderConcurrentIOTest method testDeleteWhenWriteCompleted.
@Test
@BMScript("TryToDeleteWhileWritingCompleted.btm")
public void testDeleteWhenWriteCompleted() throws Exception {
final ConcreteResource resource = createTestResource("file_delete_write_completed.txt");
final Future<Boolean> deleteFuture = testPool.submit((Callable<Boolean>) new DeleteTask(provider, content, resource, latch));
testPool.execute(new WriteTask(provider, content, resource, latch));
assertLatchWait();
final Boolean deleted = deleteFuture.get();
assertThat(deleted, equalTo(true));
assertThat(provider.exists(resource), equalTo(false));
}
use of org.commonjava.maven.galley.cache.iotasks.DeleteTask in project galley by Commonjava.
the class FastLocalCacheProviderConcurrentIOTest method testDeleteWhenWriteNotCompleted.
@Test
@BMScript("TryToDeleteWhileWritingNotCompleted.btm")
public void testDeleteWhenWriteNotCompleted() throws Exception {
final ConcreteResource resource = createTestResource("file_delete_write_not_completed.txt");
final Future<Boolean> deleteFuture = testPool.submit((Callable<Boolean>) new DeleteTask(provider, content, resource, latch));
testPool.execute(new WriteTask(provider, content, resource, latch, 1000));
assertLatchWait();
final Boolean deleted = deleteFuture.get();
assertThat(deleted, equalTo(false));
assertThat(provider.exists(resource), equalTo(true));
}
use of org.commonjava.maven.galley.cache.iotasks.DeleteTask in project galley by Commonjava.
the class FastLocalCacheProviderConcurrentIOTest method testWriteWhenDeleteCompleted.
@Test
@BMScript("TryToWriteWhileDeleteCompleted.btm")
public void testWriteWhenDeleteCompleted() throws Exception {
final ConcreteResource resource = createTestResource("file_write_delete_completed.txt");
prepareBothResource(resource, content);
final Future<Boolean> deleteFuture = testPool.submit((Callable<Boolean>) new DeleteTask(provider, content, resource, latch));
testPool.execute(new WriteTask(provider, content, resource, latch));
assertLatchWait();
final Boolean deleted = deleteFuture.get();
assertThat(deleted, equalTo(true));
assertThat(provider.exists(resource), equalTo(true));
}
Aggregations