use of io.confluent.ksql.test.tools.Record in project ksql by confluentinc.
the class SchemaTranslationTest method generateInputRecords.
private static List<Record> generateInputRecords(final Schema avroSchema) {
final Generator generator = new Generator(avroSchema, new Random());
final List<Record> list = new ArrayList<>();
for (int i = 0; i < 100; i++) {
final Object avro = generator.generate();
final JsonNode spec = avroToJson(avro, avroSchema, true);
final Record record = new Record(TOPIC_NAME, "test-key", JsonNodeFactory.instance.textNode("test-key"), avroToValueSpec(avro, avroSchema, true), spec, Optional.of(0L), null, Optional.empty());
list.add(record);
}
return list;
}
use of io.confluent.ksql.test.tools.Record in project ksql by confluentinc.
the class SchemaTranslationWithSchemaIdTest method generateInputRecords.
private static List<Record> generateInputRecords(final Schema avroSchema) {
final Generator generator = new Generator(avroSchema, new Random());
final List<Record> list = new ArrayList<>();
for (int i = 0; i < 100; i++) {
final Object avro = generator.generate();
final JsonNode spec = avroToJson(avro, avroSchema, false);
final Record record = new Record(TOPIC_NAME, "test-key", JsonNodeFactory.instance.textNode("test-key"), avroToValueSpec(avro, avroSchema, false), spec, Optional.of(0L), null, Optional.empty());
list.add(record);
}
return list;
}
use of io.confluent.ksql.test.tools.Record in project ksql by confluentinc.
the class RestTestExecutor method verifyOutput.
private void verifyOutput(final RestTestCase testCase) {
testCase.getOutputsByTopic().forEach((topicName, records) -> {
final TopicInfo topicInfo = topicInfoCache.get(topicName).orElseThrow(() -> new KsqlException("No information found for topic: " + topicName));
final List<? extends ConsumerRecord<?, ?>> received = kafkaCluster.verifyAvailableRecords(topicName, records.size(), topicInfo.getKeyDeserializer(), topicInfo.getValueDeserializer());
for (int idx = 0; idx < records.size(); idx++) {
final Record expected = records.get(idx);
final ConsumerRecord<?, ?> actual = received.get(idx);
compareKeyValueTimestamp(actual, expected);
}
});
}
use of io.confluent.ksql.test.tools.Record in project ksql by confluentinc.
the class RecordNodeTest method shouldUseExactDecimals.
@Test
public void shouldUseExactDecimals() {
// Given:
final RecordNode node = new RecordNode("topic", NullNode.getInstance(), new DecimalNode(new BigDecimal("10.000")), Optional.empty(), Optional.empty(), Optional.empty());
// When:
final Record result = node.build();
// Then:
assertThat(result.value(), is(new BigDecimal("10.000")));
}
Aggregations