From e2149961c329cbafc94fad9babd2e4bd1a93ad88 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Wed, 3 Apr 2024 16:57:29 +0000 Subject: [PATCH 01/22] Split client-device-connection-infinispan module into client-device-connection-base and client-device-connection-infinispan. Unit tests run. --- bom/pom.xml | 5 + client-device-connection-base/pom.xml | 164 ++++++++++++++++++++ client-device-connection-infinispan/pom.xml | 36 +++-- pom.xml | 1 + 4 files changed, 195 insertions(+), 11 deletions(-) create mode 100644 client-device-connection-base/pom.xml diff --git a/bom/pom.xml b/bom/pom.xml index 919647b523..48412ba49f 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -430,6 +430,11 @@ quarkus.vertx.max-event-loop-execute-time=${max.event-loop.execute-time:20000} hono-service-command-router ${project.version} + + org.eclipse.hono + client-device-connection-base + ${project.version} + org.eclipse.hono client-device-connection-infinispan diff --git a/client-device-connection-base/pom.xml b/client-device-connection-base/pom.xml new file mode 100644 index 0000000000..615de3975a --- /dev/null +++ b/client-device-connection-base/pom.xml @@ -0,0 +1,164 @@ + + + + 4.0.0 + + org.eclipse.hono + hono-bom + 2.6.0-SNAPSHOT + ../bom + + client-device-connection-base + + Device Connection client + Base classes for client for accessing device connection information in a remote cache / data grid. + + + + org.eclipse.hono + hono-legal + + + org.eclipse.hono + hono-core + + + org.eclipse.hono + hono-client-common + + + + org.slf4j + slf4j-api + + + io.opentracing + opentracing-api + + + + io.smallrye.config + smallrye-config-core + + + + io.vertx + vertx-core + + + + io.vertx + vertx-health-check + + + + com.google.guava + guava + + + io.quarkus + quarkus-core + true + + + org.jboss.logmanager + jboss-logmanager-embedded + + + org.jboss.logging + jboss-logging-annotations + + + io.quarkus + quarkus-development-mode-spi + + + io.quarkus + quarkus-bootstrap-runner + + + org.jboss.slf4j + slf4j-jboss-logmanager + + + org.graalvm.sdk + graal-sdk + + + io.quarkus + quarkus-fs-util + + + + + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-params + test + + + com.google.truth + truth + test + + + ch.qos.logback + logback-classic + test + + + org.mockito + mockito-core + test + + + io.vertx + vertx-junit5 + test + + + org.eclipse.hono + core-test-utils + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + org.jboss.jandex + jandex-maven-plugin + + + org.jacoco + jacoco-maven-plugin + + + + \ No newline at end of file diff --git a/client-device-connection-infinispan/pom.xml b/client-device-connection-infinispan/pom.xml index b24f28db0b..c59cb8c236 100644 --- a/client-device-connection-infinispan/pom.xml +++ b/client-device-connection-infinispan/pom.xml @@ -1,14 +1,14 @@ org.eclipse.hono hono-legal + - org.slf4j - slf4j-api + org.eclipse.hono + client-device-connection-base + org.infinispan infinispan-core-jakarta @@ -59,13 +61,23 @@ + + + + org.slf4j + slf4j-api + + + org.eclipse.hono + hono-core + org.eclipse.hono hono-client-common io.vertx - vertx-web + vertx-core com.google.guava @@ -108,6 +120,13 @@ + + org.bouncycastle + bcpkix-jdk18on + test + + + org.junit.jupiter junit-jupiter-engine @@ -143,11 +162,6 @@ core-test-utils test - - org.bouncycastle - bcpkix-jdk18on - test - diff --git a/pom.xml b/pom.xml index fdcafbacd4..02948995f1 100644 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,7 @@ bom core cli + client-device-connection-base client-device-connection-infinispan clients demo-certs From d29a8a13d28e6bbcb8ae04fef60617a5ba38562a Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Wed, 3 Apr 2024 17:36:20 +0000 Subject: [PATCH 02/22] Move common classes from client-device-connection-infinispan module into client-device-connection-base module. Unit tests run. --- .../AdapterInstanceStatusProvider.java | 2 +- .../hono/deviceconnection/common}/Cache.java | 2 +- .../CacheBasedDeviceConnectionInfo.java | 2 +- .../common}/CommonCacheConfig.java | 2 +- .../common}/CommonCacheOptions.java | 2 +- .../common}/DeviceConnectionInfo.java | 2 +- .../DeviceToAdapterMappingErrorListener.java | 2 +- .../common}/UnknownStatusProvider.java | 2 +- .../CacheBasedDeviceConnectionInfoTest.java | 2 +- ...CommonCacheQuarkusPropertyBindingTest.java | 39 +++++++++++++++++++ .../test/resources/common-cache-options.yaml | 0 .../src/test/resources/logback-test.xml | 37 ++++++++++++++++++ .../infinispan/client/BasicCache.java | 1 + .../infinispan/client/HotrodCache.java | 1 + ...emoteCacheQuarkusPropertyBindingTest.java} | 19 +-------- .../AdapterInstanceStatusService.java | 2 +- .../commandrouter/CommandTargetMapper.java | 2 +- .../hono/commandrouter/app/Application.java | 2 +- .../app/DeviceConnectionInfoProducer.java | 8 ++-- .../impl/CommandRouterServiceImpl.java | 2 +- .../impl/CommandTargetMapperImpl.java | 2 +- .../impl/CommandRouterServiceImplTest.java | 2 +- 22 files changed, 99 insertions(+), 36 deletions(-) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/AdapterInstanceStatusProvider.java (97%) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/Cache.java (98%) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/CacheBasedDeviceConnectionInfo.java (99%) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/CommonCacheConfig.java (97%) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/CommonCacheOptions.java (95%) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/DeviceConnectionInfo.java (99%) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/DeviceToAdapterMappingErrorListener.java (95%) rename {client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common}/UnknownStatusProvider.java (94%) rename {client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client => client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common}/CacheBasedDeviceConnectionInfoTest.java (99%) create mode 100644 client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java rename {client-device-connection-infinispan => client-device-connection-base}/src/test/resources/common-cache-options.yaml (100%) create mode 100644 client-device-connection-base/src/test/resources/logback-test.xml rename client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/{QuarkusPropertyBindingTest.java => RemoteCacheQuarkusPropertyBindingTest.java} (85%) diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/AdapterInstanceStatusProvider.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/AdapterInstanceStatusProvider.java similarity index 97% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/AdapterInstanceStatusProvider.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/AdapterInstanceStatusProvider.java index 2c98c8a2c0..64a18cf0f6 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/AdapterInstanceStatusProvider.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/AdapterInstanceStatusProvider.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import java.util.Collection; import java.util.Set; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/Cache.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/Cache.java similarity index 98% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/Cache.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/Cache.java index eec68f8f7c..42d28a015c 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/Cache.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/Cache.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import java.util.Map; import java.util.Set; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CacheBasedDeviceConnectionInfo.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CacheBasedDeviceConnectionInfo.java similarity index 99% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CacheBasedDeviceConnectionInfo.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CacheBasedDeviceConnectionInfo.java index 21f3bd28a7..caa3e24172 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CacheBasedDeviceConnectionInfo.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CacheBasedDeviceConnectionInfo.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import java.net.HttpURLConnection; import java.time.Duration; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CommonCacheConfig.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CommonCacheConfig.java similarity index 97% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CommonCacheConfig.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CommonCacheConfig.java index ec4109424c..c969ab3c49 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CommonCacheConfig.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CommonCacheConfig.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import com.google.common.base.MoreObjects; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CommonCacheOptions.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CommonCacheOptions.java similarity index 95% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CommonCacheOptions.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CommonCacheOptions.java index 8118a198f5..bbd69c036d 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/CommonCacheOptions.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/CommonCacheOptions.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import org.eclipse.hono.util.CommandRouterConstants; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/DeviceConnectionInfo.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/DeviceConnectionInfo.java similarity index 99% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/DeviceConnectionInfo.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/DeviceConnectionInfo.java index 4b7e800298..f3c2d2a35c 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/DeviceConnectionInfo.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/DeviceConnectionInfo.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import java.time.Duration; import java.util.Map; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/DeviceToAdapterMappingErrorListener.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/DeviceToAdapterMappingErrorListener.java similarity index 95% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/DeviceToAdapterMappingErrorListener.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/DeviceToAdapterMappingErrorListener.java index bdb45e069b..0fa4d7fb95 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/DeviceToAdapterMappingErrorListener.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/DeviceToAdapterMappingErrorListener.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import io.opentracing.Span; import io.vertx.core.Future; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/UnknownStatusProvider.java b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/UnknownStatusProvider.java similarity index 94% rename from client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/UnknownStatusProvider.java rename to client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/UnknownStatusProvider.java index d52468ce44..861ecfda79 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/UnknownStatusProvider.java +++ b/client-device-connection-base/src/main/java/org/eclipse/hono/deviceconnection/common/UnknownStatusProvider.java @@ -12,7 +12,7 @@ */ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import java.util.Collection; import java.util.Set; diff --git a/client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/CacheBasedDeviceConnectionInfoTest.java b/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CacheBasedDeviceConnectionInfoTest.java similarity index 99% rename from client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/CacheBasedDeviceConnectionInfoTest.java rename to client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CacheBasedDeviceConnectionInfoTest.java index 744858a2be..a6efb9126d 100644 --- a/client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/CacheBasedDeviceConnectionInfoTest.java +++ b/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CacheBasedDeviceConnectionInfoTest.java @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 */ -package org.eclipse.hono.deviceconnection.infinispan.client; +package org.eclipse.hono.deviceconnection.common; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java b/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java new file mode 100644 index 0000000000..c6175ccd6f --- /dev/null +++ b/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.eclipse.hono.deviceconnection.common; + +import static com.google.common.truth.Truth.assertThat; + +import org.eclipse.hono.test.ConfigMappingSupport; +import org.junit.jupiter.api.Test; + +/** + * Tests verifying binding of configuration properties to {@link CommonCacheConfig}. + * + */ +public class CommonCacheQuarkusPropertyBindingTest { + + @Test + void testCommonCacheConfigurationPropertiesArePickedUp() { + System.out.println("!!!!!!!!!!!!!================== RUNNING TEST!!!============================!!!!!!!!!!! STFS"); + final var commonCacheConfig = new CommonCacheConfig( + ConfigMappingSupport.getConfigMapping( + CommonCacheOptions.class, + this.getClass().getResource("/common-cache-options.yaml"))); + + assertThat(commonCacheConfig.getCacheName()).isEqualTo("the-cache"); + assertThat(commonCacheConfig.getCheckKey()).isEqualTo("the-key"); + assertThat(commonCacheConfig.getCheckValue()).isEqualTo("the-value"); + } +} diff --git a/client-device-connection-infinispan/src/test/resources/common-cache-options.yaml b/client-device-connection-base/src/test/resources/common-cache-options.yaml similarity index 100% rename from client-device-connection-infinispan/src/test/resources/common-cache-options.yaml rename to client-device-connection-base/src/test/resources/common-cache-options.yaml diff --git a/client-device-connection-base/src/test/resources/logback-test.xml b/client-device-connection-base/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..0da04c2e0b --- /dev/null +++ b/client-device-connection-base/src/test/resources/logback-test.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/BasicCache.java b/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/BasicCache.java index 9373aae86f..3fdaa5ce77 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/BasicCache.java +++ b/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/BasicCache.java @@ -24,6 +24,7 @@ import java.util.function.Function; import org.eclipse.hono.client.ServerErrorException; +import org.eclipse.hono.deviceconnection.common.Cache; import org.eclipse.hono.util.Futures; import org.eclipse.hono.util.Lifecycle; import org.infinispan.commons.api.BasicCacheContainer; diff --git a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/HotrodCache.java b/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/HotrodCache.java index 4e3b3ea9b1..754554f0c7 100644 --- a/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/HotrodCache.java +++ b/client-device-connection-infinispan/src/main/java/org/eclipse/hono/deviceconnection/infinispan/client/HotrodCache.java @@ -18,6 +18,7 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; +import org.eclipse.hono.deviceconnection.common.CommonCacheConfig; import org.infinispan.client.hotrod.RemoteCache; import org.infinispan.client.hotrod.RemoteCacheContainer; import org.infinispan.client.hotrod.RemoteCacheManager; diff --git a/client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/QuarkusPropertyBindingTest.java b/client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/RemoteCacheQuarkusPropertyBindingTest.java similarity index 85% rename from client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/QuarkusPropertyBindingTest.java rename to client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/RemoteCacheQuarkusPropertyBindingTest.java index 53fe74cf6a..bce5685c98 100644 --- a/client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/QuarkusPropertyBindingTest.java +++ b/client-device-connection-infinispan/src/test/java/org/eclipse/hono/deviceconnection/infinispan/client/RemoteCacheQuarkusPropertyBindingTest.java @@ -25,24 +25,9 @@ import org.junit.jupiter.api.Test; /** - * Tests verifying binding of configuration properties to {@link CommonCacheConfig} and - * {@link InfinispanRemoteConfigurationProperties}. - * + * Tests verifying binding of configuration properties to {@link InfinispanRemoteConfigurationProperties}. */ -public class QuarkusPropertyBindingTest { - - @Test - void testCommonCacheConfigurationPropertiesArePickedUp() { - - final var commonCacheConfig = new CommonCacheConfig( - ConfigMappingSupport.getConfigMapping( - CommonCacheOptions.class, - this.getClass().getResource("/common-cache-options.yaml"))); - - assertThat(commonCacheConfig.getCacheName()).isEqualTo("the-cache"); - assertThat(commonCacheConfig.getCheckKey()).isEqualTo("the-key"); - assertThat(commonCacheConfig.getCheckValue()).isEqualTo("the-value"); - } +public class RemoteCacheQuarkusPropertyBindingTest { @SuppressWarnings("deprecation") @Test diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java index bf3dec738a..16eb5653df 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java @@ -13,7 +13,7 @@ package org.eclipse.hono.commandrouter; -import org.eclipse.hono.deviceconnection.infinispan.client.AdapterInstanceStatusProvider; +import org.eclipse.hono.deviceconnection.common.AdapterInstanceStatusProvider; import org.eclipse.hono.util.Lifecycle; /** diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java index d39fc6eb45..482efeb4da 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java @@ -15,7 +15,7 @@ import org.eclipse.hono.client.registry.DeviceRegistrationClient; import org.eclipse.hono.commandrouter.impl.CommandTargetMapperImpl; -import org.eclipse.hono.deviceconnection.infinispan.client.DeviceConnectionInfo; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; import io.opentracing.SpanContext; import io.opentracing.Tracer; diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java index 81c1309fb8..44d98f5da5 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java @@ -61,7 +61,7 @@ import org.eclipse.hono.commandrouter.impl.pubsub.PubSubBasedCommandConsumerFactoryImpl; import org.eclipse.hono.config.ServiceConfigProperties; import org.eclipse.hono.config.ServiceOptions; -import org.eclipse.hono.deviceconnection.infinispan.client.DeviceConnectionInfo; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; import org.eclipse.hono.service.HealthCheckProvider; import org.eclipse.hono.service.NotificationSupportingServiceApplication; import org.eclipse.hono.service.amqp.AmqpEndpoint; diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java index 07b1482bbb..736235996f 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java @@ -23,11 +23,11 @@ import org.eclipse.hono.commandrouter.CommandRouterServiceOptions; import org.eclipse.hono.commandrouter.impl.KubernetesBasedAdapterInstanceStatusService; import org.eclipse.hono.commandrouter.impl.UnknownStatusProvidingService; +import org.eclipse.hono.deviceconnection.common.CacheBasedDeviceConnectionInfo; +import org.eclipse.hono.deviceconnection.common.CommonCacheConfig; +import org.eclipse.hono.deviceconnection.common.CommonCacheOptions; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; import org.eclipse.hono.deviceconnection.infinispan.client.BasicCache; -import org.eclipse.hono.deviceconnection.infinispan.client.CacheBasedDeviceConnectionInfo; -import org.eclipse.hono.deviceconnection.infinispan.client.CommonCacheConfig; -import org.eclipse.hono.deviceconnection.infinispan.client.CommonCacheOptions; -import org.eclipse.hono.deviceconnection.infinispan.client.DeviceConnectionInfo; import org.eclipse.hono.deviceconnection.infinispan.client.EmbeddedCache; import org.eclipse.hono.deviceconnection.infinispan.client.HotrodCache; import org.eclipse.hono.deviceconnection.infinispan.client.InfinispanRemoteConfigurationOptions; diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java index 6d53adac9f..713ff373d6 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java @@ -38,7 +38,7 @@ import org.eclipse.hono.commandrouter.CommandRouterResult; import org.eclipse.hono.commandrouter.CommandRouterService; import org.eclipse.hono.config.ServiceConfigProperties; -import org.eclipse.hono.deviceconnection.infinispan.client.DeviceConnectionInfo; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; import org.eclipse.hono.service.HealthCheckProvider; import org.eclipse.hono.tracing.TracingHelper; import org.eclipse.hono.util.CommandConstants; diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java index 17e60de2a5..1f4a863fc6 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java @@ -23,7 +23,7 @@ import org.eclipse.hono.client.registry.DeviceDisabledOrNotRegisteredException; import org.eclipse.hono.client.registry.DeviceRegistrationClient; import org.eclipse.hono.commandrouter.CommandTargetMapper; -import org.eclipse.hono.deviceconnection.infinispan.client.DeviceConnectionInfo; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; import org.eclipse.hono.tracing.TracingHelper; import org.eclipse.hono.util.DeviceConnectionConstants; import org.eclipse.hono.util.MessageHelper; diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java index 929d2bf701..5fa82469be 100644 --- a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java +++ b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java @@ -41,7 +41,7 @@ import org.eclipse.hono.client.util.MessagingClientProvider; import org.eclipse.hono.commandrouter.CommandConsumerFactory; import org.eclipse.hono.config.ServiceConfigProperties; -import org.eclipse.hono.deviceconnection.infinispan.client.DeviceConnectionInfo; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; import org.eclipse.hono.test.VertxMockSupport; import org.eclipse.hono.util.CommandConstants; import org.eclipse.hono.util.EventConstants; From 8766a49890e432e7e33dff853d75cf95cd8f31d4 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Wed, 3 Apr 2024 19:31:09 +0000 Subject: [PATCH 03/22] Split services/command-router module into services/command-router-base and services/command-router-infinispan. Unit tests and integration tests run. --- bom/pom.xml | 2 +- .../pom.xml | 67 ++------------ .../AdapterInstanceStatusService.java | 0 .../commandrouter/CommandConsumerFactory.java | 0 .../CommandRouterAmqpServer.java | 0 .../commandrouter/CommandRouterMetrics.java | 0 .../commandrouter/CommandRouterResult.java | 0 .../commandrouter/CommandRouterService.java | 0 .../CommandRouterServiceConfigProperties.java | 0 .../CommandRouterServiceOptions.java | 0 .../commandrouter/CommandTargetMapper.java | 0 .../MicrometerBasedCommandRouterMetrics.java | 0 .../app/AbstractApplication.java} | 20 ++-- .../commandrouter/app/MetricsFactory.java | 0 .../impl/AbstractCommandProcessingQueue.java | 0 ...actMappingAndDelegatingCommandHandler.java | 0 .../impl/CommandProcessingQueue.java | 0 .../impl/CommandRouterServiceImpl.java | 0 .../impl/CommandTargetMapperImpl.java | 0 .../DelegatingCommandRouterAmqpEndpoint.java | 0 ...etesBasedAdapterInstanceStatusService.java | 0 .../impl/UnknownStatusProvidingService.java | 0 ...ProtonBasedCommandConsumerFactoryImpl.java | 0 .../ProtonBasedCommandProcessingQueue.java | 0 ...sedMappingAndDelegatingCommandHandler.java | 0 .../InternalKafkaTopicCleanupService.java | 0 .../KafkaBasedCommandConsumerFactoryImpl.java | 0 ...sedMappingAndDelegatingCommandHandler.java | 0 .../kafka/KafkaCommandProcessingQueue.java | 0 ...PubSubBasedCommandConsumerFactoryImpl.java | 0 .../PubSubBasedCommandProcessingQueue.java | 0 ...sedMappingAndDelegatingCommandHandler.java | 0 .../impl/CommandRouterServiceImplTest.java | 0 ...legatingCommandRouterAmqpEndpointTest.java | 0 ...BasedAdapterInstanceStatusServiceTest.java | 0 ...appingAndDelegatingCommandHandlerTest.java | 0 .../InternalKafkaTopicCleanupServiceTest.java | 0 ...appingAndDelegatingCommandHandlerTest.java | 0 .../KafkaCommandProcessingQueueTest.java | 0 ...appingAndDelegatingCommandHandlerTest.java | 0 .../src/test/resources/application.yml | 0 services/command-router-infinispan/pom.xml | 92 +++++++++++++++++++ .../infinispan/app/Application.java | 34 +++++++ ...finispanDeviceConnectionInfoProducer.java} | 6 +- .../native-image.properties | 0 .../main/resources/application-dev.properties | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/default_banner.txt | 2 +- services/pom.xml | 3 +- tests/pom.xml | 4 +- 50 files changed, 153 insertions(+), 77 deletions(-) rename services/{command-router => command-router-base}/pom.xml (65%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java (100%) rename services/{command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java => command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java} (97%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java (100%) rename services/{command-router => command-router-base}/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java (100%) rename services/{command-router => command-router-base}/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java (100%) rename services/{command-router => command-router-base}/src/test/resources/application.yml (100%) create mode 100644 services/command-router-infinispan/pom.xml create mode 100644 services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java rename services/{command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java => command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java} (96%) rename services/{command-router => command-router-infinispan}/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties (100%) rename services/{command-router => command-router-infinispan}/src/main/resources/application-dev.properties (100%) rename services/{command-router => command-router-infinispan}/src/main/resources/application.properties (100%) rename services/{command-router => command-router-infinispan}/src/main/resources/default_banner.txt (92%) diff --git a/bom/pom.xml b/bom/pom.xml index 48412ba49f..2e32c76703 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -427,7 +427,7 @@ quarkus.vertx.max-event-loop-execute-time=${max.event-loop.execute-time:20000} org.eclipse.hono - hono-service-command-router + hono-service-command-router-base ${project.version} diff --git a/services/command-router/pom.xml b/services/command-router-base/pom.xml similarity index 65% rename from services/command-router/pom.xml rename to services/command-router-base/pom.xml index aeaa5a4738..7b32bfc186 100644 --- a/services/command-router/pom.xml +++ b/services/command-router-base/pom.xml @@ -11,7 +11,7 @@ SPDX-License-Identifier: EPL-2.0 --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.eclipse.hono @@ -19,15 +19,16 @@ 2.6.0-SNAPSHOT ../parent - hono-service-command-router - Hono Command Router - A Quarkus based implementation of Hono's Command Router API that is using Infinispan for storing data. + hono-service-command-router-base + Hono Service Command Router Base + Base classes for implementing a Quarkus based Hono Command Router org.eclipse.hono - client-device-connection-infinispan + client-device-connection-base + org.eclipse.hono hono-client-command-amqp @@ -104,58 +105,4 @@ - - - - - io.fabric8 - docker-maven-plugin - - - - - - Command Router - - - 5671 - 5672 - ${health.check.port} - - - - - - - - - - - - - - build-docker-image - - - - io.fabric8 - docker-maven-plugin - - - - - - - build-native-image - - - - io.fabric8 - docker-maven-plugin - - - - - - - + \ No newline at end of file diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/AdapterInstanceStatusService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandConsumerFactory.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterAmqpServer.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterMetrics.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterResult.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceConfigProperties.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandRouterServiceOptions.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/CommandTargetMapper.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/MicrometerBasedCommandRouterMetrics.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java similarity index 97% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java index 44d98f5da5..49b482b58f 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java +++ b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/AbstractApplication.java @@ -86,20 +86,15 @@ import io.vertx.core.buffer.Buffer; import io.vertx.ext.healthchecks.HealthCheckHandler; import io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory; -import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; /** * The Quarkus based Command Router main application class. */ -@ApplicationScoped -public class Application extends NotificationSupportingServiceApplication { +public abstract class AbstractApplication extends NotificationSupportingServiceApplication { private static final String COMPONENT_NAME = "Hono Command Router"; - private static final Logger LOG = LoggerFactory.getLogger(Application.class); - - @Inject - DeviceConnectionInfo deviceConnectionInfo; + private static final Logger LOG = LoggerFactory.getLogger(AbstractApplication.class); @Inject ProtonSaslAuthenticatorFactory saslAuthenticatorFactory; @@ -349,16 +344,23 @@ public void registerReadinessChecks(final HealthCheckHandler handler) { return endpoint; } + /** + * Gets the repository storing device connection info. + * + * @return The device connection info repository. + */ + protected abstract DeviceConnectionInfo getDeviceConnectionInfo(); + private CommandRouterService commandRouterService() { final DeviceRegistrationClient registrationClient = registrationClient(); final TenantClient tenantClient = tenantClient(); - final var commandTargetMapper = CommandTargetMapper.create(registrationClient, deviceConnectionInfo, tracer); + final var commandTargetMapper = CommandTargetMapper.create(registrationClient, getDeviceConnectionInfo(), tracer); return new CommandRouterServiceImpl( amqpServerProperties, registrationClient, tenantClient, - deviceConnectionInfo, + getDeviceConnectionInfo(), commandConsumerFactoryProvider(tenantClient, commandTargetMapper), eventSenderProvider(), adapterInstanceStatusService, diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/app/MetricsFactory.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/AbstractMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/CommandTargetMapperImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/UnknownStatusProvidingService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandProcessingQueue.java diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java b/services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java similarity index 100% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java rename to services/command-router-base/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImplTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/DelegatingCommandRouterAmqpEndpointTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/KubernetesBasedAdapterInstanceStatusServiceTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupServiceTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java similarity index 100% rename from services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java rename to services/command-router-base/src/test/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandlerTest.java diff --git a/services/command-router/src/test/resources/application.yml b/services/command-router-base/src/test/resources/application.yml similarity index 100% rename from services/command-router/src/test/resources/application.yml rename to services/command-router-base/src/test/resources/application.yml diff --git a/services/command-router-infinispan/pom.xml b/services/command-router-infinispan/pom.xml new file mode 100644 index 0000000000..bfbcb5e456 --- /dev/null +++ b/services/command-router-infinispan/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + + org.eclipse.hono + hono-services-parent + 2.6.0-SNAPSHOT + ../parent + + hono-service-command-router-infinispan + Hono Infinispan Based Command Router + A Quarkus based implementation of Hono's Command Router API that is using Infinispan for storing data. + + + + org.eclipse.hono + hono-service-command-router-base + + + + org.eclipse.hono + client-device-connection-infinispan + + + + + + + + io.fabric8 + docker-maven-plugin + + + + + + Command Router + + + 5671 + 5672 + ${health.check.port} + + + + + + + + + + + + + + build-docker-image + + + + io.fabric8 + docker-maven-plugin + + + + + + + build-native-image + + + + io.fabric8 + docker-maven-plugin + + + + + + + \ No newline at end of file diff --git a/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java new file mode 100644 index 0000000000..c62cc3c59f --- /dev/null +++ b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/Application.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.hono.commandrouter.infinispan.app; + +import org.eclipse.hono.commandrouter.app.AbstractApplication; +import org.eclipse.hono.deviceconnection.common.DeviceConnectionInfo; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +/** + * The Quarkus based Command Router main application class (Infinispan variant). + */ +@ApplicationScoped +public class Application extends AbstractApplication { + + @Inject + DeviceConnectionInfo deviceConnectionInfo; + + @Override + protected DeviceConnectionInfo getDeviceConnectionInfo() { + return deviceConnectionInfo; + } +} diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java similarity index 96% rename from services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java rename to services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java index 736235996f..072c8134ac 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java +++ b/services/command-router-infinispan/src/main/java/org/eclipse/hono/commandrouter/infinispan/app/InfinispanDeviceConnectionInfoProducer.java @@ -12,7 +12,7 @@ */ -package org.eclipse.hono.commandrouter.app; +package org.eclipse.hono.commandrouter.infinispan.app; import java.io.IOException; import java.nio.file.Files; @@ -55,9 +55,9 @@ * on whether a remote cache config with a non-empty server list is used or not. */ @ApplicationScoped -public class DeviceConnectionInfoProducer { +public class InfinispanDeviceConnectionInfoProducer { - private static final Logger LOG = LoggerFactory.getLogger(DeviceConnectionInfoProducer.class); + private static final Logger LOG = LoggerFactory.getLogger(InfinispanDeviceConnectionInfoProducer.class); @ConfigProperty(name = "hono.commandRouter.cache.embedded.configurationFile", defaultValue = "/etc/hono/cache-config.xml") String configFile; diff --git a/services/command-router/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties b/services/command-router-infinispan/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties similarity index 100% rename from services/command-router/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties rename to services/command-router-infinispan/src/main/resources/META-INF/native-image/org.eclipse.hono/hono-service-command-router/native-image.properties diff --git a/services/command-router/src/main/resources/application-dev.properties b/services/command-router-infinispan/src/main/resources/application-dev.properties similarity index 100% rename from services/command-router/src/main/resources/application-dev.properties rename to services/command-router-infinispan/src/main/resources/application-dev.properties diff --git a/services/command-router/src/main/resources/application.properties b/services/command-router-infinispan/src/main/resources/application.properties similarity index 100% rename from services/command-router/src/main/resources/application.properties rename to services/command-router-infinispan/src/main/resources/application.properties diff --git a/services/command-router/src/main/resources/default_banner.txt b/services/command-router-infinispan/src/main/resources/default_banner.txt similarity index 92% rename from services/command-router/src/main/resources/default_banner.txt rename to services/command-router-infinispan/src/main/resources/default_banner.txt index ee1eac25ce..6ff38647e3 100644 --- a/services/command-router/src/main/resources/default_banner.txt +++ b/services/command-router-infinispan/src/main/resources/default_banner.txt @@ -8,7 +8,7 @@ | | |_| -Eclipse Hono Command Router +Eclipse Hono Infinispan Based Command Router Go to https://www.eclipse.org/hono for more information. diff --git a/services/pom.xml b/services/pom.xml index 416fc18f64..4af2a47055 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -30,7 +30,8 @@ auth auth-base base-jdbc - command-router + command-router-base + command-router-infinispan device-registry-base device-registry-jdbc device-registry-mongodb diff --git a/tests/pom.xml b/tests/pom.xml index b7466c33bc..a861133063 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -85,7 +85,7 @@ Command Router related properties. --> clustered-cache - hono-service-command-router + hono-service-command-router-infinispan 300000000 ${default.java-options} @@ -264,7 +264,7 @@ org.eclipse.hono - hono-service-command-router + hono-service-command-router-base test From e20bbb80f0ce25e041350414706fb23237f6519b Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Thu, 11 Apr 2024 16:06:57 +0000 Subject: [PATCH 04/22] Remove upper boundary of copyright timespan in all touched files as per PR comment --- bom/pom.xml | 2 +- client-device-connection-base/pom.xml | 2 +- .../deviceconnection/common/AdapterInstanceStatusProvider.java | 2 +- .../java/org/eclipse/hono/deviceconnection/common/Cache.java | 2 +- .../deviceconnection/common/CacheBasedDeviceConnectionInfo.java | 2 +- .../eclipse/hono/deviceconnection/common/CommonCacheConfig.java | 2 +- .../hono/deviceconnection/common/DeviceConnectionInfo.java | 2 +- .../common/CacheBasedDeviceConnectionInfoTest.java | 2 +- .../common/CommonCacheQuarkusPropertyBindingTest.java | 2 +- .../src/test/resources/logback-test.xml | 2 +- client-device-connection-infinispan/pom.xml | 2 +- .../hono/deviceconnection/infinispan/client/BasicCache.java | 2 +- .../hono/deviceconnection/infinispan/client/HotrodCache.java | 2 +- .../client/RemoteCacheQuarkusPropertyBindingTest.java | 2 +- pom.xml | 2 +- services/command-router-base/pom.xml | 2 +- .../hono/commandrouter/AdapterInstanceStatusService.java | 2 +- .../org/eclipse/hono/commandrouter/CommandConsumerFactory.java | 2 +- .../org/eclipse/hono/commandrouter/CommandRouterResult.java | 2 +- .../org/eclipse/hono/commandrouter/CommandRouterService.java | 2 +- .../commandrouter/CommandRouterServiceConfigProperties.java | 2 +- .../org/eclipse/hono/commandrouter/CommandTargetMapper.java | 2 +- .../org/eclipse/hono/commandrouter/app/AbstractApplication.java | 2 +- .../java/org/eclipse/hono/commandrouter/app/MetricsFactory.java | 2 +- .../hono/commandrouter/impl/AbstractCommandProcessingQueue.java | 2 +- .../impl/AbstractMappingAndDelegatingCommandHandler.java | 2 +- .../hono/commandrouter/impl/CommandRouterServiceImpl.java | 2 +- .../hono/commandrouter/impl/CommandTargetMapperImpl.java | 2 +- .../commandrouter/impl/DelegatingCommandRouterAmqpEndpoint.java | 2 +- .../impl/KubernetesBasedAdapterInstanceStatusService.java | 2 +- .../impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java | 2 +- .../amqp/ProtonBasedMappingAndDelegatingCommandHandler.java | 2 +- .../impl/kafka/InternalKafkaTopicCleanupService.java | 2 +- .../impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java | 2 +- .../kafka/KafkaBasedMappingAndDelegatingCommandHandler.java | 2 +- .../commandrouter/impl/kafka/KafkaCommandProcessingQueue.java | 2 +- .../hono/commandrouter/impl/CommandRouterServiceImplTest.java | 2 +- .../impl/DelegatingCommandRouterAmqpEndpointTest.java | 2 +- .../impl/KubernetesBasedAdapterInstanceStatusServiceTest.java | 2 +- .../amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java | 2 +- .../impl/kafka/InternalKafkaTopicCleanupServiceTest.java | 2 +- .../kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java | 2 +- .../impl/kafka/KafkaCommandProcessingQueueTest.java | 2 +- services/command-router-infinispan/pom.xml | 2 +- .../eclipse/hono/commandrouter/infinispan/app/Application.java | 2 +- .../infinispan/app/InfinispanDeviceConnectionInfoProducer.java | 2 +- services/pom.xml | 2 +- tests/pom.xml | 2 +- 48 files changed, 48 insertions(+), 48 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index 2e32c76703..f6064135fa 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.eclipse.hono @@ -161,4 +161,4 @@ - \ No newline at end of file + diff --git a/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java b/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java index 0e707a12df..4e1948ddd3 100644 --- a/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java +++ b/client-device-connection-base/src/test/java/org/eclipse/hono/deviceconnection/common/CommonCacheQuarkusPropertyBindingTest.java @@ -26,7 +26,6 @@ public class CommonCacheQuarkusPropertyBindingTest { @Test void testCommonCacheConfigurationPropertiesArePickedUp() { - System.out.println("!!!!!!!!!!!!!================== RUNNING TEST!!!============================!!!!!!!!!!! STFS"); final var commonCacheConfig = new CommonCacheConfig( ConfigMappingSupport.getConfigMapping( CommonCacheOptions.class, diff --git a/client-device-connection-base/src/test/resources/logback-test.xml b/client-device-connection-base/src/test/resources/logback-test.xml index c45908dd8b..83ac4a12e1 100644 --- a/client-device-connection-base/src/test/resources/logback-test.xml +++ b/client-device-connection-base/src/test/resources/logback-test.xml @@ -31,7 +31,6 @@ - diff --git a/client-device-connection-infinispan/pom.xml b/client-device-connection-infinispan/pom.xml index 389c8a47bc..b8145d76a6 100644 --- a/client-device-connection-infinispan/pom.xml +++ b/client-device-connection-infinispan/pom.xml @@ -1,14 +1,14 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.eclipse.hono @@ -105,4 +105,4 @@ - \ No newline at end of file + diff --git a/services/command-router-infinispan/pom.xml b/services/command-router-infinispan/pom.xml index 29d6a233f3..94adfecb83 100644 --- a/services/command-router-infinispan/pom.xml +++ b/services/command-router-infinispan/pom.xml @@ -11,7 +11,7 @@ SPDX-License-Identifier: EPL-2.0 --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.eclipse.hono From 86241c23573deccf66f6a606e170b9ee706b927f Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Thu, 11 Apr 2024 16:33:02 +0000 Subject: [PATCH 06/22] Minor whitespace formatting and cleanup as per PR comments --- services/command-router-infinispan/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/command-router-infinispan/pom.xml b/services/command-router-infinispan/pom.xml index 94adfecb83..836d6ac2e4 100644 --- a/services/command-router-infinispan/pom.xml +++ b/services/command-router-infinispan/pom.xml @@ -89,4 +89,4 @@ - \ No newline at end of file + From e04badaaed49cabf719eaf23643c64e75b78a11e Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Mon, 15 Apr 2024 16:45:46 +0000 Subject: [PATCH 07/22] whitespace fixes to reduce diff clutter --- .../src/test/resources/logback-test.xml | 6 +++--- client-device-connection-infinispan/pom.xml | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client-device-connection-base/src/test/resources/logback-test.xml b/client-device-connection-base/src/test/resources/logback-test.xml index 83ac4a12e1..45922c90a0 100644 --- a/client-device-connection-base/src/test/resources/logback-test.xml +++ b/client-device-connection-base/src/test/resources/logback-test.xml @@ -1,14 +1,14 @@ diff --git a/client-device-connection-infinispan/pom.xml b/client-device-connection-infinispan/pom.xml index b8145d76a6..04a689c1bd 100644 --- a/client-device-connection-infinispan/pom.xml +++ b/client-device-connection-infinispan/pom.xml @@ -1,14 +1,14 @@ - \ No newline at end of file + + From 331053d8ff2a623713a42808a6254fbefa0cfd9d Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 16 Apr 2024 13:31:52 +0000 Subject: [PATCH 08/22] reorder pom.xml to minimize changes in PR --- client-device-connection-infinispan/pom.xml | 37 +++++++++------------ 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/client-device-connection-infinispan/pom.xml b/client-device-connection-infinispan/pom.xml index 04a689c1bd..bd22b6e97a 100644 --- a/client-device-connection-infinispan/pom.xml +++ b/client-device-connection-infinispan/pom.xml @@ -30,12 +30,10 @@ org.eclipse.hono hono-legal - - org.eclipse.hono - client-device-connection-base + org.slf4j + slf4j-api - org.infinispan infinispan-core-jakarta @@ -55,25 +53,23 @@ org.infinispan infinispan-query-dsl - - org.infinispan - infinispan-commons - + + org.infinispan + infinispan-commons + - - - org.slf4j - slf4j-api + org.eclipse.hono + client-device-connection-base org.eclipse.hono - hono-core + hono-client-common org.eclipse.hono - hono-client-common + hono-core io.vertx @@ -120,13 +116,6 @@ - - org.bouncycastle - bcpkix-jdk18on - test - - - org.junit.jupiter junit-jupiter-engine @@ -162,6 +151,11 @@ core-test-utils test + + org.bouncycastle + bcpkix-jdk18on + test + @@ -185,4 +179,3 @@ - From 569898d551a2b0d3a46121480c82a5d0e924d090 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 16 Apr 2024 14:04:37 +0000 Subject: [PATCH 09/22] final changes to pom.xml for PR --- client-device-connection-base/pom.xml | 13 ++++--------- client-device-connection-infinispan/pom.xml | 10 +++++----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/client-device-connection-base/pom.xml b/client-device-connection-base/pom.xml index 4ae2e4456d..98f7d0c062 100644 --- a/client-device-connection-base/pom.xml +++ b/client-device-connection-base/pom.xml @@ -30,6 +30,10 @@ org.eclipse.hono hono-legal + + org.slf4j + slf4j-api + org.eclipse.hono hono-core @@ -37,31 +41,22 @@ org.eclipse.hono hono-client-common - - - - org.slf4j - slf4j-api io.opentracing opentracing-api - io.smallrye.config smallrye-config-core - io.vertx vertx-core - io.vertx vertx-health-check - com.google.guava diff --git a/client-device-connection-infinispan/pom.xml b/client-device-connection-infinispan/pom.xml index bd22b6e97a..ceb339bad3 100644 --- a/client-device-connection-infinispan/pom.xml +++ b/client-device-connection-infinispan/pom.xml @@ -30,6 +30,10 @@ org.eclipse.hono hono-legal + + org.eclipse.hono + client-device-connection-base + org.slf4j slf4j-api @@ -61,16 +65,12 @@ org.eclipse.hono - client-device-connection-base + hono-core org.eclipse.hono hono-client-common - - org.eclipse.hono - hono-core - io.vertx vertx-core From 43c3539a25c49a42b6c984ee75bc0fa57ea2a8a6 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 16 Apr 2024 14:07:52 +0000 Subject: [PATCH 10/22] silly whitespace changes --- client-device-connection-base/pom.xml | 6 +++--- client-device-connection-infinispan/pom.xml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client-device-connection-base/pom.xml b/client-device-connection-base/pom.xml index 98f7d0c062..c206c36698 100644 --- a/client-device-connection-base/pom.xml +++ b/client-device-connection-base/pom.xml @@ -1,14 +1,14 @@ Date: Tue, 16 Apr 2024 14:09:21 +0000 Subject: [PATCH 11/22] Update copyright year --- client-device-connection-base/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client-device-connection-base/pom.xml b/client-device-connection-base/pom.xml index c206c36698..9873a9e829 100644 --- a/client-device-connection-base/pom.xml +++ b/client-device-connection-base/pom.xml @@ -1,6 +1,6 @@ diff --git a/client-device-connection-base/src/test/resources/logback-test.xml b/client-device-connection-base/src/test/resources/logback-test.xml index 45922c90a0..f436327d3a 100644 --- a/client-device-connection-base/src/test/resources/logback-test.xml +++ b/client-device-connection-base/src/test/resources/logback-test.xml @@ -28,6 +28,7 @@ + From 2cd72e92d239b76c3f8c46307dfe4b8b7891f6a5 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Wed, 17 Apr 2024 16:33:16 +0000 Subject: [PATCH 14/22] Tag command-server image with it's legacy name and push to maintain backwards compatibilty --- push_hono_images.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index 0135eb561d..78520c318e 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -1,6 +1,6 @@ #!/bin/bash #******************************************************************************* -# Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation +# Copyright (c) 2016 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -23,6 +23,7 @@ IMAGES="hono-adapter-amqp \ hono-adapter-mqtt \ hono-adapter-sigfox \ hono-service-auth \ + hono-service-command-router-infinispan \ hono-service-command-router \ hono-service-device-registry-jdbc \ hono-service-device-registry-mongodb" @@ -34,6 +35,7 @@ NATIVE_IMAGES="hono-adapter-amqp-native \ hono-adapter-mqtt-native \ hono-adapter-sigfox-native \ hono-service-auth-native \ + hono-service-command-router-infinispan-native \ hono-service-command-router-native \ hono-service-device-registry-jdbc-native \ hono-service-device-registry-mongodb-native" @@ -44,8 +46,17 @@ echo "called as $ME" if [[ "push_hono_native_images.sh" == "$ME" ]] then IMAGES=${NATIVE_IMAGES} + COMMAND_ROUTER_IMAGE="eclipse/hono-service-command-router-infinispan-native:${TAG}" + COMMAND_ROUTER_IMAGE_LEGACY="eclipse/hono-service-command-router-native:${TAG}" +else + COMMAND_ROUTER_IMAGE="eclipse/hono-service-command-router-infinispan:${TAG}" + COMMAND_ROUTER_IMAGE_LEGACY="eclipse/hono-service-command-router:${TAG}" fi +# Tag the existing Infinispan Command Router image with the legacy name for backwards compatibility +echo "tagging existing command-router image (${COMMAND_ROUTER_IMAGE}) with legacy name (${COMMAND_ROUTER_IMAGE_LEGACY})" +docker tag "${COMMAND_ROUTER_IMAGE}" "$COMMAND_ROUTER_IMAGE_LEGACY" + if [[ -n "$TAG" ]] then for image in $IMAGES @@ -59,7 +70,7 @@ then IMAGE_NAME="${ECLIPSE_IMAGE_NAME}" fi echo "pushing image ${IMAGE_NAME}:${TAG} ..." - docker push "${IMAGE_NAME}:${TAG}" + #docker push "${IMAGE_NAME}:${TAG}" done else echo "This script can be used to push Hono's images from" From 37da591747a4de8c93e3c9ab6c3496b6e74522c7 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Mon, 29 Apr 2024 16:50:14 +0000 Subject: [PATCH 15/22] Attempt to make push_hono_images.sh script a bit clearer --- push_hono_images.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index 78520c318e..23a8110cb0 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -43,25 +43,37 @@ NATIVE_IMAGES="hono-adapter-amqp-native \ ME=$(basename "$0") echo "called as $ME" +COMMAND_ROUTER_IMAGE_LEGACY_BASE="hono-service-command-router" +COMMAND_ROUTER_IMAGE_INFINISPAN_BASE="${COMMAND_ROUTER_IMAGE_LEGACY_BASE}-infinispan" + +ECLIPSE_REPO="eclipse" + if [[ "push_hono_native_images.sh" == "$ME" ]] then IMAGES=${NATIVE_IMAGES} - COMMAND_ROUTER_IMAGE="eclipse/hono-service-command-router-infinispan-native:${TAG}" - COMMAND_ROUTER_IMAGE_LEGACY="eclipse/hono-service-command-router-native:${TAG}" + ECLIPSE_COMMAND_ROUTER_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE}-native:${TAG}" + ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_LEGACY_BASE}-native:${TAG}" else - COMMAND_ROUTER_IMAGE="eclipse/hono-service-command-router-infinispan:${TAG}" - COMMAND_ROUTER_IMAGE_LEGACY="eclipse/hono-service-command-router:${TAG}" + ECLIPSE_COMMAND_ROUTER_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE}:${TAG}" + ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_LEGACY_BASE}:${TAG}" fi -# Tag the existing Infinispan Command Router image with the legacy name for backwards compatibility -echo "tagging existing command-router image (${COMMAND_ROUTER_IMAGE}) with legacy name (${COMMAND_ROUTER_IMAGE_LEGACY})" -docker tag "${COMMAND_ROUTER_IMAGE}" "$COMMAND_ROUTER_IMAGE_LEGACY" +# Tag the Infinispan Command Router image produced in the build with its legacy name for backwards compatibility. +# The Command Router will be published using both the new and legacy names when looping through the IMAGES array below. +echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_IMAGE_NAME}) with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" +docker tag "${ECLIPSE_COMMAND_ROUTER_IMAGE_NAME}" "${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME}" + +# TODO: should we exit this script before attempting to push images if command-router could not be re-tagged above? +if [ $? -ne 0 ]; then + echo "re-tagging ${ECLIPSE_COMMAND_ROUTER_IMAGE_NAME} with legacy name failed" + exit 1 +fi if [[ -n "$TAG" ]] then for image in $IMAGES do - ECLIPSE_IMAGE_NAME="eclipse/$image" + ECLIPSE_IMAGE_NAME="${ECLIPSE_REPO}/$image" if [[ "docker.io" != "${CR}" || "eclipse" != "${REPO}" ]] then IMAGE_NAME="${CR}/${REPO}/${image}" From 67086243cb89e9f79badfa8e1d3ad08c67ff9570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stef=C3=A1n=20Freyr=20Stef=C3=A1nsson?= Date: Tue, 30 Apr 2024 11:04:42 +0000 Subject: [PATCH 16/22] Update push_hono_images.sh Co-authored-by: Kai Hudalla --- push_hono_images.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index 23a8110cb0..25f5474877 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -60,12 +60,12 @@ fi # Tag the Infinispan Command Router image produced in the build with its legacy name for backwards compatibility. # The Command Router will be published using both the new and legacy names when looping through the IMAGES array below. -echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_IMAGE_NAME}) with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" -docker tag "${ECLIPSE_COMMAND_ROUTER_IMAGE_NAME}" "${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME}" +echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME}) with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" +docker tag "${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME}" "${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME}" # TODO: should we exit this script before attempting to push images if command-router could not be re-tagged above? if [ $? -ne 0 ]; then - echo "re-tagging ${ECLIPSE_COMMAND_ROUTER_IMAGE_NAME} with legacy name failed" + echo "re-tagging ${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME} with legacy name failed" exit 1 fi From 5702e40cc7ee97972699863983422667d76a946d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stef=C3=A1n=20Freyr=20Stef=C3=A1nsson?= Date: Tue, 30 Apr 2024 11:05:08 +0000 Subject: [PATCH 17/22] Update push_hono_images.sh Co-authored-by: Kai Hudalla --- push_hono_images.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index 25f5474877..bc2c582ee7 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -51,10 +51,10 @@ ECLIPSE_REPO="eclipse" if [[ "push_hono_native_images.sh" == "$ME" ]] then IMAGES=${NATIVE_IMAGES} - ECLIPSE_COMMAND_ROUTER_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE}-native:${TAG}" + ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE}-native:${TAG}" ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_LEGACY_BASE}-native:${TAG}" else - ECLIPSE_COMMAND_ROUTER_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE}:${TAG}" + ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE}:${TAG}" ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME="${ECLIPSE_REPO}/${COMMAND_ROUTER_IMAGE_LEGACY_BASE}:${TAG}" fi From b0a3fd6bad1ff0c73d1844f03ebb81d1ab1bbe88 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 30 Apr 2024 11:11:52 +0000 Subject: [PATCH 18/22] Responding to PR comments --- push_hono_images.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index bc2c582ee7..90dc2f913b 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -16,6 +16,9 @@ TAG=$1 CR=${2:-"docker.io"} REPO=${3:-"eclipse"} +COMMAND_ROUTER_IMAGE_LEGACY_BASE="hono-service-command-router" +COMMAND_ROUTER_IMAGE_INFINISPAN_BASE="${COMMAND_ROUTER_IMAGE_LEGACY_BASE}-infinispan" + IMAGES="hono-adapter-amqp \ hono-adapter-coap \ hono-adapter-http \ @@ -23,8 +26,8 @@ IMAGES="hono-adapter-amqp \ hono-adapter-mqtt \ hono-adapter-sigfox \ hono-service-auth \ - hono-service-command-router-infinispan \ - hono-service-command-router \ + ${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE} \ + ${COMMAND_ROUTER_IMAGE_LEGACY_BASE} \ hono-service-device-registry-jdbc \ hono-service-device-registry-mongodb" @@ -35,17 +38,14 @@ NATIVE_IMAGES="hono-adapter-amqp-native \ hono-adapter-mqtt-native \ hono-adapter-sigfox-native \ hono-service-auth-native \ - hono-service-command-router-infinispan-native \ - hono-service-command-router-native \ + ${COMMAND_ROUTER_IMAGE_INFINISPAN_BASE}-native \ + ${COMMAND_ROUTER_IMAGE_LEGACY_BASE}-native \ hono-service-device-registry-jdbc-native \ hono-service-device-registry-mongodb-native" ME=$(basename "$0") echo "called as $ME" -COMMAND_ROUTER_IMAGE_LEGACY_BASE="hono-service-command-router" -COMMAND_ROUTER_IMAGE_INFINISPAN_BASE="${COMMAND_ROUTER_IMAGE_LEGACY_BASE}-infinispan" - ECLIPSE_REPO="eclipse" if [[ "push_hono_native_images.sh" == "$ME" ]] @@ -60,7 +60,8 @@ fi # Tag the Infinispan Command Router image produced in the build with its legacy name for backwards compatibility. # The Command Router will be published using both the new and legacy names when looping through the IMAGES array below. -echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME}) with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" +echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME})" +echo " with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" docker tag "${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME}" "${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME}" # TODO: should we exit this script before attempting to push images if command-router could not be re-tagged above? From a969467a2abe0246f9cdf50c10ae36614d11ede2 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 30 Apr 2024 11:17:28 +0000 Subject: [PATCH 19/22] Shortening lines --- push_hono_images.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index 90dc2f913b..5f6620d486 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -60,8 +60,9 @@ fi # Tag the Infinispan Command Router image produced in the build with its legacy name for backwards compatibility. # The Command Router will be published using both the new and legacy names when looping through the IMAGES array below. -echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME})" -echo " with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" +echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME})" \ + " with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" + docker tag "${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME}" "${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME}" # TODO: should we exit this script before attempting to push images if command-router could not be re-tagged above? From 47459fa2f13afa638b316ada3bb5e09a2fd80e48 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 30 Apr 2024 11:49:09 +0000 Subject: [PATCH 20/22] Exiting the script in case of failure tagging images --- push_hono_images.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index 5f6620d486..1703bb0c66 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -63,11 +63,9 @@ fi echo "tagging existing command-router image (${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME})" \ " with legacy name (${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME})" -docker tag "${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME}" "${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME}" - -# TODO: should we exit this script before attempting to push images if command-router could not be re-tagged above? -if [ $? -ne 0 ]; then - echo "re-tagging ${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME} with legacy name failed" +if ! docker tag "${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME}" "${ECLIPSE_COMMAND_ROUTER_LEGACY_IMAGE_NAME}" +then + echo "re-tagging ${ECLIPSE_COMMAND_ROUTER_INFINISPAN_IMAGE_NAME} with legacy name failed. Exiting!" exit 1 fi @@ -79,7 +77,11 @@ then if [[ "docker.io" != "${CR}" || "eclipse" != "${REPO}" ]] then IMAGE_NAME="${CR}/${REPO}/${image}" - docker tag "${ECLIPSE_IMAGE_NAME}:${TAG}" "${IMAGE_NAME}:${TAG}" + if ! docker tag "${ECLIPSE_IMAGE_NAME}:${TAG}" "${IMAGE_NAME}:${TAG}" + then + echo "re-tagging ${ECLIPSE_IMAGE_NAME}:${TAG} as ${IMAGE_NAME}:${TAG} failed. Exiting!" + exit 1 + fi else IMAGE_NAME="${ECLIPSE_IMAGE_NAME}" fi From fb643abed3416c63887bb996bdc011ce1a65bc89 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 30 Apr 2024 14:03:12 +0000 Subject: [PATCH 21/22] Split script into two phases, ensuring all images exist in one phase and then pushing them in the second --- push_hono_images.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/push_hono_images.sh b/push_hono_images.sh index 1703bb0c66..1b707944f3 100755 --- a/push_hono_images.sh +++ b/push_hono_images.sh @@ -71,6 +71,8 @@ fi if [[ -n "$TAG" ]] then + IMAGES_TO_PUSH=() + # Collect all images for pushing, re-tagging if necessary for image in $IMAGES do ECLIPSE_IMAGE_NAME="${ECLIPSE_REPO}/$image" @@ -84,9 +86,21 @@ then fi else IMAGE_NAME="${ECLIPSE_IMAGE_NAME}" + if ! docker inspect "${IMAGE_NAME}:${TAG}" > /dev/null + then + echo "image ${IMAGE_NAME}:${TAG} does not exist. Exiting!" + exit 1 + fi fi - echo "pushing image ${IMAGE_NAME}:${TAG} ..." - #docker push "${IMAGE_NAME}:${TAG}" + # Collect the image for pushing + IMAGES_TO_PUSH+=("${IMAGE_NAME}:${TAG}") + done + + # Now push all images that were collected + for image in ${IMAGES_TO_PUSH[*]} + do + echo "pushing image ${image} ..." + docker push "${image}" done else echo "This script can be used to push Hono's images from" From d114bfee3063be36b7a2954b1bcbdc9154c31dc2 Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Mon, 6 May 2024 00:56:22 +0000 Subject: [PATCH 22/22] Change quarkus dependency in client-device-connection-infinispan module to provided scope, remove the optional option and remove exclusion rule --- client-device-connection-infinispan/pom.xml | 32 +-------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/client-device-connection-infinispan/pom.xml b/client-device-connection-infinispan/pom.xml index 47664168bb..612358d8a3 100644 --- a/client-device-connection-infinispan/pom.xml +++ b/client-device-connection-infinispan/pom.xml @@ -82,37 +82,7 @@ io.quarkus quarkus-core - true - - - org.jboss.logmanager - jboss-logmanager-embedded - - - org.jboss.logging - jboss-logging-annotations - - - io.quarkus - quarkus-development-mode-spi - - - io.quarkus - quarkus-bootstrap-runner - - - org.jboss.slf4j - slf4j-jboss-logmanager - - - org.graalvm.sdk - graal-sdk - - - io.quarkus - quarkus-fs-util - - + provided