Skip to content

Commit

Permalink
extend TestClientUtil with parameter (#219)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jannast and maximilianpilz authored Nov 18, 2024
1 parent 7e41ddf commit 1ad3871
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -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() {
Expand Down Expand Up @@ -98,7 +101,8 @@ protected void configure() {
bind(TestRunObserver.class).toInstance(testRunObserver);
bind(LocalAddressResolver.class).toInstance(localAddressResolver);
}
}));
},
configurationModule));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {}
});
}
}
}

0 comments on commit 1ad3871

Please sign in to comment.