Package org.elasticsearch.common.inject

Examples of org.elasticsearch.common.inject.Injector


        }
    }

    @Before
    public void configure() {
        Injector injector = new ModulesBuilder().add(
                new OperatorModule(),
                new TestModule()
        ).createInjector();
        Injector shard0Injector = injector.createChildInjector(
                new TestShardModule(0)
        );
        Injector shard1Injector = injector.createChildInjector(
                new TestShardModule(1)
        );
        functions = injector.getInstance(Functions.class);

        IndicesService indicesService = injector.getInstance(IndicesService.class);
        indexService = injector.getInstance(IndexService.class);

        when(indexService.shardInjectorSafe(0)).thenReturn(shard0Injector);
        when(indexService.shardInjectorSafe(1)).thenReturn(shard1Injector);
        when(indexService.shardSafe(0)).thenReturn(shard0Injector.getInstance(IndexShard.class));
        when(indexService.shardSafe(1)).thenReturn(shard1Injector.getInstance(IndexShard.class));
        when(indicesService.indexServiceSafe(TEST_TABLE_NAME)).thenReturn(indexService);



        NodeSettingsService nodeSettingsService = mock(NodeSettingsService.class);
View Full Code Here


    private FunctionIdent countAggIdent;
    private AggregationFunction countImpl;

    @Before
    public void setUpFunctions() {
        Injector injector = new ModulesBuilder().add(new AggregationImplModule()).createInjector();
        Functions functions = injector.getInstance(Functions.class);
        countAggIdent = new FunctionIdent(CountAggregation.NAME, Arrays.<DataType>asList(DataTypes.STRING));
        countImpl = (AggregationFunction) functions.get(countAggIdent);
    }
View Full Code Here

    private SelectAnalysis selectAnalysis;
    private SelectStatementAnalyzer analyzer;

    @Before
    public void setUp() throws Exception {
        Injector injector = new ModulesBuilder()
            .add(new MetaDataModule())
            .add(new OperatorModule())
            .add(new MetaDataInformationModule())
            .add(new ScalarFunctionModule())
            .add(new PredicateModule()).createInjector();
        visitor = new ReferenceToTrueVisitor();
        Functions functions = injector.getInstance(Functions.class);
        ReferenceResolver referenceResolver = injector.getInstance(ReferenceResolver.class);
        ReferenceInfos referenceInfos = injector.getInstance(ReferenceInfos.class);
        normalizer = new EvaluatingNormalizer(functions, RowGranularity.CLUSTER, referenceResolver);
        analyzer = new SelectStatementAnalyzer(
            referenceInfos,
            functions,
            referenceResolver
View Full Code Here

        }
    }

    @Before
    public void setupVisitor() {
        Injector injector = new ModulesBuilder().add(
                new AggregationImplModule(),
                new TestScalarFunctionModule()
        ).createInjector();

        visitor = new ImplementationSymbolVisitor(
                null,
                injector.getInstance(Functions.class),
                RowGranularity.DOC
        );
    }
View Full Code Here

    @Before
    public void setUp() {
        ModulesBuilder builder = new ModulesBuilder();
        builder.add(new TestModule());
        Injector injector = builder.createInjector();
        functions = injector.getInstance(Functions.class);
    }
View Full Code Here

    final FunctionIdent ident = new FunctionIdent(CollectionAverageFunction.NAME,
            ImmutableList.<DataType>of(new SetType(DataTypes.LONG)));

    @Test
    public void testLookup() throws Exception {
        Injector injector = new ModulesBuilder().add(
                new ScalarFunctionModule()
        ).createInjector();

        Functions functions = injector.getInstance(Functions.class);

        assertEquals(ident, functions.get(ident).info().ident());
    }
View Full Code Here

    @Before
    public void prepare() {
        MockitoAnnotations.initMocks(this);
        ReferenceResolver referenceResolver = new GlobalReferenceResolver(new HashMap<ReferenceIdent, ReferenceImplementation>());
        Injector injector = new ModulesBuilder()
                .add(new AggregationImplModule())
                .add(new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(Client.class).toInstance(mock(Client.class));
                    }
                })
                .add(new OperatorModule())
                .createInjector();
        functions = injector.getInstance(Functions.class);
        ImplementationSymbolVisitor symbolvisitor =
                new ImplementationSymbolVisitor(referenceResolver, functions, RowGranularity.NODE);
        visitor = new ProjectionToProjectorVisitor(
                mock(ClusterService.class),
                ImmutableSettings.EMPTY,
View Full Code Here

        builder.add(
                new OperatorModule(),
                new AggregationImplModule(),
                new PredicateModule(),
                new ScalarFunctionModule());
        Injector injector = builder.createInjector();
        functions = injector.getInstance(Functions.class);
    }
View Full Code Here

    final FunctionIdent ident = new FunctionIdent(CollectionCountFunction.NAME, ImmutableList.<DataType>of(
            new SetType(DataTypes.STRING)));

    @Test
    public void testLookup() throws Exception {
        Injector injector = new ModulesBuilder().add(
                new ScalarFunctionModule()
        ).createInjector();

        Functions functions = injector.getInstance(Functions.class);

        assertEquals(ident, functions.get(ident).info().ident());
    }
View Full Code Here

    @Before
    public void setUp() {
        ModulesBuilder builder = new ModulesBuilder();
        builder.add(new TestModule());
        Injector injector = builder.createInjector();
        functions = injector.getInstance(Functions.class);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.inject.Injector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.