diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutCalendarActionResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutCalendarActionResponseTests.java index 77d4d788db6..7f486698231 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutCalendarActionResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutCalendarActionResponseTests.java @@ -5,27 +5,46 @@ */ package org.elasticsearch.xpack.core.ml.action; +import org.elasticsearch.client.ml.PutCalendarResponse; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; +import org.elasticsearch.protocol.AbstractHlrcStreamableXContentTestCase; import org.elasticsearch.xpack.core.ml.calendars.Calendar; import org.elasticsearch.xpack.core.ml.calendars.CalendarTests; import java.io.IOException; -public class PutCalendarActionResponseTests extends AbstractStreamableXContentTestCase { +public class PutCalendarActionResponseTests + extends AbstractHlrcStreamableXContentTestCase { @Override protected PutCalendarAction.Response createTestInstance() { return new PutCalendarAction.Response(CalendarTests.testInstance()); } - @Override - protected PutCalendarAction.Response createBlankInstance() { - return new PutCalendarAction.Response(); - } - @Override protected PutCalendarAction.Response doParseInstance(XContentParser parser) throws IOException { return new PutCalendarAction.Response(Calendar.LENIENT_PARSER.parse(parser, null).build()); } + + @Override + protected boolean supportsUnknownFields() { + return true; + } + + @Override + public PutCalendarResponse doHlrcParseInstance(XContentParser parser) throws IOException { + return PutCalendarResponse.fromXContent(parser); + } + + @Override + public PutCalendarAction.Response convertHlrcToInternal(PutCalendarResponse instance) { + org.elasticsearch.client.ml.calendars.Calendar hlrcCalendar = instance.getCalendar(); + Calendar internalCalendar = new Calendar(hlrcCalendar.getId(), hlrcCalendar.getJobIds(), hlrcCalendar.getDescription()); + return new PutCalendarAction.Response(internalCalendar); + } + + @Override + protected PutCalendarAction.Response createBlankInstance() { + return new PutCalendarAction.Response(); + } }