private void doCreate(String streamname, String streamdefinition, boolean deploy, Object... values) {
String actualDefinition = String.format(streamdefinition, values);
// Shell parser expects quotes to be escaped by \
String wholeCommand = String.format("stream create %s --definition \"%s\" --deploy %s", streamname,
actualDefinition.replaceAll("\"", "\\\\\""), deploy);
CommandResult cr = executeCommand(wholeCommand);
if (deploy) {
stateVerifier.waitForDeploy(streamname);
}
else {
stateVerifier.waitForCreate(streamname);
}
// add the stream name to the streams list before assertion
streams.add(streamname);
String deployMsg = "Created";
if (deploy) {
deployMsg = "Created and deployed";
}
assertEquals(deployMsg + " new stream '" + streamname + "'", cr.getResult());
verifyExists(streamname, actualDefinition, deploy);
}