use of org.talend.components.kafka.dataset.KafkaDatasetProperties in project components by Talend.
the class KafkaTestConstants method createDataset.
public static KafkaDatasetProperties createDataset(KafkaDatastoreProperties datastore) {
KafkaDatasetProperties dataset = new KafkaDatasetProperties("dataset");
dataset.init();
dataset.setDatastoreProperties(datastore);
return dataset;
}
use of org.talend.components.kafka.dataset.KafkaDatasetProperties in project components by Talend.
the class KafkaDatasetTestIT method testBasic.
@Test
public void testBasic() throws Exception {
KafkaDatasetProperties props = createDatasetProperties();
final List<IndexedRecord> consumed = new ArrayList<>();
RuntimeInfo ri = def.getRuntimeInfo(props);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
DatasetRuntime runtime = (DatasetRuntime) si.getInstance();
runtime.initialize(null, props);
assertThat(runtime, not(nullValue()));
Schema s = runtime.getSchema();
assertThat(s, not(nullValue()));
runtime.getSample(100, new Consumer<IndexedRecord>() {
@Override
public void accept(IndexedRecord ir) {
consumed.add(ir);
}
});
}
assertThat(consumed, hasSize(0));
}
use of org.talend.components.kafka.dataset.KafkaDatasetProperties in project components by Talend.
the class KafkaDatasetOtherDelimTestIT method listTopicForProperties.
@Test
public void listTopicForProperties() throws Exception {
KafkaDatasetProperties datasetProperties = createDataset(createDatastore());
datasetProperties.beforeTopic();
List<String> possibleTopics = (List<String>) datasetProperties.topic.getPossibleValues();
assertThat(possibleTopics, hasItems(TOPIC_IN, TOPIC_OUT));
}
use of org.talend.components.kafka.dataset.KafkaDatasetProperties in project components by Talend.
the class KafkaCsvBeamRuntimeTestIT method init.
@Before
public void init() {
datastoreProperties = new KafkaDatastoreProperties("datastore");
datastoreProperties.init();
datastoreProperties.brokers.setValue(BOOTSTRAP_HOST);
inputDatasetProperties = new KafkaDatasetProperties("inputDataset");
inputDatasetProperties.init();
inputDatasetProperties.setDatastoreProperties(datastoreProperties);
inputDatasetProperties.topic.setValue(TOPIC_IN);
inputDatasetProperties.valueFormat.setValue(KafkaDatasetProperties.ValueFormat.CSV);
// no schema defined
outputDatasetProperties = new KafkaDatasetProperties("outputDataset");
outputDatasetProperties.init();
outputDatasetProperties.setDatastoreProperties(datastoreProperties);
outputDatasetProperties.topic.setValue(TOPIC_OUT);
outputDatasetProperties.valueFormat.setValue(KafkaDatasetProperties.ValueFormat.CSV);
// no schema defined
}
use of org.talend.components.kafka.dataset.KafkaDatasetProperties in project components by Talend.
the class KafkaDatasetTestIT method listTopicForProperties.
@Test
public void listTopicForProperties() throws Exception {
KafkaDatasetProperties datasetProperties = createDataset(createDatastore());
datasetProperties.beforeTopic();
List<String> possibleTopics = (List<String>) datasetProperties.topic.getPossibleValues();
assertThat(possibleTopics, hasItems(TOPIC_IN, TOPIC_OUT));
}
Aggregations