Search in sources :

Example 1 with DependencyResolverSupplier

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

the class DependencyResolverSupplierTest method shouldReturnTheDependencyResolveFromTheRegisteredDatasource.

@Test
public void shouldReturnTheDependencyResolveFromTheRegisteredDatasource() throws Exception {
    // given
    DataSourceManager dataSourceManager = new DataSourceManager();
    DependencyResolverSupplier supplier = new DependencyResolverSupplier(dataSourceManager);
    NeoStoreDataSource neoStoreDataSource = mock(NeoStoreDataSource.class);
    DependencyResolver dependencyResolver = mock(DependencyResolver.class);
    when(neoStoreDataSource.getDependencyResolver()).thenReturn(dependencyResolver);
    // when
    dataSourceManager.register(neoStoreDataSource);
    // then
    assertEquals(dependencyResolver, supplier.get());
}
Also used : NeoStoreDataSource(org.neo4j.kernel.NeoStoreDataSource) DependencyResolverSupplier(org.neo4j.kernel.impl.transaction.state.DataSourceManager.DependencyResolverSupplier) DependencyResolver(org.neo4j.graphdb.DependencyResolver) Test(org.junit.Test)

Example 2 with DependencyResolverSupplier

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

the class DependencyResolverSupplierTest method shouldReturnNullIfDataSourceHasBeenUnregistered.

@Test
public void shouldReturnNullIfDataSourceHasBeenUnregistered() throws Exception {
    // given
    DataSourceManager dataSourceManager = new DataSourceManager();
    DependencyResolverSupplier supplier = new DependencyResolverSupplier(dataSourceManager);
    NeoStoreDataSource neoStoreDataSource = mock(NeoStoreDataSource.class);
    DependencyResolver dependencyResolver = mock(DependencyResolver.class);
    when(neoStoreDataSource.getDependencyResolver()).thenReturn(dependencyResolver);
    dataSourceManager.register(neoStoreDataSource);
    // when
    dataSourceManager.unregister(neoStoreDataSource);
    // then
    assertEquals(null, supplier.get());
}
Also used : NeoStoreDataSource(org.neo4j.kernel.NeoStoreDataSource) DependencyResolverSupplier(org.neo4j.kernel.impl.transaction.state.DataSourceManager.DependencyResolverSupplier) DependencyResolver(org.neo4j.graphdb.DependencyResolver) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 DependencyResolver (org.neo4j.graphdb.DependencyResolver)2 NeoStoreDataSource (org.neo4j.kernel.NeoStoreDataSource)2 DependencyResolverSupplier (org.neo4j.kernel.impl.transaction.state.DataSourceManager.DependencyResolverSupplier)2