use of com.hazelcast.jet.core.processor.SourceProcessors in project hazelcast-jet by hazelcast.
the class HazelcastConnectorTest method when_streamCache_withFilterAndProjection.
@Test
public void when_streamCache_withFilterAndProjection() {
DAG dag = new DAG();
Vertex source = dag.newVertex("source", SourceProcessors.<Integer, Integer, Integer>streamCacheP(streamSourceName, event -> !event.getKey().equals(0), EventJournalCacheEvent::getKey, START_FROM_OLDEST, wmGenParams(i -> i, limitingLag(0), noThrottling(), 10_000)));
Vertex sink = dag.newVertex("sink", writeListP(streamSinkName));
dag.edge(between(source, sink));
Job job = jetInstance.newJob(dag);
ICacheJet<Integer, Integer> sourceCache = jetInstance.getCacheManager().getCache(streamSourceName);
range(0, ENTRY_COUNT).forEach(i -> sourceCache.put(i, i));
assertSizeEventually(ENTRY_COUNT - 1, jetInstance.getList(streamSinkName));
assertFalse(jetInstance.getList(streamSinkName).contains(0));
assertTrue(jetInstance.getList(streamSinkName).contains(1));
job.cancel();
}
use of com.hazelcast.jet.core.processor.SourceProcessors in project hazelcast by hazelcast.
the class HazelcastRemoteConnectorTest method when_streamRemoteCache_withPredicateAndProjection.
@Test
public void when_streamRemoteCache_withPredicateAndProjection() {
DAG dag = new DAG();
Vertex source = dag.newVertex(SOURCE_NAME, SourceProcessors.<Integer, Integer, Integer>streamRemoteCacheP(SOURCE_NAME, clientConfig, event -> !event.getKey().equals(0), EventJournalCacheEvent::getKey, START_FROM_OLDEST, eventTimePolicy(i -> i, limitingLag(0), 1, 0, 10_000)));
Vertex sink = dag.newVertex(SINK_NAME, writeListP(SINK_NAME));
dag.edge(between(source, sink));
Job job = localHz.getJet().newJob(dag);
populateCache(remoteHz.getCacheManager().getCache(SOURCE_NAME));
assertSizeEventually(ITEM_COUNT - 1, localHz.getList(SINK_NAME));
assertFalse(localHz.getList(SINK_NAME).contains(0));
assertTrue(localHz.getList(SINK_NAME).contains(1));
job.cancel();
}
use of com.hazelcast.jet.core.processor.SourceProcessors in project hazelcast by hazelcast.
the class HazelcastConnectorTest method when_streamCache_withFilterAndProjection.
@Test
public void when_streamCache_withFilterAndProjection() {
DAG dag = new DAG();
Vertex source = dag.newVertex("source", SourceProcessors.<Integer, Integer, Integer>streamCacheP(streamSourceName, event -> !event.getKey().equals(0), EventJournalCacheEvent::getKey, START_FROM_OLDEST, eventTimePolicy(i -> i, limitingLag(0), 1, 0, 10_000)));
Vertex sink = dag.newVertex("sink", writeListP(streamSinkName));
dag.edge(between(source, sink));
Job job = instance().getJet().newJob(dag);
ICache<Integer, Integer> sourceCache = instance().getCacheManager().getCache(streamSourceName);
range(0, ENTRY_COUNT).forEach(i -> sourceCache.put(i, i));
assertSizeEventually(ENTRY_COUNT - 1, instance().getList(streamSinkName));
assertFalse(instance().getList(streamSinkName).contains(0));
assertTrue(instance().getList(streamSinkName).contains(1));
job.cancel();
}
use of com.hazelcast.jet.core.processor.SourceProcessors in project hazelcast by hazelcast.
the class HazelcastConnectorTest method when_streamMap_withFilterAndProjection.
@Test
public void when_streamMap_withFilterAndProjection() {
DAG dag = new DAG();
Vertex source = dag.newVertex("source", SourceProcessors.<Integer, Integer, Integer>streamMapP(streamSourceName, event -> event.getKey() != 0, EventJournalMapEvent::getKey, START_FROM_OLDEST, eventTimePolicy(i -> i, limitingLag(0), 1, 0, 10_000)));
Vertex sink = dag.newVertex("sink", writeListP(streamSinkName));
dag.edge(between(source, sink));
Job job = instance().getJet().newJob(dag);
IMap<Integer, Integer> sourceMap = instance().getMap(streamSourceName);
range(0, ENTRY_COUNT).forEach(i -> sourceMap.put(i, i));
assertSizeEventually(ENTRY_COUNT - 1, instance().getList(streamSinkName));
assertFalse(instance().getList(streamSinkName).contains(0));
assertTrue(instance().getList(streamSinkName).contains(1));
job.cancel();
}
use of com.hazelcast.jet.core.processor.SourceProcessors in project hazelcast-jet by hazelcast.
the class HazelcastConnectorTest method when_streamMap_withFilterAndProjection.
@Test
public void when_streamMap_withFilterAndProjection() {
DAG dag = new DAG();
Vertex source = dag.newVertex("source", SourceProcessors.<Integer, Integer, Integer>streamMapP(streamSourceName, event -> event.getKey() != 0, EventJournalMapEvent::getKey, START_FROM_OLDEST, wmGenParams(i -> i, limitingLag(0), noThrottling(), 10_000)));
Vertex sink = dag.newVertex("sink", writeListP(streamSinkName));
dag.edge(between(source, sink));
Job job = jetInstance.newJob(dag);
IMapJet<Integer, Integer> sourceMap = jetInstance.getMap(streamSourceName);
range(0, ENTRY_COUNT).forEach(i -> sourceMap.put(i, i));
assertSizeEventually(ENTRY_COUNT - 1, jetInstance.getList(streamSinkName));
assertFalse(jetInstance.getList(streamSinkName).contains(0));
assertTrue(jetInstance.getList(streamSinkName).contains(1));
job.cancel();
}
Aggregations