use of io.confluent.ksql.test.model.InputRecordsNode in project ksql by confluentinc.
the class KsqlTestingTool method runWithTripleFiles.
static void runWithTripleFiles(final String statementFile, final String inputFile, final String outputFile, final Optional<String> extensionDir) throws Exception {
final InputRecordsNode inputRecordNodes;
final OutputRecordsNode outRecordNodes;
try {
inputRecordNodes = (inputFile == null) ? null : OBJECT_MAPPER.readValue(new File(inputFile), InputRecordsNode.class);
} catch (final Exception inputException) {
throw new Exception("File name: " + inputFile + " Message: " + inputException.getMessage());
}
try {
outRecordNodes = OBJECT_MAPPER.readValue(new File(outputFile), OutputRecordsNode.class);
} catch (final Exception outputException) {
throw new Exception("File name: " + outputFile + " Message: " + outputException.getMessage());
}
final Path stmtsPath = Paths.get(statementFile);
final List<String> statements = getSqlStatements(stmtsPath);
final TestCaseNode testCaseNode = new TestCaseNode("KSQL_Test", Optional.empty(), null, (inputFile == null) ? null : inputRecordNodes.getInputRecords(), outRecordNodes.getOutputRecords(), Collections.emptyList(), statements, null, null, null, true);
final PathLocation location = new PathLocation(stmtsPath.toAbsolutePath());
final TestCase testCase = TestCaseBuilder.buildTests(testCaseNode, location.getTestPath(), name -> location).get(0);
executeTestCase(testCase, TestExecutor.create(true, extensionDir));
}
Aggregations