Package org.elasticsearch.cluster

Examples of org.elasticsearch.cluster.ClusterService.state()


        TransportQueryShardAction queryShardAction = cluster().getInstance(TransportQueryShardAction.class);
        ClusterService clusterService = cluster().getInstance(ClusterService.class);

        final SettableFuture<Boolean> response = SettableFuture.create();

        DiscoveryNode[] discoveryNodes = clusterService.state().nodes().nodes().values().toArray(DiscoveryNode.class);
        queryShardAction.execute(
                discoveryNodes[1].id(),
                new QueryShardRequest("foo",
                        1,
                        ImmutableList.<Symbol>of(),
View Full Code Here


            MetaData metaData = mock(MetaData.class);
            when(metaData.settings()).thenReturn(ImmutableSettings.EMPTY);
            when(metaData.persistentSettings()).thenReturn(ImmutableSettings.EMPTY);
            when(metaData.transientSettings()).thenReturn(ImmutableSettings.EMPTY);
            when(state.metaData()).thenReturn(metaData);
            when(clusterService.state()).thenReturn(state);
            bind(ClusterService.class).toInstance(clusterService);
            bind(Settings.class).toInstance(ImmutableSettings.EMPTY);
            OsService osService = mock(OsService.class);
            OsStats osStats = mock(OsStats.class);
            when(osService.stats()).thenReturn(osStats);
View Full Code Here

                (AggregationFunction)functions.get(new FunctionIdent(CountAggregation.NAME, ImmutableList.<DataType>of()));

        TransportMergeNodeAction transportMergeNodeAction = cluster().getInstance(TransportMergeNodeAction.class);

        Set<String> nodes = new HashSet<>();
        for (DiscoveryNode discoveryNode : clusterService.state().nodes()) {
            nodes.add(discoveryNode.getId());
        }

        // select count(*), user ... group by user
        MergeNode mergeNode = new MergeNode("merge1", 2);
View Full Code Here

        protected void configure() {
            ClusterService clusterService = mock(ClusterService.class);
            ClusterState clusterState = mock(ClusterState.class);
            DiscoveryNodes nodes = mock(DiscoveryNodes.class);
            DiscoveryNode node = mock(DiscoveryNode.class);
            when(clusterService.state()).thenReturn(clusterState);
            when(clusterState.nodes()).thenReturn(nodes);
            ImmutableOpenMap<String, DiscoveryNode> dataNodes =
                    ImmutableOpenMap.<String, DiscoveryNode>builder().fPut("foo", node).build();
            when(nodes.dataNodes()).thenReturn(dataNodes);
            FulltextAnalyzerResolver fulltextAnalyzerResolver = mock(FulltextAnalyzerResolver.class);
View Full Code Here

            DiscoveryNodes nodes = mock(DiscoveryNodes.class);
            when(nodes.get(TEST_NODE_ID)).thenReturn(testNode);
            when(nodes.get(OTHER_NODE_ID)).thenReturn(otherNode);
            when(nodes.iterator()).thenReturn(nodeMap.valuesIt());
            when(state.nodes()).thenReturn(nodes);
            when(clusterService.state()).thenReturn(state);

            DiscoveryService discoveryService = mock(DiscoveryService.class);
            when(discoveryService.localNode()).thenReturn(testNode);
            bind(DiscoveryService.class).toInstance(discoveryService);
View Full Code Here

                .put("discovery.type", "local").build();
        String node_0 = cluster().startNode(localSettings);
        ensureGreen();

        ClusterService clusterService = cluster().getInstance(ClusterService.class, node_0);
        String clusterId = clusterService.state().metaData().transientSettings().get(ClusterIdService.clusterIdSettingsKey);

        cluster().stopNode(node_0);
        node_0 = cluster().startNode(localSettings);
        ensureGreen();
View Full Code Here

        cluster().stopNode(node_0);
        node_0 = cluster().startNode(localSettings);
        ensureGreen();

        clusterService = cluster().getInstance(ClusterService.class, node_0);
        String clusterId2 = clusterService.state().metaData().transientSettings().get(ClusterIdService.clusterIdSettingsKey);
        assertNotNull(clusterId2);

        assertNotSame(clusterId, clusterId2);
    }
View Full Code Here

    @Test
    public void testMasterNodeIdIsNull() throws Exception {
        ClusterService clusterService = mock(ClusterService.class);
        ClusterState state = mock(ClusterState.class);
        DiscoveryNodes nodes = mock(DiscoveryNodes.class);
        when(clusterService.state()).thenReturn(state);
        when(state.nodes()).thenReturn(nodes);
        when(nodes.masterNodeId()).thenReturn(null);
        ClusterMasterNodeExpression clusterMasterNodeExpression = new ClusterMasterNodeExpression(clusterService);

        assertThat(clusterMasterNodeExpression.value(), Matchers.nullValue());
View Full Code Here

            when(indexShard.state()).thenReturn(IndexShardState.STARTED);

            MetaData metaData = mock(MetaData.class);
            when(metaData.hasConcreteIndex(Constants.PARTITIONED_TABLE_PREFIX + ".wikipedia_de._1")).thenReturn(false);
            ClusterState clusterState = mock(ClusterState.class);
            when(clusterService.state()).thenReturn(clusterState);
            when(clusterState.metaData()).thenReturn(metaData);
        }
    }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.