Search in sources :

Example 1 with SlidingWindowDef

use of com.hazelcast.jet.pipeline.SlidingWindowDef in project hazelcast-jet by hazelcast.

the class WindowAggregateTransform_IntegrationTest method testWindowDefinition.

@Test
public void testWindowDefinition() {
    Pipeline p = Pipeline.create();
    SlidingWindowDef tumbling = WindowDefinition.tumbling(2);
    StageWithWindow<Entry<Long, String>> stage = p.drawFrom(Sources.<Long, String>mapJournal("source", START_FROM_OLDEST)).window(tumbling);
    assertEquals(tumbling, stage.windowDefinition());
}
Also used : Entry(java.util.Map.Entry) SlidingWindowDef(com.hazelcast.jet.pipeline.SlidingWindowDef) TestSupport.listToString(com.hazelcast.jet.core.test.TestSupport.listToString) Pipeline(com.hazelcast.jet.pipeline.Pipeline) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 2 with SlidingWindowDef

use of com.hazelcast.jet.pipeline.SlidingWindowDef in project hazelcast-jet by hazelcast.

the class WindowGroupTransform_IntegrationTest method testWindowDefinition.

@Test
public void testWindowDefinition() {
    Pipeline p = Pipeline.create();
    SlidingWindowDef tumbling = WindowDefinition.tumbling(2);
    StageWithGroupingAndWindow<Entry<Long, String>, Character> stage = p.drawFrom(Sources.<Long, String>mapJournal("source", START_FROM_OLDEST)).groupingKey(entry -> entry.getValue().charAt(0)).window(tumbling);
    assertEquals(tumbling, stage.windowDefinition());
}
Also used : JetInstance(com.hazelcast.jet.JetInstance) GroupProperty(com.hazelcast.spi.properties.GroupProperty) RunWith(org.junit.runner.RunWith) EventJournalConfig(com.hazelcast.config.EventJournalConfig) TestUtil.set(com.hazelcast.jet.core.TestUtil.set) HashSet(java.util.HashSet) ThreeBags(com.hazelcast.jet.datamodel.ThreeBags) AggregateOperation(com.hazelcast.jet.aggregate.AggregateOperation) SlidingWindowDef(com.hazelcast.jet.pipeline.SlidingWindowDef) Util.entry(com.hazelcast.jet.Util.entry) Arrays.asList(java.util.Arrays.asList) WindowGroupAggregateBuilder(com.hazelcast.jet.pipeline.WindowGroupAggregateBuilder) StageWithGroupingAndWindow(com.hazelcast.jet.pipeline.StageWithGroupingAndWindow) IList(com.hazelcast.core.IList) Before(org.junit.Before) AggregateOperations.toThreeBags(com.hazelcast.jet.aggregate.AggregateOperations.toThreeBags) JetConfig(com.hazelcast.jet.config.JetConfig) WindowDefinition(com.hazelcast.jet.pipeline.WindowDefinition) Pipeline(com.hazelcast.jet.pipeline.Pipeline) JetTestSupport(com.hazelcast.jet.core.JetTestSupport) AggregateOperations.toTwoBags(com.hazelcast.jet.aggregate.AggregateOperations.toTwoBags) AggregateOperations.toSet(com.hazelcast.jet.aggregate.AggregateOperations.toSet) Tag(com.hazelcast.jet.datamodel.Tag) Sinks(com.hazelcast.jet.pipeline.Sinks) Test(org.junit.Test) START_FROM_OLDEST(com.hazelcast.jet.pipeline.JournalInitialPosition.START_FROM_OLDEST) ParallelTest(com.hazelcast.test.annotation.ParallelTest) Category(org.junit.experimental.categories.Category) Sources(com.hazelcast.jet.pipeline.Sources) IMap(com.hazelcast.core.IMap) JournalInitialPosition(com.hazelcast.jet.pipeline.JournalInitialPosition) StreamStageWithGrouping(com.hazelcast.jet.pipeline.StreamStageWithGrouping) HazelcastParallelClassRunner(com.hazelcast.test.HazelcastParallelClassRunner) Entry(java.util.Map.Entry) TwoBags(com.hazelcast.jet.datamodel.TwoBags) Assert.assertEquals(org.junit.Assert.assertEquals) TimestampedEntry(com.hazelcast.jet.datamodel.TimestampedEntry) WindowResult(com.hazelcast.jet.datamodel.WindowResult) TestSupport.listToString(com.hazelcast.jet.core.test.TestSupport.listToString) Entry(java.util.Map.Entry) TimestampedEntry(com.hazelcast.jet.datamodel.TimestampedEntry) SlidingWindowDef(com.hazelcast.jet.pipeline.SlidingWindowDef) Pipeline(com.hazelcast.jet.pipeline.Pipeline) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

TestSupport.listToString (com.hazelcast.jet.core.test.TestSupport.listToString)2 Pipeline (com.hazelcast.jet.pipeline.Pipeline)2 SlidingWindowDef (com.hazelcast.jet.pipeline.SlidingWindowDef)2 ParallelTest (com.hazelcast.test.annotation.ParallelTest)2 Entry (java.util.Map.Entry)2 Test (org.junit.Test)2 EventJournalConfig (com.hazelcast.config.EventJournalConfig)1 IList (com.hazelcast.core.IList)1 IMap (com.hazelcast.core.IMap)1 JetInstance (com.hazelcast.jet.JetInstance)1 Util.entry (com.hazelcast.jet.Util.entry)1 AggregateOperation (com.hazelcast.jet.aggregate.AggregateOperation)1 AggregateOperations.toSet (com.hazelcast.jet.aggregate.AggregateOperations.toSet)1 AggregateOperations.toThreeBags (com.hazelcast.jet.aggregate.AggregateOperations.toThreeBags)1 AggregateOperations.toTwoBags (com.hazelcast.jet.aggregate.AggregateOperations.toTwoBags)1 JetConfig (com.hazelcast.jet.config.JetConfig)1 JetTestSupport (com.hazelcast.jet.core.JetTestSupport)1 TestUtil.set (com.hazelcast.jet.core.TestUtil.set)1 Tag (com.hazelcast.jet.datamodel.Tag)1 ThreeBags (com.hazelcast.jet.datamodel.ThreeBags)1