summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/ESExceptionTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/java/org/elasticsearch/ESExceptionTests.java')
-rw-r--r--core/src/test/java/org/elasticsearch/ESExceptionTests.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/core/src/test/java/org/elasticsearch/ESExceptionTests.java b/core/src/test/java/org/elasticsearch/ESExceptionTests.java
index a547e18de5..aef38850ef 100644
--- a/core/src/test/java/org/elasticsearch/ESExceptionTests.java
+++ b/core/src/test/java/org/elasticsearch/ESExceptionTests.java
@@ -85,9 +85,9 @@ public class ESExceptionTests extends ESTestCase {
assertEquals(ElasticsearchException.getExceptionName(rootCauses[0]), "index_not_found_exception");
assertEquals(rootCauses[0].getMessage(), "no such index");
ShardSearchFailure failure = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 1));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 1));
ShardSearchFailure failure1 = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 2));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 2));
SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed", new ShardSearchFailure[]{failure, failure1});
if (randomBoolean()) {
rootCauses = (randomBoolean() ? new RemoteTransportException("remoteboom", ex) : ex).guessRootCauses();
@@ -105,11 +105,11 @@ public class ESExceptionTests extends ESTestCase {
{
ShardSearchFailure failure = new ShardSearchFailure(
new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 1));
- ShardSearchFailure failure1 = new ShardSearchFailure(new QueryShardException(new Index("foo1"), "foobar", null),
- new SearchShardTarget("node_1", "foo1", 1));
- ShardSearchFailure failure2 = new ShardSearchFailure(new QueryShardException(new Index("foo1"), "foobar", null),
- new SearchShardTarget("node_1", "foo1", 2));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 1));
+ ShardSearchFailure failure1 = new ShardSearchFailure(new QueryShardException(new Index("foo1", "_na_"), "foobar", null),
+ new SearchShardTarget("node_1", new Index("foo1", "_na_"), 1));
+ ShardSearchFailure failure2 = new ShardSearchFailure(new QueryShardException(new Index("foo1", "_na_"), "foobar", null),
+ new SearchShardTarget("node_1", new Index("foo1", "_na_"), 2));
SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed", new ShardSearchFailure[]{failure, failure1, failure2});
final ElasticsearchException[] rootCauses = ex.guessRootCauses();
assertEquals(rootCauses.length, 2);
@@ -118,7 +118,7 @@ public class ESExceptionTests extends ESTestCase {
assertEquals(((ParsingException) rootCauses[0]).getLineNumber(), 1);
assertEquals(((ParsingException) rootCauses[0]).getColumnNumber(), 2);
assertEquals(ElasticsearchException.getExceptionName(rootCauses[1]), "query_shard_exception");
- assertEquals((rootCauses[1]).getIndex(), "foo1");
+ assertEquals((rootCauses[1]).getIndex().getName(), "foo1");
assertEquals(rootCauses[1].getMessage(), "foobar");
}
@@ -136,9 +136,9 @@ public class ESExceptionTests extends ESTestCase {
public void testDeduplicate() throws IOException {
{
ShardSearchFailure failure = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 1));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 1));
ShardSearchFailure failure1 = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 2));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 2));
SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed", randomBoolean() ? failure1.getCause() : failure.getCause(), new ShardSearchFailure[]{failure, failure1});
XContentBuilder builder = XContentFactory.jsonBuilder();
builder.startObject();
@@ -149,24 +149,24 @@ public class ESExceptionTests extends ESTestCase {
}
{
ShardSearchFailure failure = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 1));
- ShardSearchFailure failure1 = new ShardSearchFailure(new QueryShardException(new Index("foo1"), "foobar", null),
- new SearchShardTarget("node_1", "foo1", 1));
- ShardSearchFailure failure2 = new ShardSearchFailure(new QueryShardException(new Index("foo1"), "foobar", null),
- new SearchShardTarget("node_1", "foo1", 2));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 1));
+ ShardSearchFailure failure1 = new ShardSearchFailure(new QueryShardException(new Index("foo1", "_na_"), "foobar", null),
+ new SearchShardTarget("node_1", new Index("foo1", "_na_"), 1));
+ ShardSearchFailure failure2 = new ShardSearchFailure(new QueryShardException(new Index("foo1", "_na_"), "foobar", null),
+ new SearchShardTarget("node_1", new Index("foo1", "_na_"), 2));
SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed", new ShardSearchFailure[]{failure, failure1, failure2});
XContentBuilder builder = XContentFactory.jsonBuilder();
builder.startObject();
ex.toXContent(builder, PARAMS);
builder.endObject();
- String expected = "{\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"search\",\"grouped\":true,\"failed_shards\":[{\"shard\":1,\"index\":\"foo\",\"node\":\"node_1\",\"reason\":{\"type\":\"parsing_exception\",\"reason\":\"foobar\",\"line\":1,\"col\":2}},{\"shard\":1,\"index\":\"foo1\",\"node\":\"node_1\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"foobar\",\"index\":\"foo1\"}}]}";
+ String expected = "{\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"search\",\"grouped\":true,\"failed_shards\":[{\"shard\":1,\"index\":\"foo\",\"node\":\"node_1\",\"reason\":{\"type\":\"parsing_exception\",\"reason\":\"foobar\",\"line\":1,\"col\":2}},{\"shard\":1,\"index\":\"foo1\",\"node\":\"node_1\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"foobar\",\"index_uuid\":\"_na_\",\"index\":\"foo1\"}}]}";
assertEquals(expected, builder.string());
}
{
ShardSearchFailure failure = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 1));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 1));
ShardSearchFailure failure1 = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
- new SearchShardTarget("node_1", "foo", 2));
+ new SearchShardTarget("node_1", new Index("foo", "_na_"), 2));
NullPointerException nullPointerException = new NullPointerException();
SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed", nullPointerException, new ShardSearchFailure[]{failure, failure1});
assertEquals(nullPointerException, ex.getCause());
@@ -320,7 +320,7 @@ public class ESExceptionTests extends ESTestCase {
new OutOfMemoryError("no memory left"),
new AlreadyClosedException("closed!!", new NullPointerException()),
new LockObtainFailedException("can't lock directory", new NullPointerException()),
- new Throwable("this exception is unknown", new QueryShardException(new Index("foo"), "foobar", null) ), // somethin unknown
+ new Throwable("this exception is unknown", new QueryShardException(new Index("foo", "_na_"), "foobar", null) ), // somethin unknown
};
for (Throwable t : causes) {
BytesStreamOutput out = new BytesStreamOutput();