use of org.apache.druid.testing.IntegrationTestingConfig in project druid by druid-io.
the class SuiteListener method onStart.
@Override
public void onStart(ISuite suite) {
Injector injector = DruidTestModuleFactory.getInjector();
IntegrationTestingConfig config = injector.getInstance(IntegrationTestingConfig.class);
DruidClusterAdminClient druidClusterAdminClient = injector.getInstance(DruidClusterAdminClient.class);
druidClusterAdminClient.waitUntilCoordinatorReady();
druidClusterAdminClient.waitUntilIndexerReady();
druidClusterAdminClient.waitUntilBrokerReady();
String routerHost = config.getRouterUrl();
if (null != routerHost) {
druidClusterAdminClient.waitUntilRouterReady();
}
Lifecycle lifecycle = injector.getInstance(Lifecycle.class);
try {
lifecycle.start();
} catch (Exception e) {
LOG.error(e, "");
throw new RuntimeException(e);
}
}
use of org.apache.druid.testing.IntegrationTestingConfig in project druid by druid-io.
the class AbstractKafkaIndexingServiceTest method generateStreamIngestionPropsTransform.
@Override
Function<String, String> generateStreamIngestionPropsTransform(String streamName, String fullDatasourceName, String parserType, String parserOrInputFormat, IntegrationTestingConfig config) {
final Map<String, Object> consumerConfigs = KafkaConsumerConfigs.getConsumerProperties();
final Properties consumerProperties = new Properties();
consumerProperties.putAll(consumerConfigs);
consumerProperties.setProperty("bootstrap.servers", config.getKafkaInternalHost());
KafkaUtil.addPropertiesFromTestConfig(config, consumerProperties);
return spec -> {
try {
spec = StringUtils.replace(spec, "%%DATASOURCE%%", fullDatasourceName);
spec = StringUtils.replace(spec, "%%STREAM_TYPE%%", "kafka");
spec = StringUtils.replace(spec, "%%TOPIC_KEY%%", "topic");
spec = StringUtils.replace(spec, "%%TOPIC_VALUE%%", streamName);
if (AbstractStreamIndexingTest.INPUT_FORMAT.equals(parserType)) {
spec = StringUtils.replace(spec, "%%INPUT_FORMAT%%", parserOrInputFormat);
spec = StringUtils.replace(spec, "%%PARSER%%", "null");
} else if (AbstractStreamIndexingTest.INPUT_ROW_PARSER.equals(parserType)) {
spec = StringUtils.replace(spec, "%%PARSER%%", parserOrInputFormat);
spec = StringUtils.replace(spec, "%%INPUT_FORMAT%%", "null");
}
spec = StringUtils.replace(spec, "%%USE_EARLIEST_KEY%%", "useEarliestOffset");
spec = StringUtils.replace(spec, "%%STREAM_PROPERTIES_KEY%%", "consumerProperties");
spec = StringUtils.replace(spec, "%%SCHEMA_REGISTRY_HOST%%", StringUtils.format("http://%s", config.getSchemaRegistryInternalHost()));
return StringUtils.replace(spec, "%%STREAM_PROPERTIES_VALUE%%", jsonMapper.writeValueAsString(consumerProperties));
} catch (Exception e) {
throw new RuntimeException(e);
}
};
}
Aggregations