use of com.enonic.xp.repo.impl.vacuum.VacuumTask in project xp by enonic.
the class AbstractBlobVacuumTaskTest method age_threshold.
public void age_threshold() throws Exception {
this.blobStore.addRecord(segment, createBlobRecord('a'));
final VacuumTask task = createTask();
final VacuumTaskResult result = task.execute(VacuumTaskParams.create().build());
assertEquals(0, result.getProcessed());
}
use of com.enonic.xp.repo.impl.vacuum.VacuumTask in project xp by enonic.
the class AbstractBlobVacuumTaskTest method test_progress_report.
public void test_progress_report() throws Exception {
this.blobStore.addRecord(segment, createBlobRecord('a'));
this.blobStore.addRecord(segment, createBlobRecord('b'));
this.blobStore.addRecord(segment, createBlobRecord('c'));
final VacuumTask task = createTask();
AtomicInteger blobReportCount = new AtomicInteger(0);
final VacuumListener progressListener = new VacuumListener() {
@Override
public void vacuumBegin(final long taskCount) {
}
@Override
public void taskBegin(final String task, final Long stepCount) {
}
@Override
public void stepBegin(final String stepName, final Long toProcessCount) {
}
@Override
public void processed(final long count) {
blobReportCount.incrementAndGet();
}
};
final VacuumTaskResult result = task.execute(VacuumTaskParams.create().ageThreshold(0).listener(progressListener).build());
assertEquals(3, result.getProcessed());
assertEquals(2, result.getDeleted());
assertEquals(1, result.getInUse());
assertEquals(3, blobReportCount.get());
}
use of com.enonic.xp.repo.impl.vacuum.VacuumTask in project xp by enonic.
the class AbstractBlobVacuumTaskTest method test_delete_unused.
public void test_delete_unused() throws Exception {
this.blobStore.addRecord(segment, createBlobRecord('a'));
this.blobStore.addRecord(segment, createBlobRecord('b'));
this.blobStore.addRecord(segment, createBlobRecord('c'));
final VacuumTask task = createTask();
final VacuumTaskResult result = task.execute(VacuumTaskParams.create().ageThreshold(0).build());
assertEquals(3, result.getProcessed());
assertEquals(2, result.getDeleted());
assertEquals(1, result.getInUse());
}
Aggregations