Merge branch 'master' into feature/shield-ui

Original commit: elastic/x-pack-elasticsearch@ce32b066e2
This commit is contained in:
Lukas Olson 2016-05-10 13:24:01 -07:00
commit 3fc2265b2d
20 changed files with 100 additions and 80 deletions

View File

@ -3,10 +3,52 @@
A set of Elastic's commercial plugins: A set of Elastic's commercial plugins:
- License - License
- Shield - Security
- Watcher - Watcher
- Marvel - Monitoring
= Setup = Setup
You must checkout x-plugins and elasticsearch in the same directory as siblings. This You must checkout x-plugins and elasticsearch in the same directory as siblings. This
elasticsearch checkout will be used when building x-plugins. elasticsearch checkout will be used when building x-plugins.
= Build
- Run unit tests:
+
[source, txt]
-----
gradle clean test
-----
- Run all tests:
+
[source, txt]
-----
gradle clean check
-----
- Run integration tests:
+
[source, txt]
-----
gradle clean integTest
-----
- Package X-Pack (wihtout running tests)
+
[source, txt]
-----
gradle clean assemble
-----
- Install X-Pack (wihtout running tests)
+
[source, txt]
-----
gradle clean install
-----
- If you don't work on the UI side of x-plugins, you can force gradle to skip building kibana by adding
`xpack.kibana.build=false` to your `~/.gradle/gradle.properties`. Alternatively you add `-Pxpack.kibana.build=false`
on the command line if you only want to do this on individual builds (or `-Pxpack.kibana.build=true` if you need to
override having added this to your `gradle.properties`).

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License; # or more contributor license agreements. Licensed under the Elastic License;

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License; # or more contributor license agreements. Licensed under the Elastic License;

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License; # or more contributor license agreements. Licensed under the Elastic License;

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License; # or more contributor license agreements. Licensed under the Elastic License;

View File

@ -125,7 +125,7 @@ bundlePlugin {
integTest { integTest {
// TODO: fix this rest test to not depend on a hardcoded port! // TODO: fix this rest test to not depend on a hardcoded port!
systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*' systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*'
cluster { cluster {
setting 'xpack.monitoring.agent.interval', '3s' setting 'xpack.monitoring.agent.interval', '3s'
setupCommand 'setupDummyUser', 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser' setupCommand 'setupDummyUser', 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser'

View File

@ -67,10 +67,16 @@ public class RestGraphAction extends BaseRestHandler {
@Inject @Inject
public RestGraphAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) { public RestGraphAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings, client); super(settings, client);
// @deprecated TODO need to add deprecation support as per https://github.com/elastic/x-plugins/issues/1760#issuecomment-217507517
controller.registerHandler(GET, "/{index}/_graph/explore", this); controller.registerHandler(GET, "/{index}/_graph/explore", this);
controller.registerHandler(POST, "/{index}/_graph/explore", this); controller.registerHandler(POST, "/{index}/_graph/explore", this);
controller.registerHandler(GET, "/{index}/{type}/_graph/explore", this); controller.registerHandler(GET, "/{index}/{type}/_graph/explore", this);
controller.registerHandler(POST, "/{index}/{type}/_graph/explore", this); controller.registerHandler(POST, "/{index}/{type}/_graph/explore", this);
// new REST endpoint
controller.registerHandler(GET, "/{index}/_xpack/graph/_explore", this);
controller.registerHandler(POST, "/{index}/_xpack/graph/_explore", this);
controller.registerHandler(GET, "/{index}/{type}/_xpack/graph/_explore", this);
controller.registerHandler(POST, "/{index}/{type}/_xpack/graph/_explore", this);
this.indicesQueriesRegistry = indicesQueriesRegistry; this.indicesQueriesRegistry = indicesQueriesRegistry;
} }

View File

@ -3,8 +3,8 @@
"documentation": "https://www.elastic.co/guide/en/graph/current/explore.html", "documentation": "https://www.elastic.co/guide/en/graph/current/explore.html",
"methods": ["GET", "POST"], "methods": ["GET", "POST"],
"url": { "url": {
"path": "/{index}/_graph/explore", "path": "/{index}/_xpack/graph/_explore",
"paths": ["/{index}/_graph/explore", "/{index}/{type}/_graph/explore"], "paths": ["/{index}/_xpack/graph/_explore", "/{index}/{type}/_xpack/graph/_explore"],
"parts" : { "parts" : {
"index": { "index": {
"type" : "list", "type" : "list",

View File

@ -1,30 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.cluster.routing;
public class ShardRoutingTestUtils {
/**
* Gives access to package private {@link ShardRouting#initialize(String, String, long)} method for test purpose.
**/
public static void initialize(ShardRouting shardRouting, String nodeId) {
shardRouting.initialize(nodeId, null, -1);
}
/**
* Gives access to package private {@link ShardRouting#moveToStarted()} method for test purpose.
**/
public static void moveToStarted(ShardRouting shardRouting) {
shardRouting.moveToStarted();
}
/**
* Gives access to package private {@link ShardRouting#relocate(String, long)} method for test purpose.
**/
public static void relocate(ShardRouting shardRouting, String nodeId) {
shardRouting.relocate(nodeId, -1);
}
}

View File

@ -137,7 +137,7 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa
private ShardStats[] randomShardStats() { private ShardStats[] randomShardStats() {
Index index = new Index("test", UUID.randomUUID().toString()); Index index = new Index("test", UUID.randomUUID().toString());
Path shardPath = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0"); Path shardPath = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0");
ShardRouting shardRouting = ShardRouting.newUnassigned(index, 0, null, false, ShardRouting shardRouting = ShardRouting.newUnassigned(new ShardId(index, 0), null, false,
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo")); new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
CommonStats shardCommonStats = new CommonStats(); CommonStats shardCommonStats = new CommonStats();
shardCommonStats.fieldData = new FieldDataStats(); shardCommonStats.fieldData = new FieldDataStats();

View File

@ -11,7 +11,6 @@ import org.elasticsearch.action.admin.indices.stats.IndexStats;
import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingTestUtils;
import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
@ -80,10 +79,10 @@ public class IndexStatsResolverTests extends MonitoringIndexNameResolverTestCase
Index index = new Index("test-" + randomIntBetween(0, 5), UUID.randomUUID().toString()); Index index = new Index("test-" + randomIntBetween(0, 5), UUID.randomUUID().toString());
ShardId shardId = new ShardId(index, 0); ShardId shardId = new ShardId(index, 0);
Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0"); Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0");
ShardRouting shardRouting = ShardRouting.newUnassigned(index, 0, null, true, ShardRouting shardRouting = ShardRouting.newUnassigned(shardId, null, true,
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
ShardRoutingTestUtils.initialize(shardRouting, "node-0"); shardRouting = shardRouting.initialize("node-0", null, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
ShardRoutingTestUtils.moveToStarted(shardRouting); shardRouting = shardRouting.moveToStarted();
CommonStats stats = new CommonStats(); CommonStats stats = new CommonStats();
stats.fieldData = new FieldDataStats(); stats.fieldData = new FieldDataStats();
stats.queryCache = new QueryCacheStats(); stats.queryCache = new QueryCacheStats();

View File

@ -12,7 +12,6 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponseTestUtil
import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingTestUtils;
import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
@ -88,10 +87,10 @@ public class IndicesStatsResolverTests extends MonitoringIndexNameResolverTestCa
for (int i=0; i < randomIntBetween(2, 5); i++) { for (int i=0; i < randomIntBetween(2, 5); i++) {
ShardId shardId = new ShardId(index, i); ShardId shardId = new ShardId(index, i);
Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve(String.valueOf(i)); Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve(String.valueOf(i));
ShardRouting shardRouting = ShardRouting.newUnassigned(index, i, null, true, ShardRouting shardRouting = ShardRouting.newUnassigned(shardId, null, true,
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
ShardRoutingTestUtils.initialize(shardRouting, "node-0"); shardRouting = shardRouting.initialize("node-0", null, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
ShardRoutingTestUtils.moveToStarted(shardRouting); shardRouting = shardRouting.moveToStarted();
CommonStats stats = new CommonStats(); CommonStats stats = new CommonStats();
stats.fieldData = new FieldDataStats(); stats.fieldData = new FieldDataStats();
stats.queryCache = new QueryCacheStats(); stats.queryCache = new QueryCacheStats();

View File

@ -13,7 +13,6 @@ import org.elasticsearch.action.admin.indices.stats.IndexShardStats;
import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingTestUtils;
import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
@ -107,10 +106,10 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
Index index = new Index("test-" + randomIntBetween(0, 5), UUID.randomUUID().toString()); Index index = new Index("test-" + randomIntBetween(0, 5), UUID.randomUUID().toString());
ShardId shardId = new ShardId(index, 0); ShardId shardId = new ShardId(index, 0);
Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0"); Path path = createTempDir().resolve("indices").resolve(index.getUUID()).resolve("0");
ShardRouting shardRouting = ShardRouting.newUnassigned(index, 0, null, true, ShardRouting shardRouting = ShardRouting.newUnassigned(shardId, null, true,
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
ShardRoutingTestUtils.initialize(shardRouting, "node-0"); shardRouting = shardRouting.initialize("node-0", null, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
ShardRoutingTestUtils.moveToStarted(shardRouting); shardRouting = shardRouting.moveToStarted();
CommonStats stats = new CommonStats(); CommonStats stats = new CommonStats();
stats.fieldData = new FieldDataStats(); stats.fieldData = new FieldDataStats();
stats.queryCache = new QueryCacheStats(); stats.queryCache = new QueryCacheStats();

View File

@ -8,11 +8,11 @@ package org.elasticsearch.marvel.agent.resolver.shards;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingTestUtils;
import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.Index; import org.elasticsearch.index.Index;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.marvel.agent.collector.shards.ShardMonitoringDoc; import org.elasticsearch.marvel.agent.collector.shards.ShardMonitoringDoc;
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCase; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolverTestCase;
@ -33,11 +33,11 @@ public class ShardsResolverTests extends MonitoringIndexNameResolverTestCase<Sha
doc.setClusterStateUUID(UUID.randomUUID().toString()); doc.setClusterStateUUID(UUID.randomUUID().toString());
doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT)); doc.setSourceNode(new DiscoveryNode("id", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT));
ShardRouting shardRouting = ShardRouting.newUnassigned(new Index(randomAsciiOfLength(5), UUID.randomUUID().toString()), ShardRouting shardRouting = ShardRouting.newUnassigned(new ShardId(new Index(randomAsciiOfLength(5), UUID.randomUUID().toString()),
randomIntBetween(0, 5), null, randomBoolean(), new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); randomIntBetween(0, 5)), null, randomBoolean(), new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
ShardRoutingTestUtils.initialize(shardRouting, "node-0"); shardRouting = shardRouting.initialize("node-0", null, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
ShardRoutingTestUtils.moveToStarted(shardRouting); shardRouting = shardRouting.moveToStarted();
ShardRoutingTestUtils.relocate(shardRouting, "node-1"); shardRouting = shardRouting.relocate("node-1", ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
doc.setShardRouting(shardRouting); doc.setShardRouting(shardRouting);
return doc; return doc;
} }
@ -72,11 +72,11 @@ public class ShardsResolverTests extends MonitoringIndexNameResolverTestCase<Sha
final String sourceNode = "node-" + randomIntBetween(0, 5); final String sourceNode = "node-" + randomIntBetween(0, 5);
final String relocationNode = "node-" + randomIntBetween(6, 10); final String relocationNode = "node-" + randomIntBetween(6, 10);
final ShardRouting shardRouting = ShardRouting.newUnassigned(new Index(index, ""), shardId, null, primary, ShardRouting shardRouting = ShardRouting.newUnassigned(new ShardId(new Index(index, ""), shardId), null, primary,
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
ShardRoutingTestUtils.initialize(shardRouting, sourceNode); shardRouting = shardRouting.initialize(sourceNode, null, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
ShardRoutingTestUtils.moveToStarted(shardRouting); shardRouting = shardRouting.moveToStarted();
ShardRoutingTestUtils.relocate(shardRouting, relocationNode); shardRouting = shardRouting.relocate(relocationNode, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
doc.setShardRouting(shardRouting); doc.setShardRouting(shardRouting);
assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22")); assertThat(resolver.index(doc), equalTo(".monitoring-es-" + MarvelTemplateUtils.TEMPLATE_VERSION + "-2015.07.22"));
@ -99,11 +99,11 @@ public class ShardsResolverTests extends MonitoringIndexNameResolverTestCase<Sha
} }
public void testShardId() { public void testShardId() {
ShardRouting shardRouting = ShardRouting.newUnassigned(new Index("bar", ""), 42, null, false, ShardRouting shardRouting = ShardRouting.newUnassigned(new ShardId(new Index("bar", ""), 42), null, false,
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null)); new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, null));
assertThat(ShardsResolver.id("foo", shardRouting), equalTo("foo:_na:bar:42:r")); assertThat(ShardsResolver.id("foo", shardRouting), equalTo("foo:_na:bar:42:r"));
ShardRoutingTestUtils.initialize(shardRouting, "node1"); shardRouting = shardRouting.initialize("node1", null, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
ShardRoutingTestUtils.moveToStarted(shardRouting); shardRouting = shardRouting.moveToStarted();
assertThat(ShardsResolver.id("foo", shardRouting), equalTo("foo:node1:bar:42:r")); assertThat(ShardsResolver.id("foo", shardRouting), equalTo("foo:node1:bar:42:r"));
} }
} }

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License; # or more contributor license agreements. Licensed under the Elastic License;

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License; # or more contributor license agreements. Licensed under the Elastic License;

View File

@ -50,7 +50,7 @@ public class RestXPackInfoAction extends XPackRestHandler {
// we treat HEAD requests as simple pings to ensure that X-Pack is installed // we treat HEAD requests as simple pings to ensure that X-Pack is installed
// we still execute the action as we want this request to be authorized // we still execute the action as we want this request to be authorized
if (request.method() == RestRequest.Method.HEAD) { if (request.method() == RestRequest.Method.HEAD) {
return new BytesRestResponse(OK); return new BytesRestResponse(OK, builder);
} }
builder.startObject(); builder.startObject();

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License; # or more contributor license agreements. Licensed under the Elastic License;

View File

@ -73,7 +73,7 @@ public class Watch implements TriggerEngine.Job, ToXContent {
private final transient AtomicLong nonceCounter = new AtomicLong(); private final transient AtomicLong nonceCounter = new AtomicLong();
private transient long version = Versions.NOT_SET; private transient long version = Versions.MATCH_ANY;
public Watch(String id, Trigger trigger, ExecutableInput input, ExecutableCondition condition, @Nullable ExecutableTransform transform, public Watch(String id, Trigger trigger, ExecutableInput input, ExecutableCondition condition, @Nullable ExecutableTransform transform,
@Nullable TimeValue throttlePeriod, ExecutableActions actions, @Nullable Map<String, Object> metadata, @Nullable TimeValue throttlePeriod, ExecutableActions actions, @Nullable Map<String, Object> metadata,

View File

@ -101,8 +101,9 @@ public class TriggeredWatchStoreTests extends ESTestCase {
} else { } else {
state = ShardRoutingState.UNASSIGNED; state = ShardRoutingState.UNASSIGNED;
} }
indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(new ShardId(index, 0)) ShardId shardId = new ShardId(index, 0);
.addShard(TestShardRouting.newShardRouting(index, 0, "_node_id", null, null, true, state, indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(shardId)
.addShard(TestShardRouting.newShardRouting(shardId, "_node_id", null, null, true, state,
new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, ""))) new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "")))
.build()); .build());
indexRoutingTableBuilder.addReplica(); indexRoutingTableBuilder.addReplica();
@ -136,8 +137,9 @@ public class TriggeredWatchStoreTests extends ESTestCase {
metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1)); metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1));
final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex(); final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex();
IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index); IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index);
indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(new ShardId(index, 0)) ShardId shardId = new ShardId(index, 0);
.addShard(TestShardRouting.newShardRouting(index, 0, "_node_id", null, true, ShardRoutingState.STARTED)) indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(shardId)
.addShard(TestShardRouting.newShardRouting(shardId, "_node_id", null, true, ShardRoutingState.STARTED))
.build()); .build());
indexRoutingTableBuilder.addReplica(); indexRoutingTableBuilder.addReplica();
routingTableBuilder.add(indexRoutingTableBuilder.build()); routingTableBuilder.add(indexRoutingTableBuilder.build());
@ -170,8 +172,9 @@ public class TriggeredWatchStoreTests extends ESTestCase {
metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1)); metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1));
final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex(); final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex();
IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index); IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index);
indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(new ShardId(index, 0)) ShardId shardId = new ShardId(index, 0);
.addShard(TestShardRouting.newShardRouting(index, 0, "_node_name", null, true, ShardRoutingState.STARTED)) indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(shardId)
.addShard(TestShardRouting.newShardRouting(shardId, "_node_name", null, true, ShardRoutingState.STARTED))
.build()); .build());
indexRoutingTableBuilder.addReplica(); indexRoutingTableBuilder.addReplica();
routingTableBuilder.add(indexRoutingTableBuilder.build()); routingTableBuilder.add(indexRoutingTableBuilder.build());
@ -213,8 +216,9 @@ public class TriggeredWatchStoreTests extends ESTestCase {
metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1)); metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1));
final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex(); final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex();
IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index); IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index);
indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(new ShardId(index, 0)) ShardId shardId = new ShardId(index, 0);
.addShard(TestShardRouting.newShardRouting(index, 0, "_node_name", null, true, ShardRoutingState.STARTED)) indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(shardId)
.addShard(TestShardRouting.newShardRouting(shardId, "_node_name", null, true, ShardRoutingState.STARTED))
.build()); .build());
indexRoutingTableBuilder.addReplica(); indexRoutingTableBuilder.addReplica();
routingTableBuilder.add(indexRoutingTableBuilder.build()); routingTableBuilder.add(indexRoutingTableBuilder.build());
@ -255,8 +259,9 @@ public class TriggeredWatchStoreTests extends ESTestCase {
metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1)); metaDateBuilder.put(IndexMetaData.builder(TriggeredWatchStore.INDEX_NAME).settings(settings).numberOfShards(1).numberOfReplicas(1));
final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex(); final Index index = metaDateBuilder.get(TriggeredWatchStore.INDEX_NAME).getIndex();
IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index); IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index);
indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(new ShardId(index, 0)) ShardId shardId = new ShardId(index, 0);
.addShard(TestShardRouting.newShardRouting(index, 0, "_node_id", null, true, ShardRoutingState.STARTED)) indexRoutingTableBuilder.addIndexShard(new IndexShardRoutingTable.Builder(shardId)
.addShard(TestShardRouting.newShardRouting(shardId, "_node_id", null, true, ShardRoutingState.STARTED))
.build()); .build());
indexRoutingTableBuilder.addReplica(); indexRoutingTableBuilder.addReplica();
routingTableBuilder.add(indexRoutingTableBuilder.build()); routingTableBuilder.add(indexRoutingTableBuilder.build());