Search in sources :

Example 1 with SinkProcessors.writeMapP

use of com.hazelcast.jet.core.processor.SinkProcessors.writeMapP in project hazelcast by hazelcast.

the class HazelcastConnectorTest method test_writeMapWithNearCache.

@Test
public void test_writeMapWithNearCache() {
    List<Integer> items = range(0, ENTRY_COUNT).boxed().collect(toList());
    sinkName = "nearCache-" + randomName();
    DAG dag = new DAG();
    Vertex src = dag.newVertex("src", () -> new TestProcessors.ListSource(items)).localParallelism(1);
    Vertex sink = dag.newVertex("sink", SinkProcessors.writeMapP(sinkName, i -> i, i -> i));
    dag.edge(between(src, sink));
    instance().getJet().newJob(dag).join();
    IMap<Object, Object> sinkMap = instance().getMap(sinkName);
    assertInstanceOf(NearCachedMapProxyImpl.class, sinkMap);
    assertEquals(ENTRY_COUNT, sinkMap.size());
}
Also used : ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) IntStream.range(java.util.stream.IntStream.range) QuickTest(com.hazelcast.test.annotation.QuickTest) SourceProcessors.readMapP(com.hazelcast.jet.core.processor.SourceProcessors.readMapP) SourceProcessors.readListP(com.hazelcast.jet.core.processor.SourceProcessors.readListP) SourceProcessors.streamCacheP(com.hazelcast.jet.core.processor.SourceProcessors.streamCacheP) EventJournalCacheEvent(com.hazelcast.cache.EventJournalCacheEvent) TruePredicate(com.hazelcast.query.impl.predicates.TruePredicate) Map(java.util.Map) SinkProcessors.writeCacheP(com.hazelcast.jet.core.processor.SinkProcessors.writeCacheP) DAG(com.hazelcast.jet.core.DAG) ICacheManager(com.hazelcast.core.ICacheManager) Projections(com.hazelcast.projection.Projections) SourceProcessors.readCacheP(com.hazelcast.jet.core.processor.SourceProcessors.readCacheP) SimpleTestInClusterSupport(com.hazelcast.jet.SimpleTestInClusterSupport) EventTimePolicy.noEventTime(com.hazelcast.jet.core.EventTimePolicy.noEventTime) START_FROM_OLDEST(com.hazelcast.jet.pipeline.JournalInitialPosition.START_FROM_OLDEST) Category(org.junit.experimental.categories.Category) Collectors.joining(java.util.stream.Collectors.joining) List(java.util.List) NearCacheConfig(com.hazelcast.config.NearCacheConfig) EventJournalMapEvent(com.hazelcast.map.EventJournalMapEvent) Assert.assertFalse(org.junit.Assert.assertFalse) SinkProcessors(com.hazelcast.jet.core.processor.SinkProcessors) Entry(java.util.Map.Entry) SinkProcessors.writeMapP(com.hazelcast.jet.core.processor.SinkProcessors.writeMapP) IntStream(java.util.stream.IntStream) NearCachedMapProxyImpl(com.hazelcast.map.impl.proxy.NearCachedMapProxyImpl) BeforeClass(org.junit.BeforeClass) SourceProcessors(com.hazelcast.jet.core.processor.SourceProcessors) TestProcessors(com.hazelcast.jet.core.TestProcessors) Util.entry(com.hazelcast.jet.Util.entry) Job(com.hazelcast.jet.Job) Before(org.junit.Before) IList(com.hazelcast.collection.IList) Config(com.hazelcast.config.Config) SourceProcessors.streamMapP(com.hazelcast.jet.core.processor.SourceProcessors.streamMapP) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) WatermarkPolicy.limitingLag(com.hazelcast.jet.core.WatermarkPolicy.limitingLag) Vertex(com.hazelcast.jet.core.Vertex) Collectors.toList(java.util.stream.Collectors.toList) Predicates(com.hazelcast.query.Predicates) ICache(com.hazelcast.cache.ICache) EventTimePolicy.eventTimePolicy(com.hazelcast.jet.core.EventTimePolicy.eventTimePolicy) Util.mapPutEvents(com.hazelcast.jet.Util.mapPutEvents) Assert.assertEquals(org.junit.Assert.assertEquals) IMap(com.hazelcast.map.IMap) Edge.between(com.hazelcast.jet.core.Edge.between) SinkProcessors.writeListP(com.hazelcast.jet.core.processor.SinkProcessors.writeListP) Vertex(com.hazelcast.jet.core.Vertex) DAG(com.hazelcast.jet.core.DAG) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

EventJournalCacheEvent (com.hazelcast.cache.EventJournalCacheEvent)1 ICache (com.hazelcast.cache.ICache)1 IList (com.hazelcast.collection.IList)1 Config (com.hazelcast.config.Config)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 ICacheManager (com.hazelcast.core.ICacheManager)1 Job (com.hazelcast.jet.Job)1 SimpleTestInClusterSupport (com.hazelcast.jet.SimpleTestInClusterSupport)1 Util.entry (com.hazelcast.jet.Util.entry)1 Util.mapPutEvents (com.hazelcast.jet.Util.mapPutEvents)1 DAG (com.hazelcast.jet.core.DAG)1 Edge.between (com.hazelcast.jet.core.Edge.between)1 EventTimePolicy.eventTimePolicy (com.hazelcast.jet.core.EventTimePolicy.eventTimePolicy)1 EventTimePolicy.noEventTime (com.hazelcast.jet.core.EventTimePolicy.noEventTime)1 TestProcessors (com.hazelcast.jet.core.TestProcessors)1 Vertex (com.hazelcast.jet.core.Vertex)1 WatermarkPolicy.limitingLag (com.hazelcast.jet.core.WatermarkPolicy.limitingLag)1 SinkProcessors (com.hazelcast.jet.core.processor.SinkProcessors)1 SinkProcessors.writeCacheP (com.hazelcast.jet.core.processor.SinkProcessors.writeCacheP)1 SinkProcessors.writeListP (com.hazelcast.jet.core.processor.SinkProcessors.writeListP)1