You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/03/29 14:25:42 UTC

[camel] branch main updated (df0d0ec -> eb0e0de)

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from df0d0ec  [CAMEL-17871] Google Pubsub -  Graceful shutdown for synchronous pull consumers (#7285)
     new 2b1b546  CAMEL-17855: enable singleton services for HBase
     new 398e0d6  CAMEL-17855: enable singleton services for ArangoDB
     new eb0e0de  CAMEL-17855: enable singleton services for MongoDB

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../arangodb/integration/BaseArangoDb.java         |  2 +-
 .../component/hbase/CamelHBaseTestSupport.java     |  2 +-
 .../integration/AbstractMongoDbITSupport.java      |  2 +-
 .../arangodb/services/ArangoDBServiceFactory.java  | 35 ++++++++++++++++++++++
 .../infra/hbase/services/HBaseServiceFactory.java  | 31 ++++++++++++++++++-
 .../mongodb/services/MongoDBServiceFactory.java    | 34 +++++++++++++++++++++
 6 files changed, 102 insertions(+), 4 deletions(-)

[camel] 01/03: CAMEL-17855: enable singleton services for HBase

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2b1b546fc41c599278931eeeadc7630e43f4d5e0
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Mar 25 12:16:26 2022 +0100

    CAMEL-17855: enable singleton services for HBase
---
 .../component/hbase/CamelHBaseTestSupport.java     |  2 +-
 .../infra/hbase/services/HBaseServiceFactory.java  | 31 +++++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java b/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java
index 1dd954f..d713c93 100644
--- a/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java
+++ b/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java
@@ -38,7 +38,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
 
 public abstract class CamelHBaseTestSupport extends CamelTestSupport {
     @RegisterExtension
-    public static HBaseService service = HBaseServiceFactory.createService();
+    public static HBaseService service = HBaseServiceFactory.createSingletonService();
 
     protected static final String PERSON_TABLE = "person";
     protected static final String INFO_FAMILY = "info";
diff --git a/test-infra/camel-test-infra-hbase/src/test/java/org/apache/camel/test/infra/hbase/services/HBaseServiceFactory.java b/test-infra/camel-test-infra-hbase/src/test/java/org/apache/camel/test/infra/hbase/services/HBaseServiceFactory.java
index 607e5fa..0a9a6ed 100644
--- a/test-infra/camel-test-infra-hbase/src/test/java/org/apache/camel/test/infra/hbase/services/HBaseServiceFactory.java
+++ b/test-infra/camel-test-infra-hbase/src/test/java/org/apache/camel/test/infra/hbase/services/HBaseServiceFactory.java
@@ -17,8 +17,32 @@
 package org.apache.camel.test.infra.hbase.services;
 
 import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder;
+import org.apache.camel.test.infra.common.services.SingletonService;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.jupiter.api.extension.ExtensionContext;
 
 public final class HBaseServiceFactory {
+    static class SingletonHBaseService extends SingletonService<HBaseService> implements HBaseService {
+        public SingletonHBaseService(HBaseService service, String name) {
+            super(service, name);
+        }
+
+        @Override
+        public Configuration getConfiguration() {
+            return getService().getConfiguration();
+        }
+
+        @Override
+        public void beforeAll(ExtensionContext extensionContext) {
+            addToStore(extensionContext);
+        }
+
+        @Override
+        public void afterAll(ExtensionContext extensionContext) {
+            // NO-OP
+        }
+    }
+
     private HBaseServiceFactory() {
 
     }
@@ -30,7 +54,12 @@ public final class HBaseServiceFactory {
     public static HBaseService createService() {
         return builder()
                 .addLocalMapping(HBaseLocalContainerService::new)
-                .addRemoteMapping(HBaseLocalContainerService::new)
+                .build();
+    }
+
+    public static HBaseService createSingletonService() {
+        return builder()
+                .addLocalMapping(() -> new SingletonHBaseService(new HBaseLocalContainerService(), "hbase"))
                 .build();
     }
 }

[camel] 02/03: CAMEL-17855: enable singleton services for ArangoDB

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 398e0d6762c69cf0ee7a957f3fe62a80bebf77a1
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Mar 25 12:38:05 2022 +0100

    CAMEL-17855: enable singleton services for ArangoDB
---
 .../arangodb/integration/BaseArangoDb.java         |  2 +-
 .../arangodb/services/ArangoDBServiceFactory.java  | 35 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java
index 01f2954..f9dec8e 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class BaseArangoDb extends CamelTestSupport {
     @RegisterExtension
-    public static ArangoDBService service = ArangoDBServiceFactory.createService();
+    public static ArangoDBService service = ArangoDBServiceFactory.createSingletonService();
 
     protected static final String DATABASE_NAME = "dbTest";
     protected static final String COLLECTION_NAME = "camelTest";
diff --git a/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDBServiceFactory.java b/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDBServiceFactory.java
index 06eb905..2233912 100644
--- a/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDBServiceFactory.java
+++ b/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDBServiceFactory.java
@@ -17,8 +17,36 @@
 package org.apache.camel.test.infra.arangodb.services;
 
 import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder;
+import org.apache.camel.test.infra.common.services.SingletonService;
+import org.junit.jupiter.api.extension.ExtensionContext;
 
 public final class ArangoDBServiceFactory {
+    private static class SingletonArangoDBService extends SingletonService<ArangoDBService> implements ArangoDBService {
+        public SingletonArangoDBService(ArangoDBService service, String name) {
+            super(service, name);
+        }
+
+        @Override
+        public void beforeAll(ExtensionContext extensionContext) {
+            addToStore(extensionContext);
+        }
+
+        @Override
+        public void afterAll(ExtensionContext extensionContext) {
+            // NO-OP
+        }
+
+        @Override
+        public int getPort() {
+            return getService().getPort();
+        }
+
+        @Override
+        public String getHost() {
+            return getService().getHost();
+        }
+    }
+
     private ArangoDBServiceFactory() {
 
     }
@@ -33,4 +61,11 @@ public final class ArangoDBServiceFactory {
                 .addRemoteMapping(ArangoDBRemoteService::new)
                 .build();
     }
+
+    public static ArangoDBService createSingletonService() {
+        return builder()
+                .addLocalMapping(() -> new SingletonArangoDBService(new ArangoDBLocalContainerService(), "arangoDB"))
+                .addRemoteMapping(ArangoDBRemoteService::new)
+                .build();
+    }
 }

[camel] 03/03: CAMEL-17855: enable singleton services for MongoDB

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit eb0e0de1706c6eb18d31126df234ed770de58862
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Mar 25 12:50:32 2022 +0100

    CAMEL-17855: enable singleton services for MongoDB
---
 .../integration/AbstractMongoDbITSupport.java      |  2 +-
 .../mongodb/services/MongoDBServiceFactory.java    | 34 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java
index 0e79a39..04017b7 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java
@@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 public abstract class AbstractMongoDbITSupport extends CamelTestSupport {
 
     @RegisterExtension
-    public static MongoDBService service = MongoDBServiceFactory.createService();
+    public static MongoDBService service = MongoDBServiceFactory.createSingletonService();
 
     protected static final String SCHEME = "mongodb";
     protected static final String USER = "test-user";
diff --git a/test-infra/camel-test-infra-mongodb/src/test/java/org/apache/camel/test/infra/mongodb/services/MongoDBServiceFactory.java b/test-infra/camel-test-infra-mongodb/src/test/java/org/apache/camel/test/infra/mongodb/services/MongoDBServiceFactory.java
index 125cbbf..ba0c8f5 100644
--- a/test-infra/camel-test-infra-mongodb/src/test/java/org/apache/camel/test/infra/mongodb/services/MongoDBServiceFactory.java
+++ b/test-infra/camel-test-infra-mongodb/src/test/java/org/apache/camel/test/infra/mongodb/services/MongoDBServiceFactory.java
@@ -18,8 +18,35 @@
 package org.apache.camel.test.infra.mongodb.services;
 
 import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder;
+import org.apache.camel.test.infra.common.services.SingletonService;
+import org.junit.jupiter.api.extension.ExtensionContext;
 
 public final class MongoDBServiceFactory {
+    static class SingletonMongoDBService extends SingletonService<MongoDBService> implements MongoDBService {
+        public SingletonMongoDBService(MongoDBService service, String name) {
+            super(service, name);
+        }
+
+        @Override
+        public void beforeAll(ExtensionContext extensionContext) {
+            addToStore(extensionContext);
+        }
+
+        @Override
+        public void afterAll(ExtensionContext extensionContext) {
+            // NO-OP
+        }
+
+        @Override
+        public String getReplicaSetUrl() {
+            return getService().getReplicaSetUrl();
+        }
+
+        @Override
+        public String getConnectionAddress() {
+            return getService().getConnectionAddress();
+        }
+    }
     private MongoDBServiceFactory() {
 
     }
@@ -34,4 +61,11 @@ public final class MongoDBServiceFactory {
                 .addRemoteMapping(MongoDBRemoteService::new)
                 .build();
     }
+
+    public static MongoDBService createSingletonService() {
+        return builder()
+                .addLocalMapping(() -> new SingletonMongoDBService(new MongoDBLocalContainerService(), "mongo-db"))
+                .addRemoteMapping(MongoDBRemoteService::new)
+                .build();
+    }
 }