From aefe2909c4167c3fcc71d42ba4eeba4287e21821 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Fri, 26 Oct 2018 09:15:35 -0700 Subject: [PATCH] [Style] Remove line length violations from ingest actions (#34886) --- .../main/resources/checkstyle_suppressions.xml | 9 --------- .../ingest/GetPipelineRequestBuilder.java | 3 ++- .../ingest/GetPipelineTransportAction.java | 6 ++++-- .../ingest/PutPipelineTransportAction.java | 3 ++- .../ingest/SimulateExecutionServiceTests.java | 18 ++++++++++++------ .../ingest/SimulatePipelineResponseTests.java | 18 +++++++++++------- .../ingest/WriteableIngestDocumentTests.java | 9 ++++++--- 7 files changed, 37 insertions(+), 29 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 267488e97a0..1da4c0f9fbd 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -91,11 +91,6 @@ - - - - - @@ -299,10 +294,6 @@ - - - - diff --git a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineRequestBuilder.java index f96a5ffbe24..1073086998b 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineRequestBuilder.java @@ -22,7 +22,8 @@ package org.elasticsearch.action.ingest; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.client.ElasticsearchClient; -public class GetPipelineRequestBuilder extends MasterNodeReadOperationRequestBuilder { +public class GetPipelineRequestBuilder + extends MasterNodeReadOperationRequestBuilder { public GetPipelineRequestBuilder(ElasticsearchClient client, GetPipelineAction action) { super(client, action, new GetPipelineRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java index 540f46982a5..db94448fe35 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java @@ -39,7 +39,8 @@ public class GetPipelineTransportAction extends TransportMasterNodeReadAction listener) throws Exception { + protected void masterOperation(GetPipelineRequest request, ClusterState state, ActionListener listener) + throws Exception { listener.onResponse(new GetPipelineResponse(IngestService.getPipelines(state, request.getIds()))); } diff --git a/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java b/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java index 38e1f2fb54b..e7686773a23 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java @@ -70,7 +70,8 @@ public class PutPipelineTransportAction extends TransportMasterNodeAction listener) throws Exception { + protected void masterOperation(PutPipelineRequest request, ClusterState state, ActionListener listener) + throws Exception { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(); nodesInfoRequest.clear(); nodesInfoRequest.ingest(true); diff --git a/server/src/test/java/org/elasticsearch/action/ingest/SimulateExecutionServiceTests.java b/server/src/test/java/org/elasticsearch/action/ingest/SimulateExecutionServiceTests.java index a4320d26411..4c6fb7df620 100644 --- a/server/src/test/java/org/elasticsearch/action/ingest/SimulateExecutionServiceTests.java +++ b/server/src/test/java/org/elasticsearch/action/ingest/SimulateExecutionServiceTests.java @@ -103,7 +103,8 @@ public class SimulateExecutionServiceTests extends ESTestCase { public void testExecuteVerboseItemExceptionWithoutOnFailure() throws Exception { TestProcessor processor1 = new TestProcessor("processor_0", "mock", ingestDocument -> {}); - TestProcessor processor2 = new TestProcessor("processor_1", "mock", ingestDocument -> { throw new RuntimeException("processor failed"); }); + TestProcessor processor2 = new TestProcessor("processor_1", "mock", + ingestDocument -> { throw new RuntimeException("processor failed"); }); TestProcessor processor3 = new TestProcessor("processor_2", "mock", ingestDocument -> {}); Pipeline pipeline = new Pipeline("_id", "_description", version, new CompoundProcessor(processor1, processor2, processor3)); SimulateDocumentResult actualItemResponse = executionService.executeDocument(pipeline, ingestDocument, true); @@ -117,7 +118,8 @@ public class SimulateExecutionServiceTests extends ESTestCase { assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getFailure(), nullValue()); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), not(sameInstance(ingestDocument))); assertIngestDocument(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), ingestDocument); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument().getSourceAndMetadata(), not(sameInstance(ingestDocument.getSourceAndMetadata()))); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument().getSourceAndMetadata(), + not(sameInstance(ingestDocument.getSourceAndMetadata()))); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getProcessorTag(), equalTo("processor_1")); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getIngestDocument(), nullValue()); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getFailure(), instanceOf(RuntimeException.class)); @@ -126,7 +128,8 @@ public class SimulateExecutionServiceTests extends ESTestCase { } public void testExecuteVerboseItemWithOnFailure() throws Exception { - TestProcessor processor1 = new TestProcessor("processor_0", "mock", ingestDocument -> { throw new RuntimeException("processor failed"); }); + TestProcessor processor1 = new TestProcessor("processor_0", "mock", + ingestDocument -> { throw new RuntimeException("processor failed"); }); TestProcessor processor2 = new TestProcessor("processor_1", "mock", ingestDocument -> {}); TestProcessor processor3 = new TestProcessor("processor_2", "mock", ingestDocument -> {}); Pipeline pipeline = new Pipeline("_id", "_description", version, @@ -151,7 +154,8 @@ public class SimulateExecutionServiceTests extends ESTestCase { metadata.put(CompoundProcessor.ON_FAILURE_PROCESSOR_TYPE_FIELD, "mock"); metadata.put(CompoundProcessor.ON_FAILURE_PROCESSOR_TAG_FIELD, "processor_0"); metadata.put(CompoundProcessor.ON_FAILURE_MESSAGE_FIELD, "processor failed"); - assertIngestDocument(simulateDocumentVerboseResult.getProcessorResults().get(1).getIngestDocument(), ingestDocumentWithOnFailureMetadata); + assertIngestDocument(simulateDocumentVerboseResult.getProcessorResults().get(1).getIngestDocument(), + ingestDocumentWithOnFailureMetadata); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(1).getFailure(), nullValue()); @@ -175,7 +179,8 @@ public class SimulateExecutionServiceTests extends ESTestCase { assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getFailure(), sameInstance(exception)); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), not(sameInstance(ingestDocument))); assertIngestDocument(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), ingestDocument); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument().getSourceAndMetadata(), not(sameInstance(ingestDocument.getSourceAndMetadata()))); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument().getSourceAndMetadata(), + not(sameInstance(ingestDocument.getSourceAndMetadata()))); } public void testExecuteVerboseItemWithoutExceptionAndWithIgnoreFailure() throws Exception { @@ -191,7 +196,8 @@ public class SimulateExecutionServiceTests extends ESTestCase { assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getFailure(), nullValue()); assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), not(sameInstance(ingestDocument))); assertIngestDocument(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument(), ingestDocument); - assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument().getSourceAndMetadata(), not(sameInstance(ingestDocument.getSourceAndMetadata()))); + assertThat(simulateDocumentVerboseResult.getProcessorResults().get(0).getIngestDocument().getSourceAndMetadata(), + not(sameInstance(ingestDocument.getSourceAndMetadata()))); } public void testExecuteItemWithFailure() throws Exception { diff --git a/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java b/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java index 65f82ceacff..5b85761d44a 100644 --- a/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java @@ -56,11 +56,14 @@ public class SimulatePipelineResponseTests extends AbstractXContentTestCase expectedResultIterator = response.getResults().iterator(); for (SimulateDocumentResult result : otherResponse.getResults()) { if (isVerbose) { - SimulateDocumentVerboseResult expectedSimulateDocumentVerboseResult = (SimulateDocumentVerboseResult) expectedResultIterator.next(); + SimulateDocumentVerboseResult expectedSimulateDocumentVerboseResult = + (SimulateDocumentVerboseResult) expectedResultIterator.next(); assertThat(result, instanceOf(SimulateDocumentVerboseResult.class)); SimulateDocumentVerboseResult simulateDocumentVerboseResult = (SimulateDocumentVerboseResult) result; - assertThat(simulateDocumentVerboseResult.getProcessorResults().size(), equalTo(expectedSimulateDocumentVerboseResult.getProcessorResults().size())); - Iterator expectedProcessorResultIterator = expectedSimulateDocumentVerboseResult.getProcessorResults().iterator(); + assertThat(simulateDocumentVerboseResult.getProcessorResults().size(), + equalTo(expectedSimulateDocumentVerboseResult.getProcessorResults().size())); + Iterator expectedProcessorResultIterator = + expectedSimulateDocumentVerboseResult.getProcessorResults().iterator(); for (SimulateProcessorResult simulateProcessorResult : simulateDocumentVerboseResult.getProcessorResults()) { SimulateProcessorResult expectedProcessorResult = expectedProcessorResultIterator.next(); assertThat(simulateProcessorResult.getProcessorTag(), equalTo(expectedProcessorResult.getProcessorTag())); @@ -80,7 +83,8 @@ public class SimulatePipelineResponseTests extends AbstractXContentTestCase instanceSupplier = SimulatePipelineResponseTests::createTestInstanceWithFailures; //exceptions are not of the same type whenever parsed back boolean assertToXContentEquivalence = false; - AbstractXContentTestCase.testFromXContent(NUMBER_OF_TEST_RUNS, instanceSupplier, supportsUnknownFields(), getShuffleFieldsExceptions(), - getRandomFieldsExcludeFilter(), this::createParser, this::doParseInstance, - this::assertEqualInstances, assertToXContentEquivalence, getToXContentParams()); + AbstractXContentTestCase.testFromXContent(NUMBER_OF_TEST_RUNS, instanceSupplier, supportsUnknownFields(), + getShuffleFieldsExceptions(), getRandomFieldsExcludeFilter(), this::createParser, this::doParseInstance, + this::assertEqualInstances, assertToXContentEquivalence, getToXContentParams()); } } diff --git a/server/src/test/java/org/elasticsearch/action/ingest/WriteableIngestDocumentTests.java b/server/src/test/java/org/elasticsearch/action/ingest/WriteableIngestDocumentTests.java index bc4589ff5d3..93a48817077 100644 --- a/server/src/test/java/org/elasticsearch/action/ingest/WriteableIngestDocumentTests.java +++ b/server/src/test/java/org/elasticsearch/action/ingest/WriteableIngestDocumentTests.java @@ -88,7 +88,8 @@ public class WriteableIngestDocumentTests extends AbstractXContentTestCase