Skip to content

Commit 4e76198

Browse files
authored
fix spotless (#37508)
1 parent fed1b55 commit 4e76198

4 files changed

Lines changed: 33 additions & 32 deletions

File tree

sdks/java/io/components/src/main/java/org/apache/beam/sdk/io/components/deadletterqueue/DLQRouter.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package org.apache.beam.sdk.io.components.deadletterqueue;
1919

20-
2120
import java.util.HashMap;
2221
import java.util.Map;
2322
import org.apache.beam.sdk.transforms.PTransform;
@@ -26,27 +25,33 @@
2625
import org.apache.beam.sdk.values.TupleTag;
2726
import org.checkerframework.checker.nullness.qual.NonNull;
2827

29-
public class DLQRouter<T, K> extends PTransform<@NonNull PCollectionTuple, @NonNull PCollection<T>> {
28+
public class DLQRouter<T, K>
29+
extends PTransform<@NonNull PCollectionTuple, @NonNull PCollection<T>> {
3030

3131
private final TupleTag<T> goodMessages;
3232

3333
private final TupleTag<K> badMessages;
3434

35-
private final PTransform<@NonNull PCollection<K>,?> errorSink;
35+
private final PTransform<@NonNull PCollection<K>, ?> errorSink;
3636

37-
public DLQRouter (TupleTag<T> goodMessages, TupleTag<K> badMessages, PTransform<@NonNull PCollection<K>,?> errorSink){
37+
public DLQRouter(
38+
TupleTag<T> goodMessages,
39+
TupleTag<K> badMessages,
40+
PTransform<@NonNull PCollection<K>, ?> errorSink) {
3841
this.goodMessages = goodMessages;
3942
this.badMessages = badMessages;
4043
this.errorSink = errorSink;
4144
}
45+
4246
@Override
4347
public PCollection<T> expand(@NonNull PCollectionTuple input) {
44-
//validate no extra messages are dropped
45-
Map<TupleTag<?>,PCollection<?>> pcollections = new HashMap<>(input.getAll());
48+
// validate no extra messages are dropped
49+
Map<TupleTag<?>, PCollection<?>> pcollections = new HashMap<>(input.getAll());
4650
pcollections.remove(goodMessages);
4751
pcollections.remove(badMessages);
48-
if (pcollections.size() != 0){
49-
throw new IllegalArgumentException("DLQ Router only supports PCollectionTuples split between two message groupings");
52+
if (pcollections.size() != 0) {
53+
throw new IllegalArgumentException(
54+
"DLQ Router only supports PCollectionTuples split between two message groupings");
5055
}
5156

5257
input.get(badMessages).apply(errorSink);

sdks/java/io/components/src/main/java/org/apache/beam/sdk/io/components/deadletterqueue/sinks/ThrowingSink.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package org.apache.beam.sdk.io.components.deadletterqueue.sinks;
1919

20-
2120
import org.apache.beam.repackaged.core.org.apache.commons.lang3.ObjectUtils.Null;
2221
import org.apache.beam.sdk.transforms.DoFn;
2322
import org.apache.beam.sdk.transforms.PTransform;
@@ -38,7 +37,7 @@ public PDone expand(@NonNull PCollection<T> input) {
3837
public class ThrowingDoFn extends DoFn<T, Null> {
3938

4039
@ProcessElement
41-
public void processElement(@Element @NonNull T element){
40+
public void processElement(@Element @NonNull T element) {
4241
throw new RuntimeException(element.toString());
4342
}
4443
}

sdks/java/io/components/src/main/java/org/apache/beam/sdk/io/components/throttling/ThrottlingSignaler.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
import org.apache.beam.sdk.metrics.Counter;
2121
import org.apache.beam.sdk.metrics.Metrics;
22+
2223
/**
23-
* The ThrottlingSignaler is a utility class for IOs to signal to the runner
24-
* that a process is being throttled, preventing autoscaling. This is primarily
25-
* used when making calls to a remote service where quotas and rate limiting
26-
* are reasonable considerations.
24+
* The ThrottlingSignaler is a utility class for IOs to signal to the runner that a process is being
25+
* throttled, preventing autoscaling. This is primarily used when making calls to a remote service
26+
* where quotas and rate limiting are reasonable considerations.
2727
*/
2828
public class ThrottlingSignaler {
2929
private final Counter throttleCounter;
@@ -37,8 +37,7 @@ public ThrottlingSignaler() {
3737
}
3838

3939
/**
40-
* Signal that a transform has been throttled for an amount of time
41-
* represented in milliseconds.
40+
* Signal that a transform has been throttled for an amount of time represented in milliseconds.
4241
*/
4342
public void signalThrottling(long milliseconds) {
4443
throttleCounter.inc(milliseconds);

sdks/java/io/components/src/test/java/org/apache/beam/sdk/io/components/deadletterqueue/DLQRouterTest.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package org.apache.beam.sdk.io.components.deadletterqueue;
1919

20-
2120
import org.apache.beam.sdk.io.components.deadletterqueue.sinks.ThrowingSink;
2221
import org.apache.beam.sdk.testing.PAssert;
2322
import org.apache.beam.sdk.testing.TestPipeline;
@@ -31,46 +30,45 @@
3130

3231
public class DLQRouterTest {
3332

34-
@Rule
35-
public final transient TestPipeline p = TestPipeline.create();
33+
@Rule public final transient TestPipeline p = TestPipeline.create();
3634

3735
@Rule public ExpectedException thrown = ExpectedException.none();
3836

39-
4037
@Test
41-
public void testExceptionWithInvalidConfiguration(){
38+
public void testExceptionWithInvalidConfiguration() {
4239
thrown.expect(IllegalArgumentException.class);
43-
thrown.expectMessage("DLQ Router only supports PCollectionTuples split between two message groupings");
40+
thrown.expectMessage(
41+
"DLQ Router only supports PCollectionTuples split between two message groupings");
4442

4543
TupleTag<String> tag1 = new TupleTag<>();
4644
TupleTag<String> tag2 = new TupleTag<>();
4745
TupleTag<String> tag3 = new TupleTag<>();
48-
PCollectionTuple tuple = PCollectionTuple.of(tag1, p.apply(Create.<String>of("elem1")))
49-
.and(tag2, p.apply(Create.<String>of("elem2")))
50-
.and(tag3, p.apply(Create.<String>of("elem1")));
46+
PCollectionTuple tuple =
47+
PCollectionTuple.of(tag1, p.apply(Create.<String>of("elem1")))
48+
.and(tag2, p.apply(Create.<String>of("elem2")))
49+
.and(tag3, p.apply(Create.<String>of("elem1")));
5150
tuple.apply(new DLQRouter<>(tag1, tag2, new ThrowingSink<>()));
5251

5352
p.run();
54-
5553
}
5654

5755
@Test
58-
public void testExpectCorrectRouting(){
56+
public void testExpectCorrectRouting() {
5957
thrown.expect(RuntimeException.class);
6058
thrown.expectMessage("elem2");
6159

6260
TupleTag<String> tag1 = new TupleTag<>();
6361
TupleTag<String> tag2 = new TupleTag<>();
6462

65-
PCollectionTuple tuple = PCollectionTuple.of(tag1, p.apply("create elem1", Create.<String>of("elem1")))
66-
.and(tag2, p.apply("create elem2", Create.<String>of("elem2")));
63+
PCollectionTuple tuple =
64+
PCollectionTuple.of(tag1, p.apply("create elem1", Create.<String>of("elem1")))
65+
.and(tag2, p.apply("create elem2", Create.<String>of("elem2")));
6766

68-
PCollection<String> expectedElement = tuple.apply(new DLQRouter<>(tag1, tag2, new ThrowingSink<>()));
67+
PCollection<String> expectedElement =
68+
tuple.apply(new DLQRouter<>(tag1, tag2, new ThrowingSink<>()));
6969

7070
PAssert.thatSingleton(expectedElement).isEqualTo("elem1");
7171

7272
p.run();
7373
}
74-
75-
7674
}

0 commit comments

Comments
 (0)