use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class BeaconTest method testForeverBeacon.
@Test
public void testForeverBeacon() throws Exception {
Topology topology = newTopology("testForeverBeacon");
final int count = new Random().nextInt(1000) + 37;
TStream<BeaconTuple> fb = BeaconStreams.beacon(topology, count);
Tester tester = topology.getTester();
Condition<Long> endCondition = tester.atLeastTupleCount(fb, count);
assertTrue(complete(tester, endCondition, 20, TimeUnit.SECONDS));
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class BeaconTest method testFixedCount.
@Test
public void testFixedCount() throws Exception {
Topology topology = newTopology("testFixedCount");
final int count = new Random().nextInt(1000) + 37;
TStream<BeaconTuple> fb = BeaconStreams.beacon(topology, count);
Tester tester = topology.getTester();
Condition<Long> expectedCount = tester.tupleCount(fb, count);
complete(tester, expectedCount, 20, TimeUnit.SECONDS);
assertTrue(expectedCount.valid());
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class BeaconTest method testBeaconTypes.
@Test
public void testBeaconTypes() {
assumeTrue(isMainRun());
Topology t = newTopology();
assertEquals(BeaconTuple.class, BeaconStreams.beacon(t).getTupleClass());
assertEquals(BeaconTuple.class, BeaconStreams.beacon(t, 77).getTupleClass());
assertEquals(Long.class, BeaconStreams.longBeacon(t).getTupleClass());
assertEquals(Long.class, BeaconStreams.longBeacon(t, 23).getTupleClass());
assertEquals(Long.class, BeaconStreams.single(t).getTupleClass());
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class ConditionTest method testExactCountBad2.
@Test
public void testExactCountBad2() throws Exception {
final Topology topology = new Topology();
TStream<String> source = topology.strings("hello", "goodbye");
Condition<Long> tupleCount = topology.getTester().tupleCount(source, 3);
boolean passed = complete(topology.getTester(), tupleCount, 10, TimeUnit.SECONDS);
assertFalse(tupleCount.toString(), tupleCount.valid());
assertFalse(tupleCount.failed());
assertFalse(passed);
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class ConditionTest method testStringContentsBad3.
@Test
public void testStringContentsBad3() throws Exception {
final Topology topology = new Topology();
TStream<String> source = topology.strings("A", "B", "C", "D");
Condition<List<String>> contents = topology.getTester().stringContents(source, "A", "B", "C");
boolean passed = complete(topology.getTester(), contents, 10, TimeUnit.SECONDS);
assertFalse(contents.toString(), contents.valid());
assertFalse(passed);
}
Aggregations