use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class JobConfigOverlaysFileTest method testWithIsolate.
@Test
public void testWithIsolate() throws Exception {
// Just a simple graph, which won't be executed.
Topology topology = newTopology("testNoConfig");
topology.constants(Collections.emptyList()).isolate().forEach(tuple -> {
});
sab = bundler().submit(topology).get();
JsonObject jcos = assertSabGetJcos(topology);
assertLegacyDeployment(jcos);
JsonObject jco = jobConfigOverlay(jcos);
assertMissing(jco, "jobConfig");
assertMissing(jco, "operatorConfigs");
assertMissing(jco, "configInstructions");
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class PythonFunctionalOperatorsKwargsTest method testFilterOptionalOutput.
@Test
public void testFilterOptionalOutput() throws Exception {
assumeTrue(!isStreamingAnalyticsRun());
Topology topology = new Topology("testFilterOptionalOutput");
SPLStream tuples = sampleFilterStream(topology);
PythonFunctionalOperatorsTest.addTestToolkit(tuples);
List<SPLStream> filtered = SPL.invokeOperator(topology, "CFOpt", "com.ibm.streamsx.topology.pysamples.kwargs::ContainsFilter", Collections.singletonList(tuples), Collections.nCopies(2, tuples.getSchema()), Collections.singletonMap("term", "23"));
SPLStream pass = filtered.get(0);
SPLStream failed = filtered.get(1);
Tester tester = topology.getTester();
Condition<Long> expectedPassCount = tester.tupleCount(pass, 2);
Condition<Long> expectedFailedCount = tester.tupleCount(failed, 2);
Condition<List<Tuple>> passResult = tester.tupleContents(pass);
Condition<List<Tuple>> failedResult = tester.tupleContents(failed);
getConfig().put(ContextProperties.KEEP_ARTIFACTS, true);
complete(tester, expectedPassCount.and(expectedFailedCount), 10, TimeUnit.SECONDS);
assertEquals(TEST_TUPLES[1], passResult.getResult().get(0));
assertEquals(TEST_TUPLES[3], passResult.getResult().get(1));
assertEquals(TEST_TUPLES[0], failedResult.getResult().get(0));
assertEquals(TEST_TUPLES[2], failedResult.getResult().get(1));
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class PythonFunctionalOperatorsKwargsTest method testMap.
@Test
public void testMap() throws Exception {
assumeTrue(!isStreamingAnalyticsRun());
Topology topology = new Topology("testMap");
SPLStream tuples = sampleFilterStream(topology);
PythonFunctionalOperatorsTest.addTestToolkit(tuples);
SPLStream mapped = SPL.invokeOperator("Mp", "com.ibm.streamsx.topology.pytest.pymap::OffByOne", tuples, tuples.getSchema(), null);
Tester tester = topology.getTester();
Condition<Long> expectedCount = tester.tupleCount(mapped, 3);
Condition<List<Tuple>> result = tester.tupleContents(mapped, TEST_TUPLES[0], TEST_TUPLES[1], TEST_TUPLES[2]);
getConfig().put(ContextProperties.KEEP_ARTIFACTS, true);
complete(tester, expectedCount, 10, TimeUnit.SECONDS);
assertTrue(result.getResult().toString(), result.valid());
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class PythonFunctionalOperatorsKwargsTest method testFilter.
@Test
public void testFilter() throws Exception {
assumeTrue(!isStreamingAnalyticsRun());
Topology topology = new Topology("testFilter");
SPLStream tuples = sampleFilterStream(topology);
PythonFunctionalOperatorsTest.addTestToolkit(tuples);
SPLStream pass = SPL.invokeOperator("com.ibm.streamsx.topology.pysamples.kwargs::ContainsFilter", tuples, tuples.getSchema(), Collections.singletonMap("term", "23"));
Tester tester = topology.getTester();
Condition<Long> expectedCount = tester.tupleCount(pass, 2);
Condition<List<Tuple>> passResult = tester.tupleContents(pass);
this.getConfig().put(ContextProperties.KEEP_ARTIFACTS, true);
complete(tester, expectedCount, 10, TimeUnit.SECONDS);
assertEquals(TEST_TUPLES[1], passResult.getResult().get(0));
assertEquals(TEST_TUPLES[3], passResult.getResult().get(1));
assertTrue(expectedCount.valid());
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class BeaconTest method testLongFixedCount.
@Test
public void testLongFixedCount() throws Exception {
Topology topology = newTopology("testLongFixedCount");
final int count = 7;
TStream<Long> fb = BeaconStreams.longBeacon(topology, count);
TStream<String> fs = StringStreams.toString(fb);
Tester tester = topology.getTester();
Condition<Long> expectedCount = tester.tupleCount(fs, count);
Condition<List<String>> expectedContents = tester.stringContents(fs, "0", "1", "2", "3", "4", "5", "6");
complete(tester, expectedCount, 20, TimeUnit.SECONDS);
assertTrue(expectedCount.valid());
assertTrue(expectedContents.valid());
}
Aggregations