convert more request objects to writeable (elastic/x-pack-elasticsearch#2457)
* convert more to writeable * migrate streamable tests to writeable tests Original commit: elastic/x-pack-elasticsearch@56794e5760
This commit is contained in:
parent
3a9aad5ece
commit
5a090c14c1
|
@ -7,6 +7,9 @@ package org.elasticsearch.license;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionRequestValidationException;
|
import org.elasticsearch.action.ActionRequestValidationException;
|
||||||
import org.elasticsearch.action.support.master.MasterNodeReadRequest;
|
import org.elasticsearch.action.support.master.MasterNodeReadRequest;
|
||||||
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
public class GetLicenseRequest extends MasterNodeReadRequest<GetLicenseRequest> {
|
public class GetLicenseRequest extends MasterNodeReadRequest<GetLicenseRequest> {
|
||||||
|
@ -14,6 +17,10 @@ public class GetLicenseRequest extends MasterNodeReadRequest<GetLicenseRequest>
|
||||||
public GetLicenseRequest() {
|
public GetLicenseRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GetLicenseRequest(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionRequestValidationException validate() {
|
public ActionRequestValidationException validate() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -27,8 +27,8 @@ public class TransportGetLicenseAction extends TransportMasterNodeReadAction<Get
|
||||||
public TransportGetLicenseAction(Settings settings, TransportService transportService, ClusterService clusterService,
|
public TransportGetLicenseAction(Settings settings, TransportService transportService, ClusterService clusterService,
|
||||||
LicenseService licenseService, ThreadPool threadPool, ActionFilters actionFilters,
|
LicenseService licenseService, ThreadPool threadPool, ActionFilters actionFilters,
|
||||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||||
super(settings, GetLicenseAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver,
|
super(settings, GetLicenseAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
GetLicenseRequest::new);
|
GetLicenseRequest::new, indexNameExpressionResolver);
|
||||||
this.licenseService = licenseService;
|
this.licenseService = licenseService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,17 @@ public class DeprecationInfoAction extends Action<DeprecationInfoAction.Request,
|
||||||
this.indices = indices;
|
this.indices = indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Request(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
indices = in.readStringArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeStringArray(indices);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] indices() {
|
public String[] indices() {
|
||||||
return indices;
|
return indices;
|
||||||
|
@ -237,14 +248,7 @@ public class DeprecationInfoAction extends Action<DeprecationInfoAction.Request,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
indices = in.readStringArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeStringArray(indices);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -286,7 +290,7 @@ public class DeprecationInfoAction extends Action<DeprecationInfoAction.Request,
|
||||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||||
XPackLicenseState licenseState, InternalClient client) {
|
XPackLicenseState licenseState, InternalClient client) {
|
||||||
super(settings, DeprecationInfoAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
super(settings, DeprecationInfoAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
indexNameExpressionResolver, Request::new);
|
Request::new, indexNameExpressionResolver);
|
||||||
this.licenseState = licenseState;
|
this.licenseState = licenseState;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
||||||
|
|
|
@ -79,6 +79,23 @@ public class GetDatafeedsAction extends Action<GetDatafeedsAction.Request, GetDa
|
||||||
local(true);
|
local(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Request(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
datafeedId = in.readString();
|
||||||
|
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
|
||||||
|
allowNoDatafeeds = in.readBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(datafeedId);
|
||||||
|
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
|
||||||
|
out.writeBoolean(allowNoDatafeeds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getDatafeedId() {
|
public String getDatafeedId() {
|
||||||
return datafeedId;
|
return datafeedId;
|
||||||
}
|
}
|
||||||
|
@ -98,20 +115,7 @@ public class GetDatafeedsAction extends Action<GetDatafeedsAction.Request, GetDa
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
datafeedId = in.readString();
|
|
||||||
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
|
|
||||||
allowNoDatafeeds = in.readBoolean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(datafeedId);
|
|
||||||
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
|
|
||||||
out.writeBoolean(allowNoDatafeeds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -202,7 +206,7 @@ public class GetDatafeedsAction extends Action<GetDatafeedsAction.Request, GetDa
|
||||||
public TransportAction(Settings settings, TransportService transportService, ClusterService clusterService,
|
public TransportAction(Settings settings, TransportService transportService, ClusterService clusterService,
|
||||||
ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
|
ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||||
super(settings, GetDatafeedsAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
super(settings, GetDatafeedsAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
indexNameExpressionResolver, Request::new);
|
Request::new, indexNameExpressionResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -85,6 +85,23 @@ public class GetDatafeedsStatsAction extends Action<GetDatafeedsStatsAction.Requ
|
||||||
|
|
||||||
Request() {}
|
Request() {}
|
||||||
|
|
||||||
|
Request(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
datafeedId = in.readString();
|
||||||
|
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
|
||||||
|
allowNoDatafeeds = in.readBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(datafeedId);
|
||||||
|
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
|
||||||
|
out.writeBoolean(allowNoDatafeeds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getDatafeedId() {
|
public String getDatafeedId() {
|
||||||
return datafeedId;
|
return datafeedId;
|
||||||
}
|
}
|
||||||
|
@ -104,20 +121,7 @@ public class GetDatafeedsStatsAction extends Action<GetDatafeedsStatsAction.Requ
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
datafeedId = in.readString();
|
|
||||||
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
|
|
||||||
allowNoDatafeeds = in.readBoolean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(datafeedId);
|
|
||||||
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
|
|
||||||
out.writeBoolean(allowNoDatafeeds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -304,7 +308,7 @@ public class GetDatafeedsStatsAction extends Action<GetDatafeedsStatsAction.Requ
|
||||||
ThreadPool threadPool, ActionFilters actionFilters,
|
ThreadPool threadPool, ActionFilters actionFilters,
|
||||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||||
super(settings, GetDatafeedsStatsAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
super(settings, GetDatafeedsStatsAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
indexNameExpressionResolver, Request::new);
|
Request::new, indexNameExpressionResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -73,6 +73,23 @@ public class GetJobsAction extends Action<GetJobsAction.Request, GetJobsAction.R
|
||||||
local(true);
|
local(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Request(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
jobId = in.readString();
|
||||||
|
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
|
||||||
|
allowNoJobs = in.readBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(jobId);
|
||||||
|
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
|
||||||
|
out.writeBoolean(allowNoJobs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setAllowNoJobs(boolean allowNoJobs) {
|
public void setAllowNoJobs(boolean allowNoJobs) {
|
||||||
this.allowNoJobs = allowNoJobs;
|
this.allowNoJobs = allowNoJobs;
|
||||||
}
|
}
|
||||||
|
@ -92,20 +109,7 @@ public class GetJobsAction extends Action<GetJobsAction.Request, GetJobsAction.R
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
jobId = in.readString();
|
|
||||||
if (in.getVersion().onOrAfter(Version.V_6_1_0)) {
|
|
||||||
allowNoJobs = in.readBoolean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(jobId);
|
|
||||||
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
|
|
||||||
out.writeBoolean(allowNoJobs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -197,10 +201,10 @@ public class GetJobsAction extends Action<GetJobsAction.Request, GetJobsAction.R
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public TransportAction(Settings settings, TransportService transportService, ClusterService clusterService,
|
public TransportAction(Settings settings, TransportService transportService, ClusterService clusterService,
|
||||||
ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
|
ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
|
||||||
JobManager jobManager) {
|
JobManager jobManager) {
|
||||||
super(settings, GetJobsAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
super(settings, GetJobsAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
indexNameExpressionResolver, Request::new);
|
Request::new, indexNameExpressionResolver);
|
||||||
this.jobManager = jobManager;
|
this.jobManager = jobManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,17 @@ public class IndexUpgradeAction extends Action<IndexUpgradeAction.Request, BulkB
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Request(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
index = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(index);
|
||||||
|
}
|
||||||
|
|
||||||
public String index() {
|
public String index() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
@ -123,14 +134,7 @@ public class IndexUpgradeAction extends Action<IndexUpgradeAction.Request, BulkB
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
index = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -179,7 +183,7 @@ public class IndexUpgradeAction extends Action<IndexUpgradeAction.Request, BulkB
|
||||||
IndexUpgradeService indexUpgradeService,
|
IndexUpgradeService indexUpgradeService,
|
||||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||||
super(settings, IndexUpgradeAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
super(settings, IndexUpgradeAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
indexNameExpressionResolver, Request::new);
|
Request::new, indexNameExpressionResolver);
|
||||||
this.indexUpgradeService = indexUpgradeService;
|
this.indexUpgradeService = indexUpgradeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,19 @@ public class IndexUpgradeInfoAction extends Action<IndexUpgradeInfoAction.Reques
|
||||||
this.indices = indices;
|
this.indices = indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Request(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
indices = in.readStringArray();
|
||||||
|
indicesOptions = IndicesOptions.readIndicesOptions(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeStringArray(indices);
|
||||||
|
indicesOptions.writeIndicesOptions(out);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] indices() {
|
public String[] indices() {
|
||||||
return indices;
|
return indices;
|
||||||
|
@ -166,16 +179,7 @@ public class IndexUpgradeInfoAction extends Action<IndexUpgradeInfoAction.Reques
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
indices = in.readStringArray();
|
|
||||||
indicesOptions = IndicesOptions.readIndicesOptions(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeStringArray(indices);
|
|
||||||
indicesOptions.writeIndicesOptions(out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -223,7 +227,7 @@ public class IndexUpgradeInfoAction extends Action<IndexUpgradeInfoAction.Reques
|
||||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||||
XPackLicenseState licenseState) {
|
XPackLicenseState licenseState) {
|
||||||
super(settings, IndexUpgradeInfoAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
super(settings, IndexUpgradeInfoAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
indexNameExpressionResolver, Request::new);
|
Request::new, indexNameExpressionResolver);
|
||||||
this.indexUpgradeService = indexUpgradeService;
|
this.indexUpgradeService = indexUpgradeService;
|
||||||
this.licenseState = licenseState;
|
this.licenseState = licenseState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.elasticsearch.action.ActionResponse;
|
||||||
import org.elasticsearch.action.support.ActionFilters;
|
import org.elasticsearch.action.support.ActionFilters;
|
||||||
import org.elasticsearch.action.support.HandledTransportAction;
|
import org.elasticsearch.action.support.HandledTransportAction;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.license.LicenseUtils;
|
import org.elasticsearch.license.LicenseUtils;
|
||||||
import org.elasticsearch.license.XPackLicenseState;
|
import org.elasticsearch.license.XPackLicenseState;
|
||||||
|
@ -19,8 +20,6 @@ import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.TransportService;
|
import org.elasticsearch.transport.TransportService;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public abstract class WatcherTransportAction<Request extends ActionRequest, Response extends ActionResponse>
|
public abstract class WatcherTransportAction<Request extends ActionRequest, Response extends ActionResponse>
|
||||||
extends HandledTransportAction<Request, Response> {
|
extends HandledTransportAction<Request, Response> {
|
||||||
|
|
||||||
|
@ -28,8 +27,8 @@ public abstract class WatcherTransportAction<Request extends ActionRequest, Resp
|
||||||
|
|
||||||
public WatcherTransportAction(Settings settings, String actionName, TransportService transportService, ThreadPool threadPool,
|
public WatcherTransportAction(Settings settings, String actionName, TransportService transportService, ThreadPool threadPool,
|
||||||
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
|
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
|
||||||
XPackLicenseState licenseState, Supplier<Request> request) {
|
XPackLicenseState licenseState, Writeable.Reader<Request> request) {
|
||||||
super(settings, actionName, threadPool, transportService, actionFilters, indexNameExpressionResolver, request);
|
super(settings, actionName, threadPool, transportService, actionFilters, request, indexNameExpressionResolver);
|
||||||
this.licenseState = licenseState;
|
this.licenseState = licenseState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class AckWatchRequest extends ActionRequest {
|
||||||
private String[] actionIds = Strings.EMPTY_ARRAY;
|
private String[] actionIds = Strings.EMPTY_ARRAY;
|
||||||
|
|
||||||
public AckWatchRequest() {
|
public AckWatchRequest() {
|
||||||
this(null);
|
this(null, (String[]) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AckWatchRequest(String watchId, String... actionIds) {
|
public AckWatchRequest(String watchId, String... actionIds) {
|
||||||
|
@ -33,6 +33,19 @@ public class AckWatchRequest extends ActionRequest {
|
||||||
this.actionIds = actionIds;
|
this.actionIds = actionIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AckWatchRequest(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
watchId = in.readString();
|
||||||
|
actionIds = in.readStringArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(watchId);
|
||||||
|
out.writeStringArray(actionIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The id of the watch to be acked
|
* @return The id of the watch to be acked
|
||||||
*/
|
*/
|
||||||
|
@ -78,16 +91,7 @@ public class AckWatchRequest extends ActionRequest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
watchId = in.readString();
|
|
||||||
actionIds = in.readStringArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(watchId);
|
|
||||||
out.writeStringArray(actionIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,6 +31,19 @@ public class ActivateWatchRequest extends ActionRequest {
|
||||||
this.activate = activate;
|
this.activate = activate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActivateWatchRequest(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
watchId = in.readString();
|
||||||
|
activate = in.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(watchId);
|
||||||
|
out.writeBoolean(activate);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The id of the watch to be acked
|
* @return The id of the watch to be acked
|
||||||
*/
|
*/
|
||||||
|
@ -59,16 +72,7 @@ public class ActivateWatchRequest extends ActionRequest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
watchId = in.readString();
|
|
||||||
activate = in.readBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(watchId);
|
|
||||||
out.writeBoolean(activate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -51,6 +51,56 @@ public class ExecuteWatchRequest extends ActionRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExecuteWatchRequest(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
id = in.readOptionalString();
|
||||||
|
ignoreCondition = in.readBoolean();
|
||||||
|
recordExecution = in.readBoolean();
|
||||||
|
if (in.readBoolean()){
|
||||||
|
alternativeInput = in.readMap();
|
||||||
|
}
|
||||||
|
if (in.readBoolean()) {
|
||||||
|
triggerData = in.readMap();
|
||||||
|
}
|
||||||
|
long actionModesCount = in.readLong();
|
||||||
|
actionModes = new HashMap<>();
|
||||||
|
for (int i = 0; i < actionModesCount; i++) {
|
||||||
|
actionModes.put(in.readString(), ActionExecutionMode.resolve(in.readByte()));
|
||||||
|
}
|
||||||
|
if (in.readBoolean()) {
|
||||||
|
watchSource = in.readBytesReference();
|
||||||
|
xContentType = XContentType.readFrom(in);
|
||||||
|
}
|
||||||
|
debug = in.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeOptionalString(id);
|
||||||
|
out.writeBoolean(ignoreCondition);
|
||||||
|
out.writeBoolean(recordExecution);
|
||||||
|
out.writeBoolean(alternativeInput != null);
|
||||||
|
if (alternativeInput != null) {
|
||||||
|
out.writeMap(alternativeInput);
|
||||||
|
}
|
||||||
|
out.writeBoolean(triggerData != null);
|
||||||
|
if (triggerData != null) {
|
||||||
|
out.writeMap(triggerData);
|
||||||
|
}
|
||||||
|
out.writeLong(actionModes.size());
|
||||||
|
for (Map.Entry<String, ActionExecutionMode> entry : actionModes.entrySet()) {
|
||||||
|
out.writeString(entry.getKey());
|
||||||
|
out.writeByte(entry.getValue().id());
|
||||||
|
}
|
||||||
|
out.writeBoolean(watchSource != null);
|
||||||
|
if (watchSource != null) {
|
||||||
|
out.writeBytesReference(watchSource);
|
||||||
|
xContentType.writeTo(out);
|
||||||
|
}
|
||||||
|
out.writeBoolean(debug);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The id of the watch to be executed
|
* @return The id of the watch to be executed
|
||||||
*/
|
*/
|
||||||
|
@ -221,54 +271,7 @@ public class ExecuteWatchRequest extends ActionRequest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
id = in.readOptionalString();
|
|
||||||
ignoreCondition = in.readBoolean();
|
|
||||||
recordExecution = in.readBoolean();
|
|
||||||
if (in.readBoolean()){
|
|
||||||
alternativeInput = in.readMap();
|
|
||||||
}
|
|
||||||
if (in.readBoolean()) {
|
|
||||||
triggerData = in.readMap();
|
|
||||||
}
|
|
||||||
long actionModesCount = in.readLong();
|
|
||||||
actionModes = new HashMap<>();
|
|
||||||
for (int i = 0; i < actionModesCount; i++) {
|
|
||||||
actionModes.put(in.readString(), ActionExecutionMode.resolve(in.readByte()));
|
|
||||||
}
|
|
||||||
if (in.readBoolean()) {
|
|
||||||
watchSource = in.readBytesReference();
|
|
||||||
xContentType = XContentType.readFrom(in);
|
|
||||||
}
|
|
||||||
debug = in.readBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeOptionalString(id);
|
|
||||||
out.writeBoolean(ignoreCondition);
|
|
||||||
out.writeBoolean(recordExecution);
|
|
||||||
out.writeBoolean(alternativeInput != null);
|
|
||||||
if (alternativeInput != null) {
|
|
||||||
out.writeMap(alternativeInput);
|
|
||||||
}
|
|
||||||
out.writeBoolean(triggerData != null);
|
|
||||||
if (triggerData != null) {
|
|
||||||
out.writeMap(triggerData);
|
|
||||||
}
|
|
||||||
out.writeLong(actionModes.size());
|
|
||||||
for (Map.Entry<String, ActionExecutionMode> entry : actionModes.entrySet()) {
|
|
||||||
out.writeString(entry.getKey());
|
|
||||||
out.writeByte(entry.getValue().id());
|
|
||||||
}
|
|
||||||
out.writeBoolean(watchSource != null);
|
|
||||||
if (watchSource != null) {
|
|
||||||
out.writeBytesReference(watchSource);
|
|
||||||
xContentType.writeTo(out);
|
|
||||||
}
|
|
||||||
out.writeBoolean(debug);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,6 +31,17 @@ public class GetWatchRequest extends ActionRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GetWatchRequest(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
id = in.readString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(id);
|
||||||
|
}
|
||||||
|
|
||||||
GetWatchRequest setId(String id) {
|
GetWatchRequest setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
return this;
|
return this;
|
||||||
|
@ -58,14 +69,7 @@ public class GetWatchRequest extends ActionRequest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
id = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,23 @@ public class PutWatchRequest extends ActionRequest {
|
||||||
this.xContentType = xContentType;
|
this.xContentType = xContentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PutWatchRequest(StreamInput in) throws IOException {
|
||||||
|
super(in);
|
||||||
|
id = in.readString();
|
||||||
|
source = in.readBytesReference();
|
||||||
|
active = in.readBoolean();
|
||||||
|
xContentType = XContentType.readFrom(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
|
super.writeTo(out);
|
||||||
|
out.writeString(id);
|
||||||
|
out.writeBytesReference(source);
|
||||||
|
out.writeBoolean(active);
|
||||||
|
xContentType.writeTo(out);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The name that will be the ID of the indexed document
|
* @return The name that will be the ID of the indexed document
|
||||||
*/
|
*/
|
||||||
|
@ -115,19 +132,6 @@ public class PutWatchRequest extends ActionRequest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||||
id = in.readString();
|
|
||||||
source = in.readBytesReference();
|
|
||||||
active = in.readBoolean();
|
|
||||||
xContentType = XContentType.readFrom(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeString(id);
|
|
||||||
out.writeBytesReference(source);
|
|
||||||
out.writeBoolean(active);
|
|
||||||
xContentType.writeTo(out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.deprecation;
|
package org.elasticsearch.xpack.deprecation;
|
||||||
|
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||||
|
|
||||||
public class DeprecationInfoActionRequestTests extends AbstractStreamableTestCase<DeprecationInfoAction.Request> {
|
public class DeprecationInfoActionRequestTests extends AbstractWireSerializingTestCase<DeprecationInfoAction.Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DeprecationInfoAction.Request createTestInstance() {
|
protected DeprecationInfoAction.Request createTestInstance() {
|
||||||
|
@ -15,7 +16,7 @@ public class DeprecationInfoActionRequestTests extends AbstractStreamableTestCas
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DeprecationInfoAction.Request createBlankInstance() {
|
protected Writeable.Reader<DeprecationInfoAction.Request> instanceReader() {
|
||||||
return new DeprecationInfoAction.Request();
|
return DeprecationInfoAction.Request::new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||||
import org.elasticsearch.xpack.ml.action.GetDatafeedsStatsAction.Request;
|
import org.elasticsearch.xpack.ml.action.GetDatafeedsStatsAction.Request;
|
||||||
|
|
||||||
public class GetDatafeedStatsActionRequestTests extends AbstractStreamableTestCase<Request> {
|
public class GetDatafeedStatsActionRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createTestInstance() {
|
protected Request createTestInstance() {
|
||||||
|
@ -19,8 +20,7 @@ public class GetDatafeedStatsActionRequestTests extends AbstractStreamableTestCa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createBlankInstance() {
|
protected Writeable.Reader<Request> instanceReader() {
|
||||||
return new Request();
|
return Request::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||||
import org.elasticsearch.xpack.ml.action.GetDatafeedsAction.Request;
|
import org.elasticsearch.xpack.ml.action.GetDatafeedsAction.Request;
|
||||||
|
|
||||||
public class GetDatafeedsActionRequestTests extends AbstractStreamableTestCase<Request> {
|
public class GetDatafeedsActionRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createTestInstance() {
|
protected Request createTestInstance() {
|
||||||
|
@ -19,8 +20,7 @@ public class GetDatafeedsActionRequestTests extends AbstractStreamableTestCase<R
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createBlankInstance() {
|
protected Writeable.Reader<Request> instanceReader() {
|
||||||
return new Request();
|
return Request::new;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||||
import org.elasticsearch.xpack.ml.action.GetJobsAction.Request;
|
import org.elasticsearch.xpack.ml.action.GetJobsAction.Request;
|
||||||
|
|
||||||
public class GetJobsActionRequestTests extends AbstractStreamableTestCase<GetJobsAction.Request> {
|
public class GetJobsActionRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createTestInstance() {
|
protected Request createTestInstance() {
|
||||||
|
@ -19,7 +20,7 @@ public class GetJobsActionRequestTests extends AbstractStreamableTestCase<GetJob
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createBlankInstance() {
|
protected Writeable.Reader<Request> instanceReader() {
|
||||||
return new Request();
|
return Request::new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,18 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.upgrade.actions;
|
package org.elasticsearch.xpack.upgrade.actions;
|
||||||
|
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||||
import org.elasticsearch.xpack.upgrade.actions.IndexUpgradeAction.Request;
|
import org.elasticsearch.xpack.upgrade.actions.IndexUpgradeAction.Request;
|
||||||
|
|
||||||
public class IndexUpgradeActionRequestTests extends AbstractStreamableTestCase<Request> {
|
public class IndexUpgradeActionRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||||
@Override
|
@Override
|
||||||
protected Request createTestInstance() {
|
protected Request createTestInstance() {
|
||||||
return new Request(randomAlphaOfLength(10));
|
return new Request(randomAlphaOfLength(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createBlankInstance() {
|
protected Writeable.Reader<Request> instanceReader() {
|
||||||
return new Request();
|
return Request::new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
package org.elasticsearch.xpack.upgrade.actions;
|
package org.elasticsearch.xpack.upgrade.actions;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
import org.elasticsearch.action.support.IndicesOptions;
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||||
import org.elasticsearch.xpack.upgrade.actions.IndexUpgradeInfoAction.Request;
|
import org.elasticsearch.xpack.upgrade.actions.IndexUpgradeInfoAction.Request;
|
||||||
|
|
||||||
public class IndexUpgradeInfoActionRequestTests extends AbstractStreamableTestCase<Request> {
|
public class IndexUpgradeInfoActionRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||||
@Override
|
@Override
|
||||||
protected Request createTestInstance() {
|
protected Request createTestInstance() {
|
||||||
int indexCount = randomInt(4);
|
int indexCount = randomInt(4);
|
||||||
|
@ -25,7 +26,7 @@ public class IndexUpgradeInfoActionRequestTests extends AbstractStreamableTestCa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request createBlankInstance() {
|
protected Writeable.Reader<Request> instanceReader() {
|
||||||
return new Request();
|
return Request::new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class WatchRequestValidationTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetWatchNullId() {
|
public void testGetWatchNullId() {
|
||||||
ActionRequestValidationException e = new GetWatchRequest(null).validate();
|
ActionRequestValidationException e = new GetWatchRequest((String) null).validate();
|
||||||
assertThat(e, is(notNullValue()));
|
assertThat(e, is(notNullValue()));
|
||||||
assertThat(e.validationErrors(), hasItem("watch id is missing"));
|
assertThat(e.validationErrors(), hasItem("watch id is missing"));
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class WatchRequestValidationTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExecuteWatchMissingWatchIdNoSource() {
|
public void testExecuteWatchMissingWatchIdNoSource() {
|
||||||
ActionRequestValidationException e = new ExecuteWatchRequest(null).validate();
|
ActionRequestValidationException e = new ExecuteWatchRequest((String) null).validate();
|
||||||
assertThat(e, is(notNullValue()));
|
assertThat(e, is(notNullValue()));
|
||||||
assertThat(e.validationErrors(),
|
assertThat(e.validationErrors(),
|
||||||
hasItem("a watch execution request must either have a watch id or an inline watch source, but both are missing"));
|
hasItem("a watch execution request must either have a watch id or an inline watch source, but both are missing"));
|
||||||
|
|
|
@ -25,8 +25,7 @@ public class ExecuteWatchRequestTests extends ESTestCase {
|
||||||
BytesStreamOutput out = new BytesStreamOutput();
|
BytesStreamOutput out = new BytesStreamOutput();
|
||||||
request.writeTo(out);
|
request.writeTo(out);
|
||||||
StreamInput in = StreamInput.wrap(out.bytes().toBytesRef().bytes);
|
StreamInput in = StreamInput.wrap(out.bytes().toBytesRef().bytes);
|
||||||
ExecuteWatchRequest serialized = new ExecuteWatchRequest();
|
ExecuteWatchRequest serialized = new ExecuteWatchRequest(in);
|
||||||
serialized.readFrom(in);
|
|
||||||
assertEquals(XContentType.JSON, serialized.getXContentType());
|
assertEquals(XContentType.JSON, serialized.getXContentType());
|
||||||
assertEquals("{}", serialized.getWatchSource().utf8ToString());
|
assertEquals("{}", serialized.getWatchSource().utf8ToString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,7 @@ public class PutWatchSerializationTests extends ESTestCase {
|
||||||
BytesStreamOutput streamOutput = new BytesStreamOutput();
|
BytesStreamOutput streamOutput = new BytesStreamOutput();
|
||||||
request.writeTo(streamOutput);
|
request.writeTo(streamOutput);
|
||||||
|
|
||||||
PutWatchRequest readRequest = new PutWatchRequest();
|
PutWatchRequest readRequest = new PutWatchRequest(streamOutput.bytes().streamInput());
|
||||||
readRequest.readFrom(streamOutput.bytes().streamInput());
|
|
||||||
assertThat(readRequest.isActive(), is(request.isActive()));
|
assertThat(readRequest.isActive(), is(request.isActive()));
|
||||||
assertThat(readRequest.getId(), is(request.getId()));
|
assertThat(readRequest.getId(), is(request.getId()));
|
||||||
assertThat(readRequest.getSource(), is(request.getSource()));
|
assertThat(readRequest.getSource(), is(request.getSource()));
|
||||||
|
@ -49,9 +48,7 @@ public class PutWatchSerializationTests extends ESTestCase {
|
||||||
BytesStreamOutput streamOutput = new BytesStreamOutput();
|
BytesStreamOutput streamOutput = new BytesStreamOutput();
|
||||||
request.writeTo(streamOutput);
|
request.writeTo(streamOutput);
|
||||||
|
|
||||||
PutWatchRequest readRequest = new PutWatchRequest();
|
PutWatchRequest readRequest = new PutWatchRequest(streamOutput.bytes().streamInput());
|
||||||
StreamInput input = streamOutput.bytes().streamInput();
|
|
||||||
readRequest.readFrom(input);
|
|
||||||
assertThat(readRequest.isActive(), is(request.isActive()));
|
assertThat(readRequest.isActive(), is(request.isActive()));
|
||||||
assertThat(readRequest.getId(), is(request.getId()));
|
assertThat(readRequest.getId(), is(request.getId()));
|
||||||
assertThat(readRequest.getSource(), is(request.getSource()));
|
assertThat(readRequest.getSource(), is(request.getSource()));
|
||||||
|
|
Loading…
Reference in New Issue