use of com.ibm.streamsx.topology.tuple.BeaconTuple in project streamsx.topology by IBMStreams.
the class BeaconTest method testBeaconTupleToString.
@Test
public void testBeaconTupleToString() throws Exception {
assumeTrue(isMainRun());
BeaconTuple bt1 = new BeaconTuple(0, 1);
BeaconTuple bt2 = new BeaconTuple(0, 2);
String s = bt1.toString();
assertNotNull(s);
assertFalse(s.isEmpty());
assertFalse(s.equals(bt2.toString()));
}
use of com.ibm.streamsx.topology.tuple.BeaconTuple in project streamsx.topology by IBMStreams.
the class BeaconTest method testForeverBeacon.
@Test
public void testForeverBeacon() throws Exception {
Topology topology = new Topology("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.tuple.BeaconTuple in project streamsx.topology by IBMStreams.
the class BeaconTest method testBeaconTupleEquals.
@Test
public void testBeaconTupleEquals() throws Exception {
assumeTrue(isMainRun());
BeaconTuple bt1 = new BeaconTuple(0, 1);
BeaconTuple bt2 = new BeaconTuple(0, 2);
BeaconTuple bt3 = new BeaconTuple(0, 2);
BeaconTuple bt4 = new BeaconTuple(1, 2);
assertTrue(!bt1.equals("foo"));
assertTrue(!bt1.equals(null));
assertTrue(bt1.equals(bt1));
assertTrue(!bt1.equals(bt2));
assertTrue(bt2.equals(bt3));
assertTrue(!bt3.equals(bt4));
}
use of com.ibm.streamsx.topology.tuple.BeaconTuple in project streamsx.topology by IBMStreams.
the class BeaconTest method testFixedCount.
@Test
public void testFixedCount() throws Exception {
Topology topology = new Topology("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.tuple.BeaconTuple in project streamsx.topology by IBMStreams.
the class BeaconTest method testBeaconTupleHashCode.
@Test
public void testBeaconTupleHashCode() throws Exception {
assumeTrue(isMainRun());
BeaconTuple bt1 = new BeaconTuple(0, 1);
BeaconTuple bt2 = new BeaconTuple(0, 2);
BeaconTuple bt3 = new BeaconTuple(0, 2);
assertTrue(bt1.hashCode() != 0);
assertTrue(bt1.hashCode() != bt2.hashCode());
assertTrue(bt2.hashCode() == bt3.hashCode());
}
Aggregations