You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by va...@apache.org on 2021/10/25 20:40:30 UTC
[camel-kafka-connector] 10/11: Related to #423 : itests fix after
kamelets based connectors generation.
This is an automated email from the ASF dual-hosted git repository.
valdar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git
commit ebbd225e59f184ef75eed80e0a4b9e03772cd854
Author: Andrea Tarocchi <an...@gmail.com>
AuthorDate: Sat Sep 18 21:31:04 2021 +0200
Related to #423 : itests fix after kamelets based connectors generation.
---
.../apache/camel/kafkaconnector/CamelSinkTask.java | 10 ++-
.../camel/kafkaconnector/CamelSourceTask.java | 11 ++-
.../ConnectRecordValueToMapTransforms.java | 69 +++++++++++++++++++
tests/itests-aws-v2/pom.xml | 5 ++
.../aws/v2/clients/AWSSNSClient.java | 79 ++++++++++++++++++++++
.../aws/v2/cw/sink/CamelAWSCWPropertyFactory.java | 25 +++----
.../aws/v2/cw/sink/CamelSinkAWSCWITCase.java | 13 ++--
.../v2/ec2/sink/CamelAWSEC2PropertyFactory.java | 22 +++---
.../aws/v2/ec2/sink/CamelSinkAWSEC2ITCase.java | 4 +-
.../sink/CamelAWSKinesisPropertyFactory.java | 20 +++---
.../v2/kinesis/sink/CamelSinkAWSKinesisITCase.java | 5 +-
.../source/CamelAWSKinesisPropertyFactory.java | 27 +++-----
.../source/CamelSourceAWSKinesisITCase.java | 34 +---------
.../lambda/sink/CamelAWSLambdaPropertyFactory.java | 29 +++-----
.../aws/v2/lambda/sink/CamelSinkLambdaITCase.java | 5 +-
.../aws/v2/s3/sink/CamelAWSS3PropertyFactory.java | 20 +++---
.../aws/v2/s3/sink/CamelSinkAWSS3ITCase.java | 2 +-
.../v2/s3/source/CamelAWSS3PropertyFactory.java | 25 ++-----
.../aws/v2/s3/source/CamelSourceAWSS3ITCase.java | 37 +---------
.../source/CamelSourceAWSS3LargeFilesITCase.java | 4 +-
.../v2/sns/sink/CamelAWSSNSPropertyFactory.java | 37 ++++------
.../aws/v2/sns/sink/CamelSinkAWSSNSITCase.java | 66 +++++-------------
.../v2/sqs/sink/CamelAWSSQSPropertyFactory.java | 36 +++-------
.../aws/v2/sqs/sink/CamelSinkAWSSQSITCase.java | 64 +-----------------
.../v2/sqs/source/CamelAWSSQSPropertyFactory.java | 31 +++------
.../aws/v2/sqs/source/CamelSourceAWSSQSITCase.java | 43 +-----------
.../blob/sink/CamelSinkAzureStorageBlobITCase.java | 24 ++-----
.../CamelSinkAzureStorageBlobPropertyFactory.java | 23 +++----
.../sink/CamelSinkAzureStorageQueueITCase.java | 22 +-----
.../CamelSinkAzureStorageQueuePropertyFactory.java | 23 ++-----
.../source/CamelSourceAzureStorageQueueITCase.java | 2 +-
...amelSourceAzureStorageQueuePropertyFactory.java | 15 ++--
.../common/ConnectorPropertyFactory.java | 2 +-
tests/itests-elasticsearch/pom.xml | 18 +++++
.../elasticsearch/common/ElasticSearchCommon.java | 1 -
.../common/ElasticSearchIndexMessageProducer.java | 50 ++++++++++++++
.../sink/CamelElasticSearchPropertyFactory.java | 25 +++----
.../sink/CamelSinkElasticSearchITCase.java | 48 +++++--------
.../http/sink/CamelHTTPPropertyFactory.java | 16 ++---
.../http/sink/CamelSinkHTTPITCase.java | 19 +-----
.../common/MongoDBEnvVarServiceFactory.java | 47 +++++++++++++
.../MongoDBLocalContainerEnvVarService.java} | 23 ++-----
.../mongodb/sink/CamelMongoDBPropertyFactory.java | 25 ++++---
.../mongodb/sink/CamelSinkMongoDBITCase.java | 15 ++--
.../source/CamelMongoDBPropertyFactory.java | 22 +++---
.../mongodb/source/CamelSourceMongoDBITCase.java | 18 +++--
tests/itests-parent/pom.xml | 6 +-
.../sink/CamelRabbitMQPropertyFactory.java | 22 +++---
.../rabbitmq/sink/RabbitMQSinkITCase.java | 24 +++----
.../source/CamelRabbitMQPropertyFactory.java | 41 +++--------
.../rabbitmq/source/RabbitMQSourceITCase.java | 19 ++----
tests/itests-sql/pom.xml | 10 ++-
.../sql/sink/CamelSinkSQLITCase.java | 24 +++++--
.../sql/sink/CamelSqlPropertyFactory.java | 32 +++++++--
.../sql/source/CamelSourceSQLITCase.java | 24 +++++--
.../sql/source/CamelSqlPropertyFactory.java | 34 ++++++++--
.../ssh/sink/CamelSinkSshITCase.java | 9 +--
.../ssh/sink/CamelSshPropertyFactory.java | 10 ++-
.../ssh/source/CamelSourceSshITCase.java | 6 +-
.../ssh/source/CamelSshPropertyFactory.java | 22 +++---
.../timer/source/CamelSourceTimerITCase.java | 21 ++----
.../timer/source/CamelTimerPropertyFactory.java | 20 ++----
.../CamelKafkaConnectorKameletUpdateMojo.java | 4 +-
63 files changed, 706 insertions(+), 783 deletions(-)
diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
index e4430fc..f5d942e 100644
--- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
@@ -94,6 +94,7 @@ public class CamelSinkTask extends SinkTask {
}
String remoteUrl = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_URL_CONF);
+ final String componentSchema = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_COMPONENT_CONF);
final String marshaller = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_MARSHAL_CONF);
final String unmarshaller = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_UNMARSHAL_CONF);
final int size = config.getInt(CamelSinkConnectorConfig.CAMEL_CONNECTOR_AGGREGATE_SIZE_CONF);
@@ -115,14 +116,17 @@ public class CamelSinkTask extends SinkTask {
mapHeaders = config.getBoolean(CamelSinkConnectorConfig.CAMEL_CONNECTOR_MAP_HEADERS_CONF);
CamelContext camelContext = new DefaultCamelContext();
- if (remoteUrl == null) {
+ // componentSchema can legitimately be null in case of kamelet connectors, in that case KAMELET_SINK_TEMPLATE_PARAMETERS_PREFIX + "toUrl" property is ignored
+ if (remoteUrl == null && componentSchema != null) {
remoteUrl = TaskHelper.buildUrl(camelContext,
actualProps,
- config.getString(CamelSinkConnectorConfig.CAMEL_SINK_COMPONENT_CONF),
+ componentSchema,
CAMEL_SINK_ENDPOINT_PROPERTIES_PREFIX,
CAMEL_SINK_PATH_PROPERTIES_PREFIX);
}
- actualProps.put(KAMELET_SINK_TEMPLATE_PARAMETERS_PREFIX + "toUrl", remoteUrl);
+ if (remoteUrl != null) {
+ actualProps.put(KAMELET_SINK_TEMPLATE_PARAMETERS_PREFIX + "toUrl", remoteUrl);
+ }
cms = CamelKafkaConnectMain.builder(LOCAL_URL, getSinkKamelet())
.withProperties(actualProps)
diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java
index 2437f64..05a0d96 100644
--- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java
@@ -102,6 +102,7 @@ public class CamelSourceTask extends SourceTask {
camelMessageHeaderKey = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_MESSAGE_HEADER_KEY_CONF);
String remoteUrl = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_URL_CONF);
+ final String componentSchema = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_COMPONENT_CONF);
final String unmarshaller = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_UNMARSHAL_CONF);
final String marshaller = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_MARSHAL_CONF);
final int size = config.getInt(CamelSourceConnectorConfig.CAMEL_CONNECTOR_AGGREGATE_SIZE_CONF);
@@ -141,13 +142,17 @@ public class CamelSourceTask extends SourceTask {
exchangesWaitingForAck = new Exchange[freeSlots.capacity()];
CamelContext camelContext = new DefaultCamelContext();
- if (remoteUrl == null) {
+ // componentSchema can legitimately be null in case of kamelet connectors, in that case KAMELET_SOURCE_TEMPLATE_PARAMETERS_PREFIX + "fromUrl" property is ignored
+ if (remoteUrl == null && componentSchema != null) {
remoteUrl = TaskHelper.buildUrl(camelContext,
actualProps,
- config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_COMPONENT_CONF), CAMEL_SOURCE_ENDPOINT_PROPERTIES_PREFIX,
+ componentSchema,
+ CAMEL_SOURCE_ENDPOINT_PROPERTIES_PREFIX,
CAMEL_SOURCE_PATH_PROPERTIES_PREFIX);
}
- actualProps.put(KAMELET_SOURCE_TEMPLATE_PARAMETERS_PREFIX + "fromUrl", remoteUrl);
+ if (remoteUrl != null) {
+ actualProps.put(KAMELET_SOURCE_TEMPLATE_PARAMETERS_PREFIX + "fromUrl", remoteUrl);
+ }
cms = CamelKafkaConnectMain.builder(getSourceKamelet(), localUrl)
.withProperties(actualProps)
diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/transforms/ConnectRecordValueToMapTransforms.java b/core/src/main/java/org/apache/camel/kafkaconnector/transforms/ConnectRecordValueToMapTransforms.java
new file mode 100644
index 0000000..b18abc9
--- /dev/null
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/transforms/ConnectRecordValueToMapTransforms.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.kafkaconnector.transforms;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.kafkaconnector.utils.SchemaHelper;
+import org.apache.kafka.common.config.ConfigDef;
+import org.apache.kafka.common.config.ConfigException;
+import org.apache.kafka.connect.connector.ConnectRecord;
+import org.apache.kafka.connect.transforms.Transformation;
+import org.apache.kafka.connect.transforms.util.SimpleConfig;
+
+public class ConnectRecordValueToMapTransforms<R extends ConnectRecord<R>> implements Transformation<R> {
+ public static final String FIELD_KEY_CONFIG = "key";
+
+ public static final ConfigDef CONFIG_DEF = new ConfigDef()
+ .define(FIELD_KEY_CONFIG, ConfigDef.Type.STRING, null, ConfigDef.Importance.MEDIUM,
+ "Transforms String-based content from Kafka into a map");
+
+ private String key;
+
+ @Override
+ public R apply(R r) {
+ Map<String, Object> targetMap = new HashMap<>();
+
+ Object value = r.value();
+
+ targetMap.put(key, value);
+ return r.newRecord(r.topic(), r.kafkaPartition(), null, r.key(),
+ SchemaHelper.buildSchemaBuilderForType(value), targetMap, r.timestamp());
+ }
+
+ @Override
+ public ConfigDef config() {
+ return CONFIG_DEF;
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ @Override
+ public void configure(Map<String, ?> map) {
+ final SimpleConfig config = new SimpleConfig(CONFIG_DEF, map);
+
+ this.key = config.getString(FIELD_KEY_CONFIG);
+
+ if (this.key == null) {
+ throw new ConfigException("The ConnectRecordValueToMapTransforms transformer requires a 'key'");
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/itests-aws-v2/pom.xml b/tests/itests-aws-v2/pom.xml
index 5760529..984572c 100644
--- a/tests/itests-aws-v2/pom.xml
+++ b/tests/itests-aws-v2/pom.xml
@@ -97,6 +97,11 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-aws2-lambda</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-gson</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/clients/AWSSNSClient.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/clients/AWSSNSClient.java
new file mode 100644
index 0000000..fc6a3c8
--- /dev/null
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/clients/AWSSNSClient.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.kafkaconnector.aws.v2.clients;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.services.sns.SnsClient;
+import software.amazon.awssdk.services.sns.model.CreateTopicRequest;
+import software.amazon.awssdk.services.sns.model.CreateTopicResponse;
+import software.amazon.awssdk.services.sns.model.ListTopicsRequest;
+import software.amazon.awssdk.services.sns.model.ListTopicsResponse;
+import software.amazon.awssdk.services.sns.model.SubscribeRequest;
+import software.amazon.awssdk.services.sns.model.SubscribeResponse;
+import software.amazon.awssdk.services.sns.model.Topic;
+
+public class AWSSNSClient {
+ private static final Logger LOG = LoggerFactory.getLogger(AWSSNSClient.class);
+
+ private final SnsClient sns;
+ private final int maxNumberOfMessages = 1;
+
+ public AWSSNSClient(SnsClient sns) {
+ this.sns = sns;
+ }
+
+ public List<Topic> getTopics() {
+ ListTopicsRequest request = ListTopicsRequest.builder()
+ .build();
+
+ ListTopicsResponse result = sns.listTopics(request);
+
+ return result.topics();
+ }
+
+ public String createTopic(String topic) {
+ CreateTopicRequest request = CreateTopicRequest.builder()
+ .name(topic)
+ .build();
+
+ CreateTopicResponse response = sns.createTopic(request);
+
+ if (response.sdkHttpResponse().isSuccessful()) {
+ return response.topicArn();
+ }
+
+ LOG.warn("Unable to create the topic: {}", response.sdkHttpResponse().statusCode());
+ return null;
+ }
+
+ public void subscribeSQS(String topicArn, String sqsArn) {
+ SubscribeRequest request = SubscribeRequest.builder()
+ .protocol("sqs")
+ .endpoint(sqsArn)
+ .returnSubscriptionArn(true)
+ .topicArn(topicArn)
+ .build();
+
+ SubscribeResponse response = sns.subscribe(request);
+ if (!response.sdkHttpResponse().isSuccessful()) {
+ LOG.warn("Unable to create sqs subscription from sqs queue {} to sns topic: {}, status code: {}", sqsArn, topicArn, response.sdkHttpResponse().statusCode());
+ }
+ }
+}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelAWSCWPropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelAWSCWPropertyFactory.java
index cd7f638..85612b1 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelAWSCWPropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelAWSCWPropertyFactory.java
@@ -27,24 +27,15 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
public class CamelAWSCWPropertyFactory extends SinkConnectorPropertyFactory<CamelAWSCWPropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-cw.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-cw.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-cw.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-cw.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-cw.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-cw.region");
- }
-
- public CamelAWSCWPropertyFactory withSinkPathNamespace(String value) {
- return setProperty("camel.sink.path.namespace", value);
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-cloudwatch-sink.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-cloudwatch-sink.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-cloudwatch-sink.region");
}
- public CamelAWSCWPropertyFactory withName(String value) {
- return setProperty("camel.sink.endpoint.name", value);
+ public CamelAWSCWPropertyFactory withNamespace(String value) {
+ return setProperty("camel.kamelet.aws-cloudwatch-sink.cw_namespace", value);
}
public CamelAWSCWPropertyFactory withConfiguration(String value) {
@@ -65,9 +56,11 @@ public class CamelAWSCWPropertyFactory extends SinkConnectorPropertyFactory<Came
return new CamelAWSCWPropertyFactory()
.withTasksMax(1)
.withName("CamelAWSCWConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2cw.CamelAws2cwSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awscloudwatchsink.CamelAwscloudwatchsinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.sink.contentLogLevel", "INFO")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java
index e862464..b14ac16 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java
@@ -65,9 +65,9 @@ public class CamelSinkAWSCWITCase extends CamelSinkTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(CamelSinkAWSCWITCase.class);
+ private static String metricName = "test-metric";
private CloudWatchClient client;
private String namespace;
- private String metricName = "test-metric";
private volatile int received;
private final int expect = 10;
@@ -88,6 +88,9 @@ public class CamelSinkAWSCWITCase extends CamelSinkTestSupport {
public Map<String, String> messageHeaders(String text, int current) {
Map<String, String> headers = new HashMap<>();
+ headers.put(CamelSinkTask.HEADER_CAMEL_PREFIX + "metric-name", metricName);
+ //TODO: once this https://github.com/apache/camel-kamelets/pull/522 is published the following headers
+ // must be changed to metric-dimension-name and metric-dimension-value
headers.put(CamelSinkTask.HEADER_CAMEL_PREFIX + "CamelAwsCwMetricDimensionName",
"test-dimension-" + current);
headers.put(CamelSinkTask.HEADER_CAMEL_PREFIX + "CamelAwsCwMetricDimensionValue", String.valueOf(current));
@@ -98,7 +101,7 @@ public class CamelSinkAWSCWITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-cw-kafka-connector"};
+ return new String[] {"camel-aws-cloudwatch-sink-kafka-connector"};
}
@BeforeEach
@@ -123,7 +126,7 @@ public class CamelSinkAWSCWITCase extends CamelSinkTestSupport {
ListMetricsResponse response = client.listMetrics(request);
for (Metric metric : response.metrics()) {
- LOG.info("Retrieved metric {}", metric.metricName());
+ LOG.info("Retrieved metric {}, dimensions {}", metric.metricName(), metric.dimensions());
for (Dimension dimension : metric.dimensions()) {
LOG.info("Dimension {} value: {}", dimension.name(), dimension.value());
@@ -154,7 +157,6 @@ public class CamelSinkAWSCWITCase extends CamelSinkTestSupport {
}
}
-
@Test
@Timeout(value = 120)
public void testBasicSendReceive() throws Exception {
@@ -166,8 +168,7 @@ public class CamelSinkAWSCWITCase extends CamelSinkTestSupport {
.withTopics(topicName)
.withConfiguration(TestCloudWatchConfiguration.class.getName())
.withAmazonConfig(amazonProperties)
- .withName(metricName)
- .withSinkPathNamespace(namespace);
+ .withNamespace(namespace);
runTest(testProperties, new CustomProducer(getKafkaService().getBootstrapServers(), topicName, expect));
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelAWSEC2PropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelAWSEC2PropertyFactory.java
index 3a35bbb..9cce302 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelAWSEC2PropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelAWSEC2PropertyFactory.java
@@ -27,24 +27,19 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
public class CamelAWSEC2PropertyFactory extends SinkConnectorPropertyFactory<CamelAWSEC2PropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-ec2.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-ec2.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-ec2.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-ec2.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-ec2.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-ec2.region");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-ec2-sink.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-ec2-sink.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-ec2-sink.region");
}
- public CamelAWSEC2PropertyFactory withSinkPathLabel(String value) {
- return setProperty("camel.sink.path.label", value);
- }
+// public CamelAWSEC2PropertyFactory withSinkPathLabel(String value) {
+// return setProperty("camel.kamelet.aws-ec2-sink.label", value);
+// }
public CamelAWSEC2PropertyFactory withSinkEndpointOperation(String value) {
- return setProperty("camel.sink.endpoint.operation", value);
+ return setProperty("camel.component.aws2-ec2.operation", value);
}
public CamelAWSEC2PropertyFactory withConfiguration(String value) {
@@ -67,7 +62,8 @@ public class CamelAWSEC2PropertyFactory extends SinkConnectorPropertyFactory<Cam
.withName("CamelAws2ec2SinkConnector")
.withConnectorClass("org.apache.camel.kafkaconnector.aws2ec2.CamelAws2ec2SinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelSinkAWSEC2ITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelSinkAWSEC2ITCase.java
index db02c0e..2555833 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelSinkAWSEC2ITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/ec2/sink/CamelSinkAWSEC2ITCase.java
@@ -34,6 +34,7 @@ import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
import org.apache.camel.test.infra.common.TestUtils;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
@@ -48,6 +49,7 @@ import software.amazon.awssdk.services.ec2.model.InstanceStatus;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
+@Disabled("Until this https://github.com/apache/camel-kamelets/issues/516 is implemented and published.")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIfSystemProperty(named = "enable.slow.tests", matches = "true")
public class CamelSinkAWSEC2ITCase extends CamelSinkTestSupport {
@@ -144,7 +146,7 @@ public class CamelSinkAWSEC2ITCase extends CamelSinkTestSupport {
.withTopics(topicName)
.withConfiguration(TestCloudWatchConfiguration.class.getName())
.withAmazonConfig(amazonProperties)
- .withSinkPathLabel(logicalName)
+// .withSinkPathLabel(logicalName)
.withConfiguration(TestEC2Configuration.class.getName())
.withSinkEndpointOperation("createAndRunInstances");
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelAWSKinesisPropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelAWSKinesisPropertyFactory.java
index fb250a1..3a65dc7 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelAWSKinesisPropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelAWSKinesisPropertyFactory.java
@@ -31,16 +31,11 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
*/
final class CamelAWSKinesisPropertyFactory extends SinkConnectorPropertyFactory<CamelAWSKinesisPropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-kinesis.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-kinesis.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-kinesis.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-kinesis.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-kinesis.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-kinesis.region");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-kinesis-sink.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-kinesis-sink.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-kinesis-sink.region");
}
private CamelAWSKinesisPropertyFactory() {
@@ -57,8 +52,8 @@ final class CamelAWSKinesisPropertyFactory extends SinkConnectorPropertyFactory<
return this;
}
- public CamelAWSKinesisPropertyFactory withStreamName(String streamName) {
- return setProperty("camel.sink.path.streamName", streamName);
+ public CamelAWSKinesisPropertyFactory withStream(String streamName) {
+ return setProperty("camel.kamelet.aws-kinesis-sink.stream", streamName);
}
public CamelAWSKinesisPropertyFactory withConfiguration(String configurationClass) {
@@ -70,8 +65,9 @@ final class CamelAWSKinesisPropertyFactory extends SinkConnectorPropertyFactory<
return new CamelAWSKinesisPropertyFactory()
.withName("CamelAwsKinesisSinkConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2kinesis.CamelAws2kinesisSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awskinesissink.CamelAwskinesissinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelSinkAWSKinesisITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelSinkAWSKinesisITCase.java
index 1f3ecda..77f347e 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelSinkAWSKinesisITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/sink/CamelSinkAWSKinesisITCase.java
@@ -110,7 +110,6 @@ public class CamelSinkAWSKinesisITCase extends CamelSinkTestSupport {
}
}
-
@Override
protected void verifyMessages(CountDownLatch latch) throws InterruptedException {
if (latch.await(110, TimeUnit.SECONDS)) {
@@ -123,7 +122,7 @@ public class CamelSinkAWSKinesisITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-kinesis-kafka-connector"};
+ return new String[] {"camel-aws-kinesis-sink-kafka-connector"};
}
@BeforeEach
@@ -147,7 +146,7 @@ public class CamelSinkAWSKinesisITCase extends CamelSinkTestSupport {
.withTopics(topicName)
.withAmazonConfig(amazonProperties)
.withConfiguration(TestKinesisConfiguration.class.getName())
- .withStreamName(streamName);
+ .withStream(streamName);
runTest(connectorPropertyFactory, new CustomProducer(getKafkaService().getBootstrapServers(), topicName, expect));
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelAWSKinesisPropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelAWSKinesisPropertyFactory.java
index 78ef14d..7a653e3 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelAWSKinesisPropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelAWSKinesisPropertyFactory.java
@@ -22,7 +22,6 @@ import java.util.Map;
import java.util.Properties;
import org.apache.camel.kafkaconnector.aws.v2.common.AWSPropertiesUtils;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SourceConnectorPropertyFactory;
import org.apache.camel.test.infra.aws.common.AWSConfigs;
@@ -32,16 +31,11 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
*/
final class CamelAWSKinesisPropertyFactory extends SourceConnectorPropertyFactory<CamelAWSKinesisPropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-kinesis.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-kinesis.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-kinesis.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-kinesis.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-kinesis.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-kinesis.region");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-kinesis-source.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-kinesis-source.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-kinesis-source.region");
}
private CamelAWSKinesisPropertyFactory() {
@@ -58,14 +52,8 @@ final class CamelAWSKinesisPropertyFactory extends SourceConnectorPropertyFactor
return this;
}
- public CamelAWSKinesisPropertyFactory withStreamName(String streamName) {
- return setProperty("camel.source.path.streamName", streamName);
- }
-
- public EndpointUrlBuilder<CamelAWSKinesisPropertyFactory> withUrl(String streamName) {
- String sourceUrl = String.format("aws2-kinesis://%s", streamName);
-
- return new EndpointUrlBuilder<>(this::withSourceUrl, sourceUrl);
+ public CamelAWSKinesisPropertyFactory withStream(String streamName) {
+ return setProperty("camel.kamelet.aws-kinesis-source.stream", streamName);
}
public CamelAWSKinesisPropertyFactory withConfiguration(String configurationClass) {
@@ -77,8 +65,9 @@ final class CamelAWSKinesisPropertyFactory extends SourceConnectorPropertyFactor
return new CamelAWSKinesisPropertyFactory()
.withName("CamelAwskinesisSourceConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2kinesis.CamelAws2kinesisSourceConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awskinesissource.CamelAwskinesissourceSourceConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelSourceAWSKinesisITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelSourceAWSKinesisITCase.java
index b782521..8f824e2 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelSourceAWSKinesisITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/kinesis/source/CamelSourceAWSKinesisITCase.java
@@ -45,7 +45,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIfSystemProperty(named = "enable.slow.tests", matches = "true")
public class CamelSourceAWSKinesisITCase extends CamelSourceTestSupport {
-
@RegisterExtension
public static AWSService awsService = AWSServiceFactory.createKinesisService();
@@ -57,7 +56,7 @@ public class CamelSourceAWSKinesisITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-kinesis-kafka-connector"};
+ return new String[] {"camel-aws-kinesis-source-kafka-connector"};
}
@BeforeEach
@@ -70,7 +69,6 @@ public class CamelSourceAWSKinesisITCase extends CamelSourceTestSupport {
createStream(kinesisClient, streamName);
}
-
@AfterEach
public void tearDown() {
deleteStream(kinesisClient, streamName);
@@ -86,7 +84,6 @@ public class CamelSourceAWSKinesisITCase extends CamelSourceTestSupport {
assertEquals(received, expect, "Didn't process the expected amount of messages");
}
-
@Test
@Timeout(120)
public void testBasicSendReceive() throws ExecutionException, InterruptedException {
@@ -95,34 +92,7 @@ public class CamelSourceAWSKinesisITCase extends CamelSourceTestSupport {
.withKafkaTopic(topicName)
.withAmazonConfig(awsService.getConnectionProperties())
.withConfiguration(TestKinesisConfiguration.class.getName())
- .withStreamName(streamName);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- @Test
- @Timeout(120)
- public void testBasicSendReceiveWithKafkaStyle() throws ExecutionException, InterruptedException {
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSKinesisPropertyFactory
- .basic()
- .withKafkaTopic(topicName)
- .withAmazonConfig(awsService.getConnectionProperties(), CamelAWSKinesisPropertyFactory.KAFKA_STYLE)
- .withConfiguration(TestKinesisConfiguration.class.getName())
- .withStreamName(streamName);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- @Test
- @Timeout(120)
- public void testBasicSendReceiveUsingUrl() throws ExecutionException, InterruptedException {
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSKinesisPropertyFactory
- .basic()
- .withKafkaTopic(topicName)
- .withAmazonConfig(awsService.getConnectionProperties())
- .withConfiguration(TestKinesisConfiguration.class.getName())
- .withUrl(streamName)
- .buildUrl();
+ .withStream(streamName);
runTest(connectorPropertyFactory, topicName, expect);
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelAWSLambdaPropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelAWSLambdaPropertyFactory.java
index e8a1433..14472aa 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelAWSLambdaPropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelAWSLambdaPropertyFactory.java
@@ -27,19 +27,13 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
public class CamelAWSLambdaPropertyFactory extends SinkConnectorPropertyFactory<CamelAWSLambdaPropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-lambda.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-lambda.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-lambda.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-lambda.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-lambda.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-lambda.region");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-lambda-sink.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-lambda-sink.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-lambda-sink.region");
}
-
public CamelAWSLambdaPropertyFactory withAmazonConfig(Properties amazonConfigs) {
return withAmazonConfig(amazonConfigs, this.SPRING_STYLE);
}
@@ -50,29 +44,22 @@ public class CamelAWSLambdaPropertyFactory extends SinkConnectorPropertyFactory<
return this;
}
- public CamelAWSLambdaPropertyFactory withSinkPathFunction(String value) {
- return setProperty("camel.sink.path.function", value);
- }
-
- public CamelAWSLambdaPropertyFactory withSinkEndpointOperation(String value) {
- return setProperty("camel.sink.endpoint.operation", value);
+ public CamelAWSLambdaPropertyFactory withFunction(String value) {
+ return setProperty("camel.kamelet.aws-lambda-sink.function", value);
}
public CamelAWSLambdaPropertyFactory withConfiguration(String value) {
return setProperty("camel.component.aws2-lambda.configuration", classRef(value));
}
- public CamelAWSLambdaPropertyFactory withPojoRequest(boolean value) {
- return setProperty("camel.sink.endpoint.pojoRequest", value);
- }
-
public static CamelAWSLambdaPropertyFactory basic() {
return new CamelAWSLambdaPropertyFactory()
.withTasksMax(1)
.withName("CamelAws2lambdaSinkConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2lambda.CamelAws2lambdaSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awslambdasink.CamelAwslambdasinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelSinkLambdaITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelSinkLambdaITCase.java
index 309fbca..37d440a 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelSinkLambdaITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/lambda/sink/CamelSinkLambdaITCase.java
@@ -124,7 +124,7 @@ public class CamelSinkLambdaITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-lambda-kafka-connector"};
+ return new String[] {"camel-aws-lambda-sink-kafka-connector"};
}
@BeforeEach
@@ -180,8 +180,7 @@ public class CamelSinkLambdaITCase extends CamelSinkTestSupport {
.withTopics(topicName)
.withConfiguration(TestLambda2Configuration.class.getName())
.withAmazonConfig(amazonProperties)
- .withSinkPathFunction(function)
- .withSinkEndpointOperation("createFunction");
+ .withFunction(function);
runTest(testProperties, new CustomProducer(getKafkaService().getBootstrapServers(), topicName, expect));
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelAWSS3PropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelAWSS3PropertyFactory.java
index 23264b5..9474eb1 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelAWSS3PropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelAWSS3PropertyFactory.java
@@ -27,16 +27,11 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
public final class CamelAWSS3PropertyFactory extends SinkConnectorPropertyFactory<CamelAWSS3PropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-s3.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-s3.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-s3.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-s3.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-s3.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-s3.region");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-s3-sink.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-s3-sink.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-s3-sink.region");
}
private CamelAWSS3PropertyFactory() {
@@ -54,7 +49,7 @@ public final class CamelAWSS3PropertyFactory extends SinkConnectorPropertyFactor
}
public CamelAWSS3PropertyFactory withBucketNameOrArn(String bucketNameOrArn) {
- return setProperty("camel.sink.path.bucketNameOrArn", bucketNameOrArn);
+ return setProperty("camel.kamelet.aws-s3-sink.bucketNameOrArn", bucketNameOrArn);
}
public CamelAWSS3PropertyFactory withConfiguration(String configurationClass) {
@@ -62,15 +57,16 @@ public final class CamelAWSS3PropertyFactory extends SinkConnectorPropertyFactor
}
public CamelAWSS3PropertyFactory withAutoCreateBucket(boolean value) {
- return setProperty("camel.sink.endpoint.autoCreateBucket", value);
+ return setProperty("camel.kamelet.aws-s3-sink.autoCreateBucket", value);
}
public static CamelAWSS3PropertyFactory basic() {
return new CamelAWSS3PropertyFactory()
.withTasksMax(1)
.withName("CamelAws2s3SinkConnectorConfig")
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2s3.CamelAws2s3SinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awss3sink.CamelAwss3sinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelSinkAWSS3ITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelSinkAWSS3ITCase.java
index 565aceb..3818f01 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelSinkAWSS3ITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/sink/CamelSinkAWSS3ITCase.java
@@ -120,7 +120,7 @@ public class CamelSinkAWSS3ITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-s3-kafka-connector"};
+ return new String[] {"camel-aws-s3-sink-kafka-connector"};
}
@BeforeEach
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelAWSS3PropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelAWSS3PropertyFactory.java
index 9584ac6..2d42a62 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelAWSS3PropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelAWSS3PropertyFactory.java
@@ -22,7 +22,6 @@ import java.util.Map;
import java.util.Properties;
import org.apache.camel.kafkaconnector.aws.v2.common.AWSPropertiesUtils;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SourceConnectorPropertyFactory;
import org.apache.camel.test.infra.aws.common.AWSConfigs;
@@ -32,16 +31,11 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
*/
final class CamelAWSS3PropertyFactory extends SourceConnectorPropertyFactory<CamelAWSS3PropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-s3.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-s3.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-s3.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-s3.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-s3.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-s3.region");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-s3-source.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-s3-source.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-s3-source.region");
}
private CamelAWSS3PropertyFactory() {
@@ -58,18 +52,12 @@ final class CamelAWSS3PropertyFactory extends SourceConnectorPropertyFactory<Cam
return this;
}
- public EndpointUrlBuilder<CamelAWSS3PropertyFactory> withUrl(String bucket) {
- String queueUrl = String.format("aws2-s3://%s", bucket);
-
- return new EndpointUrlBuilder<>(this::withSourceUrl, queueUrl);
- }
-
public CamelAWSS3PropertyFactory withMaxMessagesPerPoll(int value) {
return setProperty("camel.source.endpoint.maxMessagesPerPoll", Integer.toString(value));
}
public CamelAWSS3PropertyFactory withBucketNameOrArn(String bucketNameOrArn) {
- return setProperty("camel.source.path.bucketNameOrArn", bucketNameOrArn);
+ return setProperty("camel.kamelet.aws-s3-source.bucketNameOrArn", bucketNameOrArn);
}
public CamelAWSS3PropertyFactory withConfiguration(String configurationClass) {
@@ -80,8 +68,9 @@ final class CamelAWSS3PropertyFactory extends SourceConnectorPropertyFactory<Cam
return new CamelAWSS3PropertyFactory()
.withName("CamelAwss3SourceConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2s3.CamelAws2s3SourceConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awss3source.CamelAwss3sourceSourceConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java
index 8ee47b6..1b4d2e5 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java
@@ -20,7 +20,6 @@ package org.apache.camel.kafkaconnector.aws.v2.s3.source;
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import java.util.Properties;
import java.util.concurrent.ExecutionException;
import org.apache.camel.kafkaconnector.aws.v2.s3.common.S3Utils;
@@ -29,7 +28,6 @@ import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.test.CamelSourceTestSupport;
import org.apache.camel.kafkaconnector.common.test.TestMessageConsumer;
import org.apache.camel.test.infra.aws.common.AWSCommon;
-import org.apache.camel.test.infra.aws.common.AWSConfigs;
import org.apache.camel.test.infra.aws.common.services.AWSService;
import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
@@ -44,7 +42,6 @@ import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import static org.apache.camel.kafkaconnector.aws.v2.s3.common.S3Utils.createBucket;
@@ -68,7 +65,7 @@ public class CamelSourceAWSS3ITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-s3-kafka-connector"};
+ return new String[] {"camel-aws-s3-source-kafka-connector"};
}
@BeforeAll
@@ -145,36 +142,4 @@ public class CamelSourceAWSS3ITCase extends CamelSourceTestSupport {
runTest(connectorPropertyFactory, topicName, expect);
}
-
- @Test
- @Timeout(180)
- public void testBasicSendReceiveWithKafkaStyle() throws ExecutionException, InterruptedException {
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSS3PropertyFactory
- .basic()
- .withKafkaTopic(topicName)
- .withConfiguration(TestS3Configuration.class.getName())
- .withBucketNameOrArn(bucketName)
- .withAmazonConfig(service.getConnectionProperties(), CamelAWSS3PropertyFactory.KAFKA_STYLE);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- @Test
- @Timeout(180)
- public void testBasicSendReceiveUsingUrl() throws ExecutionException, InterruptedException {
- Properties amazonProperties = service.getConnectionProperties();
-
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSS3PropertyFactory
- .basic()
- .withKafkaTopic(topicName)
- .withConfiguration(TestS3Configuration.class.getName())
- .withUrl(bucketName)
- .append("accessKey", amazonProperties.getProperty(AWSConfigs.ACCESS_KEY))
- .append("secretKey", amazonProperties.getProperty(AWSConfigs.SECRET_KEY))
- .appendIfAvailable("proxyProtocol", amazonProperties.getProperty(AWSConfigs.PROTOCOL))
- .append("region", amazonProperties.getProperty(AWSConfigs.REGION, Region.US_EAST_1.id()))
- .buildUrl();
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3LargeFilesITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3LargeFilesITCase.java
index f8ae34e..5228604 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3LargeFilesITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3LargeFilesITCase.java
@@ -77,7 +77,7 @@ public class CamelSourceAWSS3LargeFilesITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-s3-kafka-connector"};
+ return new String[] {"camel-aws-s3-source-kafka-connector"};
}
@BeforeAll
@@ -136,7 +136,7 @@ public class CamelSourceAWSS3LargeFilesITCase extends CamelSourceTestSupport {
.withKafkaTopic(topicName)
.withConfiguration(TestS3Configuration.class.getName())
.withBucketNameOrArn(bucketName)
- .withAmazonConfig(service.getConnectionProperties(), CamelAWSS3PropertyFactory.KAFKA_STYLE);
+ .withAmazonConfig(service.getConnectionProperties());
runTest(connectorPropertyFactory, topicName, expect);
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelAWSSNSPropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelAWSSNSPropertyFactory.java
index 7a0a0ab..e4a7422 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelAWSSNSPropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelAWSSNSPropertyFactory.java
@@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SinkConnectorPropertyFactory;
import org.apache.camel.test.infra.aws.common.AWSConfigs;
import software.amazon.awssdk.regions.Region;
@@ -31,34 +30,18 @@ import software.amazon.awssdk.regions.Region;
*/
final class CamelAWSSNSPropertyFactory extends SinkConnectorPropertyFactory<CamelAWSSNSPropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-sns.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-sns.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-sns.region");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-sns.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-sns.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-sns.region");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-sns-sink.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-sns-sink.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-sns-sink.region");
}
private CamelAWSSNSPropertyFactory() {
}
- public EndpointUrlBuilder<CamelAWSSNSPropertyFactory> withUrl(String topicOrArn) {
- String sinkUrl = String.format("aws2-sns:%s", topicOrArn);
-
- return new EndpointUrlBuilder<>(this::withSinkUrl, sinkUrl);
- }
-
public CamelAWSSNSPropertyFactory withTopicOrArn(String topicOrArn) {
- return setProperty("camel.sink.path.topicNameOrArn", topicOrArn);
- }
-
- public CamelAWSSNSPropertyFactory withSubscribeSNStoSQS(String queue) {
- return setProperty("camel.sink.endpoint.subscribeSNStoSQS", "true").setProperty("camel.sink.endpoint.queueUrl",
- queue);
+ return setProperty("camel.kamelet.aws-sns-sink.topicNameOrArn", topicOrArn);
}
public CamelAWSSNSPropertyFactory withAmazonConfig(Properties amazonConfigs) {
@@ -66,7 +49,12 @@ final class CamelAWSSNSPropertyFactory extends SinkConnectorPropertyFactory<Came
}
public CamelAWSSNSPropertyFactory withAutoCreateTopic(boolean value) {
- return setProperty("camel.sink.endpoint.autoCreateTopic", value);
+ return setProperty("camel.kamelet.aws-sns-sink.autoCreateTopic", value);
+ }
+
+ public CamelAWSSNSPropertyFactory withSubscribeSNStoSQS(String queue) {
+ return setProperty("camel.component.aws2-sns.subscribeSNStoSQS", "true")
+ .setProperty("camel.component.aws2-sns.queueUrl", queue);
}
public CamelAWSSNSPropertyFactory withAmazonConfig(Properties amazonConfigs, Map<String, String> style) {
@@ -86,8 +74,9 @@ final class CamelAWSSNSPropertyFactory extends SinkConnectorPropertyFactory<Came
public static CamelAWSSNSPropertyFactory basic() {
return new CamelAWSSNSPropertyFactory().withName("CamelAWS2SNSSinkConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2sns.CamelAws2snsSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awssnssink.CamelAwssnssinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelSinkAWSSNSITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelSinkAWSSNSITCase.java
index bed6b25..3421778 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelSinkAWSSNSITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sns/sink/CamelSinkAWSSNSITCase.java
@@ -22,11 +22,11 @@ import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import org.apache.camel.kafkaconnector.aws.v2.clients.AWSSNSClient;
import org.apache.camel.kafkaconnector.aws.v2.clients.AWSSQSClient;
import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport;
import org.apache.camel.test.infra.aws.common.AWSCommon;
-import org.apache.camel.test.infra.aws.common.AWSConfigs;
import org.apache.camel.test.infra.aws.common.services.AWSService;
import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
@@ -39,10 +39,8 @@ import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sqs.model.Message;
-import static org.apache.camel.kafkaconnector.common.BasicConnectorPropertyFactory.classRef;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
@@ -55,26 +53,39 @@ public class CamelSinkAWSSNSITCase extends CamelSinkTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(CamelSinkAWSSNSITCase.class);
private AWSSQSClient awsSqsClient;
- private String sqsQueueUrl;
+ private AWSSNSClient awsSnsClient;
+
private String queueName;
+ private String sqsQueueUrl;
+ private String snsTopicUrl;
+
private volatile int received;
private final int expect = 10;
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-sns-kafka-connector"};
+ return new String[] {"camel-aws-sns-sink-kafka-connector"};
}
@BeforeEach
public void setUp() {
awsSqsClient = new AWSSQSClient(AWSSDKClientUtils.newSQSClient());
+ awsSnsClient = new AWSSNSClient(AWSSDKClientUtils.newSNSClient());
queueName = AWSCommon.DEFAULT_SQS_QUEUE_FOR_SNS + "-" + TestUtils.randomWithRange(0, 1000);
sqsQueueUrl = awsSqsClient.createQueue(queueName);
LOG.info("Created SQS queue {}", sqsQueueUrl);
+ snsTopicUrl = awsSnsClient.createTopic(queueName);
+
+ LOG.info("Created SNS topic {}", snsTopicUrl);
+
+ awsSnsClient.subscribeSQS(snsTopicUrl, sqsQueueUrl);
+
+ LOG.info("Created subscription between SQS queue {} and SNS topic {}", sqsQueueUrl, snsTopicUrl);
+
received = 0;
}
@@ -124,52 +135,11 @@ public class CamelSinkAWSSNSITCase extends CamelSinkTestSupport {
.withName("CamelAWSSNSSinkConnectorDefault")
.withTopics(topicName)
.withTopicOrArn(queueName)
- .withSubscribeSNStoSQS(sqsQueueUrl)
- .withAutoCreateTopic(true)
+// .withSubscribeSNStoSQS(sqsQueueUrl)
.withConfiguration(TestSnsConfiguration.class.getName())
- .withAmazonConfig(amazonProperties);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- @Test
- @Timeout(value = 90)
- public void testBasicSendReceiveUsingKafkaStyle() throws Exception {
- Properties amazonProperties = service.getConnectionProperties();
- String topicName = getTopicForTest(this.getClass());
-
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSSNSPropertyFactory
- .basic()
- .withName("CamelAWSSNSSinkKafkaStyleConnector")
- .withTopics(topicName)
- .withTopicOrArn(queueName)
- .withSubscribeSNStoSQS(sqsQueueUrl)
.withAutoCreateTopic(true)
- .withConfiguration(TestSnsConfiguration.class.getName())
- .withAmazonConfig(amazonProperties, CamelAWSSNSPropertyFactory.KAFKA_STYLE);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- @Test
- @Timeout(value = 90)
- public void testBasicSendReceiveUsingUrl() throws Exception {
- Properties amazonProperties = service.getConnectionProperties();
- String topicName = getTopicForTest(this.getClass());
-
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSSNSPropertyFactory
- .basic()
- .withName("CamelAWSSNSSinkKafkaStyleConnectorWithUrl")
- .withTopics(topicName)
- .withUrl(queueName)
- .append("queueUrl", sqsQueueUrl)
- .append("subscribeSNStoSQS", "true")
- .append("region", amazonProperties.getProperty(AWSConfigs.REGION, Region.US_EAST_1.id()))
- .append("configuration", classRef(TestSnsConfiguration.class.getName()))
- .append("autoCreateTopic", "true")
- .buildUrl();
+ .withAmazonConfig(amazonProperties);
runTest(connectorPropertyFactory, topicName, expect);
-
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelAWSSQSPropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelAWSSQSPropertyFactory.java
index 60b5803..01f5758 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelAWSSQSPropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelAWSSQSPropertyFactory.java
@@ -22,7 +22,6 @@ import java.util.Map;
import java.util.Properties;
import org.apache.camel.kafkaconnector.aws.v2.common.AWSPropertiesUtils;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SinkConnectorPropertyFactory;
import org.apache.camel.test.infra.aws.common.AWSConfigs;
@@ -31,27 +30,18 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
*/
final class CamelAWSSQSPropertyFactory extends SinkConnectorPropertyFactory<CamelAWSSQSPropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-sqs.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-sqs.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-sqs.region");
- SPRING_STYLE.put(AWSConfigs.PROTOCOL, "camel.sink.endpoint.protocol");
- SPRING_STYLE.put(AWSConfigs.AMAZON_AWS_HOST, "camel.sink.endpoint.amazonAWSHost");
-
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-sqs.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-sqs.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-sqs.region");
- KAFKA_STYLE.put(AWSConfigs.PROTOCOL, "camel.sink.endpoint.protocol");
- KAFKA_STYLE.put(AWSConfigs.AMAZON_AWS_HOST, "camel.sink.endpoint.amazonAWSHost");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-sqs-sink.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-sqs-sink.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-sqs-sink.region");
+ SPRING_STYLE.put(AWSConfigs.PROTOCOL, "camel.component.aws2-sqs.protocol");
+ SPRING_STYLE.put(AWSConfigs.AMAZON_AWS_HOST, "camel.component.aws2-sqs.amazonAWSHost");
}
private CamelAWSSQSPropertyFactory() {
}
-
public CamelAWSSQSPropertyFactory withAmazonConfig(Properties amazonConfigs) {
return withAmazonConfig(amazonConfigs, this.SPRING_STYLE);
}
@@ -62,27 +52,21 @@ final class CamelAWSSQSPropertyFactory extends SinkConnectorPropertyFactory<Came
return this;
}
- public EndpointUrlBuilder<CamelAWSSQSPropertyFactory> withUrl(String queueNameOrArn) {
- String queueUrl = String.format("aws2-sqs://%s", queueNameOrArn);
-
- return new EndpointUrlBuilder<>(this::withSinkUrl, queueUrl);
- }
-
public CamelAWSSQSPropertyFactory withQueueNameOrArn(String queueNameOrArn) {
- return setProperty("camel.sink.path.queueNameOrArn", queueNameOrArn);
+ return setProperty("camel.kamelet.aws-sqs-sink.queueNameOrArn", queueNameOrArn);
}
public CamelAWSSQSPropertyFactory withAutoCreateQueue(boolean value) {
- return setProperty("camel.sink.endpoint.autoCreateQueue", value);
+ return setProperty("camel.kamelet.aws-sqs-sink.autoCreateQueue", value);
}
public static CamelAWSSQSPropertyFactory basic() {
return new CamelAWSSQSPropertyFactory()
.withName("CamelAws2sqsSinkConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2sqs.CamelAws2sqsSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awssqssink.CamelAwssqssinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
-
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelSinkAWSSQSITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelSinkAWSSQSITCase.java
index f688611..e21b5d2 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelSinkAWSSQSITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/sink/CamelSinkAWSSQSITCase.java
@@ -26,23 +26,19 @@ import org.apache.camel.kafkaconnector.aws.v2.clients.AWSSQSClient;
import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport;
import org.apache.camel.test.infra.aws.common.AWSCommon;
-import org.apache.camel.test.infra.aws.common.AWSConfigs;
import org.apache.camel.test.infra.aws.common.services.AWSService;
import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
import org.apache.camel.test.infra.common.TestUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sqs.model.Message;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -64,7 +60,7 @@ public class CamelSinkAWSSQSITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-sqs-kafka-connector"};
+ return new String[] {"camel-aws-sqs-sink-kafka-connector"};
}
@@ -144,62 +140,4 @@ public class CamelSinkAWSSQSITCase extends CamelSinkTestSupport {
fail(e.getMessage());
}
}
-
- @DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote",
- disabledReason = "Runs repeatedly, so it's disabled to avoid abusing the free tier")
- @Timeout(value = 120)
- @RepeatedTest(3)
- public void testBasicSendReceiveUsingKafkaStyle() {
- try {
- Properties amazonProperties = awsService.getConnectionProperties();
- String topicName = getTopicForTest(this);
-
- ConnectorPropertyFactory testProperties = CamelAWSSQSPropertyFactory
- .basic()
- .withName("CamelAwssqsSinkConnectorKafkaStyle")
- .withTopics(topicName)
- .withAmazonConfig(amazonProperties, CamelAWSSQSPropertyFactory.KAFKA_STYLE)
- .withAutoCreateQueue(true)
- .withQueueNameOrArn(queueName);
-
- runTest(testProperties, topicName, expect);
-
- } catch (Exception e) {
- LOG.error("Amazon SQS test failed: {}", e.getMessage(), e);
- fail(e.getMessage());
- }
- }
-
- @DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote",
- disabledReason = "Uses arguments that may require additional setup on AWS or are not available in remote mode")
- @Timeout(value = 120)
- @RepeatedTest(3)
- public void testBasicSendReceiveUsingUrl() {
- try {
- Properties amazonProperties = awsService.getConnectionProperties();
- String topicName = getTopicForTest(this);
-
- ConnectorPropertyFactory testProperties = CamelAWSSQSPropertyFactory
- .basic()
- .withName("CamelAwssqsSinkConnectorUsingUrl")
- .withTopics(topicName)
- .withUrl(queueName)
- .append("autoCreateQueue", "true")
- .append("accessKey", amazonProperties.getProperty(AWSConfigs.ACCESS_KEY))
- .append("secretKey", amazonProperties.getProperty(AWSConfigs.SECRET_KEY))
- .append("protocol", amazonProperties.getProperty(AWSConfigs.PROTOCOL))
- .append("region", amazonProperties.getProperty(AWSConfigs.REGION, Region.US_EAST_1.toString()))
- .append("amazonAWSHost", amazonProperties.getProperty(AWSConfigs.AMAZON_AWS_HOST))
- .buildUrl();
-
- runTest(testProperties, topicName, expect);
-
- } catch (Exception e) {
- LOG.error("Amazon SQS test failed: {}", e.getMessage(), e);
- fail(e.getMessage());
- }
- }
-
-
-
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelAWSSQSPropertyFactory.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelAWSSQSPropertyFactory.java
index 85aa76e..d238eba 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelAWSSQSPropertyFactory.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelAWSSQSPropertyFactory.java
@@ -22,7 +22,6 @@ import java.util.Map;
import java.util.Properties;
import org.apache.camel.kafkaconnector.aws.v2.common.AWSPropertiesUtils;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SourceConnectorPropertyFactory;
import org.apache.camel.test.infra.aws.common.AWSConfigs;
@@ -31,20 +30,13 @@ import org.apache.camel.test.infra.aws.common.AWSConfigs;
*/
final class CamelAWSSQSPropertyFactory extends SourceConnectorPropertyFactory<CamelAWSSQSPropertyFactory> {
public static final Map<String, String> SPRING_STYLE = new HashMap<>();
- public static final Map<String, String> KAFKA_STYLE = new HashMap<>();
static {
- SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-sqs.accessKey");
- SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-sqs.secretKey");
- SPRING_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-sqs.region");
- SPRING_STYLE.put(AWSConfigs.PROTOCOL, "camel.source.endpoint.protocol");
- SPRING_STYLE.put(AWSConfigs.AMAZON_AWS_HOST, "camel.source.endpoint.amazonAWSHost");
-
- KAFKA_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.component.aws2-sqs.access-key");
- KAFKA_STYLE.put(AWSConfigs.SECRET_KEY, "camel.component.aws2-sqs.secret-key");
- KAFKA_STYLE.put(AWSConfigs.REGION, "camel.component.aws2-sqs.region");
- KAFKA_STYLE.put(AWSConfigs.PROTOCOL, "camel.source.endpoint.protocol");
- KAFKA_STYLE.put(AWSConfigs.AMAZON_AWS_HOST, "camel.source.endpoint.amazonAWSHost");
+ SPRING_STYLE.put(AWSConfigs.ACCESS_KEY, "camel.kamelet.aws-sqs-source.accessKey");
+ SPRING_STYLE.put(AWSConfigs.SECRET_KEY, "camel.kamelet.aws-sqs-source.secretKey");
+ SPRING_STYLE.put(AWSConfigs.REGION, "camel.kamelet.aws-sqs-source.region");
+ SPRING_STYLE.put(AWSConfigs.PROTOCOL, "camel.component.aws2-sqs.protocol");
+ SPRING_STYLE.put(AWSConfigs.AMAZON_AWS_HOST, "camel.component.aws2-sqs.amazonAWSHost");
}
private CamelAWSSQSPropertyFactory() {
@@ -62,21 +54,16 @@ final class CamelAWSSQSPropertyFactory extends SourceConnectorPropertyFactory<Ca
}
public CamelAWSSQSPropertyFactory withQueueOrArn(String queueOrArn) {
- return setProperty("camel.source.path.queueNameOrArn", queueOrArn);
- }
-
- public EndpointUrlBuilder<CamelAWSSQSPropertyFactory> withUrl(String queueOrArn) {
- String queueUrl = String.format("aws2-sqs://%s", queueOrArn);
-
- return new EndpointUrlBuilder<>(this::withSourceUrl, queueUrl);
+ return setProperty("camel.kamelet.aws-sqs-source.queueNameOrArn", queueOrArn);
}
public static CamelAWSSQSPropertyFactory basic() {
return new CamelAWSSQSPropertyFactory()
.withName("CamelAws2sqsSourceConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.aws2sqs.CamelAws2sqsSourceConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.awssqssource.CamelAwssqssourceSourceConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelSourceAWSSQSITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelSourceAWSSQSITCase.java
index 9f40c4f..7ee73bd 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelSourceAWSSQSITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/sqs/source/CamelSourceAWSSQSITCase.java
@@ -17,7 +17,6 @@
package org.apache.camel.kafkaconnector.aws.v2.sqs.source;
-import java.util.Properties;
import java.util.concurrent.ExecutionException;
import org.apache.camel.kafkaconnector.aws.v2.clients.AWSSQSClient;
@@ -25,7 +24,6 @@ import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.test.CamelSourceTestSupport;
import org.apache.camel.kafkaconnector.common.test.TestMessageConsumer;
import org.apache.camel.test.infra.aws.common.AWSCommon;
-import org.apache.camel.test.infra.aws.common.AWSConfigs;
import org.apache.camel.test.infra.aws.common.services.AWSService;
import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
@@ -35,12 +33,10 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import software.amazon.awssdk.regions.Region;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
@@ -60,7 +56,7 @@ public class CamelSourceAWSSQSITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-aws2-sqs-kafka-connector"};
+ return new String[] {"camel-aws-sqs-source-kafka-connector"};
}
@BeforeEach
@@ -107,41 +103,4 @@ public class CamelSourceAWSSQSITCase extends CamelSourceTestSupport {
runTest(connectorPropertyFactory, topicName, expect);
}
-
- // This test does not run remotely because SQS has a cool down period for
- // creating and removing the SQS queue
- @DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote")
- @Test
- @Timeout(90)
- public void testBasicSendReceiveWithKafkaStyle() throws ExecutionException, InterruptedException {
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSSQSPropertyFactory
- .basic()
- .withKafkaTopic(topicName)
- .withQueueOrArn(queueName)
- .withAmazonConfig(service.getConnectionProperties(), CamelAWSSQSPropertyFactory.KAFKA_STYLE);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- // This test does not run remotely because SQS has a cool down period for
- // creating and removing the SQS queue
- @DisabledIfSystemProperty(named = "aws-service.instance.type", matches = "remote")
- @Test
- @Timeout(90)
- public void testBasicSendReceiveUsingUrl() throws ExecutionException, InterruptedException {
- Properties amazonProperties = service.getConnectionProperties();
-
- ConnectorPropertyFactory connectorPropertyFactory = CamelAWSSQSPropertyFactory
- .basic()
- .withKafkaTopic(topicName)
- .withUrl(queueName)
- .append("accessKey", amazonProperties.getProperty(AWSConfigs.ACCESS_KEY))
- .append("secretKey", amazonProperties.getProperty(AWSConfigs.SECRET_KEY))
- .append("protocol", amazonProperties.getProperty(AWSConfigs.PROTOCOL))
- .appendIfAvailable("amazonAWSHost", amazonProperties.getProperty(AWSConfigs.AMAZON_AWS_HOST))
- .append("region", amazonProperties.getProperty(AWSConfigs.REGION, Region.US_EAST_1.toString()))
- .buildUrl();
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
}
diff --git a/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobITCase.java b/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobITCase.java
index 088b4ae..55cdc5d 100644
--- a/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobITCase.java
+++ b/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobITCase.java
@@ -81,7 +81,7 @@ public class CamelSinkAzureStorageBlobITCase extends CamelSinkTestSupport {
sentData.put(sentFile, testMessageContent(current));
- messageParameters.put(CamelSinkTask.HEADER_CAMEL_PREFIX + "CamelAzureStorageBlobBlobName", sentFile);
+ messageParameters.put(CamelSinkTask.HEADER_CAMEL_PREFIX + "file", sentFile);
return messageParameters;
}
@@ -89,7 +89,7 @@ public class CamelSinkAzureStorageBlobITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[]{"camel-azure-storage-blob-kafka-connector"};
+ return new String[]{"camel-azure-storage-blob-sink-kafka-connector"};
}
@BeforeEach
@@ -119,7 +119,7 @@ public class CamelSinkAzureStorageBlobITCase extends CamelSinkTestSupport {
@Override
protected void verifyMessages(CountDownLatch latch) throws InterruptedException {
- if (latch.await(120, TimeUnit.SECONDS)) {
+ if (latch.await(240, TimeUnit.SECONDS)) {
assertEquals(expect, received,
"Didn't process the expected amount of messages: " + received + " != " + expect);
} else {
@@ -147,7 +147,7 @@ public class CamelSinkAzureStorageBlobITCase extends CamelSinkTestSupport {
blobClient.download(outputStream);
String contentFile = outputStream.toString();
- LOG.info("Received: '{}' with content: '{}'", receivedFile, contentFile);
+ LOG.info("Received: '{}' with content: '{}' expected content: '{}'", receivedFile, contentFile, sentData.get(receivedFile));
assertEquals(sentData.get(receivedFile), contentFile, "Did not receive the same message that was sent");
received++;
@@ -173,20 +173,4 @@ public class CamelSinkAzureStorageBlobITCase extends CamelSinkTestSupport {
runTest(factory, new CustomProducer(getKafkaService().getBootstrapServers(), topicName, expect));
}
- @Test
- @Timeout(90)
- public void testBasicSendReceiveUrl() throws Exception {
- AzureCredentialsHolder azureCredentialsHolder = service.azureCredentials();
-
- ConnectorPropertyFactory factory = CamelSinkAzureStorageBlobPropertyFactory
- .basic()
- .withTopics(topicName)
- .withConfiguration(TestBlobConfiguration.class.getName())
- .withUrl(azureCredentialsHolder.accountName() + "/" + blobContainerName)
- .append("accessKey", azureCredentialsHolder.accountKey())
- .append("operation", "uploadBlockBlob")
- .buildUrl();
-
- runTest(factory, new CustomProducer(getKafkaService().getBootstrapServers(), topicName, expect));
- }
}
diff --git a/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobPropertyFactory.java b/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobPropertyFactory.java
index 48491a8..23b5fe2 100644
--- a/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobPropertyFactory.java
+++ b/tests/itests-azure-storage-blob/src/test/java/org/apache/camel/kafkaconnector/azure/storage/blob/sink/CamelSinkAzureStorageBlobPropertyFactory.java
@@ -17,25 +17,24 @@
package org.apache.camel.kafkaconnector.azure.storage.blob.sink;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SinkConnectorPropertyFactory;
public class CamelSinkAzureStorageBlobPropertyFactory extends SinkConnectorPropertyFactory<CamelSinkAzureStorageBlobPropertyFactory> {
public CamelSinkAzureStorageBlobPropertyFactory withAccountName(String value) {
- return setProperty("camel.sink.path.accountName", value);
+ return setProperty("camel.kamelet.azure-storage-blob-sink.accountName", value);
}
public CamelSinkAzureStorageBlobPropertyFactory withContainerName(String value) {
- return setProperty("camel.sink.path.containerName", value);
+ return setProperty("camel.kamelet.azure-storage-blob-sink.containerName", value);
}
public CamelSinkAzureStorageBlobPropertyFactory withAccessKey(String value) {
- return setProperty("camel.sink.endpoint.accessKey", value);
+ return setProperty("camel.kamelet.azure-storage-blob-sink.accessKey", value);
}
public CamelSinkAzureStorageBlobPropertyFactory withBlobName(String value) {
- return setProperty("camel.component.azure-storage-blob.blobName", value);
+ return setProperty("camel.kamelet.azure-storage-blob-sink.blobName", value);
}
public CamelSinkAzureStorageBlobPropertyFactory withConfiguration(String configurationClass) {
@@ -43,23 +42,17 @@ public class CamelSinkAzureStorageBlobPropertyFactory extends SinkConnectorPrope
}
public CamelSinkAzureStorageBlobPropertyFactory withOperation(String value) {
- return setProperty("camel.sink.endpoint.operation", value);
+ return setProperty("camel.kamelet.azure-storage-blob-sink.operation", value);
}
- public EndpointUrlBuilder<CamelSinkAzureStorageBlobPropertyFactory> withUrl(String path) {
- String sinkUrl = String.format("azure-storage-blob://%s", path);
-
- return new EndpointUrlBuilder<>(this::withSinkUrl, sinkUrl);
- }
-
-
public static CamelSinkAzureStorageBlobPropertyFactory basic() {
return new CamelSinkAzureStorageBlobPropertyFactory()
.withTasksMax(1)
.withName("CamelAzurestorageblobSinkConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.azurestorageblob.CamelAzurestorageblobSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.azurestorageblobsink.CamelAzurestorageblobsinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueueITCase.java b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueueITCase.java
index 55b99e3..0533d2b 100644
--- a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueueITCase.java
+++ b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueueITCase.java
@@ -59,7 +59,7 @@ public class CamelSinkAzureStorageQueueITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[]{"camel-azure-storage-queue-kafka-connector"};
+ return new String[]{"camel-azure-storage-queue-sink-kafka-connector"};
}
@BeforeEach
@@ -118,7 +118,6 @@ public class CamelSinkAzureStorageQueueITCase extends CamelSinkTestSupport {
queueClient.peekMessages(count, null, null).forEach(this::acknowledgeReceived);
}
-
@Test
@Timeout(90)
public void testBasicSendReceive() throws Exception {
@@ -130,27 +129,8 @@ public class CamelSinkAzureStorageQueueITCase extends CamelSinkTestSupport {
.withTopics(topicName)
.withAccessKey(azureCredentialsHolder.accountKey())
.withAccountName(azureCredentialsHolder.accountName())
- .withOperation("sendMessage")
.withQueueName(queueName);
runTest(connectorPropertyFactory, topicName, expect);
}
-
-
- @Test
- @Timeout(90)
- public void testBasicSendReceiveUrl() throws Exception {
- AzureCredentialsHolder azureCredentialsHolder = service.azureCredentials();
-
- ConnectorPropertyFactory connectorPropertyFactory = CamelSinkAzureStorageQueuePropertyFactory
- .basic()
- .withTopics(topicName)
- .withConfiguration(TestQueueConfiguration.class.getName())
- .withUrl(azureCredentialsHolder.accountName() + "/" + queueName)
- .append("accessKey", azureCredentialsHolder.accountKey())
- .append("operation", "sendMessage")
- .buildUrl();
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
}
diff --git a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueuePropertyFactory.java b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueuePropertyFactory.java
index c6f22f1..280b20e 100644
--- a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueuePropertyFactory.java
+++ b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/sink/CamelSinkAzureStorageQueuePropertyFactory.java
@@ -17,45 +17,34 @@
package org.apache.camel.kafkaconnector.azure.storage.queue.sink;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SinkConnectorPropertyFactory;
public class CamelSinkAzureStorageQueuePropertyFactory extends SinkConnectorPropertyFactory<CamelSinkAzureStorageQueuePropertyFactory> {
public CamelSinkAzureStorageQueuePropertyFactory withAccountName(String value) {
- return setProperty("camel.sink.path.accountName", value);
+ return setProperty("camel.kamelet.azure-storage-queue-sink.accountName", value);
}
public CamelSinkAzureStorageQueuePropertyFactory withQueueName(String value) {
- return setProperty("camel.sink.path.queueName", value);
+ return setProperty("camel.kamelet.azure-storage-queue-sink.queueName", value);
}
public CamelSinkAzureStorageQueuePropertyFactory withAccessKey(String value) {
- return setProperty("camel.component.azure-storage-queue.accessKey", value);
+ return setProperty("camel.kamelet.azure-storage-queue-sink.accessKey", value);
}
public CamelSinkAzureStorageQueuePropertyFactory withConfiguration(String configurationClass) {
return setProperty("camel.component.azure-storage-queue.configuration", classRef(configurationClass));
}
- public CamelSinkAzureStorageQueuePropertyFactory withOperation(String value) {
- return setProperty("camel.component.azure-storage-queue.operation", value);
- }
-
- public EndpointUrlBuilder<CamelSinkAzureStorageQueuePropertyFactory> withUrl(String destinationName) {
- String sinkUrl = String.format("azure-storage-queue://%s", destinationName);
-
- return new EndpointUrlBuilder<>(this::withSinkUrl, sinkUrl);
- }
-
-
public static CamelSinkAzureStorageQueuePropertyFactory basic() {
return new CamelSinkAzureStorageQueuePropertyFactory()
.withTasksMax(1)
.withName("CamelAzurestoragequeueSinkConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.azurestoragequeue.CamelAzurestoragequeueSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.azurestoragequeuesink.CamelAzurestoragequeuesinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueueITCase.java b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueueITCase.java
index d4b31af..687b817 100644
--- a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueueITCase.java
+++ b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueueITCase.java
@@ -55,7 +55,7 @@ public class CamelSourceAzureStorageQueueITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[]{"camel-azure-storage-queue-kafka-connector"};
+ return new String[]{"camel-azure-storage-queue-source-kafka-connector"};
}
@BeforeEach
diff --git a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueuePropertyFactory.java b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueuePropertyFactory.java
index 13024cf..585078c 100644
--- a/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueuePropertyFactory.java
+++ b/tests/itests-azure-storage-queue/src/test/java/org/apache/camel/kafkaconnector/azure/storage/queue/source/CamelSourceAzureStorageQueuePropertyFactory.java
@@ -21,32 +21,29 @@ import org.apache.camel.kafkaconnector.common.SourceConnectorPropertyFactory;
public class CamelSourceAzureStorageQueuePropertyFactory extends SourceConnectorPropertyFactory<CamelSourceAzureStorageQueuePropertyFactory> {
public CamelSourceAzureStorageQueuePropertyFactory withAccountName(String value) {
- return setProperty("camel.source.path.accountName", value);
+ return setProperty("camel.kamelet.azure-storage-queue-source.accountName", value);
}
public CamelSourceAzureStorageQueuePropertyFactory withQueueName(String value) {
- return setProperty("camel.source.path.queueName", value);
+ return setProperty("camel.kamelet.azure-storage-queue-source.queueName", value);
}
public CamelSourceAzureStorageQueuePropertyFactory withAccessKey(String value) {
- return setProperty("camel.component.azure-storage-queue.accessKey", value);
+ return setProperty("camel.kamelet.azure-storage-queue-source.accessKey", value);
}
public CamelSourceAzureStorageQueuePropertyFactory withConfiguration(String configurationClass) {
return setProperty("camel.component.azure-storage-queue.configuration", classRef(configurationClass));
}
- public CamelSourceAzureStorageQueuePropertyFactory withOperation(String value) {
- return setProperty("camel.component.azure-storage-queue.operation", value);
- }
-
public static CamelSourceAzureStorageQueuePropertyFactory basic() {
return new CamelSourceAzureStorageQueuePropertyFactory()
.withTasksMax(1)
.withName("CamelAzurequeueSourceConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.azurestoragequeue.CamelAzurestoragequeueSourceConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.azurestoragequeuesource.CamelAzurestoragequeuesourceSourceConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/ConnectorPropertyFactory.java b/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/ConnectorPropertyFactory.java
index a89695a..67cc07d 100644
--- a/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/ConnectorPropertyFactory.java
+++ b/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/ConnectorPropertyFactory.java
@@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
/**
* An interface for producing different types of connector properties that match
- * an specific type of connector in test.
+ * a specific type of connector in test.
*/
public interface ConnectorPropertyFactory {
diff --git a/tests/itests-elasticsearch/pom.xml b/tests/itests-elasticsearch/pom.xml
index 6e55473..8a3b38e 100644
--- a/tests/itests-elasticsearch/pom.xml
+++ b/tests/itests-elasticsearch/pom.xml
@@ -58,6 +58,24 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-elasticsearch-rest</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-bean</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-kamelet-reify</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.slf4j</groupId>
+ <artifactId>slf4j-jboss-logmanager</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
diff --git a/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/common/ElasticSearchCommon.java b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/common/ElasticSearchCommon.java
index 7db8529..ee34326 100644
--- a/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/common/ElasticSearchCommon.java
+++ b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/common/ElasticSearchCommon.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.camel.kafkaconnector.elasticsearch.common;
public final class ElasticSearchCommon {
diff --git a/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/common/ElasticSearchIndexMessageProducer.java b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/common/ElasticSearchIndexMessageProducer.java
new file mode 100644
index 0000000..0b0832f
--- /dev/null
+++ b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/common/ElasticSearchIndexMessageProducer.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.kafkaconnector.elasticsearch.common;
+
+import java.util.Map;
+
+import org.apache.camel.kafkaconnector.common.clients.kafka.KafkaClient;
+import org.apache.camel.kafkaconnector.common.test.AbstractTestMessageProducer;
+
+public class ElasticSearchIndexMessageProducer extends AbstractTestMessageProducer<String> {
+
+ public ElasticSearchIndexMessageProducer(String bootStrapServer, String topicName, int count) {
+ super(bootStrapServer, topicName, count);
+ }
+
+ public ElasticSearchIndexMessageProducer(KafkaClient<String, String> kafkaClient, String topicName, int count) {
+ super(kafkaClient, topicName, count);
+ }
+
+ @Override
+ public Map<String, String> messageHeaders(String text, int current) {
+ return null;
+ }
+
+ @Override
+ public String testMessageContent(int current) {
+ return "{\n"
+ + " \"tags\": [\n"
+ + " \"opster\",\n"
+ + " \"elasticsearch\"\n"
+ + " ],\n"
+ + " \"date\": \"01-01-2020\",\n"
+ + " \"counter\": \"" + current + "\"\n"
+ + "}";
+ }
+}
\ No newline at end of file
diff --git a/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelElasticSearchPropertyFactory.java b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelElasticSearchPropertyFactory.java
index e0c8118..a68780f 100644
--- a/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelElasticSearchPropertyFactory.java
+++ b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelElasticSearchPropertyFactory.java
@@ -17,7 +17,6 @@
package org.apache.camel.kafkaconnector.elasticsearch.sink;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SinkConnectorPropertyFactory;
final class CamelElasticSearchPropertyFactory extends SinkConnectorPropertyFactory<CamelElasticSearchPropertyFactory> {
@@ -27,34 +26,28 @@ final class CamelElasticSearchPropertyFactory extends SinkConnectorPropertyFacto
}
public CamelElasticSearchPropertyFactory withClusterName(String clusterName) {
- return setProperty("camel.sink.path.clusterName", clusterName);
+ return setProperty("camel.kamelet.elasticsearch-index-sink.clusterName", clusterName);
}
public CamelElasticSearchPropertyFactory withHostAddress(String hostAddress) {
- return setProperty("camel.sink.endpoint.hostAddresses", hostAddress);
+ return setProperty("camel.kamelet.elasticsearch-index-sink.hostAddresses", hostAddress);
}
public CamelElasticSearchPropertyFactory withIndexName(String indexName) {
- return setProperty("camel.sink.endpoint.indexName", indexName);
- }
-
- public CamelElasticSearchPropertyFactory withOperation(String operation) {
- return setProperty("camel.sink.endpoint.operation", operation);
- }
-
- public EndpointUrlBuilder<CamelElasticSearchPropertyFactory> withUrl(String clusterName) {
- String queueUrl = String.format("elasticsearch-rest://%s", clusterName);
-
- return new EndpointUrlBuilder<>(this::withSinkUrl, queueUrl);
+ return setProperty("camel.kamelet.elasticsearch-index-sink.indexName", indexName);
}
public static CamelElasticSearchPropertyFactory basic() {
return new CamelElasticSearchPropertyFactory()
.withName("CamelElasticSearchSinkConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.elasticsearchrest.CamelElasticsearchrestSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.elasticsearchindexsink.CamelElasticsearchindexsinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.kamelet.elasticsearch-index-sink.username", "dummy")
+ .setProperty("camel.kamelet.elasticsearch-index-sink.password", "dummy")
+ .setProperty("camel.kamelet.elasticsearch-index-sink.enableSSL", "false")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelSinkElasticSearchITCase.java b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelSinkElasticSearchITCase.java
index bc12b51..e3efa9b 100644
--- a/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelSinkElasticSearchITCase.java
+++ b/tests/itests-elasticsearch/src/test/java/org/apache/camel/kafkaconnector/elasticsearch/sink/CamelSinkElasticSearchITCase.java
@@ -20,10 +20,14 @@ package org.apache.camel.kafkaconnector.elasticsearch.sink;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport;
import org.apache.camel.kafkaconnector.elasticsearch.clients.ElasticSearchClient;
import org.apache.camel.kafkaconnector.elasticsearch.common.ElasticSearchCommon;
+import org.apache.camel.kafkaconnector.elasticsearch.common.ElasticSearchIndexMessageProducer;
import org.apache.camel.test.infra.elasticsearch.services.ElasticSearchService;
import org.apache.camel.test.infra.elasticsearch.services.ElasticSearchServiceFactory;
import org.elasticsearch.search.SearchHit;
@@ -39,7 +43,6 @@ import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@DisabledIfSystemProperty(named = "kafka.instance.type", matches = "local-(kafka|strimzi)-container",
@@ -49,6 +52,7 @@ public class CamelSinkElasticSearchITCase extends CamelSinkTestSupport {
public static ElasticSearchService elasticSearch = ElasticSearchServiceFactory.createService();
private static final Logger LOG = LoggerFactory.getLogger(CamelElasticSearchPropertyFactory.class);
+ private static final ObjectMapper MAPPER = new ObjectMapper();
private ElasticSearchClient client;
private String topicName;
@@ -60,7 +64,7 @@ public class CamelSinkElasticSearchITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-elasticsearch-rest-kafka-connector"};
+ return new String[] {"camel-elasticsearch-index-sink-kafka-connector"};
}
@BeforeEach
@@ -100,52 +104,32 @@ public class CamelSinkElasticSearchITCase extends CamelSinkTestSupport {
private void verifyHit(SearchHit searchHit) {
String source = searchHit.getSourceAsString();
+ LOG.debug("Search hit: {} ", source);
assertNotNull(source);
assertFalse(source.isEmpty());
- // TODO: this is not enough, we need to parse the json and check the key itself
- assertTrue(source.contains(transformKey));
+ try {
+ JsonNode rootNode = MAPPER.readTree(source);
+ assertEquals(String.valueOf(received), rootNode.at("/counter").asText());
+ } catch (JsonProcessingException e) {
+ LOG.error("Error in parsing json elasticsearch search hit answer: " + e.getMessage() + e.getCause());
+ fail();
+ }
- LOG.debug("Search hit: {} ", searchHit.getSourceAsString());
received++;
}
-
@Test
@Timeout(90)
public void testIndexOperation() throws Exception {
ConnectorPropertyFactory propertyFactory = CamelElasticSearchPropertyFactory
.basic()
.withTopics(topicName)
- .withOperation("Index")
.withClusterName(ElasticSearchCommon.DEFAULT_ELASTICSEARCH_CLUSTER)
.withHostAddress(elasticSearch.getHttpHostAddress())
- .withIndexName(ElasticSearchCommon.DEFAULT_ELASTICSEARCH_INDEX)
- .withTransformsConfig("ElasticSearchTransforms")
- .withEntry("type", "org.apache.camel.kafkaconnector.elasticsearchrest.transformers.ConnectRecordValueToMapTransforms")
- .withEntry("key", transformKey)
- .end();
-
- runTest(propertyFactory, topicName, expect);
- }
+ .withIndexName(ElasticSearchCommon.DEFAULT_ELASTICSEARCH_INDEX);
- @Test
- @Timeout(90)
- public void testIndexOperationUsingUrl() throws Exception {
- ConnectorPropertyFactory propertyFactory = CamelElasticSearchPropertyFactory
- .basic()
- .withTopics(topicName)
- .withUrl(ElasticSearchCommon.DEFAULT_ELASTICSEARCH_CLUSTER)
- .append("hostAddresses", elasticSearch.getHttpHostAddress())
- .append("operation", "Index")
- .append("indexName", ElasticSearchCommon.DEFAULT_ELASTICSEARCH_INDEX)
- .buildUrl()
- .withTransformsConfig("ElasticSearchTransforms")
- .withEntry("type", "org.apache.camel.kafkaconnector.elasticsearchrest.transformers.ConnectRecordValueToMapTransforms")
- .withEntry("key", transformKey)
- .end();
-
- runTest(propertyFactory, topicName, expect);
+ runTest(propertyFactory, new ElasticSearchIndexMessageProducer(getKafkaService().getBootstrapServers(), topicName, expect));
}
}
diff --git a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelHTTPPropertyFactory.java b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelHTTPPropertyFactory.java
index d469756..67606a7 100644
--- a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelHTTPPropertyFactory.java
+++ b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelHTTPPropertyFactory.java
@@ -17,7 +17,6 @@
package org.apache.camel.kafkaconnector.http.sink;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SinkConnectorPropertyFactory;
final class CamelHTTPPropertyFactory extends SinkConnectorPropertyFactory<CamelHTTPPropertyFactory> {
@@ -25,22 +24,17 @@ final class CamelHTTPPropertyFactory extends SinkConnectorPropertyFactory<CamelH
}
- public CamelHTTPPropertyFactory withHttpUri(String uri) {
- return setProperty("camel.sink.path.httpUri", uri);
- }
-
- public EndpointUrlBuilder<CamelHTTPPropertyFactory> withUrl(String hostname) {
- String url = String.format("http://%s", hostname);
-
- return new EndpointUrlBuilder<>(this::withSinkUrl, url);
+ public CamelHTTPPropertyFactory withHttpUrl(String url) {
+ return setProperty("camel.kamelet.http-sink.url", url);
}
public static CamelHTTPPropertyFactory basic() {
return new CamelHTTPPropertyFactory()
.withTasksMax(1)
.withName("CamelHttpSinkConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.http.CamelHttpSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.httpsink.CamelHttpsinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java
index ab08a5e..79b4b40 100644
--- a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java
+++ b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java
@@ -55,7 +55,7 @@ public class CamelSinkHTTPITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-http-kafka-connector"};
+ return new String[] {"camel-http-sink-kafka-connector"};
}
@BeforeEach
@@ -118,24 +118,11 @@ public class CamelSinkHTTPITCase extends CamelSinkTestSupport {
@Test
@Timeout(90)
public void testBasicSendReceive() throws Exception {
- String url = localServer.getInetAddress().getHostName() + ":" + localServer.getLocalPort() + "/ckc";
+ String url = "http://" + localServer.getInetAddress().getHostName() + ":" + localServer.getLocalPort() + "/ckc";
ConnectorPropertyFactory connectorPropertyFactory = CamelHTTPPropertyFactory.basic()
.withTopics(topicName)
- .withHttpUri(url);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- @Test
- @Timeout(90)
- public void testBasicSendReceiveUsingUrl() throws Exception {
- String hostName = localServer.getInetAddress().getHostName() + ":" + localServer.getLocalPort() + "/ckc";
-
- ConnectorPropertyFactory connectorPropertyFactory = CamelHTTPPropertyFactory.basic()
- .withTopics(topicName)
- .withUrl(hostName)
- .buildUrl();
+ .withHttpUrl(url);
runTest(connectorPropertyFactory, topicName, expect);
}
diff --git a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/common/MongoDBEnvVarServiceFactory.java b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/common/MongoDBEnvVarServiceFactory.java
new file mode 100644
index 0000000..d4c6077
--- /dev/null
+++ b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/common/MongoDBEnvVarServiceFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.kafkaconnector.mongodb.common;
+
+import java.util.function.Supplier;
+
+import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder;
+import org.apache.camel.test.infra.mongodb.services.MongoDBRemoteService;
+import org.apache.camel.test.infra.mongodb.services.MongoDBService;
+
+public final class MongoDBEnvVarServiceFactory {
+ private MongoDBEnvVarServiceFactory() {
+ }
+
+ public static SimpleTestServiceBuilder<MongoDBService> builder() {
+ return new SimpleTestServiceBuilder("mongodb");
+ }
+
+ public static MongoDBService createService() {
+ return createService(MongoDBLocalContainerEnvVarService::new);
+ }
+
+ public static MongoDBService createService(Supplier<MongoDBService> localMapping) {
+ return (MongoDBService)builder().addLocalMapping(localMapping).addRemoteMapping(MongoDBRemoteService::new).build();
+ }
+
+ public static MongoDBService createService(String username, String password) {
+ MongoDBLocalContainerEnvVarService mongoDBLocalContainerEnvVarService = new MongoDBLocalContainerEnvVarService();
+ mongoDBLocalContainerEnvVarService.addEnvProperty("MONGO_INITDB_ROOT_USERNAME", username);
+ mongoDBLocalContainerEnvVarService.addEnvProperty("MONGO_INITDB_ROOT_PASSWORD", password);
+ return createService(() -> mongoDBLocalContainerEnvVarService);
+ }
+}
diff --git a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/services/TestDataSource.java b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/common/MongoDBLocalContainerEnvVarService.java
similarity index 62%
rename from tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/services/TestDataSource.java
rename to tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/common/MongoDBLocalContainerEnvVarService.java
index a1bad09..65a650d 100644
--- a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/services/TestDataSource.java
+++ b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/common/MongoDBLocalContainerEnvVarService.java
@@ -14,25 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.camel.kafkaconnector.mongodb.common;
-package org.apache.camel.kafkaconnector.sql.services;
-
-import org.apache.camel.test.infra.jdbc.common.JDBCProperties;
-import org.postgresql.ds.PGSimpleDataSource;
-
-public class TestDataSource extends PGSimpleDataSource {
- private static final String URL;
-
- static {
- URL = System.getProperty(JDBCProperties.JDBC_CONNECTION_URL);
- }
-
- public TestDataSource() {
- super();
- setUrl(URL);
-
- setUser("ckc");
- setPassword("ckcDevel123");
+import org.apache.camel.test.infra.mongodb.services.MongoDBLocalContainerService;
+public class MongoDBLocalContainerEnvVarService extends MongoDBLocalContainerService {
+ public void addEnvProperty(String property, String value) {
+ getContainer().addEnv(property, value);
}
}
diff --git a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelMongoDBPropertyFactory.java b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelMongoDBPropertyFactory.java
index ea184e7..a86c50b 100644
--- a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelMongoDBPropertyFactory.java
+++ b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelMongoDBPropertyFactory.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.camel.kafkaconnector.mongodb.sink;
@@ -26,29 +25,33 @@ final class CamelMongoDBPropertyFactory extends SinkConnectorPropertyFactory<Cam
}
- public CamelMongoDBPropertyFactory withConnectionBean(String connectionBean, String ref) {
- setProperty("camel.sink.path.connectionBean", connectionBean);
- return withBeans(connectionBean, ref);
+ public CamelMongoDBPropertyFactory withPassword(String password) {
+ return setProperty("camel.kamelet.mongodb-sink.password", password);
}
- public CamelMongoDBPropertyFactory withDatabase(String database) {
- return setProperty("camel.sink.endpoint.database", database);
+ public CamelMongoDBPropertyFactory withUsername(String username) {
+ return setProperty("camel.kamelet.mongodb-sink.username", username);
}
- public CamelMongoDBPropertyFactory withOperation(String operation) {
- return setProperty("camel.sink.endpoint.operation", operation);
+ public CamelMongoDBPropertyFactory withHosts(String hosts) {
+ return setProperty("camel.kamelet.mongodb-sink.hosts", hosts);
+ }
+
+ public CamelMongoDBPropertyFactory withDatabase(String database) {
+ return setProperty("camel.kamelet.mongodb-sink.database", database);
}
public CamelMongoDBPropertyFactory withCollection(String connection) {
- return setProperty("camel.sink.endpoint.collection", connection);
+ return setProperty("camel.kamelet.mongodb-sink.collection", connection);
}
public static CamelMongoDBPropertyFactory basic() {
return new CamelMongoDBPropertyFactory()
.withName("CamelMongoDBSinkConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.mongodb.CamelMongodbSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.mongodbsink.CamelMongodbsinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelSinkMongoDBITCase.java b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelSinkMongoDBITCase.java
index 5401948..c22c241 100644
--- a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelSinkMongoDBITCase.java
+++ b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/sink/CamelSinkMongoDBITCase.java
@@ -24,14 +24,14 @@ import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
-import org.apache.camel.kafkaconnector.common.BasicConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport;
import org.apache.camel.kafkaconnector.common.test.StringMessageProducer;
+import org.apache.camel.kafkaconnector.mongodb.common.MongoDBEnvVarServiceFactory;
import org.apache.camel.test.infra.common.TestUtils;
import org.apache.camel.test.infra.mongodb.services.MongoDBService;
-import org.apache.camel.test.infra.mongodb.services.MongoDBServiceFactory;
import org.bson.Document;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
@@ -42,10 +42,11 @@ import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
+@Disabled("Waiting for https://github.com/apache/camel-kamelets/pull/485 to be merged and published.")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class CamelSinkMongoDBITCase extends CamelSinkTestSupport {
@RegisterExtension
- public static MongoDBService mongoDBService = MongoDBServiceFactory.createService();
+ public static MongoDBService mongoDBService = MongoDBEnvVarServiceFactory.createService("root", "password");
private static final Logger LOG = LoggerFactory.getLogger(CamelMongoDBPropertyFactory.class);
@@ -69,7 +70,7 @@ public class CamelSinkMongoDBITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[]{"camel-mongodb-kafka-connector"};
+ return new String[]{"camel-mongodb-sink-kafka-connector"};
}
@@ -122,11 +123,11 @@ public class CamelSinkMongoDBITCase extends CamelSinkTestSupport {
CamelMongoDBPropertyFactory factory = CamelMongoDBPropertyFactory.basic()
.withTopics(topicName)
- .withConnectionBean("mongo",
- BasicConnectorPropertyFactory.classRef(connectionBeanRef))
.withDatabase("testDB")
.withCollection("testRecords")
- .withOperation("insert");
+ .withUsername("root")
+ .withPassword("password")
+ .withHosts(mongoDBService.getConnectionAddress());
runTest(factory, new CustomProducer(getKafkaService().getBootstrapServers(), topicName, expect));
}
diff --git a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelMongoDBPropertyFactory.java b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelMongoDBPropertyFactory.java
index 56ce01d..2c3b45e 100644
--- a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelMongoDBPropertyFactory.java
+++ b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelMongoDBPropertyFactory.java
@@ -26,17 +26,20 @@ final class CamelMongoDBPropertyFactory extends SourceConnectorPropertyFactory<C
}
- public CamelMongoDBPropertyFactory withConnectionBean(String connectionBean, String ref) {
- setProperty("camel.source.path.connectionBean", connectionBean);
- return withBeans(connectionBean, ref);
+ public CamelMongoDBPropertyFactory withPassword(String password) {
+ return setProperty("camel.kamelet.mongodb-source.password", password);
}
- public CamelMongoDBPropertyFactory withDatabase(String database) {
- return setProperty("camel.source.endpoint.database", database);
+ public CamelMongoDBPropertyFactory withUsername(String username) {
+ return setProperty("camel.kamelet.mongodb-source.username", username);
+ }
+
+ public CamelMongoDBPropertyFactory withHosts(String hosts) {
+ return setProperty("camel.kamelet.mongodb-source.hosts", hosts);
}
- public CamelMongoDBPropertyFactory withCreateCollection(boolean createCollection) {
- return setProperty("camel.source.endpoint.createCollection", createCollection);
+ public CamelMongoDBPropertyFactory withDatabase(String database) {
+ return setProperty("camel.kamelet.mongodb-source.database", database);
}
public CamelMongoDBPropertyFactory withCollection(String connection) {
@@ -47,9 +50,10 @@ final class CamelMongoDBPropertyFactory extends SourceConnectorPropertyFactory<C
return new CamelMongoDBPropertyFactory()
.withName("CamelMongoDBSourceConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.mongodb.CamelMongodbSourceConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.mongodbsource.CamelMongodbsourceSourceConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
diff --git a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelSourceMongoDBITCase.java b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelSourceMongoDBITCase.java
index 671c6e1..17257b5 100644
--- a/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelSourceMongoDBITCase.java
+++ b/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/source/CamelSourceMongoDBITCase.java
@@ -26,15 +26,15 @@ import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.CreateCollectionOptions;
-import org.apache.camel.kafkaconnector.common.BasicConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory;
import org.apache.camel.kafkaconnector.common.test.CamelSourceTestSupport;
import org.apache.camel.kafkaconnector.common.test.TestMessageConsumer;
+import org.apache.camel.kafkaconnector.mongodb.common.MongoDBEnvVarServiceFactory;
import org.apache.camel.test.infra.mongodb.services.MongoDBService;
-import org.apache.camel.test.infra.mongodb.services.MongoDBServiceFactory;
import org.bson.Document;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
@@ -42,10 +42,11 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import static org.junit.jupiter.api.Assertions.assertEquals;
+@Disabled("Waiting for https://github.com/apache/camel-kamelets/pull/486 to be merged and published.")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class CamelSourceMongoDBITCase extends CamelSourceTestSupport {
@RegisterExtension
- public static MongoDBService mongoDBService = MongoDBServiceFactory.createService();
+ public static MongoDBService mongoDBService = MongoDBEnvVarServiceFactory.createService("root", "password");
private MongoClient mongoClient;
private String topicName;
@@ -54,7 +55,7 @@ public class CamelSourceMongoDBITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[]{"camel-mongodb-kafka-connector"};
+ return new String[]{"camel-mongodb-source-kafka-connector"};
}
@BeforeAll
@@ -108,16 +109,13 @@ public class CamelSourceMongoDBITCase extends CamelSourceTestSupport {
@Test
@Timeout(90)
public void testFindAll() throws ExecutionException, InterruptedException {
- String connectionBeanRef = String.format("com.mongodb.client.MongoClients#create('%s')",
- mongoDBService.getReplicaSetUrl());
-
ConnectorPropertyFactory factory = CamelMongoDBPropertyFactory.basic()
.withKafkaTopic(topicName)
- .withConnectionBean("mongo",
- BasicConnectorPropertyFactory.classRef(connectionBeanRef))
.withDatabase("testDatabase")
.withCollection("testCollection")
- .withCreateCollection(true);
+ .withUsername("root")
+ .withPassword("password")
+ .withHosts(mongoDBService.getConnectionAddress());
runTest(factory, topicName, expect);
}
diff --git a/tests/itests-parent/pom.xml b/tests/itests-parent/pom.xml
index 1482ff6..5dac6e3 100644
--- a/tests/itests-parent/pom.xml
+++ b/tests/itests-parent/pom.xml
@@ -37,7 +37,7 @@
<failsafe.args.jul>-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager</failsafe.args.jul>
<failsafe.args.strimzi>-Ditest.strimzi.container.image=${itest.strimzi.container.image} -Ditest.zookeeper.container.image=${itest.zookeeper.container.image}</failsafe.args.strimzi>
- <common.failsafe.args>${failsafe.args.jul} ${failsafe.args.basedir} ${failsafe.args.strimzi}</common.failsafe.args>
+ <common.failsafe.args>${failsafe.args.jul} ${failsafe.args.basedir} ${failsafe.args.strimzi} -Dmongodb.container=mongo:5.0.2</common.failsafe.args>
</properties>
<dependencies>
@@ -56,6 +56,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-direct</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-yaml-dsl</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/CamelRabbitMQPropertyFactory.java b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/CamelRabbitMQPropertyFactory.java
index 16c667b..7be1e5d 100644
--- a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/CamelRabbitMQPropertyFactory.java
+++ b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/CamelRabbitMQPropertyFactory.java
@@ -17,7 +17,6 @@
package org.apache.camel.kafkaconnector.rabbitmq.sink;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SinkConnectorPropertyFactory;
public class CamelRabbitMQPropertyFactory extends SinkConnectorPropertyFactory<CamelRabbitMQPropertyFactory> {
@@ -45,6 +44,14 @@ public class CamelRabbitMQPropertyFactory extends SinkConnectorPropertyFactory<C
return setProperty("camel.source.endpoint.exchangeType", value);
}
+ public CamelRabbitMQPropertyFactory withSkipExchangeDeclare(boolean value) {
+ return setProperty("camel.source.endpoint.skipExchangeDeclare", value);
+ }
+
+ public CamelRabbitMQPropertyFactory withSkipQueueBind(boolean value) {
+ return setProperty("camel.source.endpoint.skipQueueBind", value);
+ }
+
public CamelRabbitMQPropertyFactory withAutoDelete(boolean value) {
return setProperty("camel.source.endpoint.autoDelete", value);
}
@@ -57,20 +64,15 @@ public class CamelRabbitMQPropertyFactory extends SinkConnectorPropertyFactory<C
return setProperty("camel.source.endpoint.routingKey", value);
}
- public EndpointUrlBuilder<CamelRabbitMQPropertyFactory> withUrl(String exchangeName) {
- String sourceUrl = String.format("rabbitmq:%s", exchangeName);
-
- return new EndpointUrlBuilder<>(this::withSinkUrl, sourceUrl);
- }
-
public static CamelRabbitMQPropertyFactory basic() {
return new CamelRabbitMQPropertyFactory()
.withTasksMax(1)
.withName("CamelRabbitmqSinkConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.rabbitmq.CamelRabbitmqSinkConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.rabbitmqsink.CamelRabbitmqsinkSinkConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.converters.ByteArrayConverter");
-
+ .withValueConverterClass("org.apache.kafka.connect.converters.ByteArrayConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets")
+ .setProperty("camel.component.properties.environment-variable-mode", "1");
}
}
diff --git a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/RabbitMQSinkITCase.java b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/RabbitMQSinkITCase.java
index 82b97c0..2b0beae 100644
--- a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/RabbitMQSinkITCase.java
+++ b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/sink/RabbitMQSinkITCase.java
@@ -29,6 +29,7 @@ import org.apache.camel.test.infra.rabbitmq.services.RabbitMQService;
import org.apache.camel.test.infra.rabbitmq.services.RabbitMQServiceFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
@@ -39,6 +40,7 @@ import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
+@Disabled("Until we have a rabbitmq sink kamelet see: https://github.com/apache/camel-kamelets/issues/45")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class RabbitMQSinkITCase extends CamelSinkTestSupport {
@RegisterExtension
@@ -54,7 +56,7 @@ public class RabbitMQSinkITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-rabbitmq-kafka-connector"};
+ return new String[] {"camel-rabbitmq-sink-kafka-connector"};
}
@BeforeEach
@@ -116,17 +118,15 @@ public class RabbitMQSinkITCase extends CamelSinkTestSupport {
ConnectorPropertyFactory factory = CamelRabbitMQPropertyFactory
.basic()
.withTopics(topicName)
- .withUrl("")
- .append("username", rabbitmqService.connectionProperties().username())
- .append("password", rabbitmqService.connectionProperties().password())
- .append("autoDelete", "false")
- .append("queue", DEFAULT_RABBITMQ_QUEUE)
- .append("RoutingKey", DEFAULT_RABBITMQ_QUEUE)
- .append("skipExchangeDeclare", "true")
- .append("skipQueueBind", "true")
- .append("hostname", rabbitmqService.connectionProperties().hostname())
- .append("portNumber", rabbitmqService.connectionProperties().port())
- .buildUrl();
+ .withUsername(rabbitmqService.connectionProperties().username())
+ .withPassword(rabbitmqService.connectionProperties().password())
+ .withAutoDelete(false)
+ .withQueue(DEFAULT_RABBITMQ_QUEUE)
+ .withRoutingKey(DEFAULT_RABBITMQ_QUEUE)
+ .withSkipExchangeDeclare(true)
+ .withSkipQueueBind(true)
+ .withHostname(rabbitmqService.connectionProperties().hostname())
+ .withPortNumber(rabbitmqService.connectionProperties().port());
runTest(factory, topicName, expect);
}
diff --git a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/CamelRabbitMQPropertyFactory.java b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/CamelRabbitMQPropertyFactory.java
index 1548b2e..769e3fa 100644
--- a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/CamelRabbitMQPropertyFactory.java
+++ b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/CamelRabbitMQPropertyFactory.java
@@ -17,59 +17,38 @@
package org.apache.camel.kafkaconnector.rabbitmq.source;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SourceConnectorPropertyFactory;
public class CamelRabbitMQPropertyFactory extends SourceConnectorPropertyFactory<CamelRabbitMQPropertyFactory> {
- public CamelRabbitMQPropertyFactory withHostname(String value) {
- return setProperty("camel.component.rabbitmq.hostname", value);
+ public CamelRabbitMQPropertyFactory withAddresses(String value) {
+ return setProperty("camel.kamelet.rabbitmq-source.addresses", value);
}
public CamelRabbitMQPropertyFactory withPortNumber(int value) {
- return setProperty("camel.component.rabbitmq.portNumber", value);
+ return setProperty("camel.kamelet.rabbitmq-source.portNumber", value);
}
public CamelRabbitMQPropertyFactory withUsername(String value) {
- return setProperty("camel.component.rabbitmq.username", value);
+ return setProperty("camel.kamelet.rabbitmq-source.username", value);
}
public CamelRabbitMQPropertyFactory withPassword(String value) {
- return setProperty("camel.component.rabbitmq.password", value);
+ return setProperty("camel.kamelet.rabbitmq-source.password", value);
}
public CamelRabbitMQPropertyFactory withExchangeName(String value) {
- return setProperty("camel.source.path.exchangeName", value);
- }
-
- public CamelRabbitMQPropertyFactory withExchangeType(String value) {
- return setProperty("camel.source.endpoint.exchangeType", value);
- }
-
- public CamelRabbitMQPropertyFactory withAutoDelete(boolean value) {
- return setProperty("camel.source.endpoint.autoDelete", value);
- }
-
- public CamelRabbitMQPropertyFactory withQueue(String value) {
- return setProperty("camel.source.endpoint.queue", value);
- }
-
- public CamelRabbitMQPropertyFactory withRoutingKey(String value) {
- return setProperty("camel.source.endpoint.routingKey", value);
- }
-
- public EndpointUrlBuilder<CamelRabbitMQPropertyFactory> withUrl(String exchangeName) {
- String sourceUrl = String.format("rabbitmq://%s", exchangeName);
-
- return new EndpointUrlBuilder<>(this::withSourceUrl, sourceUrl);
+ return setProperty("camel.kamelet.rabbitmq-source.exchangeName", value);
}
public static CamelRabbitMQPropertyFactory basic() {
return new CamelRabbitMQPropertyFactory()
.withTasksMax(1)
.withName("CamelRabbitmqSourceConnector")
- .withConnectorClass("org.apache.camel.kafkaconnector.rabbitmq.CamelRabbitmqSourceConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.rabbitmqsource.CamelRabbitmqsourceSourceConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.converters.ByteArrayConverter");
+ .withValueConverterClass("org.apache.kafka.connect.converters.ByteArrayConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets")
+ .setProperty("camel.component.properties.environment-variable-mode", "1");
}
diff --git a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/RabbitMQSourceITCase.java b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/RabbitMQSourceITCase.java
index 4ef2ae2..8b094e8 100644
--- a/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/RabbitMQSourceITCase.java
+++ b/tests/itests-rabbitmq/src/test/java/org/apache/camel/kafkaconnector/rabbitmq/source/RabbitMQSourceITCase.java
@@ -25,6 +25,7 @@ import org.apache.camel.kafkaconnector.rabbitmq.clients.RabbitMQClient;
import org.apache.camel.test.infra.rabbitmq.services.RabbitMQService;
import org.apache.camel.test.infra.rabbitmq.services.RabbitMQServiceFactory;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
@@ -34,6 +35,7 @@ import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
+@Disabled("Until https://github.com/apache/camel-kamelets/pull/502 is merged and published")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class RabbitMQSourceITCase extends CamelSourceTestSupport {
@RegisterExtension
@@ -48,7 +50,7 @@ public class RabbitMQSourceITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-rabbitmq-kafka-connector"};
+ return new String[] {"camel-rabbitmq-source-kafka-connector"};
}
@BeforeEach
@@ -72,23 +74,16 @@ public class RabbitMQSourceITCase extends CamelSourceTestSupport {
assertEquals(received, expect, "Didn't process the expected amount of messages");
}
-
@Test
@Timeout(90)
public void testSource() throws ExecutionException, InterruptedException {
ConnectorPropertyFactory factory = CamelRabbitMQPropertyFactory
.basic()
.withKafkaTopic(topicName)
- .withUrl("")
- .append("username", rabbitmqService.connectionProperties().username())
- .append("password", rabbitmqService.connectionProperties().password())
- .append("autoDelete", "false")
- .append("queue", DEFAULT_RABBITMQ_QUEUE)
- .append("skipExchangeDeclare", "true")
- .append("skipQueueBind", "true")
- .append("hostname", rabbitmqService.connectionProperties().hostname())
- .append("portNumber", rabbitmqService.connectionProperties().port())
- .buildUrl();
+ .withAddresses(rabbitmqService.connectionProperties().hostname() + ":" + rabbitmqService.connectionProperties().port())
+ .withPassword(rabbitmqService.connectionProperties().password())
+ .withUsername(rabbitmqService.connectionProperties().username())
+ .withExchangeName("default");
runTest(factory, topicName, expect);
}
diff --git a/tests/itests-sql/pom.xml b/tests/itests-sql/pom.xml
index f8c8473..71dc195 100644
--- a/tests/itests-sql/pom.xml
+++ b/tests/itests-sql/pom.xml
@@ -58,7 +58,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-sql</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jackson</artifactId>
+ </dependency>
<dependency>
<groupId>org.testcontainers</groupId>
@@ -71,6 +74,11 @@
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSinkSQLITCase.java b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSinkSQLITCase.java
index f5fd9fe..d49993d 100644
--- a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSinkSQLITCase.java
+++ b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSinkSQLITCase.java
@@ -28,7 +28,6 @@ import org.apache.camel.kafkaconnector.CamelSinkTask;
import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport;
import org.apache.camel.kafkaconnector.common.test.StringMessageProducer;
import org.apache.camel.kafkaconnector.sql.client.DatabaseClient;
-import org.apache.camel.kafkaconnector.sql.services.TestDataSource;
import org.apache.camel.test.infra.common.TestUtils;
import org.apache.camel.test.infra.jdbc.services.JDBCService;
import org.apache.camel.test.infra.jdbc.services.JDBCServiceBuilder;
@@ -47,6 +46,9 @@ import static org.junit.jupiter.api.Assertions.fail;
public class CamelSinkSQLITCase extends CamelSinkTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(CamelSinkSQLITCase.class);
+ private static final String DATABASE_NAME = "camel";
+ private static final String USERNAME = "ckc";
+ private static final String PASSWORD = "ckcDevel123";
@RegisterExtension
public JDBCService sqlService;
@@ -56,6 +58,9 @@ public class CamelSinkSQLITCase extends CamelSinkTestSupport {
private final int expect = 1;
private int received;
+ private String hostname;
+ private String port;
+
private static class CustomProducer extends StringMessageProducer {
public CustomProducer(String bootstrapServer, String topicName, int count) {
super(bootstrapServer, topicName, count);
@@ -80,9 +85,9 @@ public class CamelSinkSQLITCase extends CamelSinkTestSupport {
public CamelSinkSQLITCase() {
JdbcDatabaseContainer<?> container = new PostgreSQLContainer<>("postgres:9.6.2")
- .withDatabaseName("camel")
- .withUsername("ckc")
- .withPassword("ckcDevel123")
+ .withDatabaseName(DATABASE_NAME)
+ .withUsername(USERNAME)
+ .withPassword(PASSWORD)
.withInitScript("schema.sql")
.withStartupTimeoutSeconds(60);
@@ -91,11 +96,14 @@ public class CamelSinkSQLITCase extends CamelSinkTestSupport {
.build();
sqlService.initialize();
+
+ hostname = container.getContainerIpAddress();
+ port = String.valueOf(container.getMappedPort(PostgreSQLContainer.POSTGRESQL_PORT));
}
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-sql-kafka-connector"};
+ return new String[] {"camel-postgresql-sink-kafka-connector"};
}
@BeforeEach
@@ -155,7 +163,11 @@ public class CamelSinkSQLITCase extends CamelSinkTestSupport {
public void testDBFetch() throws Exception {
CamelSqlPropertyFactory factory = CamelSqlPropertyFactory
.basic()
- .withDataSource(CamelSqlPropertyFactory.classRef(TestDataSource.class.getName()))
+ .withDatabaseName(DATABASE_NAME)
+ .withServerName(hostname)
+ .withPort(port)
+ .withUsername(USERNAME)
+ .withPassword(PASSWORD)
.withQuery("insert into test(test_name, test_data) values(:#TestName,:#TestData)")
.withTopics(topicName);
diff --git a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSqlPropertyFactory.java b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSqlPropertyFactory.java
index 3a64a5a..78ebfe9 100644
--- a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSqlPropertyFactory.java
+++ b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/sink/CamelSqlPropertyFactory.java
@@ -24,16 +24,38 @@ public final class CamelSqlPropertyFactory extends SinkConnectorPropertyFactory<
}
- public CamelSqlPropertyFactory withDataSource(String value) {
- return setProperty("camel.component.sql.dataSource", value);
+ public CamelSqlPropertyFactory withServerName(String value) {
+ return setProperty("camel.kamelet.postgresql-sink.serverName", value);
+ }
+
+ public CamelSqlPropertyFactory withUsername(String value) {
+ return setProperty("camel.kamelet.postgresql-sink.username", value);
+ }
+
+ public CamelSqlPropertyFactory withPassword(String value) {
+ return setProperty("camel.kamelet.postgresql-sink.password", value);
}
public CamelSqlPropertyFactory withQuery(String value) {
- return setProperty("camel.sink.path.query", value);
+ return setProperty("camel.kamelet.postgresql-sink.query", value);
+ }
+
+ public CamelSqlPropertyFactory withDatabaseName(String value) {
+ return setProperty("camel.kamelet.postgresql-sink.databaseName", value);
+ }
+
+ public CamelSqlPropertyFactory withPort(String port) {
+ return setProperty("camel.kamelet.postgresql-sink.port", port);
}
public static CamelSqlPropertyFactory basic() {
- return new CamelSqlPropertyFactory().withName("CamelSQLSinkConnector").withTasksMax(1).withConnectorClass("org.apache.camel.kafkaconnector.sql.CamelSqlSinkConnector")
- .withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter").withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ return new CamelSqlPropertyFactory()
+ .withName("CamelSQLSinkConnector")
+ .withTasksMax(1)
+ .withConnectorClass("org.apache.camel.kafkaconnector.postgresqlsink.CamelPostgresqlsinkSinkConnector")
+ .withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets")
+ .setProperty("camel.component.properties.environment-variable-mode", "1");
}
}
diff --git a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSourceSQLITCase.java b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSourceSQLITCase.java
index 6ee744c..a47083f 100644
--- a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSourceSQLITCase.java
+++ b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSourceSQLITCase.java
@@ -21,26 +21,31 @@ import java.util.concurrent.ExecutionException;
import org.apache.camel.kafkaconnector.common.test.CamelSourceTestSupport;
import org.apache.camel.kafkaconnector.common.test.TestMessageConsumer;
-import org.apache.camel.kafkaconnector.sql.services.TestDataSource;
import org.apache.camel.test.infra.jdbc.services.JDBCService;
import org.apache.camel.test.infra.jdbc.services.JDBCServiceBuilder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import static org.junit.jupiter.api.Assertions.assertEquals;
-@DisabledIfSystemProperty(named = "kafka.instance.type", matches = "local-(kafka|strimzi)-container",
- disabledReason = "Database connection fails when running with the embedded Kafka Connect instance")
+//@DisabledIfSystemProperty(named = "kafka.instance.type", matches = "local-(kafka|strimzi)-container",
+// disabledReason = "Database connection fails when running with the embedded Kafka Connect instance")
public class CamelSourceSQLITCase extends CamelSourceTestSupport {
+ private static final String DATABASE_NAME = "camel";
+ private static final String USERNAME = "ckc";
+ private static final String PASSWORD = "ckcDevel123";
+
@RegisterExtension
public JDBCService sqlService;
private final int expect = 1;
+ private String hostname;
+ private String port;
+
public CamelSourceSQLITCase() {
JdbcDatabaseContainer<?> container = new PostgreSQLContainer<>("postgres:9.6.2")
.withDatabaseName("camel")
@@ -54,11 +59,14 @@ public class CamelSourceSQLITCase extends CamelSourceTestSupport {
.build();
sqlService.initialize();
+
+ hostname = container.getContainerIpAddress();
+ port = String.valueOf(container.getMappedPort(PostgreSQLContainer.POSTGRESQL_PORT));
}
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-sql-kafka-connector"};
+ return new String[] {"camel-postgresql-source-kafka-connector"};
}
@Override
@@ -79,7 +87,11 @@ public class CamelSourceSQLITCase extends CamelSourceTestSupport {
CamelSqlPropertyFactory factory = CamelSqlPropertyFactory
.basic()
- .withDataSource(CamelSqlPropertyFactory.classRef(TestDataSource.class.getName()))
+ .withDatabaseName(DATABASE_NAME)
+ .withServerName(hostname)
+ .withPort(port)
+ .withUsername(USERNAME)
+ .withPassword(PASSWORD)
.withQuery("select * from test")
.withTopics(topicName);
diff --git a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSqlPropertyFactory.java b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSqlPropertyFactory.java
index 4f5100a..f537817 100644
--- a/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSqlPropertyFactory.java
+++ b/tests/itests-sql/src/test/java/org/apache/camel/kafkaconnector/sql/source/CamelSqlPropertyFactory.java
@@ -24,16 +24,40 @@ public final class CamelSqlPropertyFactory extends SinkConnectorPropertyFactory<
}
- public CamelSqlPropertyFactory withDataSource(String value) {
- return setProperty("camel.component.sql.dataSource", value);
+ public CamelSqlPropertyFactory withServerName(String value) {
+ return setProperty("camel.kamelet.postgresql-source.serverName", value);
+ }
+
+ public CamelSqlPropertyFactory withUsername(String value) {
+ return setProperty("camel.kamelet.postgresql-source.username", value);
+ }
+
+ public CamelSqlPropertyFactory withPassword(String value) {
+ return setProperty("camel.kamelet.postgresql-source.password", value);
}
public CamelSqlPropertyFactory withQuery(String value) {
- return setProperty("camel.source.path.query", value);
+ return setProperty("camel.kamelet.postgresql-source.query", value);
+ }
+
+ public CamelSqlPropertyFactory withDatabaseName(String value) {
+ return setProperty("camel.kamelet.postgresql-source.databaseName", value);
+ }
+
+ public CamelSqlPropertyFactory withPort(String port) {
+ return setProperty("camel.kamelet.postgresql-source.port", port);
}
public static CamelSqlPropertyFactory basic() {
- return new CamelSqlPropertyFactory().withName("CamelSQLSourceConnector").withTasksMax(1).withConnectorClass("org.apache.camel.kafkaconnector.sql.CamelSqlSourceConnector")
- .withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter").withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ return new CamelSqlPropertyFactory()
+ .withName("CamelSQLSourceConnector")
+ .withTasksMax(1)
+ .withConnectorClass("org.apache.camel.kafkaconnector.postgresqlsource.CamelPostgresqlsourceSourceConnector")
+ .withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets")
+ .setProperty("camel.component.properties.environment-variable-mode", "1");
}
+
+
}
diff --git a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSinkSshITCase.java b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSinkSshITCase.java
index 03ee0f3..0aa3f6f 100644
--- a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSinkSshITCase.java
+++ b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSinkSshITCase.java
@@ -26,18 +26,19 @@ import org.apache.camel.kafkaconnector.common.test.StringMessageProducer;
import org.apache.camel.kafkaconnector.ssh.services.SshService;
import org.apache.camel.kafkaconnector.ssh.services.SshServiceFactory;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.fail;
-@DisabledIfSystemProperty(named = "kafka.instance.type", matches = "local-(kafka|strimzi)-container",
- disabledReason = "Hangs when running with the embedded Kafka Connect instance")
+@Disabled("Sink ssh kamelet needs to be implemented see: https://github.com/apache/camel-kamelets/issues/504")
+//@DisabledIfSystemProperty(named = "kafka.instance.type", matches = "local-(kafka|strimzi)-container",
+// disabledReason = "Hangs when running with the embedded Kafka Connect instance")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class CamelSinkSshITCase extends CamelSinkTestSupport {
@RegisterExtension
@@ -61,7 +62,7 @@ public class CamelSinkSshITCase extends CamelSinkTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-ssh-kafka-connector"};
+ return new String[] {"camel-ssh-sink-kafka-connector"};
}
@BeforeEach
diff --git a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSshPropertyFactory.java b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSshPropertyFactory.java
index 9ca3dcb..02d4cf3 100644
--- a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSshPropertyFactory.java
+++ b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/sink/CamelSshPropertyFactory.java
@@ -42,8 +42,12 @@ final class CamelSshPropertyFactory extends SinkConnectorPropertyFactory<CamelSs
}
public static CamelSshPropertyFactory basic() {
- return new CamelSshPropertyFactory().withName("CamelSshSourceConnector").withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.ssh.CamelSshSourceConnector").withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ return new CamelSshPropertyFactory().withName("CamelSshSourceConnector")
+ .withTasksMax(1)
+ .withConnectorClass("org.apache.camel.kafkaconnector.sshsink.CamelSshsinkSinkonnector")
+ .withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets")
+ .setProperty("camel.component.properties.environment-variable-mode", "1");
}
}
diff --git a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSourceSshITCase.java b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSourceSshITCase.java
index 488029d..c78fcb0 100644
--- a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSourceSshITCase.java
+++ b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSourceSshITCase.java
@@ -46,7 +46,7 @@ public class CamelSourceSshITCase extends CamelSourceTestSupport {
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-ssh-kafka-connector"};
+ return new String[] {"camel-ssh-source-kafka-connector"};
}
@BeforeAll
@@ -81,12 +81,12 @@ public class CamelSourceSshITCase extends CamelSourceTestSupport {
.withKafkaTopic(topic)
.withHost(sshService.getSshHost())
.withPort(Integer.toString(sshService.getSshPort()))
- .withDelay(Integer.toString(10000))
.withUsername("root")
.withPassword("root")
.withPollcommand("date")
.withTransformsConfig("SshTransforms")
- .withEntry("type", "org.apache.camel.kafkaconnector.ssh.transformers.SshTransforms")
+ .withEntry("type", "org.apache.camel.kafkaconnector.transforms.CamelTypeConverterTransform$Value")
+ .withEntry("target.type", "java.lang.String")
.end();
runTest(connectorPropertyFactory, topic, expect);
diff --git a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSshPropertyFactory.java b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSshPropertyFactory.java
index bccd5ff..4baebf0 100644
--- a/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSshPropertyFactory.java
+++ b/tests/itests-ssh/src/test/java/org/apache/camel/kafkaconnector/ssh/source/CamelSshPropertyFactory.java
@@ -26,31 +26,31 @@ final class CamelSshPropertyFactory extends SourceConnectorPropertyFactory<Camel
}
public CamelSshPropertyFactory withHost(String host) {
- return setProperty("camel.source.path.host", host);
+ return setProperty("camel.kamelet.ssh-source.host", host);
}
public CamelSshPropertyFactory withPort(String port) {
- return setProperty("camel.source.path.port", port);
- }
-
- public CamelSshPropertyFactory withDelay(String value) {
- return setProperty("camel.source.endpoint.delay", value);
+ return setProperty("camel.kamelet.ssh-source.port", port);
}
public CamelSshPropertyFactory withUsername(String username) {
- return setProperty("camel.source.endpoint.username", username);
+ return setProperty("camel.kamelet.ssh-source.username", username);
}
public CamelSshPropertyFactory withPassword(String password) {
- return setProperty("camel.source.endpoint.password", password);
+ return setProperty("camel.kamelet.ssh-source.password", password);
}
public CamelSshPropertyFactory withPollcommand(String pollCommand) {
- return setProperty("camel.source.endpoint.pollCommand", pollCommand);
+ return setProperty("camel.kamelet.ssh-source.pollCommand", pollCommand);
}
public static CamelSshPropertyFactory basic() {
- return new CamelSshPropertyFactory().withName("CamelSshSourceConnector").withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.ssh.CamelSshSourceConnector").withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ return new CamelSshPropertyFactory().withName("CamelSshSourceConnector")
+ .withTasksMax(1)
+ .withConnectorClass("org.apache.camel.kafkaconnector.sshsource.CamelSshsourceSourceConnector")
+ .withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets")
+ .setProperty("camel.component.properties.environment-variable-mode", "1");
}
}
diff --git a/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelSourceTimerITCase.java b/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelSourceTimerITCase.java
index cedb12d..88bb7e6 100644
--- a/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelSourceTimerITCase.java
+++ b/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelSourceTimerITCase.java
@@ -34,12 +34,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class CamelSourceTimerITCase extends CamelSourceTestSupport {
- private final int expect = 10;
+ private final int expect = 1;
private String topicName;
@Override
protected String[] getConnectorsInTest() {
- return new String[] {"camel-timer-kafka-connector"};
+ return new String[] {"camel-timer-source-kafka-connector"};
}
@BeforeEach
@@ -65,21 +65,8 @@ public class CamelSourceTimerITCase extends CamelSourceTestSupport {
CamelTimerPropertyFactory connectorPropertyFactory = CamelTimerPropertyFactory
.basic()
.withKafkaTopic(topicName)
- .withTimerName("launchTest")
- .withRepeatCount(expect);
-
- runTest(connectorPropertyFactory, topicName, expect);
- }
-
- @Test
- @Timeout(30)
- public void testLaunchConnectorUsingUrl() throws ExecutionException, InterruptedException {
- CamelTimerPropertyFactory connectorPropertyFactory = CamelTimerPropertyFactory
- .basic()
- .withKafkaTopic(topicName)
- .withUrl("launchTestUsingUrl")
- .append("repeatCount", expect)
- .buildUrl();
+ .withPeriod(Integer.MAX_VALUE)
+ .withMessage("hello world!");
runTest(connectorPropertyFactory, topicName, expect);
}
diff --git a/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelTimerPropertyFactory.java b/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelTimerPropertyFactory.java
index dc94abb..452cafb 100644
--- a/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelTimerPropertyFactory.java
+++ b/tests/itests-timer/src/test/java/org/apache/camel/kafkaconnector/timer/source/CamelTimerPropertyFactory.java
@@ -17,7 +17,6 @@
package org.apache.camel.kafkaconnector.timer.source;
-import org.apache.camel.kafkaconnector.common.EndpointUrlBuilder;
import org.apache.camel.kafkaconnector.common.SourceConnectorPropertyFactory;
final class CamelTimerPropertyFactory extends SourceConnectorPropertyFactory<CamelTimerPropertyFactory> {
@@ -26,26 +25,21 @@ final class CamelTimerPropertyFactory extends SourceConnectorPropertyFactory<Cam
}
- public CamelTimerPropertyFactory withRepeatCount(int repeatCount) {
- return setProperty("camel.source.endpoint.repeatCount", repeatCount);
+ public CamelTimerPropertyFactory withPeriod(int period) {
+ return setProperty("camel.kamelet.timer-source.period", period);
}
- public CamelTimerPropertyFactory withTimerName(String timerName) {
- return setProperty("camel.source.path.timerName", timerName);
- }
-
- public EndpointUrlBuilder<CamelTimerPropertyFactory> withUrl(String timerName) {
- String url = String.format("timer:%s", timerName);
-
- return new EndpointUrlBuilder<>(this::withSourceUrl, url);
+ public CamelTimerPropertyFactory withMessage(String message) {
+ return setProperty("camel.kamelet.timer-source.message", message);
}
public static CamelTimerPropertyFactory basic() {
return new CamelTimerPropertyFactory()
.withName("CamelTimerSourceConnector")
.withTasksMax(1)
- .withConnectorClass("org.apache.camel.kafkaconnector.timer.CamelTimerSourceConnector")
+ .withConnectorClass("org.apache.camel.kafkaconnector.timersource.CamelTimersourceSourceConnector")
.withKeyConverterClass("org.apache.kafka.connect.storage.StringConverter")
- .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter");
+ .withValueConverterClass("org.apache.kafka.connect.storage.StringConverter")
+ .setProperty("camel.component.kamelet.location", "kamelets");
}
}
diff --git a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java
index e4ca758..b7f9854 100644
--- a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java
+++ b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java
@@ -590,7 +590,7 @@ public class CamelKafkaConnectorKameletUpdateMojo extends AbstractCamelKameletKa
String propertyPrefix = "CAMEL_" + ct + "_" + sanitizedName.replace("-", "").toUpperCase() + "_" + propertyQualifier.toUpperCase() + "_"
+ StringUtils.capitalize(propertyName).replaceAll(regex, replacement).toUpperCase();
- String propertyValue = "camel.kamelet." + propertyName;
+ String propertyValue = "camel.kamelet." + name + "." + propertyName;
String confFieldName = propertyPrefix + "CONF";
javaClass.addField().setFinal(true).setPublic().setStatic(true).setName(confFieldName).setType(String.class).setStringInitializer(propertyValue);
@@ -604,7 +604,7 @@ public class CamelKafkaConnectorKameletUpdateMojo extends AbstractCamelKameletKa
String defaultFieldName = propertyPrefix + "DEFAULT";
Class<?> defaultValueClass = PRIMITIVE_TYPES_TO_CLASS_MAP.getOrDefault(kameletProperty.getType(), String.class);
- String type = defaultValueClass.getSimpleName();
+ String type = defaultValueClass.getSimpleName().toLowerCase();
String defaultValueClassLiteralInitializer;
if (kameletProperty.getDefaultValue() == null) {