From 49bfe6410e50621a8be98679aac3bfed7eed6378 Mon Sep 17 00:00:00 2001 From: javanna Date: Tue, 24 Nov 2015 15:49:25 +0100 Subject: [PATCH] Rename Data leftovers --- ...Data.java => WriteableIngestDocument.java} | 16 +++++------ .../SimulateDocumentSimpleResult.java | 22 +++++++-------- .../simulate/SimulateProcessorResult.java | 22 +++++++-------- .../elasticsearch/ingest/IngestClientIT.java | 3 +- ...ataTests.java => IngestDocumentTests.java} | 4 +-- ...java => WriteableIngestDocumentTests.java} | 28 +++++++++---------- .../SimulateDocumentSimpleResultTests.java | 2 +- .../SimulateExecutionServiceTests.java | 18 ++++++------ .../SimulatePipelineResponseTests.java | 4 +-- .../SimulateProcessorResultTests.java | 2 +- 10 files changed, 60 insertions(+), 61 deletions(-) rename plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/{TransportData.java => WriteableIngestDocument.java} (84%) rename plugins/ingest/src/test/java/org/elasticsearch/ingest/{DataTests.java => IngestDocumentTests.java} (99%) rename plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/{TransportDataTests.java => WriteableIngestDocumentTests.java} (67%) diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/TransportData.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/WriteableIngestDocument.java similarity index 84% rename from plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/TransportData.java rename to plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/WriteableIngestDocument.java index bb26161582a..ec7ea798a86 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/TransportData.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/WriteableIngestDocument.java @@ -35,31 +35,31 @@ import static org.elasticsearch.ingest.IngestDocument.MetaData.ID; import static org.elasticsearch.ingest.IngestDocument.MetaData.INDEX; import static org.elasticsearch.ingest.IngestDocument.MetaData.TYPE; -public class TransportData implements Writeable, ToXContent { +public class WriteableIngestDocument implements Writeable, ToXContent { - private static final TransportData PROTOTYPE = new TransportData(null); + private static final WriteableIngestDocument PROTOTYPE = new WriteableIngestDocument(null); private final IngestDocument ingestDocument; - public TransportData(IngestDocument ingestDocument) { + public WriteableIngestDocument(IngestDocument ingestDocument) { this.ingestDocument = ingestDocument; } - public IngestDocument get() { + public IngestDocument getIngestDocument() { return ingestDocument; } - public static TransportData readTransportDataFrom(StreamInput in) throws IOException { + public static WriteableIngestDocument readWriteableIngestDocumentFrom(StreamInput in) throws IOException { return PROTOTYPE.readFrom(in); } @Override - public TransportData readFrom(StreamInput in) throws IOException { + public WriteableIngestDocument readFrom(StreamInput in) throws IOException { String index = in.readString(); String type = in.readString(); String id = in.readString(); Map doc = in.readMap(); - return new TransportData(new IngestDocument(index, type, id, doc)); + return new WriteableIngestDocument(new IngestDocument(index, type, id, doc)); } @Override @@ -90,7 +90,7 @@ public class TransportData implements Writeable, ToXContent { if (o == null || getClass() != o.getClass()) { return false; } - TransportData that = (TransportData) o; + WriteableIngestDocument that = (WriteableIngestDocument) o; return Objects.equals(ingestDocument, that.ingestDocument); } diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResult.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResult.java index 8cf08e3dc61..87f2b42ccaf 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResult.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResult.java @@ -23,7 +23,7 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.ingest.IngestDocument; -import org.elasticsearch.plugin.ingest.transport.TransportData; +import org.elasticsearch.plugin.ingest.transport.WriteableIngestDocument; import java.io.IOException; @@ -31,26 +31,26 @@ public class SimulateDocumentSimpleResult implements SimulateDocumentResult document = new HashMap<>(); document.put("foo", "bar"); document.put("int", 123); diff --git a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/TransportDataTests.java b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/WriteableIngestDocumentTests.java similarity index 67% rename from plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/TransportDataTests.java rename to plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/WriteableIngestDocumentTests.java index 165ea62e1f2..168afa40ccf 100644 --- a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/TransportDataTests.java +++ b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/WriteableIngestDocumentTests.java @@ -31,7 +31,7 @@ import java.util.Map; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; -public class TransportDataTests extends ESTestCase { +public class WriteableIngestDocumentTests extends ESTestCase { public void testEqualsAndHashcode() throws Exception { String index = randomAsciiOfLengthBetween(1, 10); @@ -39,7 +39,7 @@ public class TransportDataTests extends ESTestCase { String id = randomAsciiOfLengthBetween(1, 10); String fieldName = randomAsciiOfLengthBetween(1, 10); String fieldValue = randomAsciiOfLengthBetween(1, 10); - TransportData transportData = new TransportData(new IngestDocument(index, type, id, Collections.singletonMap(fieldName, fieldValue))); + WriteableIngestDocument writeableIngestDocument = new WriteableIngestDocument(new IngestDocument(index, type, id, Collections.singletonMap(fieldName, fieldValue))); boolean changed = false; String otherIndex; @@ -71,28 +71,28 @@ public class TransportDataTests extends ESTestCase { document = Collections.singletonMap(fieldName, fieldValue); } - TransportData otherTransportData = new TransportData(new IngestDocument(otherIndex, otherType, otherId, document)); + WriteableIngestDocument otherWriteableIngestDocument = new WriteableIngestDocument(new IngestDocument(otherIndex, otherType, otherId, document)); if (changed) { - assertThat(transportData, not(equalTo(otherTransportData))); - assertThat(otherTransportData, not(equalTo(transportData))); + assertThat(writeableIngestDocument, not(equalTo(otherWriteableIngestDocument))); + assertThat(otherWriteableIngestDocument, not(equalTo(writeableIngestDocument))); } else { - assertThat(transportData, equalTo(otherTransportData)); - assertThat(otherTransportData, equalTo(transportData)); - TransportData thirdTransportData = new TransportData(new IngestDocument(index, type, id, Collections.singletonMap(fieldName, fieldValue))); - assertThat(thirdTransportData, equalTo(transportData)); - assertThat(transportData, equalTo(thirdTransportData)); + assertThat(writeableIngestDocument, equalTo(otherWriteableIngestDocument)); + assertThat(otherWriteableIngestDocument, equalTo(writeableIngestDocument)); + WriteableIngestDocument thirdWriteableIngestDocument = new WriteableIngestDocument(new IngestDocument(index, type, id, Collections.singletonMap(fieldName, fieldValue))); + assertThat(thirdWriteableIngestDocument, equalTo(writeableIngestDocument)); + assertThat(writeableIngestDocument, equalTo(thirdWriteableIngestDocument)); } } public void testSerialization() throws IOException { IngestDocument ingestDocument = new IngestDocument(randomAsciiOfLengthBetween(1, 10), randomAsciiOfLengthBetween(1, 10), randomAsciiOfLengthBetween(1, 10), Collections.singletonMap(randomAsciiOfLengthBetween(1, 10), randomAsciiOfLengthBetween(1, 10))); - TransportData transportData = new TransportData(ingestDocument); + WriteableIngestDocument writeableIngestDocument = new WriteableIngestDocument(ingestDocument); BytesStreamOutput out = new BytesStreamOutput(); - transportData.writeTo(out); + writeableIngestDocument.writeTo(out); StreamInput streamInput = StreamInput.wrap(out.bytes()); - TransportData otherTransportData = TransportData.readTransportDataFrom(streamInput); - assertThat(otherTransportData, equalTo(transportData)); + WriteableIngestDocument otherWriteableIngestDocument = WriteableIngestDocument.readWriteableIngestDocumentFrom(streamInput); + assertThat(otherWriteableIngestDocument, equalTo(writeableIngestDocument)); } } diff --git a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResultTests.java b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResultTests.java index 183aed0a5a4..7954b4a51a9 100644 --- a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResultTests.java +++ b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateDocumentSimpleResultTests.java @@ -48,7 +48,7 @@ public class SimulateDocumentSimpleResultTests extends ESTestCase { StreamInput streamInput = StreamInput.wrap(out.bytes()); SimulateDocumentSimpleResult otherSimulateDocumentSimpleResult = SimulateDocumentSimpleResult.readSimulateDocumentSimpleResult(streamInput); - assertThat(otherSimulateDocumentSimpleResult.getData(), equalTo(simulateDocumentSimpleResult.getData())); + assertThat(otherSimulateDocumentSimpleResult.getIngestDocument(), equalTo(simulateDocumentSimpleResult.getIngestDocument())); if (isFailure) { assertThat(otherSimulateDocumentSimpleResult.getFailure(), instanceOf(IllegalArgumentException.class)); IllegalArgumentException e = (IllegalArgumentException) otherSimulateDocumentSimpleResult.getFailure(); diff --git a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateExecutionServiceTests.java b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateExecutionServiceTests.java index 901ecb29dca..bc6de44fd5c 100644 --- a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateExecutionServiceTests.java +++ b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateExecutionServiceTests.java @@ -68,12 +68,12 @@ public class SimulateExecutionServiceTests extends ESTestCase { SimulateDocumentVerboseResult simulateDocumentVerboseResult = (SimulateDocumentVerboseResult) actualItemResponse; assertThat(simulateDocumentVerboseResult.getProcessorResults().size(), equalTo(2)); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getProcessorId(), equalTo("processor[mock]-0")); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getData(), not(sameInstance(ingestDocument))); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getData(), equalTo(ingestDocument)); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), not(sameInstance(ingestDocument))); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), equalTo(ingestDocument)); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getFailure(), nullValue()); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getProcessorId(), equalTo("processor[mock]-1")); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getData(), not(sameInstance(ingestDocument))); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getData(), equalTo(ingestDocument)); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getIngestDocument(), not(sameInstance(ingestDocument))); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getIngestDocument(), equalTo(ingestDocument)); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getFailure(), nullValue()); } @@ -82,7 +82,7 @@ public class SimulateExecutionServiceTests extends ESTestCase { verify(processor, times(2)).execute(ingestDocument); assertThat(actualItemResponse, instanceOf(SimulateDocumentSimpleResult.class)); SimulateDocumentSimpleResult simulateDocumentSimpleResult = (SimulateDocumentSimpleResult) actualItemResponse; - assertThat(simulateDocumentSimpleResult.getData(), equalTo(ingestDocument)); + assertThat(simulateDocumentSimpleResult.getIngestDocument(), equalTo(ingestDocument)); assertThat(simulateDocumentSimpleResult.getFailure(), nullValue()); } @@ -95,13 +95,13 @@ public class SimulateExecutionServiceTests extends ESTestCase { SimulateDocumentVerboseResult simulateDocumentVerboseResult = (SimulateDocumentVerboseResult) actualItemResponse; assertThat(simulateDocumentVerboseResult.getProcessorResults().size(), equalTo(2)); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getProcessorId(), equalTo("processor[mock]-0")); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getData(), nullValue()); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), nullValue()); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getFailure(), instanceOf(RuntimeException.class)); RuntimeException runtimeException = (RuntimeException) simulateDocumentVerboseResult.getProcessorResults().get(0).getFailure(); assertThat(runtimeException.getMessage(), equalTo("processor failed")); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getProcessorId(), equalTo("processor[mock]-1")); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getData(), not(sameInstance(ingestDocument))); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getData(), equalTo(ingestDocument)); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getIngestDocument(), not(sameInstance(ingestDocument))); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getIngestDocument(), equalTo(ingestDocument)); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getFailure(), nullValue()); runtimeException = (RuntimeException) simulateDocumentVerboseResult.getProcessorResults().get(0).getFailure(); assertThat(runtimeException.getMessage(), equalTo("processor failed")); @@ -114,7 +114,7 @@ public class SimulateExecutionServiceTests extends ESTestCase { verify(processor, times(1)).execute(ingestDocument); assertThat(actualItemResponse, instanceOf(SimulateDocumentSimpleResult.class)); SimulateDocumentSimpleResult simulateDocumentSimpleResult = (SimulateDocumentSimpleResult) actualItemResponse; - assertThat(simulateDocumentSimpleResult.getData(), nullValue()); + assertThat(simulateDocumentSimpleResult.getIngestDocument(), nullValue()); assertThat(simulateDocumentSimpleResult.getFailure(), instanceOf(RuntimeException.class)); RuntimeException runtimeException = (RuntimeException) simulateDocumentSimpleResult.getFailure(); assertThat(runtimeException.getMessage(), equalTo("processor failed")); diff --git a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineResponseTests.java b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineResponseTests.java index ab7803c719d..1e4ca765970 100644 --- a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineResponseTests.java +++ b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineResponseTests.java @@ -91,7 +91,7 @@ public class SimulatePipelineResponseTests extends ESTestCase { for (SimulateProcessorResult simulateProcessorResult : simulateDocumentVerboseResult.getProcessorResults()) { SimulateProcessorResult expectedProcessorResult = expectedProcessorResultIterator.next(); assertThat(simulateProcessorResult.getProcessorId(), equalTo(expectedProcessorResult.getProcessorId())); - assertThat(simulateProcessorResult.getData(), equalTo(expectedProcessorResult.getData())); + assertThat(simulateProcessorResult.getIngestDocument(), equalTo(expectedProcessorResult.getIngestDocument())); if (expectedProcessorResult.getFailure() == null) { assertThat(simulateProcessorResult.getFailure(), nullValue()); } else { @@ -104,7 +104,7 @@ public class SimulatePipelineResponseTests extends ESTestCase { SimulateDocumentSimpleResult expectedSimulateDocumentSimpleResult = (SimulateDocumentSimpleResult) expectedResultIterator.next(); assertThat(result, instanceOf(SimulateDocumentSimpleResult.class)); SimulateDocumentSimpleResult simulateDocumentSimpleResult = (SimulateDocumentSimpleResult) result; - assertThat(simulateDocumentSimpleResult.getData(), equalTo(expectedSimulateDocumentSimpleResult.getData())); + assertThat(simulateDocumentSimpleResult.getIngestDocument(), equalTo(expectedSimulateDocumentSimpleResult.getIngestDocument())); if (expectedSimulateDocumentSimpleResult.getFailure() == null) { assertThat(simulateDocumentSimpleResult.getFailure(), nullValue()); } else { diff --git a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateProcessorResultTests.java b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateProcessorResultTests.java index d347c6749e3..7f7925f451e 100644 --- a/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateProcessorResultTests.java +++ b/plugins/ingest/src/test/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulateProcessorResultTests.java @@ -49,7 +49,7 @@ public class SimulateProcessorResultTests extends ESTestCase { StreamInput streamInput = StreamInput.wrap(out.bytes()); SimulateProcessorResult otherSimulateProcessorResult = SimulateProcessorResult.readSimulateProcessorResultFrom(streamInput); assertThat(otherSimulateProcessorResult.getProcessorId(), equalTo(simulateProcessorResult.getProcessorId())); - assertThat(otherSimulateProcessorResult.getData(), equalTo(simulateProcessorResult.getData())); + assertThat(otherSimulateProcessorResult.getIngestDocument(), equalTo(simulateProcessorResult.getIngestDocument())); if (isFailure) { assertThat(otherSimulateProcessorResult.getFailure(), instanceOf(IllegalArgumentException.class)); IllegalArgumentException e = (IllegalArgumentException) otherSimulateProcessorResult.getFailure();