use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class JoinTest method testEmptyJoin.
@Test
public void testEmptyJoin() throws Exception {
final Topology t = newTopology();
TStream<String> strings = t.strings();
TWindow<String, ?> window = strings.last(3);
TStream<Number> main = t.numbers(0, 134, 76);
main = main.throttle(1, TimeUnit.SECONDS);
TStream<List<String>> joined = _jointest(main, window);
TStream<String> asString = StringStreams.toString(joined);
completeAndValidate(asString, 12, "[empty-134]", "[empty-76]");
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class JoinTest method testEmptyJoinLast.
@Test
public void testEmptyJoinLast() throws Exception {
final Topology t = newTopology();
TStream<String> strings = t.strings();
TStream<Number> main = t.numbers(0, 134, 76);
main = main.throttle(1, TimeUnit.SECONDS);
TStream<List<String>> joined = _joinLasttest(main, strings);
TStream<String> asString = StringStreams.toString(joined);
completeAndValidate(asString, 12, "[empty-134]", "[empty-76]");
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class XMLTupleTest method testConstant.
@Test
public void testConstant() throws Exception {
final Topology topology = newTopology();
String sdata = "<book><title>Dracula</title><author>Bram Stoker</author></book>";
byte[] data = sdata.getBytes(StandardCharsets.UTF_8);
XML xml = ValueFactory.newXML(new ByteArrayInputStream(data));
TStream<XML> source = topology.constants(Collections.singletonList(xml)).asType(XML.class);
assertNotNull(source);
assertEquals(XML.class, source.getTupleClass());
TStream<String> out = convertXMLToString(source);
completeAndValidate(out, 10, sdata);
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class JobConfigOverlaysFileTest method testJobConfigOther.
@Test
public void testJobConfigOther() throws Exception {
// Just a simple graph, which won't be executed.
Topology topology = newTopology("testJobConfigOther");
topology.constants(Collections.emptyList());
Map<String, Object> cfg = new HashMap<>();
{
JobConfig jc = new JobConfig();
jc.addToConfig(cfg);
jc.setDataDirectory("/tmp/abc");
jc.setPreloadApplicationBundles(true);
jc.setTracing(Level.INFO);
assertEquals("info", jc.getStreamsTracing());
}
sab = bundler().submit(topology, cfg).get();
JsonObject jcos = assertSabGetJcos(topology);
assertDefaultDeployment(jcos);
JsonObject jco = jobConfigOverlay(jcos);
assertMissing(jco, "operatorConfigs");
assertMissing(jco, "configInstructions");
assertTrue(jco.has("jobConfig"));
assertTrue(jco.get("jobConfig").isJsonObject());
JsonObject jc = jco.get("jobConfig").getAsJsonObject();
assertMissing(jc, "jobName");
assertMissing(jc, "jobGroup");
assertJsonString(jc, "dataDirectory", "/tmp/abc");
assertJsonBoolean(jc, "preloadApplicationBundles", true);
assertJsonString(jc, "tracing", "info");
assertEquals(3, jc.entrySet().size());
}
use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.
the class JobConfigOverlaysFileTest method testStandalone.
@Test
public void testStandalone() throws Exception {
// Just a simple graph, which won't be executed.
Topology topology = newTopology("testNoConfig");
topology.constants(Collections.emptyList());
@SuppressWarnings("unchecked") StreamsContext<File> sb = (StreamsContext<File>) StreamsContextFactory.getStreamsContext(Type.STANDALONE_BUNDLE);
sab = sb.submit(topology).get();
String jconame = sab.getName().replace(".sab", "_JobConfig.json");
jcos = new File(sab.getParentFile(), jconame);
assertFalse(jcos.exists());
}
Aggregations