use of com.ibm.streamsx.topology.consistent.ConsistentRegionConfig in project streamsx.topology by IBMStreams.
the class ConsistentRegionTest method testConsistentOperatorDriven.
@Test
public void testConsistentOperatorDriven() throws Exception {
Topology topology = new Topology("testConsistentOperatorDriven");
final int N = 2000;
StreamSchema schema = Type.Factory.getStreamSchema("tuple<uint64 id>");
Map<String, Object> params = new HashMap<>();
params.put("iterations", N);
params.put("period", 0.01);
params.put("triggerCount", SPL.createValue(37, Type.MetaType.UINT32));
SPLStream b = SPL.invokeSource(topology, "spl.utility::Beacon", params, schema);
ConsistentRegionConfig config = ConsistentRegionConfig.operatorDriven();
assertSame(b, b.setConsistent(config));
// Create a mini-flow
b = b.filter(t -> true);
Condition<Void> resets = topology.getTester().resetConsistentRegions(5);
assertNotNull(resets);
Condition<Long> exact = topology.getTester().tupleCount(b, N);
complete(topology.getTester(), exact, 80, TimeUnit.SECONDS);
}
use of com.ibm.streamsx.topology.consistent.ConsistentRegionConfig in project streamsx.topology by IBMStreams.
the class ConsistentRegionTest method testConsistentPeriodic.
@Test
public void testConsistentPeriodic() throws Exception {
Topology topology = new Topology("testConsistentPeriodic");
final int N = 2000;
StreamSchema schema = Type.Factory.getStreamSchema("tuple<uint64 id>");
Map<String, Object> params = new HashMap<>();
params.put("iterations", N);
params.put("period", 0.01);
SPLStream b = SPL.invokeSource(topology, "spl.utility::Beacon", params, schema);
ConsistentRegionConfig config = periodic(2);
assertSame(b, b.setConsistent(config));
// Create a mini-flow
b = b.filter(t -> true);
Condition<Long> exact = topology.getTester().tupleCount(b, N);
Condition<Void> resets = topology.getTester().resetConsistentRegions(null);
assertNotNull(resets);
complete(topology.getTester(), exact, 80, TimeUnit.SECONDS);
}
use of com.ibm.streamsx.topology.consistent.ConsistentRegionConfig in project streamsx.topology by IBMStreams.
the class ConsistentRegionConfigTest method testChangeDrain.
@Test
public void testChangeDrain() {
ConsistentRegionConfig config = operatorDriven().drainTimeout(27);
checkCRC(config, Trigger.OPERATOR_DRIVEN, -1, 27, 180, 5);
}
use of com.ibm.streamsx.topology.consistent.ConsistentRegionConfig in project streamsx.topology by IBMStreams.
the class ConsistentRegionConfigTest method testChangeReset.
@Test
public void testChangeReset() {
ConsistentRegionConfig config = periodic(4).resetTimeout(99);
checkCRC(config, Trigger.PERIODIC, 4, 180, 99, 5);
}
use of com.ibm.streamsx.topology.consistent.ConsistentRegionConfig in project streamsx.topology by IBMStreams.
the class ConsistentRegionConfigTest method testDefaultPeriod.
@Test
public void testDefaultPeriod() {
ConsistentRegionConfig config = periodic(37);
checkCRC(config, Trigger.PERIODIC, 37, 180, 180, 5);
}
Aggregations