Search in sources :

Example 6 with DataSourceManager

use of org.neo4j.kernel.impl.transaction.state.DataSourceManager in project neo4j by neo4j.

the class DefaultUdcInformationCollectorTest method shouldReportStoreSizes.

@Test
public void shouldReportStoreSizes() throws Throwable {
    DataSourceManager dataSourceManager = new DataSourceManager();
    NeoStoreDataSource dataSource = mock(NeoStoreDataSource.class);
    dataSourceManager.start();
    UdcInformationCollector collector = new DefaultUdcInformationCollector(Config.empty(), dataSourceManager, new StubIdGeneratorFactory(), mock(StartupStatistics.class), usageData);
    when(dataSource.getStoreId()).thenReturn(StoreId.DEFAULT);
    dataSourceManager.register(dataSource);
    when(dataSource.listStoreFiles(false)).thenReturn(asResourceIterator(testFiles().iterator()));
    Map<String, String> udcParams = collector.getUdcParams();
    assertThat(udcParams.get("storesize"), is("152"));
}
Also used : NeoStoreDataSource(org.neo4j.kernel.NeoStoreDataSource) DataSourceManager(org.neo4j.kernel.impl.transaction.state.DataSourceManager) StartupStatistics(org.neo4j.kernel.impl.core.StartupStatistics) Test(org.junit.Test)

Aggregations

DataSourceManager (org.neo4j.kernel.impl.transaction.state.DataSourceManager)6 Test (org.junit.Test)4 NeoStoreDataSource (org.neo4j.kernel.NeoStoreDataSource)3 InOrder (org.mockito.InOrder)2 AvailabilityGuard (org.neo4j.kernel.AvailabilityGuard)2 StartupStatistics (org.neo4j.kernel.impl.core.StartupStatistics)1 FileSystemWatcherService (org.neo4j.kernel.impl.util.watcher.FileSystemWatcherService)1