From 1ad3871fbb33f65b7514920b85e61efbb9f167be Mon Sep 17 00:00:00 2001 From: jannast <104557199+jannast@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:07:04 +0100 Subject: [PATCH] extend TestClientUtil with parameter (#219) add a configuration module parameter to the TestClientUtil # Checklist The following aspects have been respected by the author of this pull request, confirmed by both pull request assignee **and** reviewer: * Adherence to coding conventions * [x] Pull Request Assignee * [x] Reviewer maximilianpilz * Adherence to javadoc conventions * [x] Pull Request Assignee * [x] Reviewer maximilianpilz * Changelog update (necessity checked and entry added or not added respectively) * [x] Pull Request Assignee * [x] Reviewer maximilianpilz * README update (necessity checked and entry added or not added respectively) * [x] Pull Request Assignee * [x] Reviewer maximilianpilz * config update (necessity checked and entry added or not added respectively) * [x] Pull Request Assignee * [x] Reviewer maximilianpilz * SDCcc executable ran against a test device (if necessary) * [x] Pull Request Assignee * [x] Reviewer maximilianpilz --------- Co-authored-by: Maximilian Pilz --- .../sdccc/configuration/DefaultTestSuiteConfig.java | 5 +++++ .../medical/sdccc/sdcri/testclient/TestClientUtil.java | 8 ++++++-- .../java/com/draeger/medical/sdccc/util/Constants.java | 1 + .../java/it/com/draeger/medical/sdccc/TestSuiteIT.java | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/DefaultTestSuiteConfig.java b/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/DefaultTestSuiteConfig.java index 71d0a76a..d76084e6 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/DefaultTestSuiteConfig.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/DefaultTestSuiteConfig.java @@ -7,6 +7,7 @@ package com.draeger.medical.sdccc.configuration; +import com.draeger.medical.sdccc.util.Constants; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.somda.sdc.common.guice.AbstractConfigurationModule; @@ -49,6 +50,10 @@ void configureTestSuite() { bind(TestSuiteConfig.ENABLE_MESSAGE_ENCODING_CHECK, Boolean.class, true); bind(TestSuiteConfig.SUMMARIZE_MESSAGE_ENCODING_ERRORS, Boolean.class, true); + bind(Constants.CONFIGURATION_MODULE, AbstractConfigurationModule.class, new AbstractConfigurationModule() { + @Override + protected void defaultConfigure() {} + }); } void configureTLS() { diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testclient/TestClientUtil.java b/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testclient/TestClientUtil.java index a7b2c241..2ce9a989 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testclient/TestClientUtil.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testclient/TestClientUtil.java @@ -12,6 +12,7 @@ import com.draeger.medical.sdccc.sdcri.CommunicationLogMessageStorage; import com.draeger.medical.sdccc.tests.util.MdibHistorian; import com.draeger.medical.sdccc.tests.util.guice.MdibHistorianFactory; +import com.draeger.medical.sdccc.util.Constants; import com.draeger.medical.sdccc.util.TestRunObserver; import com.google.inject.AbstractModule; import com.google.inject.Guice; @@ -61,6 +62,7 @@ public class TestClientUtil { * Values from 1 to 255 are valid. * @param enabledTlsProtocols TLS protocol versions to be enabled * @param enabledCiphers ciphers to be enabled + * @param configurationModule configuration for AbstractConfigurationModule */ @Inject public TestClientUtil( @@ -70,7 +72,8 @@ public TestClientUtil( final LocalAddressResolver localAddressResolver, @Named(TestSuiteConfig.NETWORK_MULTICAST_TTL) final Long multicastTTL, @Named(TestSuiteConfig.TLS_ENABLED_PROTOCOLS) final String[] enabledTlsProtocols, - @Named(TestSuiteConfig.TLS_ENABLED_CIPHERS) final String[] enabledCiphers) { + @Named(TestSuiteConfig.TLS_ENABLED_CIPHERS) final String[] enabledCiphers, + @Named(Constants.CONFIGURATION_MODULE) final AbstractConfigurationModule configurationModule) { injector = createClientInjector(List.of( new AbstractConfigurationModule() { @@ -98,7 +101,8 @@ protected void configure() { bind(TestRunObserver.class).toInstance(testRunObserver); bind(LocalAddressResolver.class).toInstance(localAddressResolver); } - })); + }, + configurationModule)); } /** diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java b/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java index a29b84ac..f0641819 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/util/Constants.java @@ -30,6 +30,7 @@ public final class Constants { public static final String ENABLE_SETTING_POSTFIX = "Enable"; public static final String DEVICE_EPR_POSTFIX = "DeviceEpr"; public static final String FIELD_ACCESS_ERROR_BASE_MESSAGE = "Error while accessing field {}"; + public static final String CONFIGURATION_MODULE = "ConfigurationModule"; /* MDPWS constants diff --git a/sdccc/src/test/java/it/com/draeger/medical/sdccc/TestSuiteIT.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/TestSuiteIT.java index e1c6b084..ff460005 100644 --- a/sdccc/src/test/java/it/com/draeger/medical/sdccc/TestSuiteIT.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/TestSuiteIT.java @@ -30,6 +30,7 @@ import com.draeger.medical.sdccc.messages.HibernateConfig; import com.draeger.medical.sdccc.sdcri.testclient.TestClient; import com.draeger.medical.sdccc.tests.InjectorTestBase; +import com.draeger.medical.sdccc.util.Constants; import com.draeger.medical.sdccc.util.HibernateConfigInMemoryImpl; import com.draeger.medical.sdccc.util.TestRunObserver; import com.google.inject.AbstractModule; @@ -632,6 +633,10 @@ protected void defaultConfigure() { bind(Identifiers.DIRECT_TEST_IDENTIFIER_FAILING, Boolean.class, failingTests); bind(Identifiers.INVARIANT_TEST_IDENTIFIER_FAILING, Boolean.class, failingTests); + bind(Constants.CONFIGURATION_MODULE, AbstractConfigurationModule.class, new AbstractConfigurationModule() { + @Override + protected void defaultConfigure() {} + }); } } }