Cleanup test classes and add Scope support for TestCluster
TestCluster can currently only be used in a globally shared scope. This commit adds the ability to use the TestCluster in 3 different scopes per test-suite. The scopes are 'Global', 'Suite' and 'Test' where the cluster is shared across all tests, across all test methods or not at all respectivly. Subclasses of AbstractIntegrationTest (formerly AbstractSharedClusterTest) can add an annotation if they need a different scope than Global (default): ``` @ClusterScope(scope=Scope.Suite, numNodes=1) ``` This also allows to specify the number of shared nodes in that TestCluster that are available when a test starts. The cleanups in this commit include: - s/Elasticsearch/ElasticSearch/g on test classes - Move test classes in org.elasticsearch.test
This commit is contained in:
parent
de3cde3e1e
commit
575d6b0321
|
@ -25,7 +25,7 @@ import org.apache.lucene.analysis.Tokenizer;
|
|||
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
|
||||
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -35,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class UniqueTokenFilterTests extends ElasticsearchTestCase {
|
||||
public class UniqueTokenFilterTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void simpleTest() throws IOException {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.aliases;
|
||||
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse;
|
||||
|
@ -41,6 +40,7 @@ import org.elasticsearch.search.SearchHits;
|
|||
import org.elasticsearch.search.facet.FacetBuilders;
|
||||
import org.elasticsearch.search.facet.terms.TermsFacet;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -57,7 +57,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class IndexAliasesTests extends AbstractSharedClusterTest {
|
||||
public class IndexAliasesTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testAliases() throws Exception {
|
||||
|
|
|
@ -32,14 +32,13 @@ import org.elasticsearch.cluster.block.ClusterBlockException;
|
|||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
public class SimpleBlocksTests extends AbstractNodesTests {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.broadcast;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.ShardOperationFailedException;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
|
@ -28,6 +27,7 @@ import org.elasticsearch.action.count.CountResponse;
|
|||
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class BroadcastActionsTests extends AbstractSharedClusterTest {
|
||||
public class BroadcastActionsTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testBroadcastOperations() throws IOException {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.cluster;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
||||
|
|
|
@ -22,13 +22,12 @@ package org.elasticsearch.cluster;
|
|||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class ClusterHealthTests extends AbstractSharedClusterTest {
|
||||
public class ClusterHealthTests extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@Test
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
package org.elasticsearch.cluster;
|
||||
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class DiskUsageTests extends ElasticsearchTestCase {
|
||||
public class DiskUsageTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void diskUsageCalcTest() {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.cluster;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.action.percolate.PercolateSourceBuilder;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -29,6 +28,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.discovery.Discovery;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -23,14 +23,13 @@ import org.elasticsearch.action.UnavailableShardsException;
|
|||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.client.Requests.createIndexRequest;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.junit.After;
|
|||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
|
|
|
@ -22,42 +22,38 @@ package org.elasticsearch.cluster;
|
|||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class UpdateSettingsValidationTests extends AbstractNodesTests {
|
||||
|
||||
@After
|
||||
public void closeNodes() {
|
||||
closeAllNodes();
|
||||
}
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
public class UpdateSettingsValidationTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testUpdateSettingsValidation() throws Exception {
|
||||
startNode("master", settingsBuilder().put("node.data", false).build());
|
||||
startNode("node1", settingsBuilder().put("node.master", false).build());
|
||||
startNode("node2", settingsBuilder().put("node.master", false).build());
|
||||
String master = cluster().startNode(settingsBuilder().put("node.data", false).build());
|
||||
String node_1 = cluster().startNode(settingsBuilder().put("node.master", false).build());
|
||||
String node_2 = cluster().startNode(settingsBuilder().put("node.master", false).build());
|
||||
|
||||
client("master").admin().indices().prepareCreate("test")
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 5).put("index.number_of_replicas", 1)).execute().actionGet();
|
||||
ClusterHealthResponse healthResponse = client("master").admin().cluster().prepareHealth("test").setWaitForEvents(Priority.LANGUID).setWaitForNodes("3").setWaitForGreenStatus().execute().actionGet();
|
||||
ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth("test").setWaitForEvents(Priority.LANGUID).setWaitForNodes("3").setWaitForGreenStatus().execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(10));
|
||||
|
||||
client("master").admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.number_of_replicas", 0)).execute().actionGet();
|
||||
healthResponse = client("master").admin().cluster().prepareHealth("test").setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.number_of_replicas", 0)).execute().actionGet();
|
||||
healthResponse = client().admin().cluster().prepareHealth("test").setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(5));
|
||||
|
||||
try {
|
||||
client("master").admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.refresh_interval", "")).execute().actionGet();
|
||||
client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.refresh_interval", "")).execute().actionGet();
|
||||
assert false;
|
||||
} catch (ElasticSearchIllegalArgumentException ex) {
|
||||
logger.info("Error message: [{}]", ex.getMessage());
|
||||
|
|
|
@ -31,8 +31,9 @@ import org.elasticsearch.common.logging.ESLogger;
|
|||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
@ -41,15 +42,11 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class AwarenessAllocationTests extends AbstractNodesTests {
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
public class AwarenessAllocationTests extends AbstractIntegrationTest {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class);
|
||||
|
||||
@After
|
||||
public void cleanAndCloseNodes() throws Exception {
|
||||
closeAllNodes();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleAwareness() throws Exception {
|
||||
Settings commonSettings = ImmutableSettings.settingsBuilder()
|
||||
|
@ -59,17 +56,17 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
|
||||
|
||||
logger.info("--> starting 2 nodes on the same rack");
|
||||
startNode("node1", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1"));
|
||||
startNode("node2", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1"));
|
||||
cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1").build());
|
||||
cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1").build());
|
||||
|
||||
client("node1").admin().indices().prepareCreate("test1").execute().actionGet();
|
||||
client("node1").admin().indices().prepareCreate("test2").execute().actionGet();
|
||||
client().admin().indices().prepareCreate("test1").execute().actionGet();
|
||||
client().admin().indices().prepareCreate("test2").execute().actionGet();
|
||||
|
||||
ClusterHealthResponse health = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
ClusterHealthResponse health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
assertThat(health.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> starting 1 node on a different rack");
|
||||
startNode("node3", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_2"));
|
||||
String node3 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_2").build());
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
TObjectIntHashMap<String> counts;
|
||||
|
@ -77,11 +74,11 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
do {
|
||||
Thread.sleep(100);
|
||||
logger.info("--> waiting for no relocation");
|
||||
health = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("3").setWaitForRelocatingShards(0).execute().actionGet();
|
||||
health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("3").setWaitForRelocatingShards(0).execute().actionGet();
|
||||
assertThat(health.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> checking current state");
|
||||
ClusterState clusterState = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
ClusterState clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
//System.out.println(clusterState.routingTable().prettyPrint());
|
||||
// verify that we have 10 shards on node3
|
||||
counts = new TObjectIntHashMap<String>();
|
||||
|
@ -92,8 +89,8 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
}
|
||||
}
|
||||
}
|
||||
} while (counts.get("node3") != 10 && (System.currentTimeMillis() - start) < 10000);
|
||||
assertThat(counts.get("node3"), equalTo(10));
|
||||
} while (counts.get(node3) != 10 && (System.currentTimeMillis() - start) < 10000);
|
||||
assertThat(counts.get(node3), equalTo(10));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -105,10 +102,10 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
.build();
|
||||
|
||||
logger.info("--> starting 6 nodes on different zones");
|
||||
startNode("A-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a"));
|
||||
startNode("B-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b"));
|
||||
startNode("B-1", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b"));
|
||||
startNode("A-1", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a"));
|
||||
String A_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").build());
|
||||
String B_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build());
|
||||
String B_1 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build());
|
||||
String A_1 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").build());
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 5)
|
||||
.put("index.number_of_replicas", 1)).execute().actionGet();
|
||||
|
@ -124,10 +121,10 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
}
|
||||
}
|
||||
}
|
||||
assertThat(counts.get("A-1"), anyOf(equalTo(2),equalTo(3)));
|
||||
assertThat(counts.get("B-1"), anyOf(equalTo(2),equalTo(3)));
|
||||
assertThat(counts.get("A-0"), anyOf(equalTo(2),equalTo(3)));
|
||||
assertThat(counts.get("B-0"), anyOf(equalTo(2),equalTo(3)));
|
||||
assertThat(counts.get(A_1), anyOf(equalTo(2),equalTo(3)));
|
||||
assertThat(counts.get(B_1), anyOf(equalTo(2),equalTo(3)));
|
||||
assertThat(counts.get(A_0), anyOf(equalTo(2),equalTo(3)));
|
||||
assertThat(counts.get(B_0), anyOf(equalTo(2),equalTo(3)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -140,8 +137,8 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
|
||||
|
||||
logger.info("--> starting 2 nodes on zones 'a' & 'b'");
|
||||
startNode("A-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a"));
|
||||
startNode("B-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b"));
|
||||
String A_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").build());
|
||||
String B_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build());
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 5)
|
||||
.put("index.number_of_replicas", 1)).execute().actionGet();
|
||||
|
@ -157,11 +154,11 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
}
|
||||
}
|
||||
}
|
||||
assertThat(counts.get("A-0"), equalTo(5));
|
||||
assertThat(counts.get("B-0"), equalTo(5));
|
||||
assertThat(counts.get(A_0), equalTo(5));
|
||||
assertThat(counts.get(B_0), equalTo(5));
|
||||
logger.info("--> starting another node in zone 'b'");
|
||||
|
||||
startNode("B-1", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b"));
|
||||
String B_1 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build());
|
||||
health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet();
|
||||
assertThat(health.isTimedOut(), equalTo(false));
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
|
@ -179,9 +176,8 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
|
|||
}
|
||||
}
|
||||
}
|
||||
assertThat(counts.get("A-0"), equalTo(5));
|
||||
assertThat(counts.get("B-0"), equalTo(3));
|
||||
assertThat(counts.get("B-1"), equalTo(2));
|
||||
|
||||
assertThat(counts.get(A_0), equalTo(5));
|
||||
assertThat(counts.get(B_0), equalTo(3));
|
||||
assertThat(counts.get(B_1), equalTo(2));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,10 @@ import org.elasticsearch.common.logging.ESLogger;
|
|||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.gateway.Gateway;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -46,21 +45,11 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class ClusterRerouteTests extends AbstractNodesTests {
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
public class ClusterRerouteTests extends AbstractIntegrationTest {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(ClusterRerouteTests.class);
|
||||
|
||||
@After
|
||||
public void cleanAndCloseNodes() throws Exception {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (node("node" + i) != null) {
|
||||
node("node" + i).stop();
|
||||
// since we store (by default) the index snapshot under the gateway, resetting it will reset the index data as well
|
||||
((InternalNode) node("node" + i)).injector().getInstance(Gateway.class).reset();
|
||||
}
|
||||
}
|
||||
closeAllNodes();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rerouteWithCommands() throws Exception {
|
||||
|
@ -69,60 +58,60 @@ public class ClusterRerouteTests extends AbstractNodesTests {
|
|||
.put(DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_ALLOCATION, true)
|
||||
.build();
|
||||
|
||||
startNode("node1", commonSettings);
|
||||
startNode("node2", commonSettings);
|
||||
String node_1 = cluster().startNode(commonSettings);
|
||||
String node_2 = cluster().startNode(commonSettings);
|
||||
|
||||
logger.info("--> create an index with 1 shard, 1 replica, nothing should allocate");
|
||||
client("node1").admin().indices().prepareCreate("test")
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 1))
|
||||
.execute().actionGet();
|
||||
|
||||
ClusterState state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(2));
|
||||
|
||||
logger.info("--> explicitly allocate shard 1, *under dry_run*");
|
||||
state = client("node1").admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true))
|
||||
state = client().admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
|
||||
.setDryRun(true)
|
||||
.execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
|
||||
logger.info("--> get the state, verify nothing changed because of the dry run");
|
||||
state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(2));
|
||||
|
||||
logger.info("--> explicitly allocate shard 1, actually allocating, no dry run");
|
||||
state = client("node1").admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true))
|
||||
state = client().admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
|
||||
.execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
|
||||
ClusterHealthResponse healthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
|
||||
ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> get the state, verify shard 1 primary allocated");
|
||||
state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
|
||||
logger.info("--> move shard 1 primary from node1 to node2");
|
||||
state = client("node1").admin().cluster().prepareReroute()
|
||||
.add(new MoveAllocationCommand(new ShardId("test", 0), "node1", "node2"))
|
||||
state = client().admin().cluster().prepareReroute()
|
||||
.add(new MoveAllocationCommand(new ShardId("test", 0), node_1, node_2))
|
||||
.execute().actionGet().getState();
|
||||
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.RELOCATING));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node2").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.RELOCATING));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_2).id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
|
||||
|
||||
healthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().setWaitForRelocatingShards(0).execute().actionGet();
|
||||
healthResponse = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().setWaitForRelocatingShards(0).execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> get the state, verify shard 1 primary moved from node1 to node2");
|
||||
state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node2").id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_2).id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -133,69 +122,68 @@ public class ClusterRerouteTests extends AbstractNodesTests {
|
|||
.put("gateway.type", "local")
|
||||
.build();
|
||||
|
||||
// clean three nodes
|
||||
logger.info("--> cleaning nodes");
|
||||
buildNode("node1", settingsBuilder().put("gateway.type", "local").build());
|
||||
buildNode("node2", settingsBuilder().put("gateway.type", "local").build());
|
||||
cleanAndCloseNodes();
|
||||
|
||||
logger.info("--> starting 2 nodes");
|
||||
startNode("node1", commonSettings);
|
||||
startNode("node2", commonSettings);
|
||||
String node_1 = cluster().startNode(commonSettings);
|
||||
cluster().startNode(commonSettings);
|
||||
assertThat(cluster().numNodes(), equalTo(2));
|
||||
ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> create an index with 1 shard, 1 replica, nothing should allocate");
|
||||
client("node1").admin().indices().prepareCreate("test")
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_shards", 1))
|
||||
.execute().actionGet();
|
||||
|
||||
ClusterState state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(2));
|
||||
|
||||
logger.info("--> explicitly allocate shard 1, actually allocating, no dry run");
|
||||
state = client("node1").admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true))
|
||||
state = client().admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
|
||||
.execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
|
||||
ClusterHealthResponse healthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
|
||||
healthResponse = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> get the state, verify shard 1 primary allocated");
|
||||
state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
|
||||
client("node1").prepareIndex("test", "type", "1").setSource("field", "value").setRefresh(true).execute().actionGet();
|
||||
client().prepareIndex("test", "type", "1").setSource("field", "value").setRefresh(true).execute().actionGet();
|
||||
|
||||
logger.info("--> closing all nodes");
|
||||
File shardLocation = ((InternalNode) node("node1")).injector().getInstance(NodeEnvironment.class).shardLocations(new ShardId("test", 0))[0];
|
||||
closeAllNodes();
|
||||
File shardLocation = cluster().getInstance(NodeEnvironment.class).shardLocations(new ShardId("test", 0))[0];
|
||||
|
||||
logger.info("--> deleting the shard data");
|
||||
cluster().resetAllGateways();
|
||||
cluster().closeAllNodesAndReset();
|
||||
|
||||
logger.info("--> deleting the shard data [{}] ", shardLocation);
|
||||
FileSystemUtils.deleteRecursively(shardLocation);
|
||||
|
||||
logger.info("--> starting nodes back, will not allocate the shard since it has no data, but the index will be there");
|
||||
startNode("node1", commonSettings);
|
||||
startNode("node2", commonSettings);
|
||||
node_1 = cluster().startNode(commonSettings);
|
||||
cluster().startNode(commonSettings);
|
||||
// wait a bit for the cluster to realize that the shard is not there...
|
||||
// TODO can we get around this? the cluster is RED, so what do we wait for?
|
||||
Thread.sleep(300);
|
||||
assertThat(client("node1").admin().cluster().prepareHealth().execute().actionGet().getStatus(), equalTo(ClusterHealthStatus.RED));
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
assertThat(cluster().client().admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet().getStatus(), equalTo(ClusterHealthStatus.RED));
|
||||
logger.info("--> explicitly allocate primary");
|
||||
state = client("node1").admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true))
|
||||
state = client().admin().cluster().prepareReroute()
|
||||
.add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
|
||||
.execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
|
||||
|
||||
healthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
|
||||
healthResponse = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
|
||||
assertThat(healthResponse.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> get the state, verify shard 1 primary allocated");
|
||||
state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
assertThat(state.routingNodes().node(state.nodes().resolveNode(node_1).id()).shards().get(0).state(), equalTo(ShardRoutingState.STARTED));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,104 +19,91 @@
|
|||
|
||||
package org.elasticsearch.cluster.allocation;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.routing.IndexRoutingTable;
|
||||
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FilteringAllocationTests extends AbstractNodesTests {
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
public class FilteringAllocationTests extends AbstractIntegrationTest {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(FilteringAllocationTests.class);
|
||||
|
||||
@After
|
||||
public void cleanAndCloseNodes() throws Exception {
|
||||
closeAllNodes();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecommissionNodeNoReplicas() throws Exception {
|
||||
logger.info("--> starting 2 nodes");
|
||||
startNode("node1");
|
||||
startNode("node2");
|
||||
final String node_0 = cluster().startNode();
|
||||
final String node_1 = cluster().startNode();
|
||||
assertThat(cluster().numNodes(), equalTo(2));
|
||||
|
||||
logger.info("--> creating an index with no replicas");
|
||||
client("node1").admin().indices().prepareCreate("test")
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_replicas", 0))
|
||||
.execute().actionGet();
|
||||
|
||||
ClusterHealthResponse clusterHealthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
|
||||
|
||||
ensureGreen();
|
||||
logger.info("--> index some data");
|
||||
for (int i = 0; i < 100; i++) {
|
||||
client("node1").prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value" + i).execute().actionGet();
|
||||
client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value" + i).execute().actionGet();
|
||||
}
|
||||
client("node1").admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
|
||||
|
||||
logger.info("--> decommission the second node");
|
||||
client("node1").admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._name", "node2"))
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._name", node_1))
|
||||
.execute().actionGet();
|
||||
|
||||
Thread.sleep(200);
|
||||
|
||||
clusterHealthResponse = client("node1").admin().cluster().prepareHealth()
|
||||
.setWaitForGreenStatus()
|
||||
.setWaitForRelocatingShards(0)
|
||||
.execute().actionGet();
|
||||
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
ensureGreen();
|
||||
|
||||
logger.info("--> verify all are allocated on node1 now");
|
||||
ClusterState clusterState = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
ClusterState clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
for (IndexRoutingTable indexRoutingTable : clusterState.routingTable()) {
|
||||
for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) {
|
||||
for (ShardRouting shardRouting : indexShardRoutingTable) {
|
||||
assertThat(clusterState.nodes().get(shardRouting.currentNodeId()).name(), equalTo("node1"));
|
||||
assertThat(clusterState.nodes().get(shardRouting.currentNodeId()).name(), equalTo(node_0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
client("node1").admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisablingAllocationFiltering() throws Exception {
|
||||
logger.info("--> starting 2 nodes");
|
||||
startNode("node1");
|
||||
startNode("node2");
|
||||
final String node_0 = cluster().startNode();
|
||||
final String node_1 = cluster().startNode();
|
||||
assertThat(cluster().numNodes(), equalTo(2));
|
||||
|
||||
logger.info("--> creating an index with no replicas");
|
||||
client("node1").admin().indices().prepareCreate("test")
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("index.number_of_replicas", 0))
|
||||
.execute().actionGet();
|
||||
|
||||
ClusterHealthResponse clusterHealthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
|
||||
ensureGreen();
|
||||
|
||||
logger.info("--> index some data");
|
||||
for (int i = 0; i < 100; i++) {
|
||||
client("node1").prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value" + i).execute().actionGet();
|
||||
client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value" + i).execute().actionGet();
|
||||
}
|
||||
client("node1").admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
|
||||
ClusterState clusterState = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
|
||||
ClusterState clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
IndexRoutingTable indexRoutingTable = clusterState.routingTable().index("test");
|
||||
int numShardsOnNode1 = 0;
|
||||
for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) {
|
||||
|
@ -128,48 +115,37 @@ public class FilteringAllocationTests extends AbstractNodesTests {
|
|||
}
|
||||
|
||||
if (numShardsOnNode1 > ThrottlingAllocationDecider.DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES) {
|
||||
client("node1").admin().cluster().prepareUpdateSettings()
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", numShardsOnNode1)).execute().actionGet();
|
||||
// make sure we can recover all the nodes at once otherwise we might run into a state where one of the shards has not yet started relocating
|
||||
// but we already fired up the request to wait for 0 relocating shards.
|
||||
}
|
||||
logger.info("--> remove index from the first node");
|
||||
client("node1").admin().indices().prepareUpdateSettings("test")
|
||||
.setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", "node1"))
|
||||
client().admin().indices().prepareUpdateSettings("test")
|
||||
.setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", node_0))
|
||||
.execute().actionGet();
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
ensureGreen();
|
||||
|
||||
Thread.sleep(200);
|
||||
|
||||
clusterHealthResponse = client("node1").admin().cluster().prepareHealth()
|
||||
.setWaitForGreenStatus()
|
||||
.setWaitForRelocatingShards(0)
|
||||
.execute().actionGet();
|
||||
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> verify all shards are allocated on node2 now");
|
||||
clusterState = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
logger.info("--> verify all shards are allocated on node_1 now");
|
||||
clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
indexRoutingTable = clusterState.routingTable().index("test");
|
||||
for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) {
|
||||
for (ShardRouting shardRouting : indexShardRoutingTable) {
|
||||
assertThat(clusterState.nodes().get(shardRouting.currentNodeId()).name(), equalTo("node2"));
|
||||
assertThat(clusterState.nodes().get(shardRouting.currentNodeId()).name(), equalTo(node_1));
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("--> disable allocation filtering ");
|
||||
client("node1").admin().indices().prepareUpdateSettings("test")
|
||||
client().admin().indices().prepareUpdateSettings("test")
|
||||
.setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", ""))
|
||||
.execute().actionGet();
|
||||
|
||||
Thread.sleep(200);
|
||||
|
||||
clusterHealthResponse = client("node1").admin().cluster().prepareHealth()
|
||||
.setWaitForGreenStatus()
|
||||
.setWaitForRelocatingShards(0)
|
||||
.execute().actionGet();
|
||||
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
|
||||
client().admin().cluster().prepareReroute().get();
|
||||
ensureGreen();
|
||||
|
||||
logger.info("--> verify that there are shards allocated on both nodes now");
|
||||
clusterState = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(clusterState.routingTable().index("test").numberOfNodesShardsAreAllocatedOn(), equalTo(2));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
|
|
@ -18,20 +18,19 @@
|
|||
*/
|
||||
package org.elasticsearch.cluster.allocation;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.routing.RoutingNode;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.junit.Test;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class SimpleAllocationTests extends AbstractSharedClusterTest {
|
||||
public class SimpleAllocationTests extends AbstractIntegrationTest {
|
||||
|
||||
/**
|
||||
* Test for
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
package org.elasticsearch.cluster.routing.allocation;
|
||||
|
||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
|
@ -27,6 +16,17 @@ import org.hamcrest.Matcher;
|
|||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.newIndexMetaDataBuilder;
|
||||
import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class AddIncrementallyTests {
|
||||
private final ESLogger logger = Loggers.getLogger(AddIncrementallyTests.class);
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
|||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.cluster.routing.ShardRoutingState;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||
|
@ -36,13 +36,13 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class AwarenessAllocationTests extends ElasticsearchTestCase {
|
||||
public class AwarenessAllocationTests extends ElasticSearchTestCase {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class);
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
|||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class BalanceConfigurationTests {
|
||||
|
|
|
@ -34,8 +34,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
|
|
@ -34,8 +34,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
|||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
|||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -35,10 +35,11 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.cluster.metadata.MetaData;
|
|||
import org.elasticsearch.cluster.routing.RoutingTable;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||
|
@ -33,13 +33,13 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PreferPrimaryAllocationTests extends ElasticsearchTestCase {
|
||||
public class PreferPrimaryAllocationTests extends ElasticSearchTestCase {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(PreferPrimaryAllocationTests.class);
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
|||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
|
|
@ -34,8 +34,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
|||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.Decision;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -48,11 +48,11 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class RandomAllocationDeciderTests extends ElasticsearchTestCase {
|
||||
public class RandomAllocationDeciderTests extends ElasticSearchTestCase {
|
||||
|
||||
/* This test will make random allocation decision on a growing and shrinking
|
||||
* cluster leading to a random distribution of the shards. After a certain
|
||||
|
|
|
@ -34,8 +34,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
|
|
@ -33,8 +33,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.elasticsearch.cluster.routing.allocation;
|
||||
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.cluster.routing.MutableShardRouting;
|
||||
|
@ -10,6 +9,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationD
|
|||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||
|
@ -24,7 +24,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class SameShardRoutingTests extends ElasticsearchTestCase {
|
||||
public class SameShardRoutingTests extends ElasticSearchTestCase {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(SameShardRoutingTests.class);
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
|
|
@ -33,8 +33,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
|||
import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocators;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -45,11 +45,11 @@ import static org.elasticsearch.cluster.metadata.MetaData.newMetaDataBuilder;
|
|||
import static org.elasticsearch.cluster.node.DiscoveryNodes.newNodesBuilder;
|
||||
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests.newNode;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class DiskThresholdDeciderTests extends ElasticsearchTestCase {
|
||||
public class DiskThresholdDeciderTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void diskThresholdTest() {
|
||||
|
|
|
@ -20,10 +20,12 @@ package org.elasticsearch.cluster.shards;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsGroup;
|
||||
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.metadata.AliasAction;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
@ -31,30 +33,26 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class ClusterSearchShardsTests extends AbstractNodesTests {
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=2)
|
||||
public class ClusterSearchShardsTests extends AbstractIntegrationTest {
|
||||
|
||||
@Override
|
||||
protected void beforeClass() throws Exception {
|
||||
startNode("node1", settingsBuilder().put("node.tag", "A"));
|
||||
startNode("node2", settingsBuilder().put("node.tag", "B"));
|
||||
}
|
||||
|
||||
public Client client() {
|
||||
return client("node1");
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
switch(nodeOrdinal) {
|
||||
case 1:
|
||||
return settingsBuilder().put("node.tag", "B").build();
|
||||
case 0:
|
||||
return settingsBuilder().put("node.tag", "A").build();
|
||||
}
|
||||
return super.nodeSettings(nodeOrdinal);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleShardAllocation() throws Exception {
|
||||
try {
|
||||
client().admin().indices().prepareDelete("test").execute().actionGet();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder()
|
||||
.put("index.number_of_shards", "1").put("index.number_of_replicas", 0).put("index.routing.allocation.include.tag", "A")).execute().actionGet();
|
||||
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
|
||||
ClusterSearchShardsResponse response = client("node1").admin().cluster().prepareSearchShards("test").execute().actionGet();
|
||||
ensureGreen();
|
||||
ClusterSearchShardsResponse response = client().admin().cluster().prepareSearchShards("test").execute().actionGet();
|
||||
assertThat(response.getGroups().length, equalTo(1));
|
||||
assertThat(response.getGroups()[0].getIndex(), equalTo("test"));
|
||||
assertThat(response.getGroups()[0].getShardId(), equalTo(0));
|
||||
|
@ -62,7 +60,7 @@ public class ClusterSearchShardsTests extends AbstractNodesTests {
|
|||
assertThat(response.getNodes().length, equalTo(1));
|
||||
assertThat(response.getGroups()[0].getShards()[0].currentNodeId(), equalTo(response.getNodes()[0].getId()));
|
||||
|
||||
response = client("node2").admin().cluster().prepareSearchShards("test").setRouting("A").execute().actionGet();
|
||||
response = client().admin().cluster().prepareSearchShards("test").setRouting("A").execute().actionGet();
|
||||
assertThat(response.getGroups().length, equalTo(1));
|
||||
assertThat(response.getGroups()[0].getIndex(), equalTo("test"));
|
||||
assertThat(response.getGroups()[0].getShardId(), equalTo(0));
|
||||
|
@ -74,41 +72,26 @@ public class ClusterSearchShardsTests extends AbstractNodesTests {
|
|||
|
||||
@Test
|
||||
public void testMultipleShardsSingleNodeAllocation() throws Exception {
|
||||
try {
|
||||
client().admin().indices().prepareDelete("test").execute().actionGet();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder()
|
||||
.put("index.number_of_shards", "4").put("index.number_of_replicas", 0).put("index.routing.allocation.include.tag", "A")).execute().actionGet();
|
||||
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
|
||||
ensureGreen();
|
||||
|
||||
ClusterSearchShardsResponse response = client("node1").admin().cluster().prepareSearchShards("test").execute().actionGet();
|
||||
ClusterSearchShardsResponse response = client().admin().cluster().prepareSearchShards("test").execute().actionGet();
|
||||
assertThat(response.getGroups().length, equalTo(4));
|
||||
assertThat(response.getGroups()[0].getIndex(), equalTo("test"));
|
||||
assertThat(response.getNodes().length, equalTo(1));
|
||||
assertThat(response.getGroups()[0].getShards()[0].currentNodeId(), equalTo(response.getNodes()[0].getId()));
|
||||
|
||||
response = client("node1").admin().cluster().prepareSearchShards("test").setRouting("ABC").execute().actionGet();
|
||||
response = client().admin().cluster().prepareSearchShards("test").setRouting("ABC").execute().actionGet();
|
||||
assertThat(response.getGroups().length, equalTo(1));
|
||||
|
||||
response = client("node1").admin().cluster().prepareSearchShards("test").setPreference("_shards:2").execute().actionGet();
|
||||
response = client().admin().cluster().prepareSearchShards("test").setPreference("_shards:2").execute().actionGet();
|
||||
assertThat(response.getGroups().length, equalTo(1));
|
||||
assertThat(response.getGroups()[0].getShardId(), equalTo(2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleIndicesAllocation() throws Exception {
|
||||
try {
|
||||
client().admin().indices().prepareDelete("test1").execute().actionGet();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
client().admin().indices().prepareDelete("test2").execute().actionGet();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
client().admin().indices().prepareCreate("test1").setSettings(settingsBuilder()
|
||||
.put("index.number_of_shards", "4").put("index.number_of_replicas", 1)).execute().actionGet();
|
||||
client().admin().indices().prepareCreate("test2").setSettings(settingsBuilder()
|
||||
|
|
|
@ -24,17 +24,16 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.index.query.MatchQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CodecTests extends AbstractSharedClusterTest {
|
||||
public class CodecTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testFieldsWithCustomPostingsFormat() throws Exception {
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
|
|||
import com.vividsolutions.jts.geom.Point;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchGeoAssertions.assertEquals;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests for {@link GeoJSONShapeParser}
|
||||
|
|
|
@ -28,8 +28,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchGeoAssertions.assertMultiLineString;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchGeoAssertions.assertMultiPolygon;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions.assertMultiLineString;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions.assertMultiPolygon;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
/**
|
||||
* Tests for {@link ShapeBuilder}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.elasticsearch.common.Numbers;
|
|||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.mapper.internal.UidFieldMapper;
|
||||
import org.elasticsearch.index.merge.policy.IndexUpgraderMergePolicy;
|
||||
import org.elasticsearch.ElasticsearchLuceneTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchLuceneTestCase;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -46,7 +46,7 @@ import java.util.Map;
|
|||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class VersionsTests extends ElasticsearchLuceneTestCase {
|
||||
public class VersionsTests extends ElasticSearchLuceneTestCase {
|
||||
|
||||
public static DirectoryReader reopen(DirectoryReader reader) throws IOException {
|
||||
return reopen(reader, true);
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
package org.elasticsearch.common.regex;
|
||||
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
public class RegexTests extends ElasticsearchTestCase {
|
||||
public class RegexTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testFlags() {
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
package org.elasticsearch.common.settings;
|
||||
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.common.settings.bar.BarTestClass;
|
||||
import org.elasticsearch.common.settings.foo.FooTestClass;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
@ -29,7 +29,7 @@ import static org.hamcrest.Matchers.*;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class ImmutableSettingsTests extends ElasticsearchTestCase{
|
||||
public class ImmutableSettingsTests extends ElasticSearchTestCase{
|
||||
|
||||
@Test
|
||||
public void testGetAsClass() {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.common.util.concurrent;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.lessThan;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class EsExecutorsTests extends ElasticsearchTestCase {
|
||||
public class EsExecutorsTests extends ElasticSearchTestCase {
|
||||
|
||||
private TimeUnit randomTimeUnit() {
|
||||
return TimeUnit.values()[between(0, TimeUnit.values().length - 1)];
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
|||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.unit.TimeValue.timeValueMillis;
|
||||
|
@ -35,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class WriteConsistencyLevelTests extends AbstractSharedClusterTest {
|
||||
public class WriteConsistencyLevelTests extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@Test
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.index.query.*;
|
||||
import org.elasticsearch.index.query.CommonTermsQueryBuilder.Operator;
|
||||
import org.elasticsearch.index.query.MatchQueryBuilder.Type;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.format.ISODateTimeFormat;
|
||||
|
@ -40,12 +40,12 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.FilterBuilders.*;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SimpleQueryTests extends AbstractSharedClusterTest {
|
||||
public class SimpleQueryTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void passQueryAsStringTest() throws Exception {
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.elasticsearch.action.count.CountResponse;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -12,10 +12,10 @@ import java.util.concurrent.ExecutionException;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.rangeQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertNoFailures;
|
||||
|
||||
public class SimpleCountTests extends AbstractSharedClusterTest {
|
||||
public class SimpleCountTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCountRandomPreference() throws InterruptedException, ExecutionException {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.deleteByQuery;
|
||||
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder;
|
||||
import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
|
@ -27,13 +26,14 @@ import org.elasticsearch.action.support.IgnoreIndices;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.indices.IndexMissingException;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
public class DeleteByQueryTests extends AbstractSharedClusterTest {
|
||||
public class DeleteByQueryTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testDeleteAllNoIndices() {
|
||||
|
|
|
@ -22,28 +22,28 @@ package org.elasticsearch.discovery;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class DiscoveryTests extends AbstractNodesTests {
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=2)
|
||||
public class DiscoveryTests extends AbstractIntegrationTest {
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return ImmutableSettings.settingsBuilder().put("discovery.zen.multicast.enabled", false)
|
||||
.put("discovery.zen.unicast.hosts", "localhost").put(super.nodeSettings(nodeOrdinal)).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnicastDiscovery() {
|
||||
Settings settings = ImmutableSettings.settingsBuilder()
|
||||
.put("discovery.zen.multicast.enabled", false)
|
||||
.put("discovery.zen.unicast.hosts", "localhost")
|
||||
.build();
|
||||
|
||||
startNode("node1", settings);
|
||||
startNode("node2", settings);
|
||||
|
||||
ClusterState state = client("node1").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.nodes().size(), equalTo(2));
|
||||
|
||||
state = client("node2").admin().cluster().prepareState().execute().actionGet().getState();
|
||||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.nodes().size(), equalTo(2));
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.discovery.zen.DiscoveryNodesProvider;
|
||||
import org.elasticsearch.discovery.zen.ping.ZenPing;
|
||||
import org.elasticsearch.node.service.NodeService;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.transport.local.LocalTransport;
|
||||
|
@ -47,7 +47,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class MulticastZenPingTests extends ElasticsearchTestCase {
|
||||
public class MulticastZenPingTests extends ElasticSearchTestCase {
|
||||
|
||||
private Settings buildRandomMulticast(Settings settings) {
|
||||
ImmutableSettings.Builder builder = ImmutableSettings.builder().put(settings);
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
import org.elasticsearch.discovery.zen.DiscoveryNodesProvider;
|
||||
import org.elasticsearch.discovery.zen.ping.ZenPing;
|
||||
import org.elasticsearch.node.service.NodeService;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.transport.netty.NettyTransport;
|
||||
|
@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class UnicastZenPingTests extends ElasticsearchTestCase {
|
||||
public class UnicastZenPingTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testSimplePings() {
|
||||
|
|
|
@ -12,19 +12,19 @@ import org.elasticsearch.common.bytes.BytesArray;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.index.VersionType;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertNoFailures;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertSearchHits;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class BulkTests extends AbstractSharedClusterTest {
|
||||
public class BulkTests extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@Test
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.document;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||
|
@ -37,6 +36,7 @@ import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
|
|||
import org.elasticsearch.action.support.replication.ReplicationType;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -44,14 +44,14 @@ import java.util.Map;
|
|||
|
||||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class DocumentActionsTests extends AbstractSharedClusterTest {
|
||||
public class DocumentActionsTests extends AbstractIntegrationTest {
|
||||
|
||||
protected void createIndex() {
|
||||
wipeIndex(getConcreteIndexName());
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
package org.elasticsearch.explain;
|
||||
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.explain.ExplainResponse;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.index.query.FilterBuilders;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class ExplainActionTests extends AbstractSharedClusterTest {
|
||||
public class ExplainActionTests extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@Test
|
||||
|
|
|
@ -21,19 +21,19 @@ package org.elasticsearch.flt;
|
|||
|
||||
import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.fuzzyLikeThisFieldQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.fuzzyLikeThisQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertThrows;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class FuzzyLikeThisActionTests extends AbstractSharedClusterTest {
|
||||
public class FuzzyLikeThisActionTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
// See issue https://github.com/elasticsearch/elasticsearch/issues/3252
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.gateway.fs;
|
|||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Nightly;
|
||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
|
@ -40,6 +39,7 @@ import org.elasticsearch.env.Environment;
|
|||
import org.elasticsearch.gateway.Gateway;
|
||||
import org.elasticsearch.indices.IndexAlreadyExistsException;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.gateway.Gateway;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ package org.elasticsearch.gateway.local;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.gateway.Gateway;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -37,8 +37,8 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest;
|
|||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.elasticsearch.index.query.FilterBuilders;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -46,7 +46,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertHitCount;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.gateway.none;
|
|||
import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.gateway.GatewayService;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.get;
|
||||
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
|
@ -33,6 +32,7 @@ import org.elasticsearch.common.bytes.BytesReference;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -41,7 +41,7 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class GetActionTests extends AbstractSharedClusterTest {
|
||||
public class GetActionTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void simpleGetTests() {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.index.analysis;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.Tokenizer;
|
||||
|
@ -38,20 +39,14 @@ import org.elasticsearch.env.Environment;
|
|||
import org.elasticsearch.env.EnvironmentModule;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.IndexNameModule;
|
||||
import org.elasticsearch.index.analysis.filter1.MyFilterTokenFilterFactory;
|
||||
import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
|
||||
import org.elasticsearch.index.analysis.filter1.MyFilterTokenFilterFactory;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringReader;
|
||||
import java.io.*;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.index.analysis;
|
|||
|
||||
import org.apache.lucene.analysis.Tokenizer;
|
||||
import org.apache.lucene.analysis.standard.StandardTokenizer;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.index.IndexNameModule;
|
|||
import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.index.analysis;
|
|||
|
||||
import org.elasticsearch.common.inject.ProvisionException;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -30,7 +30,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
|
|||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class HunspellTokenFilterFactoryTests extends ElasticsearchTestCase {
|
||||
public class HunspellTokenFilterFactoryTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testDedup() throws IOException {
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.analysis.core.WhitespaceTokenizer;
|
|||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.analysis.Tokenizer;
|
|||
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings.Builder;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.analysis.NumericTokenStream;
|
|||
import org.apache.lucene.analysis.NumericTokenStream.NumericTermAttribute;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -31,7 +31,7 @@ import java.io.IOException;
|
|||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class NumericAnalyzerTests extends ElasticsearchTestCase {
|
||||
public class NumericAnalyzerTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testAttributeEqual() throws IOException {
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.index.IndexNameModule;
|
|||
import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
|
|||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
|
||||
import org.apache.lucene.analysis.Tokenizer;
|
||||
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.index.IndexNameModule;
|
|||
import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
|
||||
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.index.analysis;
|
|||
|
||||
import org.apache.lucene.analysis.Tokenizer;
|
||||
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -26,9 +26,9 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.analysis.AnalysisService;
|
||||
import org.elasticsearch.index.analysis.TokenFilterFactory;
|
||||
import org.elasticsearch.ElasticSearchTokenStreamTestCase;
|
||||
import org.elasticsearch.index.analysis.AnalysisTestsHelper;
|
||||
import org.elasticsearch.index.analysis.TokenFilterFactory;
|
||||
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@ import org.elasticsearch.index.mapper.DocumentMapper;
|
|||
import org.elasticsearch.index.mapper.MapperServiceModule;
|
||||
import org.elasticsearch.index.settings.IndexSettingsModule;
|
||||
import org.elasticsearch.index.similarity.SimilarityModule;
|
||||
import org.elasticsearch.ElasticsearchLuceneTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchLuceneTestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
public class CodecTests extends ElasticsearchLuceneTestCase {
|
||||
public class CodecTests extends ElasticSearchLuceneTestCase {
|
||||
|
||||
@Override
|
||||
@Before
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.apache.lucene.document.TextField;
|
|||
import org.apache.lucene.index.IndexDeletionPolicy;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
|
@ -61,6 +60,7 @@ import org.elasticsearch.index.store.ram.RamDirectoryService;
|
|||
import org.elasticsearch.index.translog.Translog;
|
||||
import org.elasticsearch.index.translog.TranslogSizeMatcher;
|
||||
import org.elasticsearch.index.translog.fs.FsTranslog;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
import org.junit.After;
|
||||
|
@ -83,7 +83,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class RobinEngineTests extends ElasticsearchTestCase {
|
||||
public class RobinEngineTests extends ElasticSearchTestCase {
|
||||
|
||||
protected final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ import org.apache.lucene.store.RAMDirectory;
|
|||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
// we might wanna cut this over to LuceneTestCase
|
||||
public abstract class AbstractFieldDataTests extends ElasticsearchTestCase {
|
||||
public abstract class AbstractFieldDataTests extends ElasticSearchTestCase {
|
||||
|
||||
protected IndexFieldDataService ifdService;
|
||||
protected IndexWriter writer;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.index.fielddata;
|
||||
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.SearchType;
|
||||
|
@ -27,6 +26,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.search.facet.Facets;
|
||||
import org.elasticsearch.search.facet.terms.TermsFacet;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -35,9 +35,9 @@ import java.io.IOException;
|
|||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.facet.FacetBuilders.termsFacet;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertAcked;
|
||||
|
||||
public class FieldDataFilterIntegrationTests extends AbstractSharedClusterTest {
|
||||
public class FieldDataFilterIntegrationTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testRegexpFilter() throws IOException {
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.index.fielddata.ordinals;
|
|||
import org.apache.lucene.util.LongsRef;
|
||||
import org.apache.lucene.util.packed.PackedInts;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
public class MultiOrdinalsTests extends ElasticsearchTestCase {
|
||||
public class MultiOrdinalsTests extends ElasticSearchTestCase {
|
||||
|
||||
protected final Ordinals creationMultiOrdinals(OrdinalsBuilder builder) {
|
||||
return this.creationMultiOrdinals(builder, ImmutableSettings.builder());
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.apache.lucene.util.BytesRef;
|
|||
import org.elasticsearch.common.compress.CompressorFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.ParsedDocument;
|
||||
import org.elasticsearch.index.mapper.MapperTestUtils;
|
||||
import org.elasticsearch.index.mapper.ParsedDocument;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
|
|
@ -24,12 +24,8 @@ import org.elasticsearch.common.bytes.BytesArray;
|
|||
import org.elasticsearch.common.compress.CompressorFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.mapper.ParsedDocument;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.index.mapper.MapperTestUtils;
|
||||
import org.elasticsearch.index.mapper.*;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -39,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class DefaultSourceMappingTests extends ElasticsearchTestCase {
|
||||
public class DefaultSourceMappingTests extends ElasticSearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testNoFormat() throws Exception {
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.lucene.search.spans.*;
|
|||
import org.apache.lucene.spatial.prefix.IntersectsPrefixTreeFilter;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.NumericUtils;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.cache.recycler.CacheRecyclerModule;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
|
@ -64,6 +63,7 @@ import org.elasticsearch.index.settings.IndexSettingsModule;
|
|||
import org.elasticsearch.index.similarity.SimilarityModule;
|
||||
import org.elasticsearch.indices.query.IndicesQueriesModule;
|
||||
import org.elasticsearch.script.ScriptModule;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
||||
import org.hamcrest.Matchers;
|
||||
|
@ -82,13 +82,13 @@ import static org.elasticsearch.index.query.FilterBuilders.*;
|
|||
import static org.elasticsearch.index.query.QueryBuilders.*;
|
||||
import static org.elasticsearch.index.query.RegexpFlag.*;
|
||||
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.factorFunction;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBooleanSubQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertBooleanSubQuery;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SimpleIndexQueryParserTests extends ElasticsearchTestCase {
|
||||
public class SimpleIndexQueryParserTests extends ElasticSearchTestCase {
|
||||
|
||||
private static Injector injector;
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.carrotsearch.randomizedtesting.SeedUtils;
|
|||
import org.apache.lucene.store.*;
|
||||
import org.apache.lucene.store.MockDirectoryWrapper.Throttling;
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.elasticsearch.ElasticsearchTestCase;
|
||||
import org.elasticsearch.cache.memory.ByteBufferCache;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -37,6 +36,7 @@ import org.elasticsearch.index.store.fs.NioFsDirectoryService;
|
|||
import org.elasticsearch.index.store.fs.SimpleFsDirectoryService;
|
||||
import org.elasticsearch.index.store.memory.ByteBufferDirectoryService;
|
||||
import org.elasticsearch.index.store.ram.RamDirectoryService;
|
||||
import org.elasticsearch.test.ElasticSearchTestCase;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
@ -58,7 +58,7 @@ public class MockDirectoryHelper {
|
|||
public MockDirectoryHelper(ShardId shardId, Settings indexSettings, ESLogger logger) {
|
||||
randomIOExceptionRate = indexSettings.getAsDouble(RANDOM_IO_EXCEPTION_RATE, 0.0d);
|
||||
randomIOExceptionRateOnOpen = indexSettings.getAsDouble(RANDOM_IO_EXCEPTION_RATE_ON_OPEN, 0.0d);
|
||||
final long seed = indexSettings.getAsLong(ElasticsearchTestCase.INDEX_SEED_SETTING, 0l);
|
||||
final long seed = indexSettings.getAsLong(ElasticSearchTestCase.INDEX_SEED_SETTING, 0l);
|
||||
random = new Random(seed);
|
||||
random.nextInt(shardId.getId() + 1); // some randomness per shard
|
||||
throttle = Throttling.valueOf(indexSettings.get(RANDOM_THROTTLE, random.nextDouble() < 0.1 ? "SOMETIMES" : "NEVER"));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.indexing;
|
|||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.index.VersionType;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class IndexActionTests extends AbstractSharedClusterTest {
|
||||
public class IndexActionTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreatedFlag() throws Exception {
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.common.logging.Loggers;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.Discovery;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -19,17 +19,17 @@
|
|||
|
||||
package org.elasticsearch.indices;
|
||||
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.search.MultiSearchResponse;
|
||||
import org.elasticsearch.action.support.IgnoreIndices;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class IgnoreIndicesTests extends AbstractSharedClusterTest {
|
||||
public class IgnoreIndicesTests extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@Test
|
||||
|
|
|
@ -25,18 +25,17 @@ import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequestBuilder;
|
|||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class AnalyzeActionTests extends AbstractSharedClusterTest {
|
||||
public class AnalyzeActionTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void simpleAnalyzerTests() throws Exception {
|
||||
|
|
|
@ -25,10 +25,9 @@ import org.elasticsearch.common.lucene.Lucene;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.indices.analysis.HunspellService;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -37,13 +36,8 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class HunspellServiceTests extends AbstractNodesTests {
|
||||
|
||||
|
||||
@After
|
||||
public void closeNodes() {
|
||||
closeAllNodes();
|
||||
}
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
public class HunspellServiceTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testLocaleDirectoryWithNodeLevelConfig() throws Exception {
|
||||
|
@ -53,9 +47,8 @@ public class HunspellServiceTests extends AbstractNodesTests {
|
|||
.put("indices.analysis.hunspell.dictionary.ignore_case", true)
|
||||
.build();
|
||||
|
||||
Node node = startNode("node1", settings);
|
||||
|
||||
HunspellDictionary dictionary = ((InternalNode) node).injector().getInstance(HunspellService.class).getDictionary("en_US");
|
||||
cluster().startNode(settings);
|
||||
HunspellDictionary dictionary = cluster().getInstance(HunspellService.class).getDictionary("en_US");
|
||||
assertThat(dictionary, notNullValue());
|
||||
Version expectedVersion = Lucene.parseVersion(settings.get("indices.analysis.hunspell.version"), Lucene.ANALYZER_VERSION, logger);
|
||||
assertThat(dictionary.getVersion(), equalTo(expectedVersion));
|
||||
|
@ -72,9 +65,8 @@ public class HunspellServiceTests extends AbstractNodesTests {
|
|||
.put("indices.analysis.hunspell.dictionary.en_US.ignore_case", false)
|
||||
.build();
|
||||
|
||||
Node node = startNode("node1", settings);
|
||||
|
||||
HunspellDictionary dictionary = ((InternalNode) node).injector().getInstance(HunspellService.class).getDictionary("en_US");
|
||||
cluster().startNode(settings);
|
||||
HunspellDictionary dictionary = cluster().getInstance(HunspellService.class).getDictionary("en_US");
|
||||
assertThat(dictionary, notNullValue());
|
||||
Version expectedVersion = Lucene.parseVersion(settings.get("indices.analysis.hunspell.version"), Lucene.ANALYZER_VERSION, logger);
|
||||
assertThat(dictionary.getVersion(), equalTo(expectedVersion));
|
||||
|
@ -82,7 +74,7 @@ public class HunspellServiceTests extends AbstractNodesTests {
|
|||
|
||||
|
||||
// testing that dictionary specific settings override node level settings
|
||||
dictionary = ((InternalNode) node).injector().getInstance(HunspellService.class).getDictionary("en_US_custom");
|
||||
dictionary = cluster().getInstance(HunspellService.class).getDictionary("en_US_custom");
|
||||
assertThat(dictionary, notNullValue());
|
||||
assertThat(dictionary.getVersion(), equalTo(expectedVersion));
|
||||
assertThat(dictionary.isIgnoreCase(), equalTo(true));
|
||||
|
@ -94,9 +86,8 @@ public class HunspellServiceTests extends AbstractNodesTests {
|
|||
.put("indices.analysis.hunspell.dictionary.location", getResource("/indices/analyze/conf_dir/hunspell"))
|
||||
.build();
|
||||
|
||||
Node node = startNode("node1", settings);
|
||||
|
||||
HunspellDictionary dictionary = ((InternalNode) node).injector().getInstance(HunspellService.class).getDictionary("en_US");
|
||||
cluster().startNode(settings);
|
||||
HunspellDictionary dictionary = cluster().getInstance(HunspellService.class).getDictionary("en_US");
|
||||
assertThat(dictionary, notNullValue());
|
||||
}
|
||||
|
||||
|
|
|
@ -23,32 +23,28 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
|||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.query.FilterBuilders;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.filteredQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CacheTests extends AbstractNodesTests {
|
||||
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
||||
public class CacheTests extends AbstractIntegrationTest {
|
||||
|
||||
@Override
|
||||
protected void beforeClass() throws Exception {
|
||||
// Filter cache is cleaned periodically, default is 60s, so make sure it runs often. Thread.sleep for 60s is bad
|
||||
startNode("node1", ImmutableSettings.settingsBuilder().put("indices.cache.filter.clean_interval", "1ms"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Client client() {
|
||||
return client("node1");
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
//Filter cache is cleaned periodically, default is 60s, so make sure it runs often. Thread.sleep for 60s is bad
|
||||
return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("indices.cache.filter.clean_interval", "1ms").build();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,15 +24,13 @@ import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse;
|
|||
import org.elasticsearch.action.support.IgnoreIndices;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.indices.IndexMissingException;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class TypesExistsTests extends AbstractSharedClusterTest {
|
||||
public class TypesExistsTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.index.shard.service.IndexShard;
|
|||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.AbstractNodesTests;
|
||||
import org.elasticsearch.test.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.elasticsearch.action.index.IndexResponse;
|
|||
import org.elasticsearch.index.query.MatchQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -37,7 +37,7 @@ import java.util.concurrent.CountDownLatch;
|
|||
|
||||
import static org.hamcrest.Matchers.emptyIterable;
|
||||
|
||||
public class ConcurrentDynamicTemplateTests extends AbstractSharedClusterTest {
|
||||
public class ConcurrentDynamicTemplateTests extends AbstractIntegrationTest {
|
||||
|
||||
private final String mappingType = "test-mapping";
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
package org.elasticsearch.indices.mapping;
|
||||
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.count.CountResponse;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
|
@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class SimpleDeleteMappingTests extends AbstractSharedClusterTest {
|
||||
public class SimpleDeleteMappingTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void simpleDeleteMapping() throws Exception {
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
|||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.AbstractSharedClusterTest;
|
||||
import org.elasticsearch.test.AbstractIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
|
@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class SimpleGetMappingsTests extends AbstractSharedClusterTest {
|
||||
public class SimpleGetMappingsTests extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void getMappingsWhereThereAreNone() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue