Add XContentType as parameter to HLRC ART#createServerTestInstance (#46036)

Add XContentType as parameter to the
AbstractResponseTestCase#createServerTestInstance method.

In the case a server side response class serializes xcontent as
bytes then the test needs to know what xcontent type was randomily selected.

This change is needed in #45970
This commit is contained in:
Martijn van Groningen 2019-08-28 16:16:11 +02:00
parent 9ac85a4a2b
commit f50c7cf88b
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
29 changed files with 88 additions and 31 deletions

View File

@ -56,10 +56,24 @@ public abstract class AbstractRequestTestCase<C extends ToXContent, S> extends E
assertInstances(serverInstance, clientTestInstance);
}
/**
* @return The client test instance to be serialized to xcontent as bytes
*/
protected abstract C createClientTestInstance();
/**
* @param parser The xcontent parser
* @return The server side instance that is parsed from the xcontent which originates from the client side test instance
*/
protected abstract S doParseToServerInstance(XContentParser parser) throws IOException;
/**
* Assert that the server instance and client test instance contain the same content.
* Typically by asserting whether each property of both instances are equal to each other.
*
* @param serverInstance The server side instance that was created by {@link #doParseToServerInstance(XContentParser)}
* @param clientTestInstance The client side test instance that was created by {@link #createClientTestInstance()}
*/
protected abstract void assertInstances(S serverInstance, C clientTestInstance);
}

View File

@ -33,7 +33,7 @@ import java.io.IOException;
/**
* Base class for HLRC response parsing tests.
*
* This case class facilitates generating server side reponse test instances and
* This case class facilitates generating server side response test instances and
* verifies that they are correctly parsed into HLRC response instances.
*
* @param <S> The class representing the response on the server side.
@ -42,9 +42,8 @@ import java.io.IOException;
public abstract class AbstractResponseTestCase<S extends ToXContent, C> extends ESTestCase {
public final void testFromXContent() throws IOException {
final S serverTestInstance = createServerTestInstance();
final XContentType xContentType = randomFrom(XContentType.values());
final S serverTestInstance = createServerTestInstance(xContentType);
final BytesReference bytes = toShuffledXContent(serverTestInstance, xContentType, getParams(), randomBoolean());
final XContent xContent = XContentFactory.xContent(xContentType);
@ -56,12 +55,32 @@ public abstract class AbstractResponseTestCase<S extends ToXContent, C> extends
assertInstances(serverTestInstance, clientInstance);
}
protected abstract S createServerTestInstance();
/**
* @param xContentType The xcontent type that will be used to serialize the test instance.
* This is parameter is needed if the test instance contains serialized xcontent as bytes or string.
*
* @return The server side test instance to will be serialized as xcontent to be used to parse client side response class.
*/
protected abstract S createServerTestInstance(XContentType xContentType);
/**
* @param parser The xcontent parser
* @return The client side instance that is parsed from the xcontent generated from the server side test instance.
*/
protected abstract C doParseToClientInstance(XContentParser parser) throws IOException;
/**
* Assert that the server instance and client instance contain the same content.
* Typically by asserting whether each property of both instances are equal to each other.
*
* @param serverTestInstance The server side instance that was created by {@link #createServerTestInstance(XContentType)}
* @param clientInstance The client side instance that was created by {@link #doParseToClientInstance(XContentParser)}
*/
protected abstract void assertInstances(S serverTestInstance, C clientInstance);
/**
* @return The params used when generated the xcontent from server side test instance as bytes
*/
protected ToXContent.Params getParams() {
return ToXContent.EMPTY_PARAMS;
}

View File

@ -19,6 +19,7 @@
package org.elasticsearch.client;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.protocol.xpack.XPackInfoResponse;
import org.elasticsearch.protocol.xpack.XPackInfoResponse.BuildInfo;
import org.elasticsearch.protocol.xpack.XPackInfoResponse.FeatureSetsInfo;
@ -100,7 +101,7 @@ public class XPackInfoResponseTests extends AbstractResponseTestCase<XPackInfoRe
}
@Override
protected XPackInfoResponse createServerTestInstance() {
protected XPackInfoResponse createServerTestInstance(XContentType xContentType) {
return new XPackInfoResponse(
randomBoolean() ? null : randomBuildInfo(),
randomBoolean() ? null : randomLicenseInfo(),

View File

@ -24,6 +24,7 @@ import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.client.ccr.IndicesFollowStats.ShardFollowStats;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus;
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
@ -44,7 +45,7 @@ import static org.hamcrest.Matchers.instanceOf;
public class CcrStatsResponseTests extends AbstractResponseTestCase<CcrStatsAction.Response, CcrStatsResponse> {
@Override
protected CcrStatsAction.Response createServerTestInstance() {
protected CcrStatsAction.Response createServerTestInstance(XContentType xContentType) {
org.elasticsearch.xpack.core.ccr.AutoFollowStats autoFollowStats = new org.elasticsearch.xpack.core.ccr.AutoFollowStats(
randomNonNegativeLong(),
randomNonNegativeLong(),

View File

@ -23,6 +23,7 @@ import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.ccr.action.FollowInfoAction;
import org.elasticsearch.xpack.core.ccr.action.FollowParameters;
@ -37,7 +38,7 @@ import static org.hamcrest.Matchers.nullValue;
public class FollowInfoResponseTests extends AbstractResponseTestCase<FollowInfoAction.Response, FollowInfoResponse> {
@Override
protected FollowInfoAction.Response createServerTestInstance() {
protected FollowInfoAction.Response createServerTestInstance(XContentType xContentType) {
int numInfos = randomIntBetween(0, 32);
List<FollowInfoAction.Response.FollowerInfo> infos = new ArrayList<>(numInfos);
for (int i = 0; i < numInfos; i++) {

View File

@ -24,6 +24,7 @@ import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.client.ccr.IndicesFollowStats.ShardFollowStats;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus;
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
@ -41,7 +42,7 @@ import static org.hamcrest.Matchers.instanceOf;
public class FollowStatsResponseTests extends AbstractResponseTestCase<FollowStatsAction.StatsResponses, FollowStatsResponse> {
@Override
protected FollowStatsAction.StatsResponses createServerTestInstance() {
protected FollowStatsAction.StatsResponses createServerTestInstance(XContentType xContentType) {
return createStatsResponse();
}

View File

@ -23,6 +23,7 @@ import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata;
import org.elasticsearch.xpack.core.ccr.action.GetAutoFollowPatternAction;
@ -41,7 +42,7 @@ public class GetAutoFollowPatternResponseTests extends AbstractResponseTestCase<
GetAutoFollowPatternResponse> {
@Override
protected GetAutoFollowPatternAction.Response createServerTestInstance() {
protected GetAutoFollowPatternAction.Response createServerTestInstance(XContentType xContentType) {
int numPatterns = randomIntBetween(0, 16);
NavigableMap<String, AutoFollowMetadata.AutoFollowPattern> patterns = new TreeMap<>();
for (int i = 0; i < numPatterns; i++) {

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.ccr;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
import java.io.IOException;
@ -30,7 +31,7 @@ import static org.hamcrest.Matchers.is;
public class PutFollowResponseTests extends AbstractResponseTestCase<PutFollowAction.Response, PutFollowResponse> {
@Override
protected PutFollowAction.Response createServerTestInstance() {
protected PutFollowAction.Response createServerTestInstance(XContentType xContentType) {
return new PutFollowAction.Response(randomBoolean(), randomBoolean(), randomBoolean());
}

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.core;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
@ -30,7 +31,7 @@ public class AcknowledgedResponseTests extends AbstractResponseTestCase<org.elas
AcknowledgedResponse> {
@Override
protected org.elasticsearch.action.support.master.AcknowledgedResponse createServerTestInstance() {
protected org.elasticsearch.action.support.master.AcknowledgedResponse createServerTestInstance(XContentType xContentType) {
return new org.elasticsearch.action.support.master.AcknowledgedResponse(randomBoolean());
}

View File

@ -22,6 +22,7 @@ package org.elasticsearch.client.core;
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.seqno.RetentionLeaseNotFoundException;
import java.io.IOException;
@ -43,7 +44,7 @@ public class BroadcastResponseTests extends AbstractResponseTestCase<org.elastic
private Set<Integer> shardIds;
@Override
protected org.elasticsearch.action.support.broadcast.BroadcastResponse createServerTestInstance() {
protected org.elasticsearch.action.support.broadcast.BroadcastResponse createServerTestInstance(XContentType xContentType) {
index = randomAlphaOfLength(8);
id = randomAlphaOfLength(8);
final int total = randomIntBetween(1, 16);

View File

@ -24,6 +24,7 @@ import org.elasticsearch.Version;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.VersionUtils;
import java.io.IOException;
@ -33,7 +34,7 @@ import static org.hamcrest.Matchers.equalTo;
public class MainResponseTests extends AbstractResponseTestCase<org.elasticsearch.action.main.MainResponse, MainResponse> {
@Override
protected org.elasticsearch.action.main.MainResponse createServerTestInstance() {
protected org.elasticsearch.action.main.MainResponse createServerTestInstance(XContentType xContentType) {
String clusterUuid = randomAlphaOfLength(10);
ClusterName clusterName = new ClusterName(randomAlphaOfLength(10));
String nodeName = randomAlphaOfLength(10);

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.dataframe.transforms.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameIndexerPosition;
import java.util.LinkedHashMap;
@ -45,7 +46,7 @@ public class DataFrameIndexerPositionTests extends AbstractResponseTestCase<
}
@Override
protected DataFrameIndexerPosition createServerTestInstance() {
protected DataFrameIndexerPosition createServerTestInstance(XContentType xContentType) {
return randomDataFrameIndexerPosition();
}

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.dataframe.transforms.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformCheckpointStats;
import java.io.IOException;
@ -48,7 +49,7 @@ public class DataFrameTransformCheckpointStatsTests extends AbstractResponseTest
}
@Override
protected DataFrameTransformCheckpointStats createServerTestInstance() {
protected DataFrameTransformCheckpointStats createServerTestInstance(XContentType xContentType) {
return randomDataFrameTransformCheckpointStats();
}

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.dataframe.transforms.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformProgress;
import static org.hamcrest.Matchers.equalTo;
@ -51,7 +52,7 @@ public class DataFrameTransformProgressTests extends AbstractResponseTestCase<
}
@Override
protected DataFrameTransformProgress createServerTestInstance() {
protected DataFrameTransformProgress createServerTestInstance(XContentType xContentType) {
return randomDataFrameTransformProgress();
}

View File

@ -23,6 +23,7 @@ import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.client.dataframe.transforms.TimeSyncConfig;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
@ -41,7 +42,7 @@ public class TimeSyncConfigTests
}
@Override
protected org.elasticsearch.xpack.core.dataframe.transforms.TimeSyncConfig createServerTestInstance() {
protected org.elasticsearch.xpack.core.dataframe.transforms.TimeSyncConfig createServerTestInstance(XContentType xContentType) {
return randomTimeSyncConfig();
}

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.dataframe.transforms.pivot.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
import org.elasticsearch.xpack.core.dataframe.transforms.pivot.DateHistogramGroupSource;
@ -48,7 +49,7 @@ public class DateHistogramGroupSourceTests extends AbstractResponseTestCase<
}
@Override
protected DateHistogramGroupSource createServerTestInstance() {
protected DateHistogramGroupSource createServerTestInstance(XContentType xContentType) {
return randomDateHistogramGroupSource();
}

View File

@ -22,6 +22,7 @@ package org.elasticsearch.client.indices;
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.RandomObjects;
import java.io.IOException;
@ -30,7 +31,7 @@ import java.util.Arrays;
public class AnalyzeResponseTests extends AbstractResponseTestCase<AnalyzeAction.Response, AnalyzeResponse> {
@Override
protected AnalyzeAction.Response createServerTestInstance() {
protected AnalyzeAction.Response createServerTestInstance(XContentType xContentType) {
int tokenCount = randomIntBetween(1, 30);
AnalyzeAction.AnalyzeToken[] tokens = new AnalyzeAction.AnalyzeToken[tokenCount];
for (int i = 0; i < tokenCount; i++) {

View File

@ -51,7 +51,7 @@ public class CloseIndexResponseTests extends
AbstractResponseTestCase<org.elasticsearch.action.admin.indices.close.CloseIndexResponse, CloseIndexResponse> {
@Override
protected org.elasticsearch.action.admin.indices.close.CloseIndexResponse createServerTestInstance() {
protected org.elasticsearch.action.admin.indices.close.CloseIndexResponse createServerTestInstance(XContentType xContentType) {
boolean acknowledged = true;
final String[] indicesNames = generateRandomStringArray(10, 10, false, true);

View File

@ -22,6 +22,7 @@ package org.elasticsearch.client.indices;
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.seqno.RetentionLeaseNotFoundException;
import org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse.ReloadDetails;
@ -48,7 +49,7 @@ public class ReloadAnalyzersResponseTests
private Set<Integer> shardIds;
@Override
protected org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse createServerTestInstance() {
protected org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse createServerTestInstance(XContentType xContentType) {
index = randomAlphaOfLength(8);
id = randomAlphaOfLength(8);
final int total = randomIntBetween(1, 16);

View File

@ -20,6 +20,7 @@ package org.elasticsearch.client.license;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
@ -27,7 +28,7 @@ public class GetBasicStatusResponseTests
extends AbstractResponseTestCase<org.elasticsearch.license.GetBasicStatusResponse, GetBasicStatusResponse> {
@Override
protected org.elasticsearch.license.GetBasicStatusResponse createServerTestInstance() {
protected org.elasticsearch.license.GetBasicStatusResponse createServerTestInstance(XContentType xContentType) {
return new org.elasticsearch.license.GetBasicStatusResponse(randomBoolean());
}

View File

@ -20,6 +20,7 @@ package org.elasticsearch.client.license;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
@ -27,7 +28,7 @@ public class GetTrialStatusResponseTests extends
AbstractResponseTestCase<org.elasticsearch.license.GetTrialStatusResponse, GetTrialStatusResponse> {
@Override
protected org.elasticsearch.license.GetTrialStatusResponse createServerTestInstance() {
protected org.elasticsearch.license.GetTrialStatusResponse createServerTestInstance(XContentType xContentType) {
return new org.elasticsearch.license.GetTrialStatusResponse(randomBoolean());
}

View File

@ -20,6 +20,7 @@ package org.elasticsearch.client.ml;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.ml.action.MlInfoAction.Response;
import java.io.IOException;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.equalTo;
public class MlInfoActionResponseTests extends AbstractResponseTestCase<Response, MlInfoResponse> {
@Override
protected Response createServerTestInstance() {
protected Response createServerTestInstance(XContentType xContentType) {
int size = randomInt(10);
Map<String, Object> info = new HashMap<>();
for (int j = 0; j < size; j++) {

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.ml;
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.ml.action.PutCalendarAction;
import org.elasticsearch.xpack.core.ml.calendars.Calendar;
@ -33,7 +34,7 @@ import static org.hamcrest.Matchers.equalTo;
public class PutCalendarActionResponseTests extends AbstractResponseTestCase<PutCalendarAction.Response, PutCalendarResponse> {
@Override
protected PutCalendarAction.Response createServerTestInstance() {
protected PutCalendarAction.Response createServerTestInstance(XContentType xContentType) {
String calendarId = new CodepointSetGenerator("abcdefghijklmnopqrstuvwxyz".toCharArray()).ofCodePointsLength(random(), 10, 10);
int size = randomInt(10);
List<String> items = new ArrayList<>(size);

View File

@ -23,6 +23,7 @@ import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.client.security.DelegatePkiAuthenticationResponse;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
@ -33,7 +34,8 @@ public class DelegatePkiAuthenticationResponseTests extends
DelegatePkiAuthenticationResponse> {
@Override
protected org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationResponse createServerTestInstance() {
protected org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationResponse createServerTestInstance(
XContentType xContentType) {
return new org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationResponse(randomAlphaOfLength(6),
TimeValue.parseTimeValue(randomTimeValue(), getClass().getSimpleName() + ".expiresIn"));
}

View File

@ -110,7 +110,7 @@ public class HasPrivilegesResponseTests extends AbstractResponseTestCase<
}
@Override
protected org.elasticsearch.xpack.core.security.action.user.HasPrivilegesResponse createServerTestInstance() {
protected org.elasticsearch.xpack.core.security.action.user.HasPrivilegesResponse createServerTestInstance(XContentType xContentType) {
return randomResponse();
}

View File

@ -46,7 +46,7 @@ import static org.hamcrest.Matchers.nullValue;
public class GetWatchResponseTests extends AbstractResponseTestCase<GetWatchResponse, org.elasticsearch.client.watcher.GetWatchResponse> {
@Override
protected GetWatchResponse createServerTestInstance() {
protected GetWatchResponse createServerTestInstance(XContentType xContentType) {
String id = randomAlphaOfLength(10);
if (LuceneTestCase.rarely()) {
return new GetWatchResponse(id);

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.watcher.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.client.watcher.DeleteWatchResponse;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
@ -30,7 +31,7 @@ public class DeleteWatchResponseTests extends AbstractResponseTestCase<
org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse, DeleteWatchResponse> {
@Override
protected org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse createServerTestInstance() {
protected org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse createServerTestInstance(XContentType xContentType) {
String id = randomAlphaOfLength(10);
long version = randomLongBetween(1, 10);
boolean found = randomBoolean();

View File

@ -35,7 +35,7 @@ public class ExecuteWatchResponseTests extends AbstractResponseTestCase<
ExecuteWatchResponse, org.elasticsearch.client.watcher.ExecuteWatchResponse> {
@Override
protected ExecuteWatchResponse createServerTestInstance() {
protected ExecuteWatchResponse createServerTestInstance(XContentType xContentType) {
String id = "my_watch_0-2015-06-02T23:17:55.124Z";
try {
XContentBuilder builder = XContentFactory.jsonBuilder();

View File

@ -21,6 +21,7 @@ package org.elasticsearch.client.watcher.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.client.watcher.PutWatchResponse;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
@ -30,7 +31,7 @@ public class PutWatchResponseTests extends AbstractResponseTestCase<
org.elasticsearch.protocol.xpack.watcher.PutWatchResponse, PutWatchResponse> {
@Override
protected org.elasticsearch.protocol.xpack.watcher.PutWatchResponse createServerTestInstance() {
protected org.elasticsearch.protocol.xpack.watcher.PutWatchResponse createServerTestInstance(XContentType xContentType) {
String id = randomAlphaOfLength(10);
long seqNo = randomNonNegativeLong();
long primaryTerm = randomLongBetween(1, 20);