use of org.neo4j.server.plugins.Injectable in project neo4j by neo4j.
the class ExtensionInitializer method initializePackages.
public Collection<Injectable<?>> initializePackages(Iterable<String> packageNames) {
GraphDatabaseAPI graphDatabaseService = neoServer.getDatabase().getGraph();
Config configuration = neoServer.getConfig();
Collection<Injectable<?>> injectables = new HashSet<>();
for (PluginLifecycle lifecycle : lifecycles) {
if (hasPackage(lifecycle, packageNames)) {
if (lifecycle instanceof SPIPluginLifecycle) {
SPIPluginLifecycle lifeCycleSpi = (SPIPluginLifecycle) lifecycle;
injectables.addAll(lifeCycleSpi.start(neoServer));
} else {
injectables.addAll(lifecycle.start(graphDatabaseService, new ConfigAdapter(configuration)));
}
}
}
return injectables;
}
use of org.neo4j.server.plugins.Injectable in project neo4j by neo4j.
the class ExtensionInitializerTest method testPluginInitialization.
@Test
public void testPluginInitialization() {
Config config = Config.embeddedDefaults(stringMap(ServerSettings.transaction_idle_timeout.name(), "600"));
NeoServer neoServer = Mockito.mock(NeoServer.class, Mockito.RETURNS_DEEP_STUBS);
Mockito.when(neoServer.getConfig()).thenReturn(config);
ExtensionInitializer extensionInitializer = new ExtensionInitializer(neoServer);
Collection<Injectable<?>> injectableProperties = extensionInitializer.initializePackages(Arrays.asList("org.neo4j.server.modules"));
assertTrue(injectableProperties.stream().anyMatch(i -> ServerSettings.transaction_idle_timeout.name().equals(i.getValue())));
}
Aggregations