Here are the examples of the java api org.apache.flink.shaded.curator.org.apache.curator.shaded.com.google.common.collect.Lists.newArrayList() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
20 Examples
18
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateFollowedByAny() throws Exception {
TestEvent event = new TestEvent();
event.setEventType("A");
event.setAttribute("attribute", "testabc");
TestEvent event2 = new TestEvent();
event2.setEventType("C");
event2.setAttribute("attribute", "testabc2");
TestEvent event3 = new TestEvent();
event3.setEventType("B");
event3.setAttribute("attribute", 30);
executeTest("A(attribute='testabc') ->> B(attribute=30)", Lists.newArrayList(event, event2, event3));
}
17
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateNextPatternAndFail() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", "testabc");
event.setEventType("A");
TestEvent event2 = new TestEvent();
event2.setAttribute("attribute", "testabc2");
event2.setEventType("A");
TestEvent event3 = new TestEvent();
event3.setAttribute("attribute", 30);
event3.setEventType("B");
executeTest("A(attribute='testabc') B(attribute=30)", Lists.newArrayList(event, event2, event3));
replacedertThat(results.size(), is(0));
}
17
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateFollowedByPattern() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", "testabc");
event.setEventType("A");
TestEvent event2 = new TestEvent();
event2.setEventType("B");
event2.setAttribute("attribute", "testabc2");
TestEvent event3 = new TestEvent();
event3.setEventType("B");
event3.setAttribute("attribute", 30);
executeTest("A(attribute='testabc') -> B(attribute=30)", Lists.newArrayList(event, event2, event3));
replacedertThat(results.size(), is(2));
}
17
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateNextPattern() throws Exception {
TestEvent event = new TestEvent();
event.setEventType("A");
event.setAttribute("attribute", "testabc");
TestEvent event2 = new TestEvent();
event2.setEventType("B");
event2.setAttribute("attribute", 30);
executeTest("A(attribute='testabc') B(attribute=30)", Lists.newArrayList(event, event2));
replacedertThat(results.size(), is(2));
}
17
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateUntilCondition() throws Exception {
TestEvent initial = new TestEvent();
initial.setAttribute("attribute", "test");
initial.setEventType("B");
TestEvent event = new TestEvent();
event.setAttribute("attribute", "testabc");
event.setAttribute("stop", false);
event.setEventType("A");
TestEvent event2 = new TestEvent();
event2.setEventType("A");
event2.setAttribute("attribute", "testabc");
event2.setAttribute("stop", false);
TestEvent event3 = new TestEvent();
event3.setEventType("A");
event3.setAttribute("attribute", "testabc");
event3.setAttribute("stop", true);
String pattern = " B(attribute='test') A{2,+}?(attribute='testabc')[stop=true]";
executeTest(pattern, Lists.newArrayList(initial, event, event2, event3));
replacedertThat(results.size(), is(2));
replacedertThat(results.get("A").size(), is(2));
}
17
Source : Expression.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
private Object getValue(IterativeCondition.Context<Event> context) {
if (Strings.isNullOrEmpty(valueClreplacedIdentifier) || Strings.isNullOrEmpty(valueAttribute)) {
return value;
}
try {
List<Event> contextEvents = Lists.newArrayList(context.getEventsForPattern(valueClreplacedIdentifier));
if (contextEvents.size() > 0) {
Event first = contextEvents.get(0);
return first.getAttribute(valueAttribute).orElseThrow((Supplier<Throwable>) () -> new RuntimeException("Attribute does not exist"));
}
} catch (Throwable throwable) {
throw new RuntimeException(throwable);
}
return null;
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluteOneOptionalOneTestEvent() throws Exception {
TestEvent event2 = new TestEvent();
event2.setAttribute("attribute", 30);
event2.setEventType("B");
executeTest("A{1}(attribute='testabc')? B(attribute=30)", Lists.newArrayList(event2));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("B"), is(true));
replacedertThat(results.get("B").size(), is(1));
replacedertThat(results.containsKey("A"), is(false));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateLowerThan() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", 5);
event.setEventType("A");
executeTest("A(attribute < 10)", Lists.newArrayList(event));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateGreaterThanEquals() throws Exception {
TestEvent event = new TestEvent();
event.setEventType("A");
event.setAttribute("attribute", 10);
executeTest("A(attribute >= 10)", Lists.newArrayList(event));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateGreaterThan() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", 20);
event.setEventType("A");
executeTest("A(attribute > 10)", Lists.newArrayList(event));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateNotEquals() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", 20);
event.setEventType("A");
executeTest("A(attribute != 10)", Lists.newArrayList(event));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateCorrelation() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", "testabc");
event.setAttribute("correlation_id", 10);
event.setEventType("A");
TestEvent event2 = new TestEvent();
event2.setAttribute("attribute", "testabc2");
event2.setAttribute("correlation_id", 10);
event2.setEventType("B");
executeTest("A(attribute='testabc') -> B(attribute='testabc2' and correlation_id=A.correlation_id)", Lists.newArrayList(event, event2));
replacedertThat(results.size(), is(2));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
replacedertThat(results.containsKey("B"), is(true));
replacedertThat(results.get("B").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluteTwoOptionalOneTestEvent() throws Exception {
TestEvent event2 = new TestEvent();
event2.setAttribute("attribute", 30);
event2.setEventType("B");
executeTest("A{2}(attribute='testabc')? B(attribute=30)", Lists.newArrayList(event2));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("B"), is(true));
replacedertThat(results.get("B").size(), is(1));
replacedertThat(results.containsKey("A"), is(false));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluteZeroOrMoreOneTestEvent() throws Exception {
TestEvent event2 = new TestEvent();
event2.setAttribute("attribute", 30);
event2.setEventType("B");
executeTest("A*(attribute='testabc') B(attribute=30)", Lists.newArrayList(event2));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("B"), is(true));
replacedertThat(results.get("B").size(), is(1));
replacedertThat(results.containsKey("A"), is(false));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateAndExpression() throws Exception {
TestEvent event = new TestEvent();
event.setEventType("A");
event.setAttribute("attribute", "testabc");
event.setAttribute("correlation_id", 10);
TestEvent event2 = new TestEvent();
event2.setEventType("B");
event2.setAttribute("attribute", "testabc2");
event2.setAttribute("correlation_id", 10);
executeTest("A(attribute='testabc') -> B(attribute='testabc2' and correlation_id=10)", Lists.newArrayList(event, event2));
replacedertThat(results.size(), is(2));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
replacedertThat(results.containsKey("B"), is(true));
replacedertThat(results.get("B").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluteZeroOrMoreTwoTestEvents() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", "testabc");
event.setEventType("A");
TestEvent event2 = new TestEvent();
event2.setAttribute("attribute", 30);
event2.setEventType("B");
executeTest("A*(attribute='testabc') B(attribute=30)", Lists.newArrayList(event, event2));
replacedertThat(results.size(), is(2));
replacedertThat(results.containsKey("B"), is(true));
replacedertThat(results.get("B").size(), is(1));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateTimesOrMoreThreeGreedyOptional() throws Exception {
TestEvent event2 = new TestEvent();
event2.setAttribute("attribute", 30);
event2.setEventType("B");
executeTest("A{2,+}?(attribute='testabc')? B(attribute=30)", Lists.newArrayList(event2));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("A"), is(false));
replacedertThat(results.containsKey("B"), is(true));
replacedertThat(results.get("B").size(), is(1));
}
16
Source : PatternEvaluationTests.java
with Apache License 2.0
from phil3k3
with Apache License 2.0
from phil3k3
@Test
public void shouldEvaluateLowerThanEquals() throws Exception {
TestEvent event = new TestEvent();
event.setAttribute("attribute", 10);
event.setEventType("A");
executeTest("A(attribute <= 10)", Lists.newArrayList(event));
replacedertThat(results.size(), is(1));
replacedertThat(results.containsKey("A"), is(true));
replacedertThat(results.get("A").size(), is(1));
}
16
Source : MapStateReadingTest.java
with Apache License 2.0
from king
with Apache License 2.0
from king
@SuppressWarnings("unchecked")
private void validateCheckpointedStateReading() throws IOException, Exception {
ExecutionEnvironment environment = ExecutionEnvironment.createLocalEnvironment();
Savepoint savepoint = getLastCheckpoint();
OperatorStateReader reader = new OperatorStateReader(environment, savepoint, "hello");
List<Tuple3<Integer, String, Integer>> countState = reader.readKeyedStates(KeyedStateReader.forMapStateEntries("Count", BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO)).collect();
List<Integer> mapValues = reader.readKeyedStates(KeyedStateReader.forMapStateValues("Count", BasicTypeInfo.INT_TYPE_INFO)).collect();
replacedertEquals(Sets.newHashSet(Tuple3.of(1, "1", 2), Tuple3.of(1, "2", 1), Tuple3.of(2, "3", 1)), new HashSet<>(countState));
Collections.sort(mapValues);
replacedertEquals(Lists.newArrayList(1, 1, 2), mapValues);
}
15
Source : TtlStateTest.java
with Apache License 2.0
from king
with Apache License 2.0
from king
@SuppressWarnings("unchecked")
private void validateCheckpointedStateReading() throws IOException, Exception {
ExecutionEnvironment environment = ExecutionEnvironment.createLocalEnvironment();
Savepoint savepoint = getLastCheckpoint();
OperatorStateReader reader = new OperatorStateReader(environment, savepoint, "hello");
List<Tuple3<Integer, String, Integer>> countState = reader.readKeyedStates(KeyedStateReader.forMapStateEntries("Map", BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO)).collect();
List<Integer> mapValues = reader.readKeyedStates(KeyedStateReader.forMapStateValues("Map", BasicTypeInfo.INT_TYPE_INFO, true)).collect();
Collections.sort(mapValues);
replacedertEquals(Lists.newArrayList(1, 1, 2), mapValues);
replacedertEquals(Sets.newHashSet(Tuple3.of(1, "1", 2), Tuple3.of(1, "2", 1), Tuple3.of(2, "3", 1)), new HashSet<>(countState));
List<Tuple2<Integer, List<Integer>>> listState = reader.readKeyedStates(KeyedStateReader.forListStates("List", BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO)).collect();
replacedertEquals(Sets.newHashSet(Tuple2.of(1, Lists.newArrayList(1, 2, 1)), Tuple2.of(2, Lists.newArrayList(3))), new HashSet<>(listState));
List<Tuple2<Integer, Integer>> listStateValues = reader.readKeyedStates(KeyedStateReader.forListStateValues("List", BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO)).collect();
replacedertEquals(Sets.newHashSet(Tuple2.of(1, 1), Tuple2.of(1, 2), Tuple2.of(2, 3)), new HashSet<>(listStateValues));
List<Tuple2<Integer, Integer>> valuePairs = reader.readKeyedStates(KeyedStateReader.forValueStateKVPairs("Val", BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO)).collect();
replacedertEquals(Sets.newHashSet(Tuple2.of(1, 1), Tuple2.of(2, 3)), new HashSet<>(valuePairs));
List<Integer> values = reader.readKeyedStates(KeyedStateReader.forValueStateValues("Val", BasicTypeInfo.INT_TYPE_INFO)).collect();
replacedertEquals(Sets.newHashSet(1, 3), new HashSet<>(values));
}