This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 1e0b16b3 Move main to 4.9.0-SNAPSHOT (#2241)
1e0b16b3 is described below
commit 1e0b16b300450b55636dc77cf4858354b83389f1
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Oct 11 09:41:06 2024 +0200
Move main to 4.9.0-SNAPSHOT (#2241)
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../kamelets/catalog/KameletsCatalogTest.java | 6 +-
.../utils/mongodb/SslAwareMongoClient.java | 245 ---------------------
pom.xml | 4 +-
3 files changed, 5 insertions(+), 250 deletions(-)
diff --git
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
index 126ed5b7..18870ab8 100644
---
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
+++
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
@@ -154,8 +154,8 @@ public class KameletsCatalogTest {
@Test
void testSupportedHeaders() throws Exception {
- verifyHeaders("aws-s3-source", 20);
- verifyHeaders("aws-s3-sink", 29);
+ verifyHeaders("aws-s3-source", 24);
+ verifyHeaders("aws-s3-sink", 33);
verifyHeaders("aws-cloudtrail-source", 4);
verifyHeaders("aws-redshift-source", 0);
verifyHeaders("aws-not-exists", 0);
@@ -196,7 +196,7 @@ public class KameletsCatalogTest {
verifyHeaders("google-pubsub-source", 5);
verifyHeaders("google-sheets-source", 6);
verifyHeaders("google-storage-source", 20);
- verifyHeaders("google-storage-sink", 13);
+ verifyHeaders("google-storage-sink", 14);
verifyHeaders("http-source", 5);
verifyHeaders("http-sink", 14);
verifyHeaders("http-secured-source", 5);
diff --git
a/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/mongodb/SslAwareMongoClient.java
b/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/mongodb/SslAwareMongoClient.java
deleted file mode 100644
index fbe1820f..00000000
---
a/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/mongodb/SslAwareMongoClient.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 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.kamelets.utils.mongodb;
-
-import com.mongodb.ClientSessionOptions;
-import com.mongodb.ConnectionString;
-import com.mongodb.MongoClientSettings;
-import com.mongodb.client.ChangeStreamIterable;
-import com.mongodb.client.ClientSession;
-import com.mongodb.client.ListDatabasesIterable;
-import com.mongodb.client.MongoClient;
-import com.mongodb.client.MongoClients;
-import com.mongodb.client.MongoDatabase;
-import com.mongodb.client.MongoIterable;
-import com.mongodb.connection.ClusterDescription;
-import org.apache.camel.util.function.Suppliers;
-import org.bson.Document;
-import org.bson.conversions.Bson;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.List;
-import java.util.function.Supplier;
-
-public class SslAwareMongoClient implements MongoClient {
- private static final Logger LOG =
LoggerFactory.getLogger(SslAwareMongoClient.class);
- private static final TrustManager[] trustAllCerts = new TrustManager[] {
- new X509TrustManager() {
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] arg0, String
arg1)
- throws CertificateException {
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] arg0, String
arg1)
- throws CertificateException {
- }
- }
- };
- private final Supplier<MongoClient> wrappedMongoClient =
Suppliers.memorize(new Supplier<MongoClient>() {
- @Override
- public MongoClient get() {
- String credentials = username == null ? "" : username;
-
- if (!credentials.isEmpty()) {
- credentials += password == null ? "@" : ":" + password + "@";
- }
-
- MongoClientSettings settings = MongoClientSettings.builder()
- .applyToSslSettings(builder -> {
- builder.enabled(ssl);
- if (!sslValidationEnabled) {
- builder.invalidHostNameAllowed(true);
- SSLContext sc = null;
- try {
- sc = SSLContext.getInstance("TLSv1.2");
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Error
instantiating trust all SSL context.", e);
- }
- try {
- sc.init(null, trustAllCerts, new
java.security.SecureRandom());
- } catch (KeyManagementException e) {
- throw new RuntimeException("Error
instantiating trust all SSL context.", e);
- }
- builder.context(sc);
- }
- })
- .applyConnectionString(new
ConnectionString(String.format("mongodb://%s%s", credentials, hosts)))
- .build();
- LOG.info("Connection created using provided credentials");
- return MongoClients.create(settings);
- }
- });
- private String hosts = null;
- private String username = null;
- private String password = null;
- private boolean ssl = true;
-
- private boolean sslValidationEnabled = true;
-
- public MongoClient getWrappedMongoClient() {
- return wrappedMongoClient.get();
- }
-
- @Override
- public MongoDatabase getDatabase(String s) {
- return getWrappedMongoClient().getDatabase(s);
- }
-
- @Override
- public ClientSession startSession() {
- return getWrappedMongoClient().startSession();
- }
-
- @Override
- public ClientSession startSession(ClientSessionOptions
clientSessionOptions) {
- return getWrappedMongoClient().startSession(clientSessionOptions);
- }
-
- @Override
- public void close() {
- getWrappedMongoClient().close();
- }
-
- @Override
- public MongoIterable<String> listDatabaseNames() {
- return getWrappedMongoClient().listDatabaseNames();
- }
-
- @Override
- public MongoIterable<String> listDatabaseNames(ClientSession
clientSession) {
- return getWrappedMongoClient().listDatabaseNames(clientSession);
- }
-
- @Override
- public ListDatabasesIterable<Document> listDatabases() {
- return getWrappedMongoClient().listDatabases();
- }
-
- @Override
- public ListDatabasesIterable<Document> listDatabases(ClientSession
clientSession) {
- return getWrappedMongoClient().listDatabases(clientSession);
- }
-
- @Override
- public <TResult> ListDatabasesIterable<TResult>
listDatabases(Class<TResult> aClass) {
- return getWrappedMongoClient().listDatabases(aClass);
- }
-
- @Override
- public <TResult> ListDatabasesIterable<TResult>
listDatabases(ClientSession clientSession, Class<TResult> aClass) {
- return getWrappedMongoClient().listDatabases(clientSession, aClass);
- }
-
- @Override
- public ChangeStreamIterable<Document> watch() {
- return getWrappedMongoClient().watch();
- }
-
- @Override
- public <TResult> ChangeStreamIterable<TResult> watch(Class<TResult>
aClass) {
- return getWrappedMongoClient().watch(aClass);
- }
-
- @Override
- public ChangeStreamIterable<Document> watch(List<? extends Bson> list) {
- return getWrappedMongoClient().watch(list);
- }
-
- @Override
- public <TResult> ChangeStreamIterable<TResult> watch(List<? extends Bson>
list, Class<TResult> aClass) {
- return getWrappedMongoClient().watch(list, aClass);
- }
-
- @Override
- public ChangeStreamIterable<Document> watch(ClientSession clientSession) {
- return getWrappedMongoClient().watch(clientSession);
- }
-
- @Override
- public <TResult> ChangeStreamIterable<TResult> watch(ClientSession
clientSession, Class<TResult> aClass) {
- return getWrappedMongoClient().watch(clientSession, aClass);
- }
-
- @Override
- public ChangeStreamIterable<Document> watch(ClientSession clientSession,
List<? extends Bson> list) {
- return getWrappedMongoClient().watch(clientSession, list);
- }
-
- @Override
- public <TResult> ChangeStreamIterable<TResult> watch(ClientSession
clientSession, List<? extends Bson> list,
- Class<TResult> aClass) {
- return getWrappedMongoClient().watch(clientSession, list, aClass);
- }
-
- @Override
- public ClusterDescription getClusterDescription() {
- return getWrappedMongoClient().getClusterDescription();
- }
-
- public String getHosts() {
- return hosts;
- }
-
- public void setHosts(String hosts) {
- this.hosts = hosts;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public boolean isSsl() {
- return ssl;
- }
-
- public void setSsl(boolean ssl) {
- this.ssl = ssl;
- }
-
- public boolean isSslValidationEnabled() {
- return sslValidationEnabled;
- }
-
- public void setSslValidationEnabled(boolean sslValidationEnabled) {
- this.sslValidationEnabled = sslValidationEnabled;
- }
-}
diff --git a/pom.xml b/pom.xml
index e3787028..1279ca90 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-dependencies</artifactId>
- <version>4.8.0</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.camel.kamelets</groupId>
@@ -63,7 +63,7 @@
<apache-rat-plugin.version>0.16.1</apache-rat-plugin.version>
<cyclonedx-maven-plugin-version>2.9.0</cyclonedx-maven-plugin-version>
- <camel.version>4.8.0</camel.version>
+ <camel.version>4.9.0-SNAPSHOT</camel.version>
<camel.k.crds.version>2.4.0</camel.k.crds.version>
<citrus.version>4.3.2</citrus.version>