use of com.enonic.xp.repo.impl.vacuum.VacuumTaskParams in project xp by enonic.
the class SegmentVacuumTaskTest method test.
@Test
public void test() {
final BlobRecord record = blobStore.addRecord(segment, ByteSource.wrap("hello".getBytes()));
final BlobRecord record2 = blobStore.addRecord(segment2, ByteSource.wrap("hello".getBytes()));
assertEquals(2, blobStore.listSegments().count());
blobStore.removeRecord(segment, record2.getKey());
assertEquals(2, blobStore.listSegments().count());
final SegmentVacuumTask task = new SegmentVacuumTask();
task.setBlobStore(blobStore);
task.setRepositoryService(repositoryService);
task.setNodeService(nodeService);
final VacuumTaskParams vacuumParameters = VacuumTaskParams.create().build();
final VacuumTaskResult result = task.execute(vacuumParameters);
assertEquals(2, result.getProcessed());
assertEquals(1, result.getDeleted());
assertEquals(1, result.getInUse());
assertEquals(1, blobStore.listSegments().count());
assertEquals(segment, blobStore.listSegments().findFirst().get());
}
Aggregations