Search in sources :

Example 11 with ConsistentRegionConfig

use of com.ibm.streamsx.topology.consistent.ConsistentRegionConfig in project streamsx.topology by IBMStreams.

the class ConsistentRegionConfigTest method checkCRC.

private static void checkCRC(ConsistentRegionConfig config, Trigger trigger, int period, long drain, long reset, int attempts) {
    assertNotNull(config.getTrigger());
    assertTrue(config.getDrainTimeout() > 0);
    assertTrue(config.getResetTimeout() > 0);
    assertTrue(config.getMaxConsecutiveResetAttempts() > 0);
    assertEquals(TimeUnit.SECONDS, config.getTimeUnit());
    assertEquals(trigger, config.getTrigger());
    assertEquals(((long) period), config.getPeriod());
    assertEquals(drain, config.getDrainTimeout());
    assertEquals(reset, config.getResetTimeout());
    assertEquals(attempts, config.getMaxConsecutiveResetAttempts());
    assertEquals(config, config);
    ConsistentRegionConfig dup;
    if (config.getTrigger() == Trigger.OPERATOR_DRIVEN)
        dup = operatorDriven();
    else
        dup = periodic(period);
    dup = dup.drainTimeout(drain).resetTimeout(reset).maxConsecutiveResetAttempts(attempts);
    assertEquals(config, dup);
    assertEquals(config.hashCode(), dup.hashCode());
}
Also used : ConsistentRegionConfig(com.ibm.streamsx.topology.consistent.ConsistentRegionConfig)

Example 12 with ConsistentRegionConfig

use of com.ibm.streamsx.topology.consistent.ConsistentRegionConfig in project streamsx.topology by IBMStreams.

the class ConsistentRegionConfigTest method testDefaultOpDrivenNew.

@Test
public void testDefaultOpDrivenNew() {
    ConsistentRegionConfig config = new ConsistentRegionConfig();
    checkCRC(config, Trigger.OPERATOR_DRIVEN, -1, 180, 180, 5);
}
Also used : ConsistentRegionConfig(com.ibm.streamsx.topology.consistent.ConsistentRegionConfig) Test(org.junit.Test)

Aggregations

ConsistentRegionConfig (com.ibm.streamsx.topology.consistent.ConsistentRegionConfig)12 Test (org.junit.Test)11 StreamSchema (com.ibm.streams.operator.StreamSchema)2 Type (com.ibm.streams.operator.Type)2 Topology (com.ibm.streamsx.topology.Topology)2 ConsistentRegionConfig.periodic (com.ibm.streamsx.topology.consistent.ConsistentRegionConfig.periodic)2 SPL (com.ibm.streamsx.topology.spl.SPL)2 SPLStream (com.ibm.streamsx.topology.spl.SPLStream)2 TestTopology (com.ibm.streamsx.topology.test.TestTopology)2 Condition (com.ibm.streamsx.topology.tester.Condition)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 TimeUnit (java.util.concurrent.TimeUnit)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 Assert.assertSame (org.junit.Assert.assertSame)2 Assume.assumeTrue (org.junit.Assume.assumeTrue)2 Before (org.junit.Before)2