Build opt 22 06 (#2132)
* Drools reformat * Further refactor * Further refactor * Refactor
This commit is contained in:
committed by
GitHub
parent
38dc2041a1
commit
87049b63f4
@@ -35,9 +35,9 @@ public class WordCountIntegrationTest {
|
||||
//then
|
||||
List<Tuple2<String, Integer>> collect = result.collect();
|
||||
assertThat(collect).containsExactlyInAnyOrder(
|
||||
new Tuple2<>("a", 3), new Tuple2<>("sentence", 2), new Tuple2<>("word", 1),
|
||||
new Tuple2<>("is", 2), new Tuple2<>("this", 2), new Tuple2<>("second", 1),
|
||||
new Tuple2<>("first", 1), new Tuple2<>("with", 1), new Tuple2<>("one", 1));
|
||||
new Tuple2<>("a", 3), new Tuple2<>("sentence", 2), new Tuple2<>("word", 1),
|
||||
new Tuple2<>("is", 2), new Tuple2<>("this", 2), new Tuple2<>("second", 1),
|
||||
new Tuple2<>("first", 1), new Tuple2<>("with", 1), new Tuple2<>("one", 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -48,9 +48,9 @@ public class WordCountIntegrationTest {
|
||||
|
||||
//when
|
||||
List<Integer> collect = amounts
|
||||
.filter(a -> a > threshold)
|
||||
.reduce((integer, t1) -> integer + t1)
|
||||
.collect();
|
||||
.filter(a -> a > threshold)
|
||||
.reduce((integer, t1) -> integer + t1)
|
||||
.collect();
|
||||
|
||||
//then
|
||||
assertThat(collect.get(0)).isEqualTo(90);
|
||||
@@ -78,13 +78,13 @@ public class WordCountIntegrationTest {
|
||||
Tuple2<Integer, String> fourthPerson = new Tuple2<>(200, "Michael");
|
||||
Tuple2<Integer, String> firstPerson = new Tuple2<>(1, "Jack");
|
||||
DataSet<Tuple2<Integer, String>> transactions = env.fromElements(fourthPerson, secondPerson,
|
||||
thirdPerson, firstPerson);
|
||||
thirdPerson, firstPerson);
|
||||
|
||||
|
||||
//when
|
||||
List<Tuple2<Integer, String>> sorted = transactions
|
||||
.sortPartition(new IdKeySelectorTransaction(), Order.ASCENDING)
|
||||
.collect();
|
||||
.sortPartition(new IdKeySelectorTransaction(), Order.ASCENDING)
|
||||
.collect();
|
||||
|
||||
//then
|
||||
assertThat(sorted).containsExactly(firstPerson, secondPerson, thirdPerson, fourthPerson);
|
||||
@@ -99,15 +99,15 @@ public class WordCountIntegrationTest {
|
||||
|
||||
Tuple2<Integer, String> firstTransaction = new Tuple2<>(1, "Transaction_1");
|
||||
DataSet<Tuple2<Integer, String>> transactions =
|
||||
env.fromElements(firstTransaction, new Tuple2<>(12, "Transaction_2"));
|
||||
env.fromElements(firstTransaction, new Tuple2<>(12, "Transaction_2"));
|
||||
|
||||
|
||||
//when
|
||||
List<Tuple2<Tuple2<Integer, String>, Tuple3<Integer, String, String>>> joined =
|
||||
transactions.join(addresses)
|
||||
.where(new IdKeySelectorTransaction())
|
||||
.equalTo(new IdKeySelectorAddress())
|
||||
.collect();
|
||||
transactions.join(addresses)
|
||||
.where(new IdKeySelectorTransaction())
|
||||
.equalTo(new IdKeySelectorAddress())
|
||||
.collect();
|
||||
|
||||
//then
|
||||
assertThat(joined).hasSize(1);
|
||||
@@ -121,7 +121,7 @@ public class WordCountIntegrationTest {
|
||||
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
|
||||
|
||||
DataStream<String> text
|
||||
= env.fromElements("This is a first sentence", "This is a second sentence with a one word");
|
||||
= env.fromElements("This is a first sentence", "This is a second sentence with a one word");
|
||||
|
||||
|
||||
SingleOutputStreamOperator<String> upperCase = text.map(String::toUpperCase);
|
||||
@@ -139,8 +139,8 @@ public class WordCountIntegrationTest {
|
||||
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
|
||||
|
||||
SingleOutputStreamOperator<Tuple2<Integer, Long>> windowed = env.fromElements(
|
||||
new Tuple2<>(16, ZonedDateTime.now().plusMinutes(25).toInstant().getEpochSecond()),
|
||||
new Tuple2<>(15, ZonedDateTime.now().plusMinutes(2).toInstant().getEpochSecond())
|
||||
new Tuple2<>(16, ZonedDateTime.now().plusMinutes(25).toInstant().getEpochSecond()),
|
||||
new Tuple2<>(15, ZonedDateTime.now().plusMinutes(2).toInstant().getEpochSecond())
|
||||
).assignTimestampsAndWatermarks(new BoundedOutOfOrdernessTimestampExtractor<Tuple2<Integer, Long>>(Time.seconds(20)) {
|
||||
@Override
|
||||
public long extractTimestamp(Tuple2<Integer, Long> element) {
|
||||
@@ -149,8 +149,8 @@ public class WordCountIntegrationTest {
|
||||
});
|
||||
|
||||
SingleOutputStreamOperator<Tuple2<Integer, Long>> reduced = windowed
|
||||
.windowAll(TumblingEventTimeWindows.of(Time.seconds(5)))
|
||||
.maxBy(0, true);
|
||||
.windowAll(TumblingEventTimeWindows.of(Time.seconds(5)))
|
||||
.maxBy(0, true);
|
||||
|
||||
reduced.print();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user