use of org.apache.heron.api.Config in project heron by twitter.
the class StatefulWindowingTest method main.
/**
* Main method
*/
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException, MalformedURLException {
StatefulWindowingTest statefulWindowingTest = new StatefulWindowingTest(args);
Config conf = new Config();
conf.setTopologyReliabilityMode(Config.TopologyReliabilityMode.EFFECTIVELY_ONCE);
statefulWindowingTest.submit(conf);
}
use of org.apache.heron.api.Config in project heron by twitter.
the class StreamletWithMapAndFlatMapAndFilterAndClone method main.
public static void main(String[] args) throws Exception {
Config conf = new Config();
StreamletWithMapAndFlatMapAndFilterAndClone topology = new StreamletWithMapAndFlatMapAndFilterAndClone(args);
topology.submit(conf);
}
use of org.apache.heron.api.Config in project heron by twitter.
the class GeneralReduceByKeyAndWindowOperatorTest method getReduceByWindowOperator.
@SuppressWarnings({ "rawtypes", "unchecked" })
private GeneralReduceByKeyAndWindowOperator<KeyValue<String, Integer>, String, Integer> getReduceByWindowOperator(Integer identity) {
GeneralReduceByKeyAndWindowOperator<KeyValue<String, Integer>, String, Integer> reduceByWindowOperator = new GeneralReduceByKeyAndWindowOperator<>(x -> x.getKey(), identity, (o, o2) -> o + o2.getValue());
reduceByWindowOperator.prepare(new Config(), PowerMockito.mock(TopologyContext.class), new OutputCollector(new IOutputCollector() {
@Override
public void reportError(Throwable error) {
}
@Override
public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) {
emittedTuples.addAll(tuple);
return null;
}
@Override
public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple) {
}
@Override
public void ack(Tuple input) {
}
@Override
public void fail(Tuple input) {
}
}));
return reduceByWindowOperator;
}
use of org.apache.heron.api.Config in project heron by twitter.
the class JoinOperatorTest method getJoinOperator.
@SuppressWarnings({ "rawtypes", "unchecked" })
private JoinOperator<String, KeyValue<String, String>, KeyValue<String, String>, String> getJoinOperator(JoinType type) {
SerializableFunction<KeyValue<String, String>, String> f = x -> x == null ? "null" : x.getKey();
JoinOperator<String, KeyValue<String, String>, KeyValue<String, String>, String> joinOperator = new JoinOperator(type, "leftComponent", "rightComponent", f, f, (SerializableBiFunction<KeyValue<String, String>, KeyValue<String, String>, String>) (o, o2) -> (o == null ? "null" : o.getValue()) + (o2 == null ? "null" : o2.getValue()));
joinOperator.prepare(new Config(), PowerMockito.mock(TopologyContext.class), new OutputCollector(new IOutputCollector() {
@Override
public void reportError(Throwable error) {
}
@Override
public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) {
emittedTuples.addAll(tuple);
return null;
}
@Override
public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple) {
}
@Override
public void ack(Tuple input) {
}
@Override
public void fail(Tuple input) {
}
}));
return joinOperator;
}
use of org.apache.heron.api.Config in project heron by twitter.
the class KeyByOperatorTest method getKeyByOperator.
@SuppressWarnings({ "rawtypes", "unchecked" })
private KeyByOperator<String, String, Integer> getKeyByOperator() {
KeyByOperator<String, String, Integer> keyByOperator = new KeyByOperator<String, String, Integer>(x -> (Integer.valueOf(x) % 2 == 0) ? "even" : "odd", x -> Integer.valueOf(x));
keyByOperator.prepare(new Config(), PowerMockito.mock(TopologyContext.class), new OutputCollector(new IOutputCollector() {
@Override
public void reportError(Throwable error) {
}
@Override
public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) {
emittedTuples.addAll(tuple);
return null;
}
@Override
public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple) {
}
@Override
public void ack(Tuple input) {
}
@Override
public void fail(Tuple input) {
}
}));
return keyByOperator;
}
Aggregations