Search in sources :

Example 16 with Dependencies

use of org.neo4j.kernel.impl.util.Dependencies in project neo4j by neo4j.

the class NeoStoreDataSourceRule method nativeLabelScanStoreProvider.

public static LabelScanStoreProvider nativeLabelScanStoreProvider(File storeDir, FileSystemAbstraction fs, PageCache pageCache, Config config, LogService logService) {
    try {
        Dependencies dependencies = new Dependencies();
        dependencies.satisfyDependencies(pageCache, config, IndexStoreView.EMPTY, logService);
        KernelContext kernelContext = new SimpleKernelContext(storeDir, DatabaseInfo.COMMUNITY, dependencies);
        return (LabelScanStoreProvider) new NativeLabelScanStoreExtension().newInstance(kernelContext, DependenciesProxy.dependencies(dependencies, NativeLabelScanStoreExtension.Dependencies.class));
    } catch (Throwable e) {
        throw launderedException(e);
    }
}
Also used : LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) SimpleKernelContext(org.neo4j.kernel.impl.spi.SimpleKernelContext) NativeLabelScanStoreExtension(org.neo4j.kernel.impl.api.scan.NativeLabelScanStoreExtension) Dependencies(org.neo4j.kernel.impl.util.Dependencies) SimpleKernelContext(org.neo4j.kernel.impl.spi.SimpleKernelContext) KernelContext(org.neo4j.kernel.impl.spi.KernelContext)

Example 17 with Dependencies

use of org.neo4j.kernel.impl.util.Dependencies in project neo4j by neo4j.

the class RESTApiModuleTest method shouldRegisterASingleUri.

@Test
public void shouldRegisterASingleUri() throws Exception {
    // Given
    WebServer webServer = mock(WebServer.class);
    Map<String, String> params = new HashMap();
    String path = "/db/data";
    params.put(ServerSettings.rest_api_path.name(), path);
    Config config = Config.embeddedDefaults(params);
    Dependencies deps = new Dependencies();
    deps.satisfyDependency(new UsageData(mock(JobScheduler.class)));
    Database db = mock(Database.class);
    // When
    RESTApiModule module = new RESTApiModule(webServer, config, deps, NullLogProvider.getInstance());
    module.start();
    // Then
    verify(webServer).addJAXRSClasses(any(List.class), anyString(), anyCollection());
}
Also used : UsageData(org.neo4j.udc.UsageData) WebServer(org.neo4j.server.web.WebServer) HashMap(java.util.HashMap) Config(org.neo4j.kernel.configuration.Config) Database(org.neo4j.server.database.Database) List(java.util.List) Matchers.anyString(org.mockito.Matchers.anyString) Dependencies(org.neo4j.kernel.impl.util.Dependencies) Test(org.junit.Test)

Example 18 with Dependencies

use of org.neo4j.kernel.impl.util.Dependencies in project neo4j by neo4j.

the class QueryEngineProviderTest method shouldUsePickTheEngineWithLowestPriority.

@Test
public void shouldUsePickTheEngineWithLowestPriority() throws Throwable {
    // Given
    QueryEngineProvider provider1 = mock(QueryEngineProvider.class);
    QueryEngineProvider provider2 = mock(QueryEngineProvider.class);
    when(provider1.enginePriority()).thenReturn(1);
    when(provider2.enginePriority()).thenReturn(2);
    Dependencies deps = new Dependencies();
    GraphDatabaseAPI graphAPI = mock(GraphDatabaseAPI.class);
    QueryExecutionEngine executionEngine = mock(QueryExecutionEngine.class);
    QueryExecutionEngine executionEngine2 = mock(QueryExecutionEngine.class);
    when(provider1.createEngine(any(), any())).thenReturn(executionEngine);
    when(provider2.createEngine(any(), any())).thenReturn(executionEngine2);
    // When
    Iterable<QueryEngineProvider> providers = Iterables.asIterable(provider1, provider2);
    QueryExecutionEngine engine = QueryEngineProvider.initialize(deps, graphAPI, providers);
    // Then
    assertSame(executionEngine, engine);
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) Dependencies(org.neo4j.kernel.impl.util.Dependencies) Test(org.junit.Test)

Aggregations

Dependencies (org.neo4j.kernel.impl.util.Dependencies)18 Test (org.junit.Test)9 Config (org.neo4j.kernel.configuration.Config)8 SimpleKernelContext (org.neo4j.kernel.impl.spi.SimpleKernelContext)7 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)7 File (java.io.File)5 IOException (java.io.IOException)5 PageCache (org.neo4j.io.pagecache.PageCache)5 Monitors (org.neo4j.kernel.monitoring.Monitors)5 KernelContext (org.neo4j.kernel.impl.spi.KernelContext)4 NullLogProvider (org.neo4j.logging.NullLogProvider)4 SimpleLogService (org.neo4j.kernel.impl.logging.SimpleLogService)3 TransactionIdStore (org.neo4j.kernel.impl.transaction.log.TransactionIdStore)3 InetSocketAddress (java.net.InetSocketAddress)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 TimeUnit (java.util.concurrent.TimeUnit)2 Stream (java.util.stream.Stream)2 Assert.assertNull (org.junit.Assert.assertNull)2 Assert.fail (org.junit.Assert.fail)2