use of org.apache.jackrabbit.core.IPentahoSystemSessionFactory in project pentaho-platform by pentaho.
the class RepositoryCleanerTest method gc.
@Test
public void gc() throws Exception {
GarbageCollector collector = mock(GarbageCollector.class);
RepositoryImpl repository = mock(RepositoryImpl.class);
when(repository.createDataStoreGarbageCollector()).thenReturn(collector);
MicroPlatform mp = new MicroPlatform(getSolutionPath());
mp.defineInstance(Repository.class, repository);
mp.defineInstance("jcrRepository", repository);
mp.start();
RepositoryCleaner cleaner = new RepositoryCleaner();
Session systemSession = mock(Session.class);
IPentahoSystemSessionFactory sessionFactory = mock(IPentahoSystemSessionFactory.class);
when(sessionFactory.create(repository)).thenReturn(systemSession);
cleaner.setSystemSessionFactory(sessionFactory);
try {
cleaner.gc();
} finally {
mp.stop();
}
verify(collector, times(1)).mark();
verify(collector, times(1)).sweep();
verify(collector, times(1)).close();
}
Aggregations