From cb62d81bdc443ad2af19e91bbea24b70da263bad Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 9 Jun 2017 14:57:48 -0400 Subject: [PATCH] Fix compilation for CreateIndexResponse The constructor for CreateIndexResponse changed to include the index name. This commit adapts x-pack-elasticsearch to this change. Original commit: elastic/x-pack-elasticsearch@b078d80cd9c1fc6632178a56dc7057b4cedf229f --- .../xpack/ml/job/persistence/JobProviderTests.java | 4 ++-- .../xpack/ml/job/persistence/MockClientBuilder.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java index c916d6ef359..58a9384a167 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobProviderTests.java @@ -85,7 +85,7 @@ public class JobProviderTests extends ESTestCase { MockClientBuilder clientBuilder = new MockClientBuilder(CLUSTER_NAME); ArgumentCaptor captor = ArgumentCaptor.forClass(CreateIndexRequest.class); - clientBuilder.createIndexRequest(captor); + clientBuilder.createIndexRequest(captor, resultsIndexName); clientBuilder.prepareAlias(resultsIndexName, AnomalyDetectorsIndex.jobResultsAliasedName("foo"), jobFilter); clientBuilder.prepareAlias(resultsIndexName, AnomalyDetectorsIndex.resultsWriteAlias("foo")); @@ -196,7 +196,7 @@ public class JobProviderTests extends ESTestCase { MockClientBuilder clientBuilder = new MockClientBuilder(CLUSTER_NAME); ArgumentCaptor captor = ArgumentCaptor.forClass(CreateIndexRequest.class); - clientBuilder.createIndexRequest(captor); + clientBuilder.createIndexRequest(captor, indexName); clientBuilder.prepareAlias(indexName, readAliasName, jobFilter); clientBuilder.prepareAlias(indexName, writeAliasName); clientBuilder.preparePutMapping(mock(PutMappingResponse.class), Result.TYPE.getPreferredName()); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java index 5b370913e06..a689adfcca3 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java @@ -173,10 +173,10 @@ public class MockClientBuilder { } @SuppressWarnings({ "rawtypes", "unchecked" }) - public MockClientBuilder createIndexRequest(ArgumentCaptor requestCapture) { + public MockClientBuilder createIndexRequest(ArgumentCaptor requestCapture, final String index) { doAnswer(invocation -> { - CreateIndexResponse response = new CreateIndexResponse(true, true) {}; + CreateIndexResponse response = new CreateIndexResponse(true, true, index) {}; ((ActionListener) invocation.getArguments()[1]).onResponse(response); return null; }).when(indicesAdminClient).create(requestCapture.capture(), any(ActionListener.class));