use of org.neo4j.kernel.extension.context.GlobalExtensionContext in project neo4j by neo4j.
the class ExtensionContextTest method shouldConsultUnsatisfiedDependencyHandlerOnMissingDependencies.
@Test
void shouldConsultUnsatisfiedDependencyHandlerOnMissingDependencies() {
GlobalExtensionContext context = mock(GlobalExtensionContext.class);
ExtensionFailureStrategy handler = mock(ExtensionFailureStrategy.class);
// that hasn't got anything.
Dependencies dependencies = new Dependencies();
TestingExtensionFactory extensionFactory = new TestingExtensionFactory();
GlobalExtensions extensions = new GlobalExtensions(context, iterable(extensionFactory), dependencies, handler);
try (Lifespan ignored = new Lifespan(extensions)) {
verify(handler).handle(eq(extensionFactory), any(UnsatisfiedDependencyException.class));
}
}
use of org.neo4j.kernel.extension.context.GlobalExtensionContext in project neo4j by neo4j.
the class ExtensionContextTest method globalContextRootDirectoryEqualToStoreDirectory.
@Test
void globalContextRootDirectoryEqualToStoreDirectory() {
GlobalExtensionContext context = new GlobalExtensionContext(neo4jLayout, DbmsInfo.TOOL, new Dependencies());
assertSame(neo4jLayout.databasesDirectory(), context.directory());
}
use of org.neo4j.kernel.extension.context.GlobalExtensionContext in project neo4j by neo4j.
the class ExtensionContextTest method shouldFindDependenciesFromHierarchyBottomUp.
@Test
void shouldFindDependenciesFromHierarchyBottomUp() {
GlobalExtensionContext context = mock(GlobalExtensionContext.class);
ExtensionFailureStrategy handler = mock(ExtensionFailureStrategy.class);
Dependencies dependencies = new Dependencies();
JobScheduler jobScheduler = mock(JobScheduler.class);
dependencies.satisfyDependencies(jobScheduler);
SubTestingExtensionFactory extensionFactory = new SubTestingExtensionFactory();
GlobalExtensions extensions = new GlobalExtensions(context, iterable(extensionFactory), dependencies, handler);
try (Lifespan ignored = new Lifespan(extensions)) {
assertNotNull(dependencies.resolveDependency(TestingExtension.class));
}
}
use of org.neo4j.kernel.extension.context.GlobalExtensionContext in project neo4j by neo4j.
the class ExtensionContextTest method shouldConsultUnsatisfiedDependencyHandlerOnFailingDependencyClasses.
@Test
void shouldConsultUnsatisfiedDependencyHandlerOnFailingDependencyClasses() {
GlobalExtensionContext context = mock(GlobalExtensionContext.class);
ExtensionFailureStrategy handler = mock(ExtensionFailureStrategy.class);
// that hasn't got anything.
Dependencies dependencies = new Dependencies();
UninitializableExtensionFactory extensionFactory = new UninitializableExtensionFactory();
GlobalExtensions extensions = new GlobalExtensions(context, iterable(extensionFactory), dependencies, handler);
try (Lifespan ignored = new Lifespan(extensions)) {
verify(handler).handle(eq(extensionFactory), any(IllegalArgumentException.class));
}
}
Aggregations