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/08/04 14:19:03 UTC
[camel] 02/04: CAMEL-18347: fix HBase services in test infra not being singleton
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 3efb6d1575913a92b354199a49400cc60bea9041
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Aug 4 14:56:41 2022 +0200
CAMEL-18347: fix HBase services in test infra not being singleton
---
.../test/infra/hbase/services/HBaseServiceFactory.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
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 0a9a6edfff4..eac5f30b921 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
@@ -43,6 +43,9 @@ public final class HBaseServiceFactory {
}
}
+ private static SimpleTestServiceBuilder<HBaseService> instance;
+ private static HBaseService service;
+
private HBaseServiceFactory() {
}
@@ -58,8 +61,16 @@ public final class HBaseServiceFactory {
}
public static HBaseService createSingletonService() {
- return builder()
- .addLocalMapping(() -> new SingletonHBaseService(new HBaseLocalContainerService(), "hbase"))
- .build();
+ if (service == null) {
+ if (instance == null) {
+ instance = builder();
+
+ instance.addLocalMapping(() -> new SingletonHBaseService(new HBaseLocalContainerService(), "hbase"));
+ }
+
+ service = instance.build();
+ }
+
+ return service;
}
}