From e24d0400e9eeedf32015642d3992056e9e6d6e70 Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Thu, 14 Mar 2024 08:04:00 +0100 Subject: [PATCH 1/9] remove provider related settings from config and TestSuite --- configuration/config.toml | 3 --- .../main/java/com/draeger/medical/sdccc/TestSuite.java | 7 ------- .../sdccc/configuration/DefaultTestSuiteConfig.java | 5 ----- .../medical/sdccc/configuration/TestSuiteConfig.java | 9 +-------- 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/configuration/config.toml b/configuration/config.toml index b17f86b5..f218986a 100644 --- a/configuration/config.toml +++ b/configuration/config.toml @@ -36,9 +36,6 @@ DeviceEpr="urn:uuid:857bf583-8a51-475f-a77f-d0ca7de69b11" # DeviceLocationPointOfCare="poc32" # etc. -[SDCcc.Provider] -Enable=false - [SDCcc.gRPC] ServerAddress="localhost:50051" 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 967948ce..5f7dbef1 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java @@ -228,7 +228,6 @@ private long phase4( } catch (final TimeoutException e) { testRunObserver.invalidateTestRun("Could not stop the test client", e); } - // TODO: Stop provider (https://github.com/Draegerwerk/SDCcc/issues/1) // flush all data so invariant tests run on most current data injector.getInstance(MessageStorage.class).flush(); @@ -368,8 +367,6 @@ private void performBasicMessagingCheck() { private Boolean setupDeviceAndProvider() { final var isConsumerEnabled = injector.getInstance(Key.get(Boolean.class, Names.named(TestSuiteConfig.CONSUMER_ENABLE))); - final var isProviderEnabled = - injector.getInstance(Key.get(Boolean.class, Names.named(TestSuiteConfig.PROVIDER_ENABLE))); if (isConsumerEnabled) { LOG.info("Starting TestSuite Client"); @@ -388,10 +385,6 @@ private Boolean setupDeviceAndProvider() { .anyMatch(service -> service.getType().getTypes().contains(WsdlConstants.PORT_TYPE_ARCHIVE_QNAME))); } - if (isProviderEnabled) { - LOG.info("Starting TestSuite Provider"); - // TODO: Start provider (https://github.com/Draegerwerk/SDCcc/issues/1) - } return isConsumerEnabled; } 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 820023ae..40b683f2 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 @@ -35,7 +35,6 @@ protected void defaultConfigure() { configureTestSuite(); configureTLS(); configureNetwork(); - configureProvider(); configureGRpc(); configureTestParameter(); configureInternalSettings(); @@ -79,10 +78,6 @@ void configureNetwork() { bind(TestSuiteConfig.NETWORK_MULTICAST_TTL, long.class, 128L); } - void configureProvider() { - bind(TestSuiteConfig.PROVIDER_ENABLE, Boolean.class, false); - } - void configureGRpc() { bind(TestSuiteConfig.GRPC_SERVER_ADDRESS, String.class, "localhost:50051"); } 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 3b9f6363..52ed3091 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 @@ -19,7 +19,7 @@ public final class TestSuiteConfig { /* * General configuration */ - private static final String SDCCC = "SDCcc."; + public static final String SDCCC = "SDCcc."; public static final String CI_MODE = SDCCC + "CIMode"; public static final String GRAPHICAL_POPUPS = SDCCC + "GraphicalPopups"; public static final String TEST_EXECUTION_LOGGING = SDCCC + "TestExecutionLogging"; @@ -58,13 +58,6 @@ public final class TestSuiteConfig { public static final String CONSUMER_DEVICE_LOCATION_ROOM = SDCCC + CONSUMER + "DeviceLocationRoom"; public static final String CONSUMER_DEVICE_LOCATION_BED = SDCCC + CONSUMER + "DeviceLocationBed"; - /* - * Provider configuration - */ - private static final String PROVIDER = "Provider."; - public static final String PROVIDER_ENABLE = SDCCC + PROVIDER + Constants.ENABLE_SETTING_POSTFIX; - public static final String PROVIDER_DEVICE_EPR = SDCCC + PROVIDER + Constants.DEVICE_EPR_POSTFIX; - /* * GRPC configuration */ From 4d4c8d3bc2c8ef49f6351d20a80f6bfa7f74be56 Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Thu, 14 Mar 2024 08:16:23 +0100 Subject: [PATCH 2/9] move provider implementation and configuration to test utils for the purpose of integration testing --- .../draeger/medical/sdccc/TestSuiteIT.java | 11 +++---- .../test_util}/testprovider/TestProvider.java | 2 +- .../testprovider/TestProviderConfig.java | 29 +++++++++++++++++++ .../TestProviderHostingServicePlugin.java | 2 +- .../testprovider/TestProviderImpl.java | 6 ++-- .../testprovider/TestProviderUtil.java | 2 +- .../testprovider/guice/ProviderFactory.java | 4 +-- .../testprovider/guice/package-info.java | 2 +- .../test_util}/testprovider/package-info.java | 2 +- 9 files changed, 45 insertions(+), 15 deletions(-) rename sdccc/src/{main/java/com/draeger/medical/sdccc/sdcri => test/java/it/com/draeger/medical/sdccc/test_util}/testprovider/TestProvider.java (95%) create mode 100644 sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java rename sdccc/src/{main/java/com/draeger/medical/sdccc/sdcri => test/java/it/com/draeger/medical/sdccc/test_util}/testprovider/TestProviderHostingServicePlugin.java (97%) rename sdccc/src/{main/java/com/draeger/medical/sdccc/sdcri => test/java/it/com/draeger/medical/sdccc/test_util}/testprovider/TestProviderImpl.java (96%) rename sdccc/src/{main/java/com/draeger/medical/sdccc/sdcri => test/java/it/com/draeger/medical/sdccc/test_util}/testprovider/TestProviderUtil.java (98%) rename sdccc/src/{main/java/com/draeger/medical/sdccc/sdcri => test/java/it/com/draeger/medical/sdccc/test_util}/testprovider/guice/ProviderFactory.java (78%) rename sdccc/src/{main/java/com/draeger/medical/sdccc/sdcri => test/java/it/com/draeger/medical/sdccc/test_util}/testprovider/guice/package-info.java (81%) rename sdccc/src/{main/java/com/draeger/medical/sdccc/sdcri => test/java/it/com/draeger/medical/sdccc/test_util}/testprovider/package-info.java (82%) 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 0892d517..88eaa725 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 @@ -29,9 +29,6 @@ import com.draeger.medical.sdccc.manipulation.precondition.PreconditionRegistry; import com.draeger.medical.sdccc.messages.HibernateConfig; import com.draeger.medical.sdccc.sdcri.testclient.TestClient; -import com.draeger.medical.sdccc.sdcri.testprovider.TestProvider; -import com.draeger.medical.sdccc.sdcri.testprovider.TestProviderImpl; -import com.draeger.medical.sdccc.sdcri.testprovider.guice.ProviderFactory; import com.draeger.medical.sdccc.tests.InjectorTestBase; import com.draeger.medical.sdccc.util.HibernateConfigInMemoryImpl; import com.draeger.medical.sdccc.util.TestRunObserver; @@ -43,6 +40,10 @@ import com.google.inject.assistedinject.FactoryModuleBuilder; import com.google.inject.util.Modules; import it.com.draeger.medical.sdccc.test_util.SslMetadata; +import it.com.draeger.medical.sdccc.test_util.testprovider.TestProvider; +import it.com.draeger.medical.sdccc.test_util.testprovider.TestProviderConfig; +import it.com.draeger.medical.sdccc.test_util.testprovider.TestProviderImpl; +import it.com.draeger.medical.sdccc.test_util.testprovider.guice.ProviderFactory; import it.com.draeger.medical.sdccc.testsuite_it_mock_tests.Identifiers; import it.com.draeger.medical.sdccc.testsuite_it_mock_tests.WasRunObserver; import java.io.File; @@ -594,8 +595,8 @@ protected void defaultConfigure() { bind(TestSuiteConfig.CONSUMER_DEVICE_LOCATION_ROOM, String.class, this.locationConfig.room); bind(TestSuiteConfig.CONSUMER_DEVICE_LOCATION_BED, String.class, this.locationConfig.bed); - bind(TestSuiteConfig.PROVIDER_ENABLE, Boolean.class, true); - bind(TestSuiteConfig.PROVIDER_DEVICE_EPR, String.class, DUT_EPR); + bind(TestProviderConfig.PROVIDER_ENABLE, Boolean.class, true); + bind(TestProviderConfig.PROVIDER_DEVICE_EPR, String.class, DUT_EPR); bind(TestSuiteConfig.NETWORK_INTERFACE_ADDRESS, String.class, "127.0.0.1"); bind(DpwsConfig.MULTICAST_TTL, Integer.class, 128); diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProvider.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProvider.java similarity index 95% rename from sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProvider.java rename to sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProvider.java index c13316a8..569d1299 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProvider.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProvider.java @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT */ -package com.draeger.medical.sdccc.sdcri.testprovider; +package it.com.draeger.medical.sdccc.test_util.testprovider; import com.google.inject.Injector; import java.time.Duration; diff --git a/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java new file mode 100644 index 00000000..ce302edb --- /dev/null +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java @@ -0,0 +1,29 @@ +/* + * This Source Code Form is subject to the terms of the MIT License. + * Copyright (c) 2023, 2024 Draegerwerk AG & Co. KGaA. + * + * SPDX-License-Identifier: MIT + */ + +package it.com.draeger.medical.sdccc.test_util.testprovider; + +import com.draeger.medical.sdccc.configuration.DefaultTestSuiteConfig; +import com.draeger.medical.sdccc.configuration.TestSuiteConfig; +import com.draeger.medical.sdccc.util.Constants; + +/** + * Configuration of the SDCcc package. + * + * @see DefaultTestSuiteConfig + */ +public final class TestProviderConfig { + + /* + * Provider configuration + */ + private static final String PROVIDER = "Provider."; + public static final String PROVIDER_ENABLE = TestSuiteConfig.SDCCC + PROVIDER + Constants.ENABLE_SETTING_POSTFIX; + public static final String PROVIDER_DEVICE_EPR = TestSuiteConfig.SDCCC + PROVIDER + Constants.DEVICE_EPR_POSTFIX; + + private TestProviderConfig() {} +} diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderHostingServicePlugin.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderHostingServicePlugin.java similarity index 97% rename from sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderHostingServicePlugin.java rename to sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderHostingServicePlugin.java index 4a61767e..9f52333b 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderHostingServicePlugin.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderHostingServicePlugin.java @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT */ -package com.draeger.medical.sdccc.sdcri.testprovider; +package it.com.draeger.medical.sdccc.test_util.testprovider; import com.google.inject.Inject; import org.somda.sdc.dpws.DpwsUtil; diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderImpl.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderImpl.java similarity index 96% rename from sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderImpl.java rename to sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderImpl.java index 0e7f0eba..75e04b4b 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderImpl.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderImpl.java @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT */ -package com.draeger.medical.sdccc.sdcri.testprovider; +package it.com.draeger.medical.sdccc.test_util.testprovider; import com.draeger.medical.sdccc.configuration.TestSuiteConfig; import com.google.common.util.concurrent.AbstractIdleService; @@ -39,7 +39,7 @@ import org.somda.sdc.glue.provider.sco.OperationInvocationReceiver; /** - * SDCri provider used to test SDC consumers. + * SDCri provider used integration tests. */ public class TestProviderImpl extends AbstractIdleService implements TestProvider { private static final Logger LOG = LogManager.getLogger(); @@ -54,7 +54,7 @@ public class TestProviderImpl extends AbstractIdleService implements TestProvide @Inject TestProviderImpl( @Assisted final InputStream mdibAsStream, - @Named(TestSuiteConfig.PROVIDER_DEVICE_EPR) final String providerEpr, + @Named(TestProviderConfig.PROVIDER_DEVICE_EPR) final String providerEpr, @Named(TestSuiteConfig.NETWORK_INTERFACE_ADDRESS) final String adapterAddress, final TestProviderUtil testProviderUtil) { this.injector = testProviderUtil.getInjector(); diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderUtil.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderUtil.java similarity index 98% rename from sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderUtil.java rename to sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderUtil.java index ed690789..13b7d432 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderUtil.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderUtil.java @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT */ -package com.draeger.medical.sdccc.sdcri.testprovider; +package it.com.draeger.medical.sdccc.test_util.testprovider; import com.draeger.medical.sdccc.configuration.TestSuiteConfig; import com.draeger.medical.sdccc.messages.MessageStorage; diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/guice/ProviderFactory.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/guice/ProviderFactory.java similarity index 78% rename from sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/guice/ProviderFactory.java rename to sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/guice/ProviderFactory.java index a06dbb62..8e870b4b 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/guice/ProviderFactory.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/guice/ProviderFactory.java @@ -5,10 +5,10 @@ * SPDX-License-Identifier: MIT */ -package com.draeger.medical.sdccc.sdcri.testprovider.guice; +package it.com.draeger.medical.sdccc.test_util.testprovider.guice; -import com.draeger.medical.sdccc.sdcri.testprovider.TestProviderImpl; import com.google.inject.assistedinject.Assisted; +import it.com.draeger.medical.sdccc.test_util.testprovider.TestProviderImpl; import java.io.InputStream; /** diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/guice/package-info.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/guice/package-info.java similarity index 81% rename from sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/guice/package-info.java rename to sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/guice/package-info.java index 1610d291..4f4333d7 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/guice/package-info.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/guice/package-info.java @@ -9,6 +9,6 @@ * SDCcc test provider guice factory. */ @ParametersAreNonnullByDefault -package com.draeger.medical.sdccc.sdcri.testprovider.guice; +package it.com.draeger.medical.sdccc.test_util.testprovider.guice; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/package-info.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/package-info.java similarity index 82% rename from sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/package-info.java rename to sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/package-info.java index ee158520..b8750070 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/package-info.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/package-info.java @@ -9,6 +9,6 @@ * SDCcc test provider. */ @ParametersAreNonnullByDefault -package com.draeger.medical.sdccc.sdcri.testprovider; +package it.com.draeger.medical.sdccc.test_util.testprovider; import javax.annotation.ParametersAreNonnullByDefault; From 5421b11a71d0af6e8a50b1254af08e819d235c06 Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Thu, 14 Mar 2024 13:31:25 +0100 Subject: [PATCH 3/9] CHANGELOG.md should contain info that the consumer related implementations have been removed --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb97706b..6ff243a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - inconsistent messaging in SDCcc logs ("No problems were found" and "Test run was invalid" one after another.) - incorrect behavior of the configuration option SDCcc.SummarizeMessageEncodingErrors +### Removed + +- consumer test related implementations + ## [9.0.0] - 2024-02-23 ### Added From 8ac0655ac02c31600ef32aac7c98655d0118f99d Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Mon, 8 Apr 2024 08:13:04 +0200 Subject: [PATCH 4/9] adapt method and comment wording --- .../src/main/java/com/draeger/medical/sdccc/TestSuite.java | 6 +++--- 1 file changed, 3 insertions(+), 3 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 5f7dbef1..28de6f63 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java @@ -165,7 +165,7 @@ public long runTestSuite() { final SummaryGeneratingListener directSummary = new SummaryGeneratingListener(); directTestLauncher.registerTestExecutionListeners(directSummary); - final Boolean isConsumerEnabled = setupDeviceAndProvider(); + final Boolean isConsumerEnabled = setupDevice(); long totalTestFailures = 0L; /* @@ -186,7 +186,7 @@ public long runTestSuite() { /* * Phase 4, invariant tests */ - // stop client and provider now + // stop client now totalTestFailures = phase4(totalTestFailures, outWriter, invariantTestLauncher, invariantTestPlan, invariantSummary); @@ -364,7 +364,7 @@ private void performBasicMessagingCheck() { LOG.info("SDC Basic Messaging Check completed" + statusline + "."); } - private Boolean setupDeviceAndProvider() { + private Boolean setupDevice() { final var isConsumerEnabled = injector.getInstance(Key.get(Boolean.class, Names.named(TestSuiteConfig.CONSUMER_ENABLE))); From f613daa21ce6f42cf48b36de5eb729b9e5ee308c Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Wed, 10 Apr 2024 08:39:07 +0200 Subject: [PATCH 5/9] "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 28de6f63..b9adae79 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; } /** @@ -658,9 +653,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); From c018aa72db017108a65bc6e3b675ca5450b30b75 Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Thu, 11 Apr 2024 08:23:15 +0200 Subject: [PATCH 6/9] remove consumer enable in config and readme --- README.md | 4 ---- configuration/config.toml | 1 - 2 files changed, 5 deletions(-) diff --git a/README.md b/README.md index 84b12496..620d7d96 100644 --- a/README.md +++ b/README.md @@ -108,14 +108,12 @@ all the given filter criteria have to be fulfilled for initiating a connection. For example the configuration ``` [SDCcc.Consumer] -Enable=true DeviceEpr="urn:uuid:857bf583-8a51-475f-a77f-d0ca7de69b11" ``` will make only those devices match during discovery that have the EPR "urn:uuid:857bf583-8a51-475f-a77f-d0ca7de69b11", the configuration ``` [SDCcc.Consumer] -Enable=true DeviceEpr="urn:uuid:857bf583-8a51-475f-a77f-d0ca7de69b11" DeviceLocationBed="bed32" ``` @@ -123,14 +121,12 @@ only those that have the EPR "urn:uuid:857bf583-8a51-475f-a77f-d0ca7de69b11" and the configuration ``` [SDCcc.Consumer] -Enable=true DeviceLocationBed="bed32" ``` only those that have the bed "bed32" in the location query, and the configuration ``` [SDCcc.Consumer] -Enable=true ``` will make all devices match during discovery. diff --git a/configuration/config.toml b/configuration/config.toml index f218986a..a2437112 100644 --- a/configuration/config.toml +++ b/configuration/config.toml @@ -30,7 +30,6 @@ MaxWait=10 MulticastTTL=128 [SDCcc.Consumer] -Enable=true DeviceEpr="urn:uuid:857bf583-8a51-475f-a77f-d0ca7de69b11" # DeviceLocationBed="bed32" # DeviceLocationPointOfCare="poc32" From c641cf937bd4d444791ff469f3f7435fbcc5d0c3 Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Thu, 11 Apr 2024 08:27:42 +0200 Subject: [PATCH 7/9] enable provider option not useful for integration test --- .../src/test/java/it/com/draeger/medical/sdccc/TestSuiteIT.java | 1 - .../medical/sdccc/test_util/testprovider/TestProviderConfig.java | 1 - 2 files changed, 2 deletions(-) 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 3e48b326..938b795a 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 @@ -594,7 +594,6 @@ protected void defaultConfigure() { bind(TestSuiteConfig.CONSUMER_DEVICE_LOCATION_ROOM, String.class, this.locationConfig.room); bind(TestSuiteConfig.CONSUMER_DEVICE_LOCATION_BED, String.class, this.locationConfig.bed); - bind(TestProviderConfig.PROVIDER_ENABLE, Boolean.class, true); bind(TestProviderConfig.PROVIDER_DEVICE_EPR, String.class, DUT_EPR); bind(TestSuiteConfig.NETWORK_INTERFACE_ADDRESS, String.class, "127.0.0.1"); diff --git a/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java index ce302edb..e051585c 100644 --- a/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java +++ b/sdccc/src/test/java/it/com/draeger/medical/sdccc/test_util/testprovider/TestProviderConfig.java @@ -22,7 +22,6 @@ public final class TestProviderConfig { * Provider configuration */ private static final String PROVIDER = "Provider."; - public static final String PROVIDER_ENABLE = TestSuiteConfig.SDCCC + PROVIDER + Constants.ENABLE_SETTING_POSTFIX; public static final String PROVIDER_DEVICE_EPR = TestSuiteConfig.SDCCC + PROVIDER + Constants.DEVICE_EPR_POSTFIX; private TestProviderConfig() {} From c27946a64dc5b74578a38c9fe43bf154fec6555c Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Tue, 16 Apr 2024 15:07:53 +0200 Subject: [PATCH 8/9] remove further redundant occurrences of "consumer enabled" boolean --- .../java/com/draeger/medical/sdccc/TestSuite.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 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 b9adae79..6642133c 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java @@ -165,13 +165,11 @@ public long runTestSuite() { final SummaryGeneratingListener directSummary = new SummaryGeneratingListener(); directTestLauncher.registerTestExecutionListeners(directSummary); - final Boolean isConsumerEnabled = setupDevice(); - long totalTestFailures = 0L; /* * Phase 1, generate messages */ - phase1(isConsumerEnabled); + phase1(); /* * Phase 2, execute direct tests @@ -272,10 +270,9 @@ private long phase2( return totalTestFailures + directSummary.getSummary().getTotalFailureCount(); } - private void phase1(final Boolean isConsumerEnabled) { - if (isConsumerEnabled) { - performBasicMessagingCheck(); - } + private void phase1() { + setupDevice(); + performBasicMessagingCheck(); try { Thread.sleep(TIME_BETWEEN_PHASES); @@ -364,7 +361,7 @@ private void performBasicMessagingCheck() { LOG.info("SDC Basic Messaging Check completed" + statusline + "."); } - private Boolean setupDevice() { + private void setupDevice() { LOG.info("Starting TestSuite Client"); try { client.startService(MAX_WAIT); @@ -380,7 +377,6 @@ private Boolean setupDevice() { client.getHostingServiceProxy().getHostedServices().values().stream() .anyMatch(service -> service.getType().getTypes().contains(WsdlConstants.PORT_TYPE_ARCHIVE_QNAME))); - return true; } /** From aeb30a2293325023f0ad39179a3fdde5d95ecfa0 Mon Sep 17 00:00:00 2001 From: "Staeck, Philipp" Date: Wed, 17 Apr 2024 15:42:38 +0200 Subject: [PATCH 9/9] starting client is not part of phase1 --- .../main/java/com/draeger/medical/sdccc/TestSuite.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 6642133c..5f57193a 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java @@ -166,6 +166,11 @@ public long runTestSuite() { directTestLauncher.registerTestExecutionListeners(directSummary); long totalTestFailures = 0L; + /* + * Starting TestSuite Client and connect, check for an archive service of the DUT + */ + startClient(); + /* * Phase 1, generate messages */ @@ -271,7 +276,6 @@ private long phase2( } private void phase1() { - setupDevice(); performBasicMessagingCheck(); try { @@ -361,7 +365,7 @@ private void performBasicMessagingCheck() { LOG.info("SDC Basic Messaging Check completed" + statusline + "."); } - private void setupDevice() { + private void startClient() { LOG.info("Starting TestSuite Client"); try { client.startService(MAX_WAIT);