From ae3eb15caaaf61f3c0b627aad1bc22fcd71ec04e Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Wed, 8 Jun 2016 15:03:35 -0400 Subject: [PATCH] fix rest tests --- .../indices/rollover/RolloverRequest.java | 24 +++++------ .../rollover/RolloverRequestBuilder.java | 4 +- .../rollover/TransportRolloverAction.java | 8 ++-- .../client/support/AbstractClient.java | 4 +- .../indices/RestRolloverIndexAction.java | 10 ++--- .../rest-api-spec/api/indices.rollover.json | 8 ++-- .../test/indices.rollover/10_basic.yaml | 41 +++++++++++-------- 7 files changed, 52 insertions(+), 47 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java b/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java index 19659171a67..a16a6db83ca 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequest.java @@ -50,7 +50,7 @@ import static org.elasticsearch.action.ValidateActions.addValidationError; */ public class RolloverRequest extends AcknowledgedRequest implements IndicesRequest { - private String sourceAlias; + private String alias; private boolean simulate; private Set conditions = new HashSet<>(2); private CreateIndexRequest createIndexRequest = new CreateIndexRequest("_na_"); @@ -77,15 +77,15 @@ public class RolloverRequest extends AcknowledgedRequest implem RolloverRequest() {} - public RolloverRequest(String sourceAlias) { - this.sourceAlias = sourceAlias; + public RolloverRequest(String alias) { + this.alias = alias; } @Override public ActionRequestValidationException validate() { ActionRequestValidationException validationException = createIndexRequest == null ? null : createIndexRequest.validate(); - if (sourceAlias == null) { - validationException = addValidationError("source alias is missing", validationException); + if (alias == null) { + validationException = addValidationError("index alias is missing", validationException); } if (createIndexRequest == null) { validationException = addValidationError("create index request is missing", validationException); @@ -96,7 +96,7 @@ public class RolloverRequest extends AcknowledgedRequest implem @Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); - sourceAlias = in.readString(); + alias = in.readString(); simulate = in.readBoolean(); int size = in.readVInt(); for (int i = 0; i < size; i++) { @@ -109,7 +109,7 @@ public class RolloverRequest extends AcknowledgedRequest implem @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); - out.writeString(sourceAlias); + out.writeString(alias); out.writeBoolean(simulate); out.writeVInt(conditions.size()); for (Condition condition : conditions) { @@ -120,7 +120,7 @@ public class RolloverRequest extends AcknowledgedRequest implem @Override public String[] indices() { - return new String[] {sourceAlias}; + return new String[] {alias}; } @Override @@ -128,8 +128,8 @@ public class RolloverRequest extends AcknowledgedRequest implem return IndicesOptions.strictSingleIndexNoExpandForbidClosed(); } - public void setSourceAlias(String sourceAlias) { - this.sourceAlias = sourceAlias; + public void setAlias(String alias) { + this.alias = alias; } public void simulate(boolean simulate) { @@ -152,8 +152,8 @@ public class RolloverRequest extends AcknowledgedRequest implem return conditions; } - public String getSourceAlias() { - return sourceAlias; + public String getAlias() { + return alias; } public CreateIndexRequest getCreateIndexRequest() { diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java index bef680110ab..dd6e22dae70 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/rollover/RolloverRequestBuilder.java @@ -34,8 +34,8 @@ public class RolloverRequestBuilder extends MasterNodeOperationRequestBuilder listener) { final MetaData metaData = state.metaData(); validate(metaData, rolloverRequest); - final AliasOrIndex aliasOrIndex = metaData.getAliasAndIndexLookup().get(rolloverRequest.getSourceAlias()); + final AliasOrIndex aliasOrIndex = metaData.getAliasAndIndexLookup().get(rolloverRequest.getAlias()); final IndexMetaData indexMetaData = aliasOrIndex.getIndices().get(0); final String sourceIndexName = indexMetaData.getIndex().getName(); client.admin().indices().prepareStats(sourceIndexName).clear().setDocs(true).execute( @@ -173,8 +173,8 @@ public class TransportRolloverAction extends TransportMasterNodeAction