Replace (read|write)PipelineAggregatorBuilder with (read|write)NamedWriteable

This commit is contained in:
Nik Everett 2016-04-18 14:41:28 -04:00
parent 4ba8bce3fd
commit d22603831d
3 changed files with 4 additions and 18 deletions

View File

@ -739,13 +739,6 @@ public abstract class StreamInput extends InputStream {
return null; return null;
} }
/**
* Reads a {@link PipelineAggregatorBuilder} from the current stream
*/
public PipelineAggregatorBuilder<?> readPipelineAggregatorBuilder() throws IOException {
return readNamedWriteable(PipelineAggregatorBuilder.class);
}
/** /**
* Reads a {@link QueryBuilder} from the current stream * Reads a {@link QueryBuilder} from the current stream
*/ */

View File

@ -704,13 +704,6 @@ public abstract class StreamOutput extends OutputStream {
} }
} }
/**
* Writes a {@link PipelineAggregatorBuilder} to the current stream
*/
public void writePipelineAggregatorBuilder(PipelineAggregatorBuilder<?> builder) throws IOException {
writeNamedWriteable(builder);
}
/** /**
* Writes a {@link QueryBuilder} to the current stream * Writes a {@link QueryBuilder} to the current stream
*/ */

View File

@ -256,9 +256,9 @@ public abstract class BasePipelineAggregationTestCase<AF extends PipelineAggrega
public void testSerialization() throws IOException { public void testSerialization() throws IOException {
AF testAgg = createTestAggregatorFactory(); AF testAgg = createTestAggregatorFactory();
try (BytesStreamOutput output = new BytesStreamOutput()) { try (BytesStreamOutput output = new BytesStreamOutput()) {
output.writePipelineAggregatorBuilder(testAgg); output.writeNamedWriteable(testAgg);
try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) { try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) {
PipelineAggregatorBuilder deserializedQuery = in.readPipelineAggregatorBuilder(); PipelineAggregatorBuilder<?> deserializedQuery = in.readNamedWriteable(PipelineAggregatorBuilder.class);
assertEquals(deserializedQuery, testAgg); assertEquals(deserializedQuery, testAgg);
assertEquals(deserializedQuery.hashCode(), testAgg.hashCode()); assertEquals(deserializedQuery.hashCode(), testAgg.hashCode());
assertNotSame(deserializedQuery, testAgg); assertNotSame(deserializedQuery, testAgg);
@ -296,10 +296,10 @@ public abstract class BasePipelineAggregationTestCase<AF extends PipelineAggrega
// argument // argument
private AF copyAggregation(AF agg) throws IOException { private AF copyAggregation(AF agg) throws IOException {
try (BytesStreamOutput output = new BytesStreamOutput()) { try (BytesStreamOutput output = new BytesStreamOutput()) {
output.writePipelineAggregatorBuilder(agg); output.writeNamedWriteable(agg);
try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) { try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
AF secondAgg = (AF) in.readPipelineAggregatorBuilder(); AF secondAgg = (AF) in.readNamedWriteable(PipelineAggregatorBuilder.class);
return secondAgg; return secondAgg;
} }
} }