diff --git a/internal/utils/config/src/main/java/org/eclipse/ditto/internal/utils/config/http/DefaultHttpProxyBaseConfig.java b/internal/utils/config/src/main/java/org/eclipse/ditto/internal/utils/config/http/DefaultHttpProxyBaseConfig.java
new file mode 100644
index 0000000000..5ee63c22a2
--- /dev/null
+++ b/internal/utils/config/src/main/java/org/eclipse/ditto/internal/utils/config/http/DefaultHttpProxyBaseConfig.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2024 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.ditto.internal.utils.config.http;
+
+import java.util.Objects;
+
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.Immutable;
+
+import org.eclipse.ditto.internal.utils.config.ConfigWithFallback;
+
+import com.typesafe.config.Config;
+
+/**
+ * This class is the default implementation of the HTTP proxy config.
+ */
+@Immutable
+public final class DefaultHttpProxyBaseConfig implements HttpProxyBaseConfig {
+
+ private static final String HTTP_PROXY_PATH = "http.proxy";
+ private static final String PROXY_PATH = "proxy";
+
+ private final boolean enabled;
+ private final String hostName;
+ private final int port;
+ private final String userName;
+ private final String password;
+
+ private DefaultHttpProxyBaseConfig(final ConfigWithFallback configWithFallback) {
+ enabled = configWithFallback.getBoolean(HttpProxyConfigValue.ENABLED.getConfigPath());
+ hostName = configWithFallback.getString(HttpProxyConfigValue.HOST_NAME.getConfigPath());
+ port = configWithFallback.getInt(HttpProxyConfigValue.PORT.getConfigPath());
+ userName = configWithFallback.getString(HttpProxyConfigValue.USER_NAME.getConfigPath());
+ password = configWithFallback.getString(HttpProxyConfigValue.PASSWORD.getConfigPath());
+ }
+
+ /**
+ * Returns an instance of {@code DefaultHttpProxyConfig} based on the settings of the specified Config.
+ *
+ * @param config is supposed to provide the settings of the HTTP proxy config at {@value #HTTP_PROXY_PATH}.
+ * @return the instance.
+ * @throws org.eclipse.ditto.internal.utils.config.DittoConfigError if {@code config} is invalid.
+ */
+ public static DefaultHttpProxyBaseConfig ofHttpProxy(final Config config) {
+ return ofConfigPath(config, HTTP_PROXY_PATH);
+ }
+
+ public static DefaultHttpProxyBaseConfig ofProxy(final Config config) {
+ return ofConfigPath(config, PROXY_PATH);
+ }
+
+ private static DefaultHttpProxyBaseConfig ofConfigPath(final Config config, final String relativePath) {
+ return new DefaultHttpProxyBaseConfig(
+ ConfigWithFallback.newInstance(config, relativePath, HttpProxyConfigValue.values()));
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ @Override
+ public String getHostname() {
+ return hostName;
+ }
+
+ @Override
+ public int getPort() {
+ return port;
+ }
+
+ @Override
+ public String getUsername() {
+ return userName;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public boolean equals(@Nullable final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final DefaultHttpProxyBaseConfig that = (DefaultHttpProxyBaseConfig) o;
+ return enabled == that.enabled &&
+ port == that.port &&
+ Objects.equals(hostName, that.hostName) &&
+ Objects.equals(userName, that.userName) &&
+ Objects.equals(password, that.password);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(enabled, hostName, port, userName, password);
+ }
+
+ @SuppressWarnings("squid:S2068")
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " [" +
+ "enabled=" + enabled +
+ ", hostName=" + hostName +
+ ", port=" + port +
+ ", userName=" + userName +
+ ", password=*****" +
+ "]";
+ }
+
+}
diff --git a/base/service/src/main/java/org/eclipse/ditto/base/service/config/http/HttpProxyConfig.java b/internal/utils/config/src/main/java/org/eclipse/ditto/internal/utils/config/http/HttpProxyBaseConfig.java
similarity index 83%
rename from base/service/src/main/java/org/eclipse/ditto/base/service/config/http/HttpProxyConfig.java
rename to internal/utils/config/src/main/java/org/eclipse/ditto/internal/utils/config/http/HttpProxyBaseConfig.java
index 8a67baed53..93af767e59 100644
--- a/base/service/src/main/java/org/eclipse/ditto/base/service/config/http/HttpProxyConfig.java
+++ b/internal/utils/config/src/main/java/org/eclipse/ditto/internal/utils/config/http/HttpProxyBaseConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,19 +10,17 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.base.service.config.http;
+package org.eclipse.ditto.internal.utils.config.http;
import javax.annotation.concurrent.Immutable;
import org.eclipse.ditto.internal.utils.config.KnownConfigValue;
-import org.apache.pekko.http.javadsl.ClientTransport;
-
/**
* Provides configuration settings for the HTTP proxy.
*/
@Immutable
-public interface HttpProxyConfig {
+public interface HttpProxyBaseConfig {
/**
* Indicates whether the HTTP proxy should be enabled.
@@ -59,14 +57,6 @@ public interface HttpProxyConfig {
*/
String getPassword();
- /**
- * Converts the proxy settings to an Pekko HTTP client transport object.
- * Does not check whether the proxy is enabled.
- *
- * @return an Pekko HTTP client transport object matching this config.
- */
- ClientTransport toClientTransport();
-
/**
* An enumeration of the known config path expressions and their associated default values for
* {@code HttpProxyConfig}.
diff --git a/internal/utils/config/src/main/resources/ditto-pekko-config.conf b/internal/utils/config/src/main/resources/ditto-pekko-config.conf
index f32d27946f..0174e5d62d 100644
--- a/internal/utils/config/src/main/resources/ditto-pekko-config.conf
+++ b/internal/utils/config/src/main/resources/ditto-pekko-config.conf
@@ -113,7 +113,7 @@ pekko {
}
default-dispatcher {
- executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedForkJoinExecutorServiceConfigurator"
+ executor = "org.eclipse.ditto.internal.utils.metrics.service.executor.InstrumentedForkJoinExecutorServiceConfigurator"
fork-join-executor {
parallelism-min = 4
parallelism-factor = 3.0
@@ -277,7 +277,7 @@ sharding-dispatcher {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
- executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedForkJoinExecutorServiceConfigurator"
+ executor = "org.eclipse.ditto.internal.utils.metrics.service.executor.InstrumentedForkJoinExecutorServiceConfigurator"
# Configuration for the fork join pool
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
@@ -316,7 +316,7 @@ pekko.contrib.persistence.mongodb.mongo {
realtime-enable-persistence = false
metrics-builder {
- class = "org.eclipse.ditto.internal.utils.metrics.mongo.MongoMetricsBuilder"
+ class = "org.eclipse.ditto.internal.utils.metrics.service.mongo.MongoMetricsBuilder"
class = ${?MONGO_METRICS_BUILDER_CLASS}
}
}
diff --git a/internal/utils/config/src/main/resources/ditto-things-aggregator.conf b/internal/utils/config/src/main/resources/ditto-things-aggregator.conf
index 8465237434..be5714d3c7 100644
--- a/internal/utils/config/src/main/resources/ditto-things-aggregator.conf
+++ b/internal/utils/config/src/main/resources/ditto-things-aggregator.conf
@@ -11,7 +11,7 @@ aggregator-internal-dispatcher {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
- executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedForkJoinExecutorServiceConfigurator"
+ executor = "org.eclipse.ditto.internal.utils.metrics.service.executor.InstrumentedForkJoinExecutorServiceConfigurator"
# Configuration for the fork join pool
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
diff --git a/internal/utils/config/src/test/java/org/eclipse/ditto/internal/utils/config/http/DefaultHttpProxyBaseConfigTest.java b/internal/utils/config/src/test/java/org/eclipse/ditto/internal/utils/config/http/DefaultHttpProxyBaseConfigTest.java
new file mode 100644
index 0000000000..c34a4c0590
--- /dev/null
+++ b/internal/utils/config/src/test/java/org/eclipse/ditto/internal/utils/config/http/DefaultHttpProxyBaseConfigTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2024 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.ditto.internal.utils.config.http;
+
+import static org.mutabilitydetector.unittesting.MutabilityAssert.assertInstancesOf;
+import static org.mutabilitydetector.unittesting.MutabilityMatchers.areImmutable;
+
+import org.assertj.core.api.JUnitSoftAssertions;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+
+import junit.framework.TestCase;
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+public class DefaultHttpProxyBaseConfigTest extends TestCase {
+
+ private static Config httpProxyConfig;
+
+ @Rule
+ public final JUnitSoftAssertions softly = new JUnitSoftAssertions();
+
+ @BeforeClass
+ public static void initTestFixture() {
+ httpProxyConfig = ConfigFactory.load("http-proxy-test");
+ }
+
+ @Test
+ public void assertImmutability() {
+ assertInstancesOf(DefaultHttpProxyBaseConfig.class, areImmutable());
+ }
+
+ @Test
+ public void testHashCodeAndEquals() {
+ EqualsVerifier.forClass(DefaultHttpProxyBaseConfig.class)
+ .usingGetClass()
+ .verify();
+ }
+
+ @Test
+ public void underTestReturnsDefaultValuesIfBaseConfigWasEmpty() {
+ final DefaultHttpProxyBaseConfig underTest = DefaultHttpProxyBaseConfig.ofHttpProxy(ConfigFactory.empty());
+
+ softly.assertThat(underTest.isEnabled())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.ENABLED.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.ENABLED.getDefaultValue());
+ softly.assertThat(underTest.getHostname())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.HOST_NAME.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.HOST_NAME.getDefaultValue());
+ softly.assertThat(underTest.getPort())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PORT.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.PORT.getDefaultValue());
+ softly.assertThat(underTest.getUsername())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.USER_NAME.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.USER_NAME.getDefaultValue());
+ softly.assertThat(underTest.getPassword())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PASSWORD.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.PASSWORD.getDefaultValue());
+ }
+
+ @Test
+ public void underTestReturnsValuesOfConfigFile() {
+ final DefaultHttpProxyBaseConfig underTest = DefaultHttpProxyBaseConfig.ofHttpProxy(httpProxyConfig);
+
+ softly.assertThat(underTest.isEnabled())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.ENABLED.getConfigPath())
+ .isTrue();
+ softly.assertThat(underTest.getHostname())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.HOST_NAME.getConfigPath())
+ .isEqualTo("example.com");
+ softly.assertThat(underTest.getPort())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PORT.getConfigPath())
+ .isEqualTo(4711);
+ softly.assertThat(underTest.getUsername())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.USER_NAME.getConfigPath())
+ .isEqualTo("john.frume");
+ softly.assertThat(underTest.getPassword())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PASSWORD.getConfigPath())
+ .isEqualTo("verySecretPW!");
+ }
+}
\ No newline at end of file
diff --git a/base/service/src/test/resources/http-proxy-test.conf b/internal/utils/config/src/test/resources/http-proxy-test.conf
similarity index 100%
rename from base/service/src/test/resources/http-proxy-test.conf
rename to internal/utils/config/src/test/resources/http-proxy-test.conf
diff --git a/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/DefaultHttpClientFacade.java b/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/DefaultHttpClientFacade.java
index b0719d9787..7b5bccea7e 100644
--- a/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/DefaultHttpClientFacade.java
+++ b/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/DefaultHttpClientFacade.java
@@ -16,13 +16,13 @@
import javax.annotation.Nullable;
-import org.eclipse.ditto.base.service.config.http.HttpProxyConfig;
-
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.http.javadsl.Http;
import org.apache.pekko.http.javadsl.model.HttpRequest;
import org.apache.pekko.http.javadsl.model.HttpResponse;
import org.apache.pekko.http.javadsl.settings.ConnectionPoolSettings;
+import org.eclipse.ditto.internal.utils.config.http.HttpProxyBaseConfig;
+import org.eclipse.ditto.internal.utils.http.config.HttpProxyConfig;
/**
* Default implementation of {@link HttpClientFacade}.
@@ -49,7 +49,7 @@ private DefaultHttpClientFacade(final ActorSystem actorSystem,
* @return the instance.
*/
public static DefaultHttpClientFacade getInstance(final ActorSystem actorSystem,
- final HttpProxyConfig httpProxyConfig) {
+ final HttpProxyBaseConfig httpProxyConfig) {
// the HttpClientProvider is only configured at the very first invocation of getInstance(Config) as we can
// assume that the config does not change during runtime
@@ -62,10 +62,10 @@ public static DefaultHttpClientFacade getInstance(final ActorSystem actorSystem,
}
private static DefaultHttpClientFacade createInstance(final ActorSystem actorSystem,
- final HttpProxyConfig proxyConfig) {
+ final HttpProxyBaseConfig proxyConfig) {
ConnectionPoolSettings connectionPoolSettings = ConnectionPoolSettings.create(actorSystem);
- if (proxyConfig.isEnabled()) {
- connectionPoolSettings = connectionPoolSettings.withTransport(proxyConfig.toClientTransport());
+ if (proxyConfig.isEnabled() && proxyConfig instanceof HttpProxyConfig pekkoHttpProxyConfig) {
+ connectionPoolSettings = connectionPoolSettings.withTransport(pekkoHttpProxyConfig.toClientTransport());
}
return new DefaultHttpClientFacade(actorSystem, connectionPoolSettings);
}
diff --git a/base/service/src/main/java/org/eclipse/ditto/base/service/config/http/DefaultHttpProxyConfig.java b/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/config/DefaultHttpProxyConfig.java
similarity index 97%
rename from base/service/src/main/java/org/eclipse/ditto/base/service/config/http/DefaultHttpProxyConfig.java
rename to internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/config/DefaultHttpProxyConfig.java
index 1045897c1d..11bdd23281 100644
--- a/base/service/src/main/java/org/eclipse/ditto/base/service/config/http/DefaultHttpProxyConfig.java
+++ b/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/config/DefaultHttpProxyConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.base.service.config.http;
+package org.eclipse.ditto.internal.utils.http.config;
import java.net.InetSocketAddress;
import java.util.Objects;
@@ -18,14 +18,13 @@
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
+import org.apache.pekko.http.javadsl.ClientTransport;
+import org.apache.pekko.http.javadsl.model.headers.HttpCredentials;
import org.eclipse.ditto.internal.utils.config.ConfigWithFallback;
import org.eclipse.ditto.internal.utils.config.DittoConfigError;
import com.typesafe.config.Config;
-import org.apache.pekko.http.javadsl.ClientTransport;
-import org.apache.pekko.http.javadsl.model.headers.HttpCredentials;
-
/**
* This class is the default implementation of the HTTP proxy config.
*/
diff --git a/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/config/HttpProxyConfig.java b/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/config/HttpProxyConfig.java
new file mode 100644
index 0000000000..30eb3d7ff7
--- /dev/null
+++ b/internal/utils/http/src/main/java/org/eclipse/ditto/internal/utils/http/config/HttpProxyConfig.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2024 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.ditto.internal.utils.http.config;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.pekko.http.javadsl.ClientTransport;
+import org.eclipse.ditto.internal.utils.config.http.HttpProxyBaseConfig;
+
+/**
+ * Provides configuration settings for the HTTP proxy with additional Pekko HTTP specifics.
+ */
+@Immutable
+public interface HttpProxyConfig extends HttpProxyBaseConfig {
+
+ /**
+ * Converts the proxy settings to a Pekko HTTP client transport object.
+ * Does not check whether the proxy is enabled.
+ *
+ * @return a Pekko HTTP client transport object matching this config.
+ */
+ ClientTransport toClientTransport();
+
+}
diff --git a/base/service/src/test/java/org/eclipse/ditto/base/service/config/http/DefaultHttpProxyConfigTest.java b/internal/utils/http/src/test/java/org/eclipse/ditto/internal/utils/http/config/DefaultHttpProxyConfigTest.java
similarity index 62%
rename from base/service/src/test/java/org/eclipse/ditto/base/service/config/http/DefaultHttpProxyConfigTest.java
rename to internal/utils/http/src/test/java/org/eclipse/ditto/internal/utils/http/config/DefaultHttpProxyConfigTest.java
index ee956c4997..de17c920b4 100644
--- a/base/service/src/test/java/org/eclipse/ditto/base/service/config/http/DefaultHttpProxyConfigTest.java
+++ b/internal/utils/http/src/test/java/org/eclipse/ditto/internal/utils/http/config/DefaultHttpProxyConfigTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,13 +10,13 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.base.service.config.http;
+package org.eclipse.ditto.internal.utils.http.config;
import static org.mutabilitydetector.unittesting.MutabilityAssert.assertInstancesOf;
import static org.mutabilitydetector.unittesting.MutabilityMatchers.areImmutable;
import org.assertj.core.api.JUnitSoftAssertions;
-import org.eclipse.ditto.base.service.config.http.HttpProxyConfig.HttpProxyConfigValue;
+import org.eclipse.ditto.internal.utils.config.http.HttpProxyBaseConfig;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
@@ -58,20 +58,20 @@ public void underTestReturnsDefaultValuesIfBaseConfigWasEmpty() {
final DefaultHttpProxyConfig underTest = DefaultHttpProxyConfig.ofHttpProxy(ConfigFactory.empty());
softly.assertThat(underTest.isEnabled())
- .as(HttpProxyConfigValue.ENABLED.getConfigPath())
- .isEqualTo(HttpProxyConfigValue.ENABLED.getDefaultValue());
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.ENABLED.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.ENABLED.getDefaultValue());
softly.assertThat(underTest.getHostname())
- .as(HttpProxyConfigValue.HOST_NAME.getConfigPath())
- .isEqualTo(HttpProxyConfigValue.HOST_NAME.getDefaultValue());
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.HOST_NAME.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.HOST_NAME.getDefaultValue());
softly.assertThat(underTest.getPort())
- .as(HttpProxyConfigValue.PORT.getConfigPath())
- .isEqualTo(HttpProxyConfigValue.PORT.getDefaultValue());
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PORT.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.PORT.getDefaultValue());
softly.assertThat(underTest.getUsername())
- .as(HttpProxyConfigValue.USER_NAME.getConfigPath())
- .isEqualTo(HttpProxyConfigValue.USER_NAME.getDefaultValue());
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.USER_NAME.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.USER_NAME.getDefaultValue());
softly.assertThat(underTest.getPassword())
- .as(HttpProxyConfigValue.PASSWORD.getConfigPath())
- .isEqualTo(HttpProxyConfigValue.PASSWORD.getDefaultValue());
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PASSWORD.getConfigPath())
+ .isEqualTo(HttpProxyBaseConfig.HttpProxyConfigValue.PASSWORD.getDefaultValue());
}
@Test
@@ -79,19 +79,19 @@ public void underTestReturnsValuesOfConfigFile() {
final DefaultHttpProxyConfig underTest = DefaultHttpProxyConfig.ofHttpProxy(httpProxyConfig);
softly.assertThat(underTest.isEnabled())
- .as(HttpProxyConfigValue.ENABLED.getConfigPath())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.ENABLED.getConfigPath())
.isTrue();
softly.assertThat(underTest.getHostname())
- .as(HttpProxyConfigValue.HOST_NAME.getConfigPath())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.HOST_NAME.getConfigPath())
.isEqualTo("example.com");
softly.assertThat(underTest.getPort())
- .as(HttpProxyConfigValue.PORT.getConfigPath())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PORT.getConfigPath())
.isEqualTo(4711);
softly.assertThat(underTest.getUsername())
- .as(HttpProxyConfigValue.USER_NAME.getConfigPath())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.USER_NAME.getConfigPath())
.isEqualTo("john.frume");
softly.assertThat(underTest.getPassword())
- .as(HttpProxyConfigValue.PASSWORD.getConfigPath())
+ .as(HttpProxyBaseConfig.HttpProxyConfigValue.PASSWORD.getConfigPath())
.isEqualTo("verySecretPW!");
}
diff --git a/internal/utils/http/src/test/resources/http-proxy-test.conf b/internal/utils/http/src/test/resources/http-proxy-test.conf
new file mode 100644
index 0000000000..2d51e8eeb7
--- /dev/null
+++ b/internal/utils/http/src/test/resources/http-proxy-test.conf
@@ -0,0 +1,9 @@
+http {
+ proxy {
+ enabled = true
+ hostname = "example.com"
+ port = 4711
+ username = "john.frume"
+ password = "verySecretPW!"
+ }
+}
\ No newline at end of file
diff --git a/internal/utils/json/pom.xml b/internal/utils/json/pom.xml
new file mode 100755
index 0000000000..69c9b9a106
--- /dev/null
+++ b/internal/utils/json/pom.xml
@@ -0,0 +1,38 @@
+
+
+
+ 4.0.0
+
+
+ org.eclipse.ditto
+ ditto-internal-utils
+ ${revision}
+
+
+ ditto-internal-utils-json
+ Eclipse Ditto :: Internal :: Utils :: JSON
+
+
+
+ org.eclipse.ditto
+ ditto-json
+
+
+ org.eclipse.ditto
+ ditto-json-cbor
+
+
+
+
diff --git a/internal/utils/cluster/src/main/java/org/eclipse/ditto/internal/utils/cluster/CborFactoryLoader.java b/internal/utils/json/src/main/java/org/eclipse/ditto/internal/utils/json/CborFactoryLoader.java
similarity index 90%
rename from internal/utils/cluster/src/main/java/org/eclipse/ditto/internal/utils/cluster/CborFactoryLoader.java
rename to internal/utils/json/src/main/java/org/eclipse/ditto/internal/utils/json/CborFactoryLoader.java
index e11e3ba6eb..44dee1c64e 100644
--- a/internal/utils/cluster/src/main/java/org/eclipse/ditto/internal/utils/cluster/CborFactoryLoader.java
+++ b/internal/utils/json/src/main/java/org/eclipse/ditto/internal/utils/json/CborFactoryLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.internal.utils.cluster;
+package org.eclipse.ditto.internal.utils.json;
import java.text.MessageFormat;
import java.util.ServiceLoader;
@@ -25,7 +25,7 @@
* is thrown.
*/
@ThreadSafe
-final class CborFactoryLoader {
+public final class CborFactoryLoader {
@Nullable
private static CborFactoryLoader instance = null;
@@ -38,7 +38,7 @@ private CborFactoryLoader() {
super();
}
- static CborFactoryLoader getInstance() {
+ public static CborFactoryLoader getInstance() {
var result = instance;
if (null == result) {
result = new CborFactoryLoader();
@@ -47,7 +47,7 @@ static CborFactoryLoader getInstance() {
return result;
}
- CborFactory getCborFactoryOrThrow() {
+ public CborFactory getCborFactoryOrThrow() {
var result = cborFactory;
// Double-Check-Idiom
diff --git a/internal/utils/cluster/src/test/java/org/eclipse/ditto/internal/utils/cluster/CborFactoryLoaderTest.java b/internal/utils/json/src/test/java/org/eclipse/ditto/internal/utils/json/CborFactoryLoaderTest.java
similarity index 91%
rename from internal/utils/cluster/src/test/java/org/eclipse/ditto/internal/utils/cluster/CborFactoryLoaderTest.java
rename to internal/utils/json/src/test/java/org/eclipse/ditto/internal/utils/json/CborFactoryLoaderTest.java
index 782757364e..d9b6c52830 100644
--- a/internal/utils/cluster/src/test/java/org/eclipse/ditto/internal/utils/cluster/CborFactoryLoaderTest.java
+++ b/internal/utils/json/src/test/java/org/eclipse/ditto/internal/utils/json/CborFactoryLoaderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.internal.utils.cluster;
+package org.eclipse.ditto.internal.utils.json;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/internal/utils/metrics-service/pom.xml b/internal/utils/metrics-service/pom.xml
new file mode 100644
index 0000000000..7caf2fd268
--- /dev/null
+++ b/internal/utils/metrics-service/pom.xml
@@ -0,0 +1,66 @@
+
+
+
+ 4.0.0
+
+
+ ditto-internal-utils
+ org.eclipse.ditto
+ ${revision}
+
+
+ ditto-internal-utils-metrics-service
+ Eclipse Ditto :: Internal :: Utils :: Metrics Service
+
+
+
+ org.eclipse.ditto
+ ditto-internal-utils-metrics
+
+
+ io.kamon
+ kamon-prometheus_${scala.version}
+
+
+ io.kamon
+ kamon-executors_${scala.version}
+
+
+ org.apache.pekko
+ pekko-actor_${scala.version}
+
+
+ org.apache.pekko
+ pekko-http_${scala.version}
+ provided
+
+
+
+
+ com.github.scullxbones
+ pekko-persistence-mongodb_${scala.version}
+ provided
+
+
+
+ nl.grons
+ metrics4-scala_${scala.version}
+
+
+
+
diff --git a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/executor/InstrumentedForkJoinExecutorServiceConfigurator.java b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/executor/InstrumentedForkJoinExecutorServiceConfigurator.java
similarity index 89%
rename from internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/executor/InstrumentedForkJoinExecutorServiceConfigurator.java
rename to internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/executor/InstrumentedForkJoinExecutorServiceConfigurator.java
index c6df458e43..32d90ef7ab 100644
--- a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/executor/InstrumentedForkJoinExecutorServiceConfigurator.java
+++ b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/executor/InstrumentedForkJoinExecutorServiceConfigurator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,16 +10,17 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.internal.utils.metrics.executor;
+package org.eclipse.ditto.internal.utils.metrics.service.executor;
import java.util.concurrent.ThreadFactory;
-import com.typesafe.config.Config;
-
import org.apache.pekko.dispatch.DispatcherPrerequisites;
import org.apache.pekko.dispatch.ExecutorServiceConfigurator;
import org.apache.pekko.dispatch.ExecutorServiceFactory;
import org.apache.pekko.dispatch.ForkJoinExecutorConfigurator;
+
+import com.typesafe.config.Config;
+
import kamon.instrumentation.executor.ExecutorInstrumentation;
/**
@@ -37,7 +38,7 @@
* with
*
* type = Dispatcher
- * executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedForkJoinExecutorServiceConfigurator"
+ * executor = "org.eclipse.ditto.internal.utils.metrics.service.executor.InstrumentedForkJoinExecutorServiceConfigurator"
* fork-join-executor {
* ...
* }
diff --git a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/executor/InstrumentedThreadPoolExecutorServiceConfigurator.java b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/executor/InstrumentedThreadPoolExecutorServiceConfigurator.java
similarity index 89%
rename from internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/executor/InstrumentedThreadPoolExecutorServiceConfigurator.java
rename to internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/executor/InstrumentedThreadPoolExecutorServiceConfigurator.java
index 47467e4b08..a7ae657f63 100644
--- a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/executor/InstrumentedThreadPoolExecutorServiceConfigurator.java
+++ b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/executor/InstrumentedThreadPoolExecutorServiceConfigurator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,16 +10,17 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.internal.utils.metrics.executor;
+package org.eclipse.ditto.internal.utils.metrics.service.executor;
import java.util.concurrent.ThreadFactory;
-import com.typesafe.config.Config;
-
import org.apache.pekko.dispatch.DispatcherPrerequisites;
import org.apache.pekko.dispatch.ExecutorServiceConfigurator;
import org.apache.pekko.dispatch.ExecutorServiceFactory;
import org.apache.pekko.dispatch.ThreadPoolExecutorConfigurator;
+
+import com.typesafe.config.Config;
+
import kamon.instrumentation.executor.ExecutorInstrumentation;
/**
@@ -37,7 +38,7 @@
* with
*
* type = Dispatcher
- * executor = "org.eclipse.ditto.internal.utils.metrics.executor.InstrumentedThreadPoolExecutorServiceConfigurator"
+ * executor = "org.eclipse.ditto.internal.utils.metrics.service.executor.InstrumentedThreadPoolExecutorServiceConfigurator"
* thread-pool-executor {
* ...
* }
diff --git a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/mongo/MongoMetricsBuilder.java b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/mongo/MongoMetricsBuilder.java
similarity index 94%
rename from internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/mongo/MongoMetricsBuilder.java
rename to internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/mongo/MongoMetricsBuilder.java
index 1b236b3ae0..c738e028bd 100644
--- a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/mongo/MongoMetricsBuilder.java
+++ b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/mongo/MongoMetricsBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.internal.utils.metrics.mongo;
+package org.eclipse.ditto.internal.utils.metrics.service.mongo;
import java.util.concurrent.atomic.LongAccumulator;
diff --git a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/prometheus/PrometheusReporterRoute.java b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/prometheus/PrometheusReporterRoute.java
similarity index 93%
rename from internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/prometheus/PrometheusReporterRoute.java
rename to internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/prometheus/PrometheusReporterRoute.java
index bb8163089c..39a89b4874 100644
--- a/internal/utils/metrics/src/main/java/org/eclipse/ditto/internal/utils/metrics/prometheus/PrometheusReporterRoute.java
+++ b/internal/utils/metrics-service/src/main/java/org/eclipse/ditto/internal/utils/metrics/service/prometheus/PrometheusReporterRoute.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
-package org.eclipse.ditto.internal.utils.metrics.prometheus;
+package org.eclipse.ditto.internal.utils.metrics.service.prometheus;
import static org.apache.pekko.http.javadsl.server.Directives.complete;
import static org.apache.pekko.http.javadsl.server.Directives.get;
@@ -21,6 +21,7 @@
import org.apache.pekko.http.javadsl.model.StatusCodes;
import org.apache.pekko.http.javadsl.server.Route;
import org.apache.pekko.util.ByteString;
+
import kamon.prometheus.PrometheusReporter;
/**
diff --git a/internal/utils/metrics/pom.xml b/internal/utils/metrics/pom.xml
index 8086c514ad..f6a47b225c 100644
--- a/internal/utils/metrics/pom.xml
+++ b/internal/utils/metrics/pom.xml
@@ -14,12 +14,13 @@
+ 4.0.0
+
ditto-internal-utils
org.eclipse.ditto
${revision}
- 4.0.0
ditto-internal-utils-metrics
Eclipse Ditto :: Internal :: Utils :: Metrics
@@ -37,37 +38,6 @@
io.kamon
kamon-core_${scala.version}
-