use of com.ibm.streamsx.topology.generator.spl.SPLGenerator in project streamsx.topology by IBMStreams.
the class ToolkitRemoteContext method generateSPL.
private void generateSPL(File toolkitRoot, JsonObject jsonGraph) throws IOException {
// Create the SPL file, and save a copy of the JSON file.
SPLGenerator generator = new SPLGenerator();
createNamespaceFile(toolkitRoot, jsonGraph, "spl", generator.generateSPL(jsonGraph));
createNamespaceFile(toolkitRoot, jsonGraph, "json", jsonGraph.toString());
}
use of com.ibm.streamsx.topology.generator.spl.SPLGenerator in project streamsx.topology by IBMStreams.
the class LowLatencyTest method threadedPortTest.
@Test
public void threadedPortTest() throws Exception {
assumeTrue(isMainRun());
Topology topology = newTopology("lowLatencyTest");
// Construct topology
TStream<String> ss = topology.strings("hello").lowLatency();
TStream<String> ss1 = ss.transform(getContainerId());
TStream<String> ss2 = ss1.transform(getContainerId()).endLowLatency();
SPLGenerator generator = new SPLGenerator();
JSONObject graph = topology.builder().complete();
JsonObject ggraph = JSON4JUtilities.gson(graph);
generator.generateSPL(ggraph);
GsonUtilities.objectArray(ggraph, "operators", op -> {
String lowLatencyTag = null;
JsonObject placement = object(op, CONFIG, PLACEMENT);
if (placement != null)
lowLatencyTag = jstring(placement, PLACEMENT_LOW_LATENCY_REGION_ID);
String kind = jstring(op, "kind");
JsonObject queue = object(op, "queue");
if (queue != null && (lowLatencyTag == null || lowLatencyTag.equals(""))) {
throw new IllegalStateException("Operator has threaded port when it shouldn't.");
}
if (queue != null && kind.equals("com.ibm.streamsx.topology.functional.java::FunctionTransform")) {
throw new IllegalStateException("Transform operator expecting threaded port; none found.");
}
});
}
Aggregations