Search in sources :

Example 6 with Injector

use of org.elasticsearch.common.inject.Injector in project crate by crate.

the class TestGlobalSysExpressions method prepare.

@Before
public void prepare() throws Exception {
    Injector injector = new ModulesBuilder().add(new SysClusterExpressionModule()).add((Module) binder -> {
        binder.bind(ClusterService.class).toInstance(new NoopClusterService());
        binder.bind(Settings.class).toInstance(Settings.EMPTY);
        binder.bind(ClusterName.class).toInstance(new ClusterName("cluster"));
        binder.bind(ClusterReferenceResolver.class).asEagerSingleton();
    }).createInjector();
    resolver = injector.getInstance(ClusterReferenceResolver.class);
}
Also used : NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) ClusterService(org.elasticsearch.cluster.ClusterService) SysClusterExpressionModule(io.crate.operation.reference.sys.cluster.SysClusterExpressionModule) Injector(org.elasticsearch.common.inject.Injector) ClusterName(org.elasticsearch.cluster.ClusterName) ModulesBuilder(org.elasticsearch.common.inject.ModulesBuilder) ClusterReferenceResolver(io.crate.metadata.ClusterReferenceResolver) Module(org.elasticsearch.common.inject.Module) SysClusterExpressionModule(io.crate.operation.reference.sys.cluster.SysClusterExpressionModule) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) CrateSettings(io.crate.metadata.settings.CrateSettings) Settings(org.elasticsearch.common.settings.Settings) Before(org.junit.Before)

Aggregations

Injector (org.elasticsearch.common.inject.Injector)6 ModulesBuilder (org.elasticsearch.common.inject.ModulesBuilder)5 Settings (org.elasticsearch.common.settings.Settings)4 SettingsModule (org.elasticsearch.common.settings.SettingsModule)4 Environment (org.elasticsearch.env.Environment)3 Path (java.nio.file.Path)2 ActionModule (org.elasticsearch.action.ActionModule)2 Module (org.elasticsearch.common.inject.Module)2 BaseResultReceiver (io.crate.action.sql.BaseResultReceiver)1 SQLOperations (io.crate.action.sql.SQLOperations)1 ClusterReferenceResolver (io.crate.metadata.ClusterReferenceResolver)1 NodeContext (io.crate.metadata.NodeContext)1 CrateSettings (io.crate.metadata.settings.CrateSettings)1 SigarModule (io.crate.module.SigarModule)1 SysClusterExpressionModule (io.crate.operation.reference.sys.cluster.SysClusterExpressionModule)1 Planner (io.crate.planner.Planner)1 Closeable (java.io.Closeable)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1