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:
Simon Willnauer 2013-09-17 22:22:48 +02:00
parent de3cde3e1e
commit 575d6b0321
203 changed files with 964 additions and 974 deletions

View File

@ -25,7 +25,7 @@ import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; 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 @Test
public void simpleTest() throws IOException { public void simpleTest() throws IOException {

View File

@ -19,7 +19,6 @@
package org.elasticsearch.aliases; package org.elasticsearch.aliases;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse; 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.FacetBuilders;
import org.elasticsearch.search.facet.terms.TermsFacet; import org.elasticsearch.search.facet.terms.TermsFacet;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.util.Set; import java.util.Set;
@ -57,7 +57,7 @@ import static org.hamcrest.Matchers.*;
/** /**
* *
*/ */
public class IndexAliasesTests extends AbstractSharedClusterTest { public class IndexAliasesTests extends AbstractIntegrationTest {
@Test @Test
public void testAliases() throws Exception { public void testAliases() throws Exception {

View File

@ -32,14 +32,13 @@ import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import java.util.HashMap; import java.util.HashMap;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
public class SimpleBlocksTests extends AbstractNodesTests { public class SimpleBlocksTests extends AbstractNodesTests {

View File

@ -20,7 +20,6 @@
package org.elasticsearch.broadcast; package org.elasticsearch.broadcast;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.ShardOperationFailedException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; 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.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; 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 @Test
public void testBroadcastOperations() throws IOException { public void testBroadcastOperations() throws IOException {

View File

@ -20,7 +20,7 @@
package org.elasticsearch.cluster; package org.elasticsearch.cluster;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;

View File

@ -22,13 +22,12 @@ package org.elasticsearch.cluster;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class ClusterHealthTests extends AbstractSharedClusterTest { public class ClusterHealthTests extends AbstractIntegrationTest {
@Test @Test

View File

@ -19,12 +19,12 @@
package org.elasticsearch.cluster; package org.elasticsearch.cluster;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class DiskUsageTests extends ElasticsearchTestCase { public class DiskUsageTests extends ElasticSearchTestCase {
@Test @Test
public void diskUsageCalcTest() { public void diskUsageCalcTest() {

View File

@ -20,7 +20,6 @@
package org.elasticsearch.cluster; package org.elasticsearch.cluster;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import org.elasticsearch.AbstractNodesTests;
import org.elasticsearch.action.percolate.PercolateSourceBuilder; import org.elasticsearch.action.percolate.PercolateSourceBuilder;
import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -29,6 +28,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.Discovery;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;

View File

@ -23,14 +23,13 @@ import org.elasticsearch.action.UnavailableShardsException;
import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.client.Requests; import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.client.Requests.createIndexRequest; import static org.elasticsearch.client.Requests.createIndexRequest;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
/** /**

View File

@ -24,7 +24,6 @@ import org.junit.After;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;

View File

@ -22,42 +22,38 @@ package org.elasticsearch.cluster;
import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.After; import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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.equalTo;
/** /**
*/ */
public class UpdateSettingsValidationTests extends AbstractNodesTests { @ClusterScope(scope=Scope.TEST, numNodes=0)
public class UpdateSettingsValidationTests extends AbstractIntegrationTest {
@After
public void closeNodes() {
closeAllNodes();
}
@Test @Test
public void testUpdateSettingsValidation() throws Exception { public void testUpdateSettingsValidation() throws Exception {
startNode("master", settingsBuilder().put("node.data", false).build()); String master = cluster().startNode(settingsBuilder().put("node.data", false).build());
startNode("node1", settingsBuilder().put("node.master", false).build()); String node_1 = cluster().startNode(settingsBuilder().put("node.master", false).build());
startNode("node2", 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(); .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.isTimedOut(), equalTo(false));
assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(10)); assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(10));
client("master").admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.number_of_replicas", 0)).execute().actionGet(); client().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(); healthResponse = client().admin().cluster().prepareHealth("test").setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false)); assertThat(healthResponse.isTimedOut(), equalTo(false));
assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(5)); assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(5));
try { 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; assert false;
} catch (ElasticSearchIllegalArgumentException ex) { } catch (ElasticSearchIllegalArgumentException ex) {
logger.info("Error message: [{}]", ex.getMessage()); logger.info("Error message: [{}]", ex.getMessage());

View File

@ -31,8 +31,9 @@ import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.After; import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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); private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class);
@After
public void cleanAndCloseNodes() throws Exception {
closeAllNodes();
}
@Test @Test
public void testSimpleAwareness() throws Exception { public void testSimpleAwareness() throws Exception {
Settings commonSettings = ImmutableSettings.settingsBuilder() Settings commonSettings = ImmutableSettings.settingsBuilder()
@ -59,17 +56,17 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
logger.info("--> starting 2 nodes on the same rack"); logger.info("--> starting 2 nodes on the same rack");
startNode("node1", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1")); cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1").build());
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());
client("node1").admin().indices().prepareCreate("test1").execute().actionGet(); client().admin().indices().prepareCreate("test1").execute().actionGet();
client("node1").admin().indices().prepareCreate("test2").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)); assertThat(health.isTimedOut(), equalTo(false));
logger.info("--> starting 1 node on a different rack"); 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(); long start = System.currentTimeMillis();
TObjectIntHashMap<String> counts; TObjectIntHashMap<String> counts;
@ -77,11 +74,11 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
do { do {
Thread.sleep(100); Thread.sleep(100);
logger.info("--> waiting for no relocation"); 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)); assertThat(health.isTimedOut(), equalTo(false));
logger.info("--> checking current state"); 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()); //System.out.println(clusterState.routingTable().prettyPrint());
// verify that we have 10 shards on node3 // verify that we have 10 shards on node3
counts = new TObjectIntHashMap<String>(); counts = new TObjectIntHashMap<String>();
@ -92,8 +89,8 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
} }
} }
} }
} while (counts.get("node3") != 10 && (System.currentTimeMillis() - start) < 10000); } while (counts.get(node3) != 10 && (System.currentTimeMillis() - start) < 10000);
assertThat(counts.get("node3"), equalTo(10)); assertThat(counts.get(node3), equalTo(10));
} }
@Test @Test
@ -105,10 +102,10 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
.build(); .build();
logger.info("--> starting 6 nodes on different zones"); logger.info("--> starting 6 nodes on different zones");
startNode("A-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a")); String A_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").build());
startNode("B-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b")); String B_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build());
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());
startNode("A-1", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a")); String A_1 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").build());
client().admin().indices().prepareCreate("test") client().admin().indices().prepareCreate("test")
.setSettings(settingsBuilder().put("index.number_of_shards", 5) .setSettings(settingsBuilder().put("index.number_of_shards", 5)
.put("index.number_of_replicas", 1)).execute().actionGet(); .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(A_1), anyOf(equalTo(2),equalTo(3)));
assertThat(counts.get("B-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(A_0), anyOf(equalTo(2),equalTo(3)));
assertThat(counts.get("B-0"), anyOf(equalTo(2),equalTo(3))); assertThat(counts.get(B_0), anyOf(equalTo(2),equalTo(3)));
} }
@Test @Test
@ -140,8 +137,8 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
logger.info("--> starting 2 nodes on zones 'a' & 'b'"); logger.info("--> starting 2 nodes on zones 'a' & 'b'");
startNode("A-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a")); String A_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").build());
startNode("B-0", ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b")); String B_0 = cluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build());
client().admin().indices().prepareCreate("test") client().admin().indices().prepareCreate("test")
.setSettings(settingsBuilder().put("index.number_of_shards", 5) .setSettings(settingsBuilder().put("index.number_of_shards", 5)
.put("index.number_of_replicas", 1)).execute().actionGet(); .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(A_0), equalTo(5));
assertThat(counts.get("B-0"), equalTo(5)); assertThat(counts.get(B_0), equalTo(5));
logger.info("--> starting another node in zone 'b'"); 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(); health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet();
assertThat(health.isTimedOut(), equalTo(false)); assertThat(health.isTimedOut(), equalTo(false));
client().admin().cluster().prepareReroute().get(); client().admin().cluster().prepareReroute().get();
@ -179,9 +176,8 @@ public class AwarenessAllocationTests extends AbstractNodesTests {
} }
} }
} }
assertThat(counts.get("A-0"), equalTo(5)); assertThat(counts.get(A_0), equalTo(5));
assertThat(counts.get("B-0"), equalTo(3)); assertThat(counts.get(B_0), equalTo(3));
assertThat(counts.get("B-1"), equalTo(2)); assertThat(counts.get(B_1), equalTo(2));
} }
} }

View File

@ -32,11 +32,10 @@ import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.gateway.Gateway;
import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.test.AbstractIntegrationTest;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
import org.junit.After; import org.elasticsearch.test.AbstractIntegrationTest.Scope;
import org.junit.Test; import org.junit.Test;
import java.io.File; 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); 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 @Test
public void rerouteWithCommands() throws Exception { public void rerouteWithCommands() throws Exception {
@ -69,60 +58,60 @@ public class ClusterRerouteTests extends AbstractNodesTests {
.put(DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_ALLOCATION, true) .put(DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_ALLOCATION, true)
.build(); .build();
startNode("node1", commonSettings); String node_1 = cluster().startNode(commonSettings);
startNode("node2", commonSettings); String node_2 = cluster().startNode(commonSettings);
logger.info("--> create an index with 1 shard, 1 replica, nothing should allocate"); 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)) .setSettings(settingsBuilder().put("index.number_of_shards", 1))
.execute().actionGet(); .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)); assertThat(state.routingNodes().unassigned().size(), equalTo(2));
logger.info("--> explicitly allocate shard 1, *under dry_run*"); logger.info("--> explicitly allocate shard 1, *under dry_run*");
state = client("node1").admin().cluster().prepareReroute() state = client().admin().cluster().prepareReroute()
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true)) .add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
.setDryRun(true) .setDryRun(true)
.execute().actionGet().getState(); .execute().actionGet().getState();
assertThat(state.routingNodes().unassigned().size(), equalTo(1)); 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"); 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)); assertThat(state.routingNodes().unassigned().size(), equalTo(2));
logger.info("--> explicitly allocate shard 1, actually allocating, no dry run"); logger.info("--> explicitly allocate shard 1, actually allocating, no dry run");
state = client("node1").admin().cluster().prepareReroute() state = client().admin().cluster().prepareReroute()
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true)) .add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
.execute().actionGet().getState(); .execute().actionGet().getState();
assertThat(state.routingNodes().unassigned().size(), equalTo(1)); 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)); assertThat(healthResponse.isTimedOut(), equalTo(false));
logger.info("--> get the state, verify shard 1 primary allocated"); 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().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"); logger.info("--> move shard 1 primary from node1 to node2");
state = client("node1").admin().cluster().prepareReroute() state = client().admin().cluster().prepareReroute()
.add(new MoveAllocationCommand(new ShardId("test", 0), "node1", "node2")) .add(new MoveAllocationCommand(new ShardId("test", 0), node_1, node_2))
.execute().actionGet().getState(); .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(node_1).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_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)); assertThat(healthResponse.isTimedOut(), equalTo(false));
logger.info("--> get the state, verify shard 1 primary moved from node1 to node2"); 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().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 @Test
@ -133,69 +122,68 @@ public class ClusterRerouteTests extends AbstractNodesTests {
.put("gateway.type", "local") .put("gateway.type", "local")
.build(); .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"); logger.info("--> starting 2 nodes");
startNode("node1", commonSettings); String node_1 = cluster().startNode(commonSettings);
startNode("node2", 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"); 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)) .setSettings(settingsBuilder().put("index.number_of_shards", 1))
.execute().actionGet(); .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)); assertThat(state.routingNodes().unassigned().size(), equalTo(2));
logger.info("--> explicitly allocate shard 1, actually allocating, no dry run"); logger.info("--> explicitly allocate shard 1, actually allocating, no dry run");
state = client("node1").admin().cluster().prepareReroute() state = client().admin().cluster().prepareReroute()
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true)) .add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
.execute().actionGet().getState(); .execute().actionGet().getState();
assertThat(state.routingNodes().unassigned().size(), equalTo(1)); 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)); assertThat(healthResponse.isTimedOut(), equalTo(false));
logger.info("--> get the state, verify shard 1 primary allocated"); 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().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"); logger.info("--> closing all nodes");
File shardLocation = ((InternalNode) node("node1")).injector().getInstance(NodeEnvironment.class).shardLocations(new ShardId("test", 0))[0]; File shardLocation = cluster().getInstance(NodeEnvironment.class).shardLocations(new ShardId("test", 0))[0];
closeAllNodes();
logger.info("--> deleting the shard data"); cluster().resetAllGateways();
cluster().closeAllNodesAndReset();
logger.info("--> deleting the shard data [{}] ", shardLocation);
FileSystemUtils.deleteRecursively(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"); logger.info("--> starting nodes back, will not allocate the shard since it has no data, but the index will be there");
startNode("node1", commonSettings); node_1 = cluster().startNode(commonSettings);
startNode("node2", commonSettings); cluster().startNode(commonSettings);
// wait a bit for the cluster to realize that the shard is not there... // 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? // TODO can we get around this? the cluster is RED, so what do we wait for?
Thread.sleep(300); client().admin().cluster().prepareReroute().get();
assertThat(client("node1").admin().cluster().prepareHealth().execute().actionGet().getStatus(), equalTo(ClusterHealthStatus.RED)); assertThat(cluster().client().admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet().getStatus(), equalTo(ClusterHealthStatus.RED));
logger.info("--> explicitly allocate primary"); logger.info("--> explicitly allocate primary");
state = client("node1").admin().cluster().prepareReroute() state = client().admin().cluster().prepareReroute()
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true)) .add(new AllocateAllocationCommand(new ShardId("test", 0), node_1, true))
.execute().actionGet().getState(); .execute().actionGet().getState();
assertThat(state.routingNodes().unassigned().size(), equalTo(1)); 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)); assertThat(healthResponse.isTimedOut(), equalTo(false));
logger.info("--> get the state, verify shard 1 primary allocated"); 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().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));
} }

View File

@ -19,104 +19,91 @@
package org.elasticsearch.cluster.allocation; package org.elasticsearch.cluster.allocation;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexRoutingTable;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.After; import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
import org.elasticsearch.test.AbstractIntegrationTest.Scope;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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.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); private final ESLogger logger = Loggers.getLogger(FilteringAllocationTests.class);
@After
public void cleanAndCloseNodes() throws Exception {
closeAllNodes();
}
@Test @Test
public void testDecommissionNodeNoReplicas() throws Exception { public void testDecommissionNodeNoReplicas() throws Exception {
logger.info("--> starting 2 nodes"); logger.info("--> starting 2 nodes");
startNode("node1"); final String node_0 = cluster().startNode();
startNode("node2"); final String node_1 = cluster().startNode();
assertThat(cluster().numNodes(), equalTo(2));
logger.info("--> creating an index with no replicas"); 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)) .setSettings(settingsBuilder().put("index.number_of_replicas", 0))
.execute().actionGet(); .execute().actionGet();
ensureGreen();
ClusterHealthResponse clusterHealthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
logger.info("--> index some data"); logger.info("--> index some data");
for (int i = 0; i < 100; i++) { 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(); client().admin().indices().prepareRefresh().execute().actionGet();
assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l)); assertThat(client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
logger.info("--> decommission the second node"); logger.info("--> decommission the second node");
client("node1").admin().cluster().prepareUpdateSettings() client().admin().cluster().prepareUpdateSettings()
.setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._name", "node2")) .setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._name", node_1))
.execute().actionGet(); .execute().actionGet();
Thread.sleep(200); client().admin().cluster().prepareReroute().get();
ensureGreen();
clusterHealthResponse = client("node1").admin().cluster().prepareHealth()
.setWaitForGreenStatus()
.setWaitForRelocatingShards(0)
.execute().actionGet();
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
logger.info("--> verify all are allocated on node1 now"); 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 (IndexRoutingTable indexRoutingTable : clusterState.routingTable()) {
for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) { for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) {
for (ShardRouting shardRouting : indexShardRoutingTable) { 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(); client().admin().indices().prepareRefresh().execute().actionGet();
assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l)); assertThat(client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
} }
@Test @Test
public void testDisablingAllocationFiltering() throws Exception { public void testDisablingAllocationFiltering() throws Exception {
logger.info("--> starting 2 nodes"); logger.info("--> starting 2 nodes");
startNode("node1"); final String node_0 = cluster().startNode();
startNode("node2"); final String node_1 = cluster().startNode();
assertThat(cluster().numNodes(), equalTo(2));
logger.info("--> creating an index with no replicas"); 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)) .setSettings(settingsBuilder().put("index.number_of_replicas", 0))
.execute().actionGet(); .execute().actionGet();
ClusterHealthResponse clusterHealthResponse = client("node1").admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); ensureGreen();
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
logger.info("--> index some data"); logger.info("--> index some data");
for (int i = 0; i < 100; i++) { 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(); client().admin().indices().prepareRefresh().execute().actionGet();
assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l)); assertThat(client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l));
ClusterState clusterState = client("node1").admin().cluster().prepareState().execute().actionGet().getState(); ClusterState clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
IndexRoutingTable indexRoutingTable = clusterState.routingTable().index("test"); IndexRoutingTable indexRoutingTable = clusterState.routingTable().index("test");
int numShardsOnNode1 = 0; int numShardsOnNode1 = 0;
for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) { for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) {
@ -128,48 +115,37 @@ public class FilteringAllocationTests extends AbstractNodesTests {
} }
if (numShardsOnNode1 > ThrottlingAllocationDecider.DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES) { 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(); .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 // 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. // but we already fired up the request to wait for 0 relocating shards.
} }
logger.info("--> remove index from the first node"); logger.info("--> remove index from the first node");
client("node1").admin().indices().prepareUpdateSettings("test") client().admin().indices().prepareUpdateSettings("test")
.setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", "node1")) .setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", node_0))
.execute().actionGet(); .execute().actionGet();
client().admin().cluster().prepareReroute().get();
ensureGreen();
Thread.sleep(200); logger.info("--> verify all shards are allocated on node_1 now");
clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
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();
indexRoutingTable = clusterState.routingTable().index("test"); indexRoutingTable = clusterState.routingTable().index("test");
for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) { for (IndexShardRoutingTable indexShardRoutingTable : indexRoutingTable) {
for (ShardRouting shardRouting : indexShardRoutingTable) { 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 "); logger.info("--> disable allocation filtering ");
client("node1").admin().indices().prepareUpdateSettings("test") client().admin().indices().prepareUpdateSettings("test")
.setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", "")) .setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", ""))
.execute().actionGet(); .execute().actionGet();
Thread.sleep(200); client().admin().cluster().prepareReroute().get();
ensureGreen();
clusterHealthResponse = client("node1").admin().cluster().prepareHealth()
.setWaitForGreenStatus()
.setWaitForRelocatingShards(0)
.execute().actionGet();
assertThat(clusterHealthResponse.isTimedOut(), equalTo(false));
logger.info("--> verify that there are shards allocated on both nodes now"); 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)); assertThat(clusterState.routingTable().index("test").numberOfNodesShardsAreAllocatedOn(), equalTo(2));
} }
} }

View File

@ -27,7 +27,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;

View File

@ -18,20 +18,19 @@
*/ */
package org.elasticsearch.cluster.allocation; package org.elasticsearch.cluster.allocation;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import org.elasticsearch.cluster.ClusterState;
import static org.hamcrest.MatcherAssert.assertThat; import org.elasticsearch.cluster.routing.RoutingNode;
import static org.hamcrest.Matchers.equalTo; import org.elasticsearch.common.Priority;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.elasticsearch.cluster.ClusterState; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import org.elasticsearch.cluster.routing.RoutingNode; import static org.hamcrest.Matchers.equalTo;
import org.elasticsearch.common.Priority;
import org.elasticsearch.AbstractSharedClusterTest;
import org.junit.Test;
public class SimpleAllocationTests extends AbstractSharedClusterTest { public class SimpleAllocationTests extends AbstractIntegrationTest {
/** /**
* Test for * Test for

View File

@ -1,16 +1,5 @@
package org.elasticsearch.cluster.routing.allocation; 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.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
@ -27,6 +16,17 @@ import org.hamcrest.Matcher;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; 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 { public class AddIncrementallyTests {
private final ESLogger logger = Loggers.getLogger(AddIncrementallyTests.class); private final ESLogger logger = Loggers.getLogger(AddIncrementallyTests.class);

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -27,7 +27,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder; 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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
/** /**
*/ */
public class AwarenessAllocationTests extends ElasticsearchTestCase { public class AwarenessAllocationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class); private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class);

View File

@ -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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
public class BalanceConfigurationTests { public class BalanceConfigurationTests {

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
/** /**
* *

View File

@ -24,7 +24,7 @@ import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder; 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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
/** /**
*/ */
public class PreferPrimaryAllocationTests extends ElasticsearchTestCase { public class PreferPrimaryAllocationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(PreferPrimaryAllocationTests.class); private final ESLogger logger = Loggers.getLogger(PreferPrimaryAllocationTests.class);

View File

@ -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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;

View File

@ -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.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.Decision;
import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; 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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.Matchers.equalTo; 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 /* This test will make random allocation decision on a growing and shrinking
* cluster leading to a random distribution of the shards. After a certain * cluster leading to a random distribution of the shards. After a certain

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;

View File

@ -1,6 +1,5 @@
package org.elasticsearch.cluster.routing.allocation; package org.elasticsearch.cluster.routing.allocation;
import org.elasticsearch.ElasticsearchTestCase;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.routing.MutableShardRouting; 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.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder; 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); private final ESLogger logger = Loggers.getLogger(SameShardRoutingTests.class);

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;

View File

@ -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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;

View File

@ -31,7 +31,7 @@ import org.elasticsearch.cluster.routing.allocation.AllocationService;
import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocators; import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocators;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays; 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.node.DiscoveryNodes.newNodesBuilder;
import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable; import static org.elasticsearch.cluster.routing.RoutingBuilders.routingTable;
import static org.elasticsearch.cluster.routing.ShardRoutingState.*; 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.cluster.routing.allocation.RoutingAllocationTests.newNode;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class DiskThresholdDeciderTests extends ElasticsearchTestCase { public class DiskThresholdDeciderTests extends ElasticSearchTestCase {
@Test @Test
public void diskThresholdTest() { public void diskThresholdTest() {

View File

@ -20,10 +20,12 @@ package org.elasticsearch.cluster.shards;
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsGroup; import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsGroup;
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse; import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.AliasAction; import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.common.Priority; 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 org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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 @Override
protected void beforeClass() throws Exception { protected Settings nodeSettings(int nodeOrdinal) {
startNode("node1", settingsBuilder().put("node.tag", "A")); switch(nodeOrdinal) {
startNode("node2", settingsBuilder().put("node.tag", "B")); case 1:
} return settingsBuilder().put("node.tag", "B").build();
case 0:
public Client client() { return settingsBuilder().put("node.tag", "A").build();
return client("node1"); }
return super.nodeSettings(nodeOrdinal);
} }
@Test @Test
public void testSingleShardAllocation() throws Exception { public void testSingleShardAllocation() throws Exception {
try {
client().admin().indices().prepareDelete("test").execute().actionGet();
} catch (Exception e) {
// ignore
}
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder() 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(); .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(); ensureGreen();
ClusterSearchShardsResponse response = client().admin().cluster().prepareSearchShards("test").execute().actionGet();
ClusterSearchShardsResponse response = client("node1").admin().cluster().prepareSearchShards("test").execute().actionGet();
assertThat(response.getGroups().length, equalTo(1)); assertThat(response.getGroups().length, equalTo(1));
assertThat(response.getGroups()[0].getIndex(), equalTo("test")); assertThat(response.getGroups()[0].getIndex(), equalTo("test"));
assertThat(response.getGroups()[0].getShardId(), equalTo(0)); assertThat(response.getGroups()[0].getShardId(), equalTo(0));
@ -62,7 +60,7 @@ public class ClusterSearchShardsTests extends AbstractNodesTests {
assertThat(response.getNodes().length, equalTo(1)); assertThat(response.getNodes().length, equalTo(1));
assertThat(response.getGroups()[0].getShards()[0].currentNodeId(), equalTo(response.getNodes()[0].getId())); 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().length, equalTo(1));
assertThat(response.getGroups()[0].getIndex(), equalTo("test")); assertThat(response.getGroups()[0].getIndex(), equalTo("test"));
assertThat(response.getGroups()[0].getShardId(), equalTo(0)); assertThat(response.getGroups()[0].getShardId(), equalTo(0));
@ -74,41 +72,26 @@ public class ClusterSearchShardsTests extends AbstractNodesTests {
@Test @Test
public void testMultipleShardsSingleNodeAllocation() throws Exception { public void testMultipleShardsSingleNodeAllocation() throws Exception {
try {
client().admin().indices().prepareDelete("test").execute().actionGet();
} catch (Exception e) {
// ignore
}
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder() 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(); .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().length, equalTo(4));
assertThat(response.getGroups()[0].getIndex(), equalTo("test")); assertThat(response.getGroups()[0].getIndex(), equalTo("test"));
assertThat(response.getNodes().length, equalTo(1)); assertThat(response.getNodes().length, equalTo(1));
assertThat(response.getGroups()[0].getShards()[0].currentNodeId(), equalTo(response.getNodes()[0].getId())); 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)); 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().length, equalTo(1));
assertThat(response.getGroups()[0].getShardId(), equalTo(2)); assertThat(response.getGroups()[0].getShardId(), equalTo(2));
} }
@Test @Test
public void testMultipleIndicesAllocation() throws Exception { 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() client().admin().indices().prepareCreate("test1").setSettings(settingsBuilder()
.put("index.number_of_shards", "4").put("index.number_of_replicas", 1)).execute().actionGet(); .put("index.number_of_shards", "4").put("index.number_of_replicas", 1)).execute().actionGet();
client().admin().indices().prepareCreate("test2").setSettings(settingsBuilder() client().admin().indices().prepareCreate("test2").setSettings(settingsBuilder()

View File

@ -24,17 +24,16 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.index.query.MatchQueryBuilder; import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 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.endsWith;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
/** /**
*/ */
public class CodecTests extends AbstractSharedClusterTest { public class CodecTests extends AbstractIntegrationTest {
@Test @Test
public void testFieldsWithCustomPostingsFormat() throws Exception { public void testFieldsWithCustomPostingsFormat() throws Exception {

View File

@ -43,7 +43,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon; 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} * Tests for {@link GeoJSONShapeParser}

View File

@ -28,8 +28,8 @@ import com.vividsolutions.jts.geom.Polygon;
import org.elasticsearch.common.geo.builders.ShapeBuilder; import org.elasticsearch.common.geo.builders.ShapeBuilder;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.test.hamcrest.ElasticsearchGeoAssertions.assertMultiLineString; import static org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions.assertMultiLineString;
import static org.elasticsearch.test.hamcrest.ElasticsearchGeoAssertions.assertMultiPolygon; import static org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions.assertMultiPolygon;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/** /**
* Tests for {@link ShapeBuilder} * Tests for {@link ShapeBuilder}

View File

@ -35,7 +35,7 @@ import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.index.mapper.internal.UidFieldMapper; import org.elasticsearch.index.mapper.internal.UidFieldMapper;
import org.elasticsearch.index.merge.policy.IndexUpgraderMergePolicy; import org.elasticsearch.index.merge.policy.IndexUpgraderMergePolicy;
import org.elasticsearch.ElasticsearchLuceneTestCase; import org.elasticsearch.test.ElasticSearchLuceneTestCase;
import org.hamcrest.MatcherAssert; import org.hamcrest.MatcherAssert;
import org.junit.Test; import org.junit.Test;
@ -46,7 +46,7 @@ import java.util.Map;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
public class VersionsTests extends ElasticsearchLuceneTestCase { public class VersionsTests extends ElasticSearchLuceneTestCase {
public static DirectoryReader reopen(DirectoryReader reader) throws IOException { public static DirectoryReader reopen(DirectoryReader reader) throws IOException {
return reopen(reader, true); return reopen(reader, true);

View File

@ -18,14 +18,14 @@
*/ */
package org.elasticsearch.common.regex; package org.elasticsearch.common.regex;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import java.util.Random; import java.util.Random;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class RegexTests extends ElasticsearchTestCase { public class RegexTests extends ElasticSearchTestCase {
@Test @Test
public void testFlags() { public void testFlags() {

View File

@ -19,9 +19,9 @@
package org.elasticsearch.common.settings; package org.elasticsearch.common.settings;
import org.elasticsearch.ElasticsearchTestCase;
import org.elasticsearch.common.settings.bar.BarTestClass; import org.elasticsearch.common.settings.bar.BarTestClass;
import org.elasticsearch.common.settings.foo.FooTestClass; import org.elasticsearch.common.settings.foo.FooTestClass;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; 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 @Test
public void testGetAsClass() { public void testGetAsClass() {

View File

@ -20,7 +20,7 @@
package org.elasticsearch.common.util.concurrent; package org.elasticsearch.common.util.concurrent;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import java.util.concurrent.CountDownLatch; 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() { private TimeUnit randomTimeUnit() {
return TimeUnit.values()[between(0, TimeUnit.values().length - 1)]; return TimeUnit.values()[between(0, TimeUnit.values().length - 1)];

View File

@ -25,7 +25,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.unit.TimeValue.timeValueMillis; 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 @Test

View File

@ -29,7 +29,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.*; import org.elasticsearch.index.query.*;
import org.elasticsearch.index.query.CommonTermsQueryBuilder.Operator; import org.elasticsearch.index.query.CommonTermsQueryBuilder.Operator;
import org.elasticsearch.index.query.MatchQueryBuilder.Type; 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.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.joda.time.format.ISODateTimeFormat; 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.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.FilterBuilders.*; import static org.elasticsearch.index.query.FilterBuilders.*;
import static org.elasticsearch.index.query.QueryBuilders.*; 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 @Test
public void passQueryAsStringTest() throws Exception { public void passQueryAsStringTest() throws Exception {

View File

@ -4,7 +4,7 @@ import org.elasticsearch.action.count.CountResponse;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.util.concurrent.ExecutionException; 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.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; import static org.elasticsearch.index.query.QueryBuilders.rangeQuery;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertHitCount;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertNoFailures;
public class SimpleCountTests extends AbstractSharedClusterTest { public class SimpleCountTests extends AbstractIntegrationTest {
@Test @Test
public void testCountRandomPreference() throws InterruptedException, ExecutionException { public void testCountRandomPreference() throws InterruptedException, ExecutionException {

View File

@ -19,7 +19,6 @@
package org.elasticsearch.deleteByQuery; package org.elasticsearch.deleteByQuery;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder;
import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse; import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
import org.elasticsearch.action.search.SearchResponse; 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.index.query.QueryBuilders;
import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
public class DeleteByQueryTests extends AbstractSharedClusterTest { public class DeleteByQueryTests extends AbstractIntegrationTest {
@Test @Test
public void testDeleteAllNoIndices() { public void testDeleteAllNoIndices() {

View File

@ -22,28 +22,28 @@ package org.elasticsearch.discovery;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; 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 org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; 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 @Test
public void testUnicastDiscovery() { public void testUnicastDiscovery() {
Settings settings = ImmutableSettings.settingsBuilder() ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
.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();
assertThat(state.nodes().size(), equalTo(2)); 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)); assertThat(state.nodes().size(), equalTo(2));
} }
} }

View File

@ -32,7 +32,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.discovery.zen.DiscoveryNodesProvider; import org.elasticsearch.discovery.zen.DiscoveryNodesProvider;
import org.elasticsearch.discovery.zen.ping.ZenPing; import org.elasticsearch.discovery.zen.ping.ZenPing;
import org.elasticsearch.node.service.NodeService; import org.elasticsearch.node.service.NodeService;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportService;
import org.elasticsearch.transport.local.LocalTransport; 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) { private Settings buildRandomMulticast(Settings settings) {
ImmutableSettings.Builder builder = ImmutableSettings.builder().put(settings); ImmutableSettings.Builder builder = ImmutableSettings.builder().put(settings);

View File

@ -31,7 +31,7 @@ import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.discovery.zen.DiscoveryNodesProvider; import org.elasticsearch.discovery.zen.DiscoveryNodesProvider;
import org.elasticsearch.discovery.zen.ping.ZenPing; import org.elasticsearch.discovery.zen.ping.ZenPing;
import org.elasticsearch.node.service.NodeService; import org.elasticsearch.node.service.NodeService;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportService;
import org.elasticsearch.transport.netty.NettyTransport; 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 @Test
public void testSimplePings() { public void testSimplePings() {

View File

@ -12,19 +12,19 @@ import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.index.VersionType; import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertNoFailures;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits; import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertSearchHits;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
/** /**
*/ */
public class BulkTests extends AbstractSharedClusterTest { public class BulkTests extends AbstractIntegrationTest {
@Test @Test

View File

@ -20,7 +20,6 @@
package org.elasticsearch.document; package org.elasticsearch.document;
import com.google.common.base.Charsets; 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.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse; 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.action.support.replication.ReplicationType;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;
@ -44,14 +44,14 @@ import java.util.Map;
import static org.elasticsearch.client.Requests.*; import static org.elasticsearch.client.Requests.*;
import static org.elasticsearch.index.query.QueryBuilders.termQuery; 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.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
/** /**
* *
*/ */
public class DocumentActionsTests extends AbstractSharedClusterTest { public class DocumentActionsTests extends AbstractIntegrationTest {
protected void createIndex() { protected void createIndex() {
wipeIndex(getConcreteIndexName()); wipeIndex(getConcreteIndexName());

View File

@ -19,11 +19,11 @@
package org.elasticsearch.explain; package org.elasticsearch.explain;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.explain.ExplainResponse; import org.elasticsearch.action.explain.ExplainResponse;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.index.query.FilterBuilders; import org.elasticsearch.index.query.FilterBuilders;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.util.Map; 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 @Test

View File

@ -21,19 +21,19 @@ package org.elasticsearch.flt;
import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchPhaseExecutionException;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.QueryBuilders.fuzzyLikeThisFieldQuery; import static org.elasticsearch.index.query.QueryBuilders.fuzzyLikeThisFieldQuery;
import static org.elasticsearch.index.query.QueryBuilders.fuzzyLikeThisQuery; 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; import static org.hamcrest.Matchers.equalTo;
/** /**
* *
*/ */
public class FuzzyLikeThisActionTests extends AbstractSharedClusterTest { public class FuzzyLikeThisActionTests extends AbstractIntegrationTest {
@Test @Test
// See issue https://github.com/elasticsearch/elasticsearch/issues/3252 // See issue https://github.com/elasticsearch/elasticsearch/issues/3252

View File

@ -21,7 +21,6 @@ package org.elasticsearch.gateway.fs;
import com.carrotsearch.randomizedtesting.annotations.Nightly; import com.carrotsearch.randomizedtesting.annotations.Nightly;
import org.apache.lucene.util.LuceneTestCase.Slow; 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.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; 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.gateway.Gateway;
import org.elasticsearch.indices.IndexAlreadyExistsException; import org.elasticsearch.indices.IndexAlreadyExistsException;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;

View File

@ -36,7 +36,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.gateway.Gateway; import org.elasticsearch.gateway.Gateway;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;

View File

@ -21,13 +21,13 @@ package org.elasticsearch.gateway.local;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import org.apache.lucene.util.LuceneTestCase.Slow; 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.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.gateway.Gateway; import org.elasticsearch.gateway.Gateway;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; 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.settings.ImmutableSettings.settingsBuilder;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticSearchAssertions.assertHitCount;
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.equalTo;
/** /**

View File

@ -37,7 +37,7 @@ import org.elasticsearch.index.query.FilterBuilders;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; 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.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.elasticsearch.index.query.QueryBuilders.termQuery; 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.*; import static org.hamcrest.Matchers.*;
/** /**

View File

@ -22,7 +22,7 @@ package org.elasticsearch.gateway.none;
import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.get; package org.elasticsearch.get;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.delete.DeleteResponse; 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.settings.ImmutableSettings;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.engine.VersionConflictEngineException; import org.elasticsearch.index.engine.VersionConflictEngineException;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.util.Map; 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.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
public class GetActionTests extends AbstractSharedClusterTest { public class GetActionTests extends AbstractIntegrationTest {
@Test @Test
public void simpleGetTests() { public void simpleGetTests() {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.index.analysis; package org.elasticsearch.index.analysis;
import com.google.common.base.Charsets;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.Tokenizer;
@ -38,20 +39,14 @@ import org.elasticsearch.env.Environment;
import org.elasticsearch.env.EnvironmentModule; import org.elasticsearch.env.EnvironmentModule;
import org.elasticsearch.index.Index; import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexNameModule; import org.elasticsearch.index.IndexNameModule;
import org.elasticsearch.index.analysis.filter1.MyFilterTokenFilterFactory;
import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule; import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import org.elasticsearch.index.analysis.filter1.MyFilterTokenFilterFactory;
import org.hamcrest.MatcherAssert; import org.hamcrest.MatcherAssert;
import org.junit.Test; import org.junit.Test;
import com.google.common.base.Charsets; import java.io.*;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.util.Set; import java.util.Set;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;

View File

@ -21,7 +21,7 @@ package org.elasticsearch.index.analysis;
import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.standard.StandardTokenizer; import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;

View File

@ -29,7 +29,7 @@ import org.elasticsearch.index.IndexNameModule;
import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule; import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;

View File

@ -21,7 +21,7 @@ package org.elasticsearch.index.analysis;
import org.elasticsearch.common.inject.ProvisionException; import org.elasticsearch.common.inject.ProvisionException;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; 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.instanceOf;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class HunspellTokenFilterFactoryTests extends ElasticsearchTestCase { public class HunspellTokenFilterFactoryTests extends ElasticSearchTestCase {
@Test @Test
public void testDedup() throws IOException { public void testDedup() throws IOException {

View File

@ -24,7 +24,7 @@ import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -23,7 +23,7 @@ import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;

View File

@ -31,7 +31,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.ImmutableSettings.Builder; import org.elasticsearch.common.settings.ImmutableSettings.Builder;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index; import org.elasticsearch.index.Index;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;

View File

@ -23,7 +23,7 @@ import org.apache.lucene.analysis.NumericTokenStream;
import org.apache.lucene.analysis.NumericTokenStream.NumericTermAttribute; import org.apache.lucene.analysis.NumericTokenStream.NumericTermAttribute;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;
@ -31,7 +31,7 @@ import java.io.IOException;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class NumericAnalyzerTests extends ElasticsearchTestCase { public class NumericAnalyzerTests extends ElasticSearchTestCase {
@Test @Test
public void testAttributeEqual() throws IOException { public void testAttributeEqual() throws IOException {

View File

@ -30,7 +30,7 @@ import org.elasticsearch.index.IndexNameModule;
import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule; import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;

View File

@ -23,7 +23,7 @@ import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;

View File

@ -30,7 +30,7 @@ import org.elasticsearch.index.IndexNameModule;
import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule; import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;

View File

@ -21,7 +21,7 @@ package org.elasticsearch.index.analysis;
import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.elasticsearch.ElasticSearchTokenStreamTestCase; import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;

View File

@ -26,9 +26,9 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.analysis.AnalysisService; 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.AnalysisTestsHelper;
import org.elasticsearch.index.analysis.TokenFilterFactory;
import org.elasticsearch.test.ElasticSearchTokenStreamTestCase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -42,14 +42,14 @@ import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.MapperServiceModule; import org.elasticsearch.index.mapper.MapperServiceModule;
import org.elasticsearch.index.settings.IndexSettingsModule; import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.index.similarity.SimilarityModule; import org.elasticsearch.index.similarity.SimilarityModule;
import org.elasticsearch.ElasticsearchLuceneTestCase; import org.elasticsearch.test.ElasticSearchLuceneTestCase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.instanceOf;
public class CodecTests extends ElasticsearchLuceneTestCase { public class CodecTests extends ElasticSearchLuceneTestCase {
@Override @Override
@Before @Before

View File

@ -27,7 +27,6 @@ import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexDeletionPolicy; import org.apache.lucene.index.IndexDeletionPolicy;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TermQuery;
import org.elasticsearch.ElasticsearchTestCase;
import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.lucene.Lucene; 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.Translog;
import org.elasticsearch.index.translog.TranslogSizeMatcher; import org.elasticsearch.index.translog.TranslogSizeMatcher;
import org.elasticsearch.index.translog.fs.FsTranslog; import org.elasticsearch.index.translog.fs.FsTranslog;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.hamcrest.MatcherAssert; import org.hamcrest.MatcherAssert;
import org.junit.After; 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); protected final ShardId shardId = new ShardId(new Index("index"), 1);

View File

@ -25,12 +25,12 @@ import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.index.Index; import org.elasticsearch.index.Index;
import org.elasticsearch.index.mapper.FieldMapper; import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
// we might wanna cut this over to LuceneTestCase // we might wanna cut this over to LuceneTestCase
public abstract class AbstractFieldDataTests extends ElasticsearchTestCase { public abstract class AbstractFieldDataTests extends ElasticSearchTestCase {
protected IndexFieldDataService ifdService; protected IndexFieldDataService ifdService;
protected IndexWriter writer; protected IndexWriter writer;

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.fielddata; package org.elasticsearch.index.fielddata;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType; 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.common.xcontent.XContentFactory;
import org.elasticsearch.search.facet.Facets; import org.elasticsearch.search.facet.Facets;
import org.elasticsearch.search.facet.terms.TermsFacet; import org.elasticsearch.search.facet.terms.TermsFacet;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
@ -35,9 +35,9 @@ import java.io.IOException;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.elasticsearch.search.facet.FacetBuilders.termsFacet; 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 @Test
public void testRegexpFilter() throws IOException { public void testRegexpFilter() throws IOException {

View File

@ -22,7 +22,7 @@ package org.elasticsearch.index.fielddata.ordinals;
import org.apache.lucene.util.LongsRef; import org.apache.lucene.util.LongsRef;
import org.apache.lucene.util.packed.PackedInts; import org.apache.lucene.util.packed.PackedInts;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.ElasticsearchTestCase; import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; 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) { protected final Ordinals creationMultiOrdinals(OrdinalsBuilder builder) {
return this.creationMultiOrdinals(builder, ImmutableSettings.builder()); return this.creationMultiOrdinals(builder, ImmutableSettings.builder());

View File

@ -23,8 +23,8 @@ import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.compress.CompressorFactory; import org.elasticsearch.common.compress.CompressorFactory;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.MapperTestUtils; import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;

View File

@ -24,12 +24,8 @@ import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.compress.CompressorFactory; import org.elasticsearch.common.compress.CompressorFactory;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.*;
import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.test.ElasticSearchTestCase;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.ElasticsearchTestCase;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.junit.Test; import org.junit.Test;
import java.util.Map; 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 @Test
public void testNoFormat() throws Exception { public void testNoFormat() throws Exception {

View File

@ -32,7 +32,6 @@ import org.apache.lucene.search.spans.*;
import org.apache.lucene.spatial.prefix.IntersectsPrefixTreeFilter; import org.apache.lucene.spatial.prefix.IntersectsPrefixTreeFilter;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.ElasticsearchTestCase;
import org.elasticsearch.cache.recycler.CacheRecyclerModule; import org.elasticsearch.cache.recycler.CacheRecyclerModule;
import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.common.bytes.BytesArray; 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.index.similarity.SimilarityModule;
import org.elasticsearch.indices.query.IndicesQueriesModule; import org.elasticsearch.indices.query.IndicesQueriesModule;
import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.threadpool.ThreadPoolModule; import org.elasticsearch.threadpool.ThreadPoolModule;
import org.hamcrest.Matchers; 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.QueryBuilders.*;
import static org.elasticsearch.index.query.RegexpFlag.*; import static org.elasticsearch.index.query.RegexpFlag.*;
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.factorFunction; 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.*; import static org.hamcrest.Matchers.*;
/** /**
* *
*/ */
public class SimpleIndexQueryParserTests extends ElasticsearchTestCase { public class SimpleIndexQueryParserTests extends ElasticSearchTestCase {
private static Injector injector; private static Injector injector;

View File

@ -23,7 +23,6 @@ import com.carrotsearch.randomizedtesting.SeedUtils;
import org.apache.lucene.store.*; import org.apache.lucene.store.*;
import org.apache.lucene.store.MockDirectoryWrapper.Throttling; import org.apache.lucene.store.MockDirectoryWrapper.Throttling;
import org.apache.lucene.util.Constants; import org.apache.lucene.util.Constants;
import org.elasticsearch.ElasticsearchTestCase;
import org.elasticsearch.cache.memory.ByteBufferCache; import org.elasticsearch.cache.memory.ByteBufferCache;
import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.settings.Settings; 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.fs.SimpleFsDirectoryService;
import org.elasticsearch.index.store.memory.ByteBufferDirectoryService; import org.elasticsearch.index.store.memory.ByteBufferDirectoryService;
import org.elasticsearch.index.store.ram.RamDirectoryService; import org.elasticsearch.index.store.ram.RamDirectoryService;
import org.elasticsearch.test.ElasticSearchTestCase;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@ -58,7 +58,7 @@ public class MockDirectoryHelper {
public MockDirectoryHelper(ShardId shardId, Settings indexSettings, ESLogger logger) { public MockDirectoryHelper(ShardId shardId, Settings indexSettings, ESLogger logger) {
randomIOExceptionRate = indexSettings.getAsDouble(RANDOM_IO_EXCEPTION_RATE, 0.0d); randomIOExceptionRate = indexSettings.getAsDouble(RANDOM_IO_EXCEPTION_RATE, 0.0d);
randomIOExceptionRateOnOpen = indexSettings.getAsDouble(RANDOM_IO_EXCEPTION_RATE_ON_OPEN, 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 = new Random(seed);
random.nextInt(shardId.getId() + 1); // some randomness per shard random.nextInt(shardId.getId() + 1); // some randomness per shard
throttle = Throttling.valueOf(indexSettings.get(RANDOM_THROTTLE, random.nextDouble() < 0.1 ? "SOMETIMES" : "NEVER")); throttle = Throttling.valueOf(indexSettings.get(RANDOM_THROTTLE, random.nextDouble() < 0.1 ? "SOMETIMES" : "NEVER"));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.indexing;
import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.index.VersionType; import org.elasticsearch.index.VersionType;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.util.ArrayList; 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 @Test
public void testCreatedFlag() throws Exception { public void testCreatedFlag() throws Exception {

View File

@ -32,7 +32,7 @@ import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.Discovery;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;

View File

@ -19,17 +19,17 @@
package org.elasticsearch.indices; package org.elasticsearch.indices;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
import org.elasticsearch.action.search.MultiSearchResponse; import org.elasticsearch.action.search.MultiSearchResponse;
import org.elasticsearch.action.support.IgnoreIndices; import org.elasticsearch.action.support.IgnoreIndices;
import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
public class IgnoreIndicesTests extends AbstractSharedClusterTest { public class IgnoreIndicesTests extends AbstractIntegrationTest {
@Test @Test

View File

@ -25,18 +25,17 @@ import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequestBuilder;
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse; import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
/** /**
* *
*/ */
public class AnalyzeActionTests extends AbstractSharedClusterTest { public class AnalyzeActionTests extends AbstractIntegrationTest {
@Test @Test
public void simpleAnalyzerTests() throws Exception { public void simpleAnalyzerTests() throws Exception {

View File

@ -25,10 +25,9 @@ import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.indices.analysis.HunspellService; import org.elasticsearch.indices.analysis.HunspellService;
import org.elasticsearch.node.Node; import org.elasticsearch.test.AbstractIntegrationTest;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.test.AbstractIntegrationTest.ClusterScope;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractIntegrationTest.Scope;
import org.junit.After;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
@ -37,13 +36,8 @@ import static org.hamcrest.Matchers.notNullValue;
/** /**
* *
*/ */
public class HunspellServiceTests extends AbstractNodesTests { @ClusterScope(scope=Scope.TEST, numNodes=0)
public class HunspellServiceTests extends AbstractIntegrationTest {
@After
public void closeNodes() {
closeAllNodes();
}
@Test @Test
public void testLocaleDirectoryWithNodeLevelConfig() throws Exception { public void testLocaleDirectoryWithNodeLevelConfig() throws Exception {
@ -53,9 +47,8 @@ public class HunspellServiceTests extends AbstractNodesTests {
.put("indices.analysis.hunspell.dictionary.ignore_case", true) .put("indices.analysis.hunspell.dictionary.ignore_case", true)
.build(); .build();
Node node = startNode("node1", settings); cluster().startNode(settings);
HunspellDictionary dictionary = cluster().getInstance(HunspellService.class).getDictionary("en_US");
HunspellDictionary dictionary = ((InternalNode) node).injector().getInstance(HunspellService.class).getDictionary("en_US");
assertThat(dictionary, notNullValue()); assertThat(dictionary, notNullValue());
Version expectedVersion = Lucene.parseVersion(settings.get("indices.analysis.hunspell.version"), Lucene.ANALYZER_VERSION, logger); Version expectedVersion = Lucene.parseVersion(settings.get("indices.analysis.hunspell.version"), Lucene.ANALYZER_VERSION, logger);
assertThat(dictionary.getVersion(), equalTo(expectedVersion)); assertThat(dictionary.getVersion(), equalTo(expectedVersion));
@ -72,9 +65,8 @@ public class HunspellServiceTests extends AbstractNodesTests {
.put("indices.analysis.hunspell.dictionary.en_US.ignore_case", false) .put("indices.analysis.hunspell.dictionary.en_US.ignore_case", false)
.build(); .build();
Node node = startNode("node1", settings); cluster().startNode(settings);
HunspellDictionary dictionary = cluster().getInstance(HunspellService.class).getDictionary("en_US");
HunspellDictionary dictionary = ((InternalNode) node).injector().getInstance(HunspellService.class).getDictionary("en_US");
assertThat(dictionary, notNullValue()); assertThat(dictionary, notNullValue());
Version expectedVersion = Lucene.parseVersion(settings.get("indices.analysis.hunspell.version"), Lucene.ANALYZER_VERSION, logger); Version expectedVersion = Lucene.parseVersion(settings.get("indices.analysis.hunspell.version"), Lucene.ANALYZER_VERSION, logger);
assertThat(dictionary.getVersion(), equalTo(expectedVersion)); assertThat(dictionary.getVersion(), equalTo(expectedVersion));
@ -82,7 +74,7 @@ public class HunspellServiceTests extends AbstractNodesTests {
// testing that dictionary specific settings override node level settings // 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, notNullValue());
assertThat(dictionary.getVersion(), equalTo(expectedVersion)); assertThat(dictionary.getVersion(), equalTo(expectedVersion));
assertThat(dictionary.isIgnoreCase(), equalTo(true)); 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")) .put("indices.analysis.hunspell.dictionary.location", getResource("/indices/analyze/conf_dir/hunspell"))
.build(); .build();
Node node = startNode("node1", settings); cluster().startNode(settings);
HunspellDictionary dictionary = cluster().getInstance(HunspellService.class).getDictionary("en_US");
HunspellDictionary dictionary = ((InternalNode) node).injector().getInstance(HunspellService.class).getDictionary("en_US");
assertThat(dictionary, notNullValue()); assertThat(dictionary, notNullValue());
} }

View File

@ -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.CommonStatsFlags;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.query.FilterBuilders; import org.elasticsearch.index.query.FilterBuilders;
import org.elasticsearch.search.sort.SortOrder; 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 org.junit.Test;
import static org.elasticsearch.index.query.QueryBuilders.filteredQuery; import static org.elasticsearch.index.query.QueryBuilders.filteredQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
/** /**
*/ */
public class CacheTests extends AbstractNodesTests { @ClusterScope(scope=Scope.SUITE, numNodes=1)
public class CacheTests extends AbstractIntegrationTest {
@Override @Override
protected void beforeClass() throws Exception { 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 //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")); return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("indices.cache.filter.clean_interval", "1ms").build();
}
@Override
public Client client() {
return client("node1");
} }
@Test @Test

View File

@ -24,15 +24,13 @@ import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse;
import org.elasticsearch.action.support.IgnoreIndices; import org.elasticsearch.action.support.IgnoreIndices;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.fail;
public class TypesExistsTests extends AbstractSharedClusterTest { public class TypesExistsTests extends AbstractIntegrationTest {
@Test @Test
public void testSimple() throws Exception { public void testSimple() throws Exception {

View File

@ -29,7 +29,7 @@ import org.elasticsearch.index.shard.service.IndexShard;
import org.elasticsearch.indices.IndicesService; import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
import org.elasticsearch.node.internal.InternalNode; import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.AbstractNodesTests; import org.elasticsearch.test.AbstractNodesTests;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;

View File

@ -25,7 +25,7 @@ import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.index.query.MatchQueryBuilder; import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.SearchHits;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import java.util.HashMap; import java.util.HashMap;
@ -37,7 +37,7 @@ import java.util.concurrent.CountDownLatch;
import static org.hamcrest.Matchers.emptyIterable; import static org.hamcrest.Matchers.emptyIterable;
public class ConcurrentDynamicTemplateTests extends AbstractSharedClusterTest { public class ConcurrentDynamicTemplateTests extends AbstractIntegrationTest {
private final String mappingType = "test-mapping"; private final String mappingType = "test-mapping";

View File

@ -19,10 +19,10 @@
package org.elasticsearch.indices.mapping; package org.elasticsearch.indices.mapping;
import org.elasticsearch.AbstractSharedClusterTest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.action.count.CountResponse;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 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 @Test
public void simpleDeleteMapping() throws Exception { public void simpleDeleteMapping() throws Exception {

View File

@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.AbstractSharedClusterTest; import org.elasticsearch.test.AbstractIntegrationTest;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 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 @Test
public void getMappingsWhereThereAreNone() { public void getMappingsWhereThereAreNone() {

Some files were not shown because too many files have changed in this diff Show More