Skip to content

Commit

Permalink
"Enable" for the consumer is now a redundant option
Browse files Browse the repository at this point in the history
  • Loading branch information
pstaeck committed Apr 10, 2024
1 parent cf7a799 commit 279dba4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 31 deletions.
53 changes: 24 additions & 29 deletions sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}

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

0 comments on commit 279dba4

Please sign in to comment.