Remove deprecated PutIndexTemplateRequestBuilder#setTemplate (#37151)

The method has been removed since 6.0, there is a direct replacement and it is
only used in tests still.
This commit is contained in:
Christoph Büscher 2019-01-07 10:41:04 +01:00 committed by GitHub
parent 2f4dafa69f
commit 12a105e5ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 14 deletions

View File

@ -27,7 +27,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -42,16 +41,6 @@ public class PutIndexTemplateRequestBuilder
super(client, action, new PutIndexTemplateRequest(name)); super(client, action, new PutIndexTemplateRequest(name));
} }
/**
* Sets the match expression that will be used to match on indices created.
*
* @deprecated Replaced by {@link #setPatterns(List)}
*/
@Deprecated
public PutIndexTemplateRequestBuilder setTemplate(String indexPattern) {
return setPatterns(Collections.singletonList(indexPattern));
}
/** /**
* Sets the match expression that will be used to match on indices created. * Sets the match expression that will be used to match on indices created.
*/ */

View File

@ -20,6 +20,7 @@
package org.elasticsearch.gateway; package org.elasticsearch.gateway;
import com.carrotsearch.hppc.cursors.ObjectCursor; import com.carrotsearch.hppc.cursors.ObjectCursor;
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
import org.elasticsearch.action.admin.indices.stats.IndexStats; import org.elasticsearch.action.admin.indices.stats.IndexStats;
import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.admin.indices.stats.ShardStats;
@ -374,7 +375,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase {
logger.info("--> add some metadata and additional template"); logger.info("--> add some metadata and additional template");
client().admin().indices().preparePutTemplate("template_1") client().admin().indices().preparePutTemplate("template_1")
.setTemplate("te*") .setPatterns(Collections.singletonList("te*"))
.setOrder(0) .setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties") .addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "text").field("store", true).endObject() .startObject("field1").field("type", "text").field("store", true).endObject()

View File

@ -91,7 +91,7 @@ public class PermissionPrecedenceTests extends SecurityIntegTestCase {
.filterWithHeader(Collections.singletonMap(UsernamePasswordToken.BASIC_AUTH_HEADER, .filterWithHeader(Collections.singletonMap(UsernamePasswordToken.BASIC_AUTH_HEADER,
basicAuthHeaderValue(transportClientUsername(), transportClientPassword()))) basicAuthHeaderValue(transportClientUsername(), transportClientPassword())))
.admin().indices().preparePutTemplate("template1") .admin().indices().preparePutTemplate("template1")
.setTemplate("test_*") .setPatterns(Collections.singletonList("test_*"))
.get(); .get();
assertAcked(putResponse); assertAcked(putResponse);
@ -105,7 +105,7 @@ public class PermissionPrecedenceTests extends SecurityIntegTestCase {
Map<String, String> auth = Collections.singletonMap(UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue("user", Map<String, String> auth = Collections.singletonMap(UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue("user",
transportClientPassword())); transportClientPassword()));
assertThrowsAuthorizationException(client.filterWithHeader(auth).admin().indices().preparePutTemplate("template1") assertThrowsAuthorizationException(client.filterWithHeader(auth).admin().indices().preparePutTemplate("template1")
.setTemplate("test_*")::get, PutIndexTemplateAction.NAME, "user"); .setPatterns(Collections.singletonList("test_*"))::get, PutIndexTemplateAction.NAME, "user");
Map<String, String> headers = Collections.singletonMap(UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue("user", Map<String, String> headers = Collections.singletonMap(UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue("user",
new SecureString("test123"))); new SecureString("test123")));