[HLRC] AcknowledgedResponse should not extend from ToXContentObject (#35372)
AcknowledgedResponse only needs to know how to parse xcontent to an AcknowledgedResponse instance. There is no need to serialize an AcknowledgedResponse instance to xcontent on the HLRC side.
This commit is contained in:
parent
87a8b99724
commit
253c2fcc6a
|
@ -20,8 +20,8 @@
|
|||
package org.elasticsearch.client;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.client.core.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.rollup.DeleteRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.DeleteRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.GetRollupIndexCapsRequest;
|
||||
import org.elasticsearch.client.rollup.GetRollupIndexCapsResponse;
|
||||
import org.elasticsearch.client.rollup.GetRollupJobRequest;
|
||||
|
@ -31,7 +31,6 @@ import org.elasticsearch.client.rollup.GetRollupCapsResponse;
|
|||
import org.elasticsearch.client.rollup.GetRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.GetRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.PutRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.PutRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.StartRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.StartRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.StopRollupJobRequest;
|
||||
|
@ -64,11 +63,11 @@ public class RollupClient {
|
|||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public PutRollupJobResponse putRollupJob(PutRollupJobRequest request, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse putRollupJob(PutRollupJobRequest request, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(request,
|
||||
RollupRequestConverters::putJob,
|
||||
options,
|
||||
PutRollupJobResponse::fromXContent,
|
||||
AcknowledgedResponse::fromXContent,
|
||||
Collections.emptySet());
|
||||
}
|
||||
|
||||
|
@ -80,11 +79,11 @@ public class RollupClient {
|
|||
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void putRollupJobAsync(PutRollupJobRequest request, RequestOptions options, ActionListener<PutRollupJobResponse> listener) {
|
||||
public void putRollupJobAsync(PutRollupJobRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(request,
|
||||
RollupRequestConverters::putJob,
|
||||
options,
|
||||
PutRollupJobResponse::fromXContent,
|
||||
AcknowledgedResponse::fromXContent,
|
||||
listener, Collections.emptySet());
|
||||
}
|
||||
|
||||
|
@ -165,11 +164,11 @@ public class RollupClient {
|
|||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public DeleteRollupJobResponse deleteRollupJob(DeleteRollupJobRequest request, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse deleteRollupJob(DeleteRollupJobRequest request, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(request,
|
||||
RollupRequestConverters::deleteJob,
|
||||
options,
|
||||
DeleteRollupJobResponse::fromXContent,
|
||||
AcknowledgedResponse::fromXContent,
|
||||
Collections.emptySet());
|
||||
}
|
||||
/**
|
||||
|
@ -182,11 +181,11 @@ public class RollupClient {
|
|||
*/
|
||||
public void deleteRollupJobAsync(DeleteRollupJobRequest request,
|
||||
RequestOptions options,
|
||||
ActionListener<DeleteRollupJobResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(request,
|
||||
RollupRequestConverters::deleteJob,
|
||||
options,
|
||||
DeleteRollupJobResponse::fromXContent,
|
||||
AcknowledgedResponse::fromXContent,
|
||||
listener, Collections.emptySet());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,6 @@ package org.elasticsearch.client.core;
|
|||
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -32,7 +29,7 @@ import java.util.function.Function;
|
|||
|
||||
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
|
||||
|
||||
public class AcknowledgedResponse implements ToXContentObject {
|
||||
public class AcknowledgedResponse {
|
||||
|
||||
protected static final String PARSE_FIELD_NAME = "acknowledged";
|
||||
private static final ConstructingObjectParser<AcknowledgedResponse, Void> PARSER = AcknowledgedResponse
|
||||
|
@ -75,16 +72,6 @@ public class AcknowledgedResponse implements ToXContentObject {
|
|||
return Objects.hash(acknowledged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
|
||||
builder.startObject();
|
||||
{
|
||||
builder.field(getFieldName(), isAcknowledged());
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the field name this response uses to output the acknowledged flag
|
||||
*/
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.client.rollup;
|
||||
|
||||
import org.elasticsearch.client.core.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DeleteRollupJobResponse extends AcknowledgedResponse {
|
||||
|
||||
public DeleteRollupJobResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
private static final ConstructingObjectParser<DeleteRollupJobResponse, Void> PARSER = AcknowledgedResponse
|
||||
.generateParser("delete_rollup_job_response", DeleteRollupJobResponse::new, AcknowledgedResponse.PARSE_FIELD_NAME);
|
||||
|
||||
public static DeleteRollupJobResponse fromXContent(final XContentParser parser) throws IOException {
|
||||
return PARSER.parse(parser, null);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.client.rollup;
|
||||
|
||||
import org.elasticsearch.client.core.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PutRollupJobResponse extends AcknowledgedResponse {
|
||||
|
||||
public PutRollupJobResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
private static final ConstructingObjectParser<PutRollupJobResponse, Void> PARSER = AcknowledgedResponse
|
||||
.generateParser("delete_rollup_job_response", PutRollupJobResponse::new, AcknowledgedResponse.PARSE_FIELD_NAME);
|
||||
|
||||
public static PutRollupJobResponse fromXContent(final XContentParser parser) throws IOException {
|
||||
return PARSER.parse(parser, null);
|
||||
}
|
||||
}
|
|
@ -29,8 +29,8 @@ import org.elasticsearch.action.index.IndexRequest;
|
|||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.client.core.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.rollup.DeleteRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.DeleteRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.GetRollupCapsRequest;
|
||||
import org.elasticsearch.client.rollup.GetRollupCapsResponse;
|
||||
import org.elasticsearch.client.rollup.GetRollupIndexCapsRequest;
|
||||
|
@ -40,11 +40,10 @@ import org.elasticsearch.client.rollup.GetRollupJobResponse;
|
|||
import org.elasticsearch.client.rollup.GetRollupJobResponse.IndexerState;
|
||||
import org.elasticsearch.client.rollup.GetRollupJobResponse.JobWrapper;
|
||||
import org.elasticsearch.client.rollup.PutRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.PutRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.RollableIndexCaps;
|
||||
import org.elasticsearch.client.rollup.RollupJobCaps;
|
||||
import org.elasticsearch.client.rollup.StartRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.StartRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.RollableIndexCaps;
|
||||
import org.elasticsearch.client.rollup.RollupJobCaps;
|
||||
import org.elasticsearch.client.rollup.StopRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.StopRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.job.config.DateHistogramGroupConfig;
|
||||
|
@ -158,7 +157,7 @@ public class RollupIT extends ESRestHighLevelClientTestCase {
|
|||
final RollupClient rollupClient = highLevelClient().rollup();
|
||||
execute(putRollupJobRequest, rollupClient::putRollupJob, rollupClient::putRollupJobAsync);
|
||||
DeleteRollupJobRequest deleteRollupJobRequest = new DeleteRollupJobRequest(id);
|
||||
DeleteRollupJobResponse deleteRollupJobResponse = highLevelClient().rollup()
|
||||
AcknowledgedResponse deleteRollupJobResponse = highLevelClient().rollup()
|
||||
.deleteRollupJob(deleteRollupJobRequest, RequestOptions.DEFAULT);
|
||||
assertTrue(deleteRollupJobResponse.isAcknowledged());
|
||||
}
|
||||
|
@ -180,7 +179,7 @@ public class RollupIT extends ESRestHighLevelClientTestCase {
|
|||
new PutRollupJobRequest(new RollupJobConfig(id, indexPattern, rollupIndex, cron, pageSize, groups, metrics, timeout));
|
||||
|
||||
final RollupClient rollupClient = highLevelClient().rollup();
|
||||
PutRollupJobResponse response = execute(putRollupJobRequest, rollupClient::putRollupJob, rollupClient::putRollupJobAsync);
|
||||
AcknowledgedResponse response = execute(putRollupJobRequest, rollupClient::putRollupJob, rollupClient::putRollupJobAsync);
|
||||
assertTrue(response.isAcknowledged());
|
||||
|
||||
StartRollupJobRequest startRequest = new StartRollupJobRequest(id);
|
||||
|
@ -313,7 +312,7 @@ public class RollupIT extends ESRestHighLevelClientTestCase {
|
|||
new PutRollupJobRequest(new RollupJobConfig(id, indexPattern, rollupIndex, cron, pageSize, groups, metrics, timeout));
|
||||
|
||||
final RollupClient rollupClient = highLevelClient().rollup();
|
||||
PutRollupJobResponse response = execute(putRollupJobRequest, rollupClient::putRollupJob, rollupClient::putRollupJobAsync);
|
||||
AcknowledgedResponse response = execute(putRollupJobRequest, rollupClient::putRollupJob, rollupClient::putRollupJobAsync);
|
||||
assertTrue(response.isAcknowledged());
|
||||
|
||||
// wait for the PutJob api to create the index w/ metadata
|
||||
|
@ -425,7 +424,7 @@ public class RollupIT extends ESRestHighLevelClientTestCase {
|
|||
new PutRollupJobRequest(new RollupJobConfig(id, indexPattern, rollupIndex, cron, pageSize, groups, metrics, timeout));
|
||||
|
||||
final RollupClient rollupClient = highLevelClient().rollup();
|
||||
PutRollupJobResponse response = execute(putRollupJobRequest, rollupClient::putRollupJob, rollupClient::putRollupJobAsync);
|
||||
AcknowledgedResponse response = execute(putRollupJobRequest, rollupClient::putRollupJob, rollupClient::putRollupJobAsync);
|
||||
assertTrue(response.isAcknowledged());
|
||||
|
||||
// wait for the PutJob api to create the index w/ metadata
|
||||
|
|
|
@ -18,26 +18,33 @@
|
|||
*/
|
||||
package org.elasticsearch.client.core;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.AbstractXContentTestCase;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AcknowledgedResponseTests extends AbstractXContentTestCase<AcknowledgedResponse> {
|
||||
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester;
|
||||
|
||||
@Override
|
||||
protected AcknowledgedResponse createTestInstance() {
|
||||
public class AcknowledgedResponseTests extends ESTestCase {
|
||||
|
||||
public void testFromXContent() throws IOException {
|
||||
xContentTester(this::createParser,
|
||||
this::createTestInstance,
|
||||
AcknowledgedResponseTests::toXContent,
|
||||
AcknowledgedResponse::fromXContent)
|
||||
.supportsUnknownFields(false)
|
||||
.test();
|
||||
}
|
||||
private AcknowledgedResponse createTestInstance() {
|
||||
return new AcknowledgedResponse(randomBoolean());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AcknowledgedResponse doParseInstance(XContentParser parser) throws IOException {
|
||||
return AcknowledgedResponse.fromXContent(parser);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
public static void toXContent(AcknowledgedResponse response, XContentBuilder builder) throws IOException {
|
||||
builder.startObject();
|
||||
{
|
||||
builder.field(response.getFieldName(), response.isAcknowledged());
|
||||
}
|
||||
builder.endObject();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ import org.elasticsearch.client.ESRestHighLevelClientTestCase;
|
|||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.client.RollupClient;
|
||||
import org.elasticsearch.client.core.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.rollup.DeleteRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.DeleteRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.GetRollupCapsRequest;
|
||||
import org.elasticsearch.client.rollup.GetRollupCapsResponse;
|
||||
import org.elasticsearch.client.rollup.GetRollupIndexCapsRequest;
|
||||
|
@ -44,7 +44,6 @@ import org.elasticsearch.client.rollup.GetRollupJobResponse.JobWrapper;
|
|||
import org.elasticsearch.client.rollup.GetRollupJobResponse.RollupIndexerJobStats;
|
||||
import org.elasticsearch.client.rollup.GetRollupJobResponse.RollupJobStatus;
|
||||
import org.elasticsearch.client.rollup.PutRollupJobRequest;
|
||||
import org.elasticsearch.client.rollup.PutRollupJobResponse;
|
||||
import org.elasticsearch.client.rollup.RollableIndexCaps;
|
||||
import org.elasticsearch.client.rollup.RollupJobCaps;
|
||||
import org.elasticsearch.client.rollup.StartRollupJobRequest;
|
||||
|
@ -148,7 +147,7 @@ public class RollupDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
//end::x-pack-rollup-put-rollup-job-request
|
||||
|
||||
//tag::x-pack-rollup-put-rollup-job-execute
|
||||
PutRollupJobResponse response = client.rollup().putRollupJob(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.rollup().putRollupJob(request, RequestOptions.DEFAULT);
|
||||
//end::x-pack-rollup-put-rollup-job-execute
|
||||
|
||||
//tag::x-pack-rollup-put-rollup-job-response
|
||||
|
@ -161,9 +160,9 @@ public class RollupDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
RollupJobConfig config = new RollupJobConfig(id, indexPattern, rollupIndex, cron, pageSize, groups, metrics, timeout);
|
||||
PutRollupJobRequest request = new PutRollupJobRequest(config);
|
||||
// tag::x-pack-rollup-put-rollup-job-execute-listener
|
||||
ActionListener<PutRollupJobResponse> listener = new ActionListener<PutRollupJobResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener = new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutRollupJobResponse response) {
|
||||
public void onResponse(AcknowledgedResponse response) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
|
@ -356,7 +355,7 @@ public class RollupDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
pageSize, groups, metrics, timeout);
|
||||
|
||||
PutRollupJobRequest request = new PutRollupJobRequest(config);
|
||||
PutRollupJobResponse response = client.rollup().putRollupJob(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.rollup().putRollupJob(request, RequestOptions.DEFAULT);
|
||||
|
||||
boolean acknowledged = response.isAcknowledged();
|
||||
//end::x-pack-rollup-get-rollup-caps-setup
|
||||
|
@ -472,7 +471,7 @@ public class RollupDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
pageSize, groups, metrics, timeout);
|
||||
|
||||
PutRollupJobRequest request = new PutRollupJobRequest(config);
|
||||
PutRollupJobResponse response = client.rollup().putRollupJob(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.rollup().putRollupJob(request, RequestOptions.DEFAULT);
|
||||
|
||||
boolean acknowledged = response.isAcknowledged();
|
||||
//end::x-pack-rollup-get-rollup-index-caps-setup
|
||||
|
@ -572,7 +571,7 @@ public class RollupDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
// end::rollup-delete-job-request
|
||||
try {
|
||||
// tag::rollup-delete-job-execute
|
||||
DeleteRollupJobResponse response = client.rollup().deleteRollupJob(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.rollup().deleteRollupJob(request, RequestOptions.DEFAULT);
|
||||
// end::rollup-delete-job-execute
|
||||
|
||||
// tag::rollup-delete-job-response
|
||||
|
@ -583,9 +582,9 @@ public class RollupDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
}
|
||||
|
||||
// tag::rollup-delete-job-execute-listener
|
||||
ActionListener<DeleteRollupJobResponse> listener = new ActionListener<DeleteRollupJobResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener = new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteRollupJobResponse response) {
|
||||
public void onResponse(AcknowledgedResponse response) {
|
||||
boolean acknowledged = response.isAcknowledged(); // <1>
|
||||
}
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.client.rollup;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.AbstractXContentTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DeleteRollupJobResponseTests extends AbstractXContentTestCase<DeleteRollupJobResponse> {
|
||||
|
||||
private boolean acknowledged;
|
||||
|
||||
@Before
|
||||
public void setupJobID() {
|
||||
acknowledged = randomBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteRollupJobResponse createTestInstance() {
|
||||
return new DeleteRollupJobResponse(acknowledged);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteRollupJobResponse doParseInstance(XContentParser parser) throws IOException {
|
||||
return DeleteRollupJobResponse.fromXContent(parser);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.client.rollup;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.AbstractXContentTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PutRollupJobResponseTests extends AbstractXContentTestCase<PutRollupJobResponse> {
|
||||
|
||||
private boolean acknowledged;
|
||||
|
||||
@Before
|
||||
public void setupJobID() {
|
||||
acknowledged = randomBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PutRollupJobResponse createTestInstance() {
|
||||
return new PutRollupJobResponse(acknowledged);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PutRollupJobResponse doParseInstance(XContentParser parser) throws IOException {
|
||||
return PutRollupJobResponse.fromXContent(parser);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -18,34 +18,25 @@
|
|||
*/
|
||||
package org.elasticsearch.client.rollup;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.AbstractXContentTestCase;
|
||||
import org.junit.Before;
|
||||
import org.elasticsearch.client.core.AcknowledgedResponseTests;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class StartRollupJobResponseTests extends AbstractXContentTestCase<StartRollupJobResponse> {
|
||||
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester;
|
||||
|
||||
private boolean acknowledged;
|
||||
public class StartRollupJobResponseTests extends ESTestCase {
|
||||
|
||||
@Before
|
||||
public void setupAcknoledged() {
|
||||
acknowledged = randomBoolean();
|
||||
public void testFromXContent() throws IOException {
|
||||
xContentTester(this::createParser,
|
||||
this::createTestInstance,
|
||||
AcknowledgedResponseTests::toXContent,
|
||||
StartRollupJobResponse::fromXContent)
|
||||
.supportsUnknownFields(false)
|
||||
.test();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StartRollupJobResponse createTestInstance() {
|
||||
return new StartRollupJobResponse(acknowledged);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StartRollupJobResponse doParseInstance(XContentParser parser) throws IOException {
|
||||
return StartRollupJobResponse.fromXContent(parser);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
private StartRollupJobResponse createTestInstance() {
|
||||
return new StartRollupJobResponse(randomBoolean());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,34 +18,25 @@
|
|||
*/
|
||||
package org.elasticsearch.client.rollup;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.AbstractXContentTestCase;
|
||||
import org.junit.Before;
|
||||
import org.elasticsearch.client.core.AcknowledgedResponseTests;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class StopRollupJobResponseTests extends AbstractXContentTestCase<StopRollupJobResponse> {
|
||||
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester;
|
||||
|
||||
private boolean acknowledged;
|
||||
public class StopRollupJobResponseTests extends ESTestCase {
|
||||
|
||||
@Before
|
||||
public void setupAcknoledged() {
|
||||
acknowledged = randomBoolean();
|
||||
public void testFromXContent() throws IOException {
|
||||
xContentTester(this::createParser,
|
||||
this::createTestInstance,
|
||||
AcknowledgedResponseTests::toXContent,
|
||||
StopRollupJobResponse::fromXContent)
|
||||
.supportsUnknownFields(false)
|
||||
.test();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StopRollupJobResponse createTestInstance() {
|
||||
return new StopRollupJobResponse(acknowledged);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StopRollupJobResponse doParseInstance(XContentParser parser) throws IOException {
|
||||
return StopRollupJobResponse.fromXContent(parser);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
private StopRollupJobResponse createTestInstance() {
|
||||
return new StopRollupJobResponse(randomBoolean());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue