From 279dba496991be5b305025984c5371dc4826608b Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Wed, 10 Apr 2024 08:39:07 +0200 Subject: [PATCH] "Enable" for the consumer is now a redundant option --- .../com/draeger/medical/sdccc/TestSuite.java | 53 +++++++++---------- .../sdccc/configuration/TestSuiteConfig.java | 1 - .../draeger/medical/sdccc/TestSuiteIT.java | 1 - 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java b/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java index 93d2dfdf..b3dbabff 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java @@ -109,14 +109,14 @@ public class TestSuite { * Used by the main injector to create a TestSuite instance. * It is also useful for extending the TestSuite class. * - * @param injector a reference to the injector injecting here - * @param testRunObserver observer for invalidating test runs - * @param sdcTestDirectories directories to search for test cases - * @param testRunDir directory to run the tests in and store artifacts + * @param injector a reference to the injector injecting here + * @param testRunObserver observer for invalidating test runs + * @param sdcTestDirectories directories to search for test cases + * @param testRunDir directory to run the tests in and store artifacts * @param testExecutionLogging whether logging of test case starts etc. shall be done - * @param messageGenerator utility for generating messages to send - * @param testRunInformation utility where information of the test run is stored - * @param client client to use for direct tests + * @param messageGenerator utility for generating messages to send + * @param testRunInformation utility where information of the test run is stored + * @param client client to use for direct tests */ @Inject public TestSuite( @@ -365,27 +365,22 @@ private void performBasicMessagingCheck() { } private Boolean setupDevice() { - final var isConsumerEnabled = - injector.getInstance(Key.get(Boolean.class, Names.named(TestSuiteConfig.CONSUMER_ENABLE))); - - if (isConsumerEnabled) { - LOG.info("Starting TestSuite Client"); - try { - client.startService(MAX_WAIT); - client.connect(); - } catch (final InterceptorException | TransportException | IOException | TimeoutException e) { - LOG.error("Could not connect to target device {}", client.getTargetEpr()); - testRunObserver.invalidateTestRun("Could not connect to target device", e); - throw new RuntimeException(e); - } - - // check the DUT for an archive service, currently needed for MDPWS:R0006 - this.testRunInformation.setArchiveServicePresent( - client.getHostingServiceProxy().getHostedServices().values().stream() - .anyMatch(service -> - service.getType().getTypes().contains(WsdlConstants.PORT_TYPE_ARCHIVE_QNAME))); + LOG.info("Starting TestSuite Client"); + try { + client.startService(MAX_WAIT); + client.connect(); + } catch (final InterceptorException | TransportException | IOException | TimeoutException e) { + LOG.error("Could not connect to target device {}", client.getTargetEpr()); + testRunObserver.invalidateTestRun("Could not connect to target device", e); + throw new RuntimeException(e); } - return isConsumerEnabled; + + // check the DUT for an archive service, currently needed for MDPWS:R0006 + this.testRunInformation.setArchiveServicePresent( + client.getHostingServiceProxy().getHostedServices().values().stream() + .anyMatch(service -> + service.getType().getTypes().contains(WsdlConstants.PORT_TYPE_ARCHIVE_QNAME))); + return true; } /** @@ -654,9 +649,9 @@ public static CommandLineOptions initialize(final String[] args) { * Run the test suite with the given already parsed command line arguments and the * specified enabled test config constants. * - * @param cmdLine parsed command line arguments + * @param cmdLine parsed command line arguments * @param enabledTestConfigClass class containing test identifier constants - * @param sdcTestDirectories directories to search for test cases + * @param sdcTestDirectories directories to search for test cases */ public static void runWithArgs( final CommandLineOptions cmdLine, diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/TestSuiteConfig.java b/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/TestSuiteConfig.java index 52ed3091..c87f4e00 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/TestSuiteConfig.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/configuration/TestSuiteConfig.java @@ -49,7 +49,6 @@ public final class TestSuiteConfig { * Consumer configuration */ private static final String CONSUMER = "Consumer."; - public static final String CONSUMER_ENABLE = SDCCC + CONSUMER + Constants.ENABLE_SETTING_POSTFIX; public static final String CONSUMER_DEVICE_EPR = SDCCC + CONSUMER + Constants.DEVICE_EPR_POSTFIX; public static final String CONSUMER_DEVICE_LOCATION_FACILITY = SDCCC + CONSUMER + "DeviceLocationFacility"; public static final String CONSUMER_DEVICE_LOCATION_BUILDING = SDCCC + CONSUMER + "DeviceLocationBuilding"; 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 88eaa725..3e48b326 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 @@ -586,7 +586,6 @@ protected void defaultConfigure() { bind(CryptoSettings.class).toInstance(cryptoSettings); bind(TestSuiteConfig.CI_MODE, Boolean.class, true); - bind(TestSuiteConfig.CONSUMER_ENABLE, Boolean.class, true); bind(TestSuiteConfig.CONSUMER_DEVICE_EPR, String.class, DUT_EPR); bind(TestSuiteConfig.CONSUMER_DEVICE_LOCATION_FACILITY, String.class, this.locationConfig.facility); bind(TestSuiteConfig.CONSUMER_DEVICE_LOCATION_BUILDING, String.class, this.locationConfig.building);