Search in sources :

Example 1 with JSONArtifact

use of com.ibm.json.java.JSONArtifact in project streamsx.topology by IBMStreams.

the class JSONStreamsTest method checkJsonOutput.

private JSONArtifact checkJsonOutput(JSONArtifact expected, TStream<String> jsonString) throws Exception, IOException {
    assertEquals(String.class, jsonString.getTupleClass());
    assertEquals(String.class, jsonString.getTupleType());
    SPLStream splS = SPLStreams.stringToSPLStream(jsonString);
    MostRecent<Tuple> mr = jsonString.topology().getTester().splHandler(splS, new MostRecent<Tuple>());
    Condition<Long> singleTuple = jsonString.topology().getTester().tupleCount(splS, 1);
    complete(jsonString.topology().getTester(), singleTuple, 10, TimeUnit.SECONDS);
    JSONArtifact rv = JSON.parse(mr.getMostRecentTuple().getString(0));
    assertEquals(expected, rv);
    return rv;
}
Also used : JSONArtifact(com.ibm.json.java.JSONArtifact) SPLStream(com.ibm.streamsx.topology.spl.SPLStream) Tuple(com.ibm.streams.operator.Tuple)

Aggregations

JSONArtifact (com.ibm.json.java.JSONArtifact)1 Tuple (com.ibm.streams.operator.Tuple)1 SPLStream (com.ibm.streamsx.topology.spl.SPLStream)1