From 994158d11a91eafe9546147f336a2cc7a37d2aba Mon Sep 17 00:00:00 2001 From: Lukas Deichmann <8513777+ldeichmann@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:33:00 +0200 Subject: [PATCH] Update sdc-ri to 6.0.0-SNAPSHOT (#151) Update sdc-ri to 6.0.0 development versions # 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 * Adherence to javadoc conventions * [x] Pull Request Assignee * [x] Reviewer * Changelog update (necessity checked and entry added or not added respectively) * [x] Pull Request Assignee * [x] Reviewer * README update (necessity checked and entry added or not added respectively) * [x] Pull Request Assignee * [x] Reviewer * config update (necessity checked and entry added or not added respectively) * [x] Pull Request Assignee * [x] Reviewer * SDCcc executable ran against a test device (if necessary) * [ ] Pull Request Assignee * [x] Reviewer --- CHANGELOG.md | 4 ++ biceps-model/pom.xml | 9 +-- dpws-model/pom.xml | 9 +-- pom.xml | 6 +- sdccc/pom.xml | 38 +++++------ .../com/draeger/medical/sdccc/TestSuite.java | 2 +- .../sdccc/messages/HibernateConfigBase.java | 2 +- .../sdccc/messages/HibernateConfigImpl.java | 4 +- .../sdccc/messages/ManipulationInfo.java | 2 +- .../sdcri/testclient/TestClientUtil.java | 2 +- .../sdcri/testprovider/TestProviderImpl.java | 6 +- .../sdcri/testprovider/TestProviderUtil.java | 2 +- .../dpws/direct/DirectMessagingTest.java | 4 +- .../tests/mdpws/direct/DirectWSDLTest.java | 4 +- .../tests/util/HostedServiceVerifier.java | 2 +- .../sdccc/tests/util/MdibHistorian.java | 63 ++++++------------- .../medical/sdccc/util/HttpClientUtil.java | 2 +- .../medical/sdccc/util/WsdlParser.java | 4 +- .../sdccc/marshalling/SoapMarshalling.java | 2 +- .../InvariantMultiStateTestTest.java | 7 ++- ...variantParticipantModelHandleTestTest.java | 19 +++--- .../DirectSecurityConsiderationsTestTest.java | 4 +- .../util/HibernateConfigInMemoryImpl.java | 4 +- .../medical/sdccc/util/MdibBuilder.java | 2 +- .../medical/sdccc/util/MessageBuilder.java | 2 +- .../medical/sdccc/util/WsdlParserTest.java | 8 +-- 26 files changed, 95 insertions(+), 118 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf1bbc24..0db0c41e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- sdc-ri version to 6.0.0-SNAPSHOT + ## [9.0.0] - 2024-02-23 ### Added diff --git a/biceps-model/pom.xml b/biceps-model/pom.xml index 3b686345..163c9e11 100644 --- a/biceps-model/pom.xml +++ b/biceps-model/pom.xml @@ -29,10 +29,11 @@ ${jakartaXmlBindApiVersion} + - com.sun.xml.bind - jaxb-impl - ${comSunXmlBindVersion} + org.glassfish.jaxb + jaxb-runtime + ${jaxbRuntimeVersion} runtime @@ -64,7 +65,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.3.0 + ${jaxbBuildHelperMavenPluginVersion} add-source diff --git a/dpws-model/pom.xml b/dpws-model/pom.xml index dc594bd4..98f641d3 100644 --- a/dpws-model/pom.xml +++ b/dpws-model/pom.xml @@ -28,10 +28,11 @@ ${jakartaXmlBindApiVersion} + - com.sun.xml.bind - jaxb-impl - ${comSunXmlBindVersion} + org.glassfish.jaxb + jaxb-runtime + ${jaxbRuntimeVersion} runtime @@ -61,7 +62,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.3.0 + ${jaxbBuildHelperMavenPluginVersion} add-source diff --git a/pom.xml b/pom.xml index 0e56d54a..941f35fe 100644 --- a/pom.xml +++ b/pom.xml @@ -19,8 +19,10 @@ -SNAPSHOT UTF-8 3.1.0 - 4.0.0 - 4.0.1 + 4.0.1 + 4.0.4 + 4.0.4 + 3.5.0 diff --git a/sdccc/pom.xml b/sdccc/pom.xml index de6ff58d..298409ba 100644 --- a/sdccc/pom.xml +++ b/sdccc/pom.xml @@ -15,7 +15,7 @@ UTF-8 5.6.0 1.6.0 - 5.0.0 + 6.0.0-SNAPSHOT 2.17.1 4.7.3 ../checkstyle @@ -34,11 +34,6 @@ - - github - GitHub Packages - https://maven.pkg.github.com/Draegerwerk/t2iapi - sonatype OSS Sonatype Snapshots @@ -195,29 +190,19 @@ ${jakartaXmlBindApiVersion} + - com.sun.xml.bind - jaxb-impl - ${comSunXmlBindVersion} - runtime - - - - com.sun.xml.bind + org.glassfish.jaxb jaxb-core - ${comSunXmlBindVersion} - compile + ${jaxbCoreVersion} - - - + - javax.xml.bind - jaxb-api - 2.3.1 + org.glassfish.jaxb + jaxb-runtime + ${jaxbRuntimeVersion} - org.bouncycastle @@ -253,6 +238,13 @@ test + + + jakarta.inject + jakarta.inject-api + 2.0.1 + + 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 011b8132..ff0e1021 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java @@ -39,6 +39,7 @@ import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.Module; +import com.google.inject.name.Named; import com.google.inject.name.Names; import com.google.inject.util.Modules; import java.io.File; @@ -54,7 +55,6 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.concurrent.TimeoutException; -import javax.inject.Named; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import org.apache.commons.lang3.SystemUtils; diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigBase.java b/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigBase.java index b85e8d25..4a03d7c8 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigBase.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigBase.java @@ -12,10 +12,10 @@ import com.draeger.medical.sdccc.messages.mapping.ManipulationParameter; import com.draeger.medical.sdccc.messages.mapping.MdibVersionGroupEntity; import com.draeger.medical.sdccc.messages.mapping.MessageContent; +import com.google.inject.Singleton; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; -import javax.inject.Singleton; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigImpl.java b/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigImpl.java index 18a8463b..f855fcb8 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigImpl.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/messages/HibernateConfigImpl.java @@ -8,11 +8,11 @@ package com.draeger.medical.sdccc.messages; import com.draeger.medical.sdccc.configuration.TestRunConfig; +import com.google.inject.Inject; +import com.google.inject.Singleton; import com.google.inject.name.Named; import java.io.File; import java.nio.file.Path; -import javax.inject.Inject; -import javax.inject.Singleton; /** * Hibernate configuration using a file based backend. diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/messages/ManipulationInfo.java b/sdccc/src/main/java/com/draeger/medical/sdccc/messages/ManipulationInfo.java index b042113a..16784c7f 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/messages/ManipulationInfo.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/messages/ManipulationInfo.java @@ -9,10 +9,10 @@ import com.draeger.medical.sdccc.tests.util.ManipulationParameterUtil; import com.draeger.medical.t2iapi.ResponseTypes; +import com.google.inject.Inject; import com.google.inject.assistedinject.Assisted; import java.util.List; import java.util.UUID; -import javax.inject.Inject; import org.apache.commons.lang3.tuple.Pair; /** 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 e6714766..a7b2c241 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 @@ -19,11 +19,11 @@ import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.assistedinject.FactoryModuleBuilder; +import com.google.inject.name.Named; import com.google.inject.util.Modules; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.inject.Named; import javax.net.ssl.HostnameVerifier; import org.somda.sdc.biceps.guice.DefaultBicepsConfigModule; import org.somda.sdc.biceps.guice.DefaultBicepsModule; diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderImpl.java b/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderImpl.java index e8a81ceb..0e7f0eba 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderImpl.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderImpl.java @@ -19,7 +19,6 @@ import java.net.SocketException; import java.net.UnknownHostException; import java.time.Duration; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.TimeoutException; @@ -37,6 +36,7 @@ import org.somda.sdc.glue.common.factory.ModificationsBuilderFactory; import org.somda.sdc.glue.provider.SdcDevice; import org.somda.sdc.glue.provider.factory.SdcDeviceFactory; +import org.somda.sdc.glue.provider.sco.OperationInvocationReceiver; /** * SDCri provider used to test SDC consumers. @@ -62,7 +62,7 @@ public class TestProviderImpl extends AbstractIdleService implements TestProvide try { this.mdib = mdibXmlIo.readMdib(mdibAsStream); - } catch (final javax.xml.bind.JAXBException e) { + } catch (final jakarta.xml.bind.JAXBException e) { throw new RuntimeException(e); } @@ -98,7 +98,7 @@ public NetworkInterface getNetworkInterface() { } }, this.mdibAccess, - Collections.emptyList(), + new OperationInvocationReceiver() {}, List.of(injector.getInstance(TestProviderHostingServicePlugin.class))); } diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderUtil.java b/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderUtil.java index 01a20f0c..ed690789 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderUtil.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/sdcri/testprovider/TestProviderUtil.java @@ -15,8 +15,8 @@ import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.assistedinject.FactoryModuleBuilder; +import com.google.inject.name.Named; import com.google.inject.util.Modules; -import javax.inject.Named; import javax.net.ssl.HostnameVerifier; import org.somda.sdc.biceps.guice.DefaultBicepsConfigModule; import org.somda.sdc.biceps.guice.DefaultBicepsModule; diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/dpws/direct/DirectMessagingTest.java b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/dpws/direct/DirectMessagingTest.java index a1bc7ae7..a38388ca 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/dpws/direct/DirectMessagingTest.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/dpws/direct/DirectMessagingTest.java @@ -175,7 +175,7 @@ private void sendToAllEpr(final String wsaAction, final int low, final int high) @TestIdentifier(EnabledTestConfig.DPWS_R0031) @TestDescription("Provokes an wsa:InvalidAddressingHeader SOAP Fault and verifies, that with an anonymous" + " reply endpoint the wsa:InvalidAddressingHeader SOAP Fault is not thrown.") - void testRequirement0031() throws javax.xml.bind.JAXBException { + void testRequirement0031() throws jakarta.xml.bind.JAXBException { final var msgUUID = soapUtil.createRandomUuidUri(); try { sendMessageWithReplyToHeader(msgUUID, SOME_REPLY_ENDPOINT); @@ -198,7 +198,7 @@ void testRequirement0031() throws javax.xml.bind.JAXBException { } private void sendMessageWithReplyToHeader(final String msgId, final String replyUri) - throws javax.xml.bind.JAXBException, SoapFaultException { + throws jakarta.xml.bind.JAXBException, SoapFaultException { final var message = soapUtil.createMessage(ActionConstants.ACTION_GET_MDIB, messageModelFactory.createGetMdib()); diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectWSDLTest.java b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectWSDLTest.java index 9b5e6c7f..c7e02b13 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectWSDLTest.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectWSDLTest.java @@ -694,10 +694,10 @@ protected void sendMustUnderstand(final TestClient testClient, final Object mess getService.sendRequestResponse(getMdibRequest); } - private javax.xml.bind.JAXBElement createMustUnderstandNode() { + private jakarta.xml.bind.JAXBElement createMustUnderstandNode() { final var entry = new AttributedURIType(); entry.setValue(MUST_UNDERSTAND_TEXT); entry.getOtherAttributes().put(Constants.MUST_UNDERSTAND_ATTRIBUTE, "true"); - return new javax.xml.bind.JAXBElement<>(CUSTOM_NAMESPACE, AttributedURIType.class, entry); + return new jakarta.xml.bind.JAXBElement<>(CUSTOM_NAMESPACE, AttributedURIType.class, entry); } } diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/HostedServiceVerifier.java b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/HostedServiceVerifier.java index 82f69349..a2c31f85 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/HostedServiceVerifier.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/HostedServiceVerifier.java @@ -101,7 +101,7 @@ public void verifyHostedService( parsedWsdls.containsKey(portTypeName), DUPLICATE_PORT_TYPE_TEMPLATE + " portType " + portTypeName + " service " + serviceId)); parsedWsdls.putAll(wsdlPortTypes); - } catch (final javax.xml.bind.JAXBException e) { + } catch (final jakarta.xml.bind.JAXBException e) { LOG.debug("Could not parse WSDL for service {}", serviceId, e); fail("Could not parse WSDL for service " + serviceId + ". Message: " + e.getMessage()); // unreachable, silence warnings diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java index fd37156e..32678c66 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/tests/util/MdibHistorian.java @@ -14,6 +14,7 @@ import com.draeger.medical.sdccc.util.Constants; import com.draeger.medical.sdccc.util.TestRunObserver; import com.google.inject.Guice; +import com.google.inject.Provider; import com.google.inject.TypeLiteral; import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.AssistedInject; @@ -28,19 +29,15 @@ import java.util.Objects; import java.util.stream.Stream; import javax.annotation.Nullable; -import javax.inject.Provider; import javax.xml.namespace.QName; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.somda.sdc.biceps.common.CommonConfig; -import org.somda.sdc.biceps.common.MdibEntity; -import org.somda.sdc.biceps.common.MdibEntityImpl; import org.somda.sdc.biceps.common.access.ReadTransaction; import org.somda.sdc.biceps.common.access.ReadTransactionImpl; import org.somda.sdc.biceps.common.access.factory.ReadTransactionFactory; -import org.somda.sdc.biceps.common.factory.MdibEntityGuiceAssistedFactory; import org.somda.sdc.biceps.common.preprocessing.DescriptorChildRemover; import org.somda.sdc.biceps.common.storage.MdibStorage; import org.somda.sdc.biceps.common.storage.MdibStorageImpl; @@ -53,18 +50,13 @@ import org.somda.sdc.biceps.consumer.access.RemoteMdibAccessImpl; import org.somda.sdc.biceps.consumer.access.factory.RemoteMdibAccessFactory; import org.somda.sdc.biceps.consumer.preprocessing.DuplicateContextStateHandleHandler; -import org.somda.sdc.biceps.model.message.AbstractAlertReport; -import org.somda.sdc.biceps.model.message.AbstractComponentReport; -import org.somda.sdc.biceps.model.message.AbstractContextReport; -import org.somda.sdc.biceps.model.message.AbstractMetricReport; -import org.somda.sdc.biceps.model.message.AbstractOperationalStateReport; import org.somda.sdc.biceps.model.message.AbstractReport; -import org.somda.sdc.biceps.model.message.DescriptionModificationReport; import org.somda.sdc.biceps.model.message.GetMdibResponse; -import org.somda.sdc.biceps.model.message.WaveformStream; import org.somda.sdc.biceps.model.participant.Mdib; import org.somda.sdc.biceps.model.participant.MdibVersion; +import org.somda.sdc.biceps.provider.preprocessing.ContextHandleDuplicateChecker; import org.somda.sdc.biceps.provider.preprocessing.DuplicateChecker; +import org.somda.sdc.biceps.provider.preprocessing.DuplicateDescriptorChecker; import org.somda.sdc.common.guice.AbstractConfigurationModule; import org.somda.sdc.common.guice.DefaultCommonModule; import org.somda.sdc.dpws.soap.MarshallingService; @@ -73,6 +65,7 @@ import org.somda.sdc.glue.common.factory.ModificationsBuilderFactory; import org.somda.sdc.glue.consumer.report.ReportProcessingException; import org.somda.sdc.glue.consumer.report.ReportProcessor; +import org.somda.sdc.glue.consumer.report.helper.EpisodicReport; /** * The {@linkplain MdibHistorian} provides methods to generate histories of the Mdib during a test run. It currently @@ -110,9 +103,6 @@ public class MdibHistorian { class MdibHistorianBicepsModule extends AbstractConfigurationModule { @Override protected void defaultConfigure() { - install(new FactoryModuleBuilder() - .implement(MdibEntity.class, MdibEntityImpl.class) - .build(MdibEntityGuiceAssistedFactory.class)); install(new FactoryModuleBuilder() .implement(MdibStoragePreprocessingChain.class, MdibStoragePreprocessingChain.class) .build(MdibStoragePreprocessingChainFactory.class)); @@ -138,11 +128,13 @@ protected void defaultConfigure() { bind( CommonConfig.CONSUMER_STATE_PREPROCESSING_SEGMENTS, new TypeLiteral>>() {}, - List.of(DuplicateContextStateHandleHandler.class)); + List.of(DuplicateContextStateHandleHandler.class, ContextHandleDuplicateChecker.class)); bind( CommonConfig.CONSUMER_DESCRIPTION_PREPROCESSING_SEGMENTS, new TypeLiteral<>() {}, - List.of(DescriptorChildRemover.class, DuplicateChecker.class)); + List.of( + DescriptorChildRemover.class, DuplicateChecker.class, + DuplicateDescriptorChecker.class, ContextHandleDuplicateChecker.class)); } } @@ -256,21 +248,15 @@ private HistorianResult getHistorianResultForEpisodicReportBasedHistory( + " same version has already been applied, and is expected behavior when e.g." + " descriptors update, as both a report for description and state will arrive."); } - if (report instanceof WaveformStream - || report instanceof AbstractMetricReport - || report instanceof AbstractAlertReport - || report instanceof AbstractOperationalStateReport - || report instanceof AbstractComponentReport - || report instanceof AbstractContextReport - || report instanceof DescriptionModificationReport) { + final var episodic = EpisodicReport.tryFrom(report); + if (episodic != null) { LOG.debug( "Applying report with mdib version {}, type {}", ImpliedValueUtil.getReportMdibVersion(report), report.getClass().getSimpleName()); - reportProcessor.processReport(report); + reportProcessor.processEpisodicReport(episodic); } else { - // other reports do not modify the Mdib and hence cannot be passed into - // reportProcessor.processReport(). + // other reports do not modify the Mdib and hence cannot be passed into report processor, // simply ignore them. LOG.debug( "Ignoring report of type {} with MdibVersion {} as it is not expected to " @@ -347,21 +333,15 @@ public HistorianResult uniqueEpisodicReportBasedHistoryUntilTimestamp(final Stri "Applying report with mdib version {}, type {}", ImpliedValueUtil.getReportMdibVersion(report), report.getClass().getSimpleName()); - if (report instanceof WaveformStream - || report instanceof AbstractMetricReport - || report instanceof AbstractAlertReport - || report instanceof AbstractOperationalStateReport - || report instanceof AbstractComponentReport - || report instanceof AbstractContextReport - || report instanceof DescriptionModificationReport) { + final var episodic = EpisodicReport.tryFrom(report); + if (episodic != null) { LOG.debug( "Applying report with mdib version {}, type {}", ImpliedValueUtil.getReportMdibVersion(report), report.getClass().getSimpleName()); - reportProcessor.processReport(report); + reportProcessor.processEpisodicReport(episodic); } else { - // other reports do not modify the Mdib and hence cannot be passed into - // reportProcessor.processReport(). + // other reports do not modify the Mdib and hence cannot be passed into report processor, // simply ignore them. LOG.debug( "Ignoring report of type {} with MdibVersion {} as it is not expected to " @@ -552,18 +532,13 @@ public RemoteMdibAccess applyReportOnStorage(final RemoteMdibAccess storage, fin + " descriptors update, as both a report for description and state will arrive."); } - if (report instanceof WaveformStream - || report instanceof AbstractMetricReport - || report instanceof AbstractAlertReport - || report instanceof AbstractOperationalStateReport - || report instanceof AbstractComponentReport - || report instanceof AbstractContextReport - || report instanceof DescriptionModificationReport) { + final var episodic = EpisodicReport.tryFrom(report); + if (episodic != null) { LOG.debug( "Applying report with mdib version {}, type {}", ImpliedValueUtil.getReportMdibVersion(report), report.getClass().getSimpleName()); - reportProcessor.processReport(report); + reportProcessor.processEpisodicReport(episodic); } else { // other reports do not modify the Mdib and hence cannot be passed into // reportProcessor.processReport(). diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/util/HttpClientUtil.java b/sdccc/src/main/java/com/draeger/medical/sdccc/util/HttpClientUtil.java index 261a151f..96110b00 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/util/HttpClientUtil.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/util/HttpClientUtil.java @@ -95,7 +95,7 @@ public SoapMessage postMessage(final HttpClient client, final String endpoint, f new HttpException(response.getStatusLine().getStatusCode()))); } } - } catch (final javax.xml.bind.JAXBException e) { + } catch (final jakarta.xml.bind.JAXBException e) { LOG.debug( "Unmarshalling of a message failed: {}. Response payload:\n{}", e.getMessage(), diff --git a/sdccc/src/main/java/com/draeger/medical/sdccc/util/WsdlParser.java b/sdccc/src/main/java/com/draeger/medical/sdccc/util/WsdlParser.java index 82af5efe..dda74006 100644 --- a/sdccc/src/main/java/com/draeger/medical/sdccc/util/WsdlParser.java +++ b/sdccc/src/main/java/com/draeger/medical/sdccc/util/WsdlParser.java @@ -50,10 +50,10 @@ public class WsdlParser { * @return map containing one entry for each portType. PortType name is the key, value is another map for * operations. The key is the operation name, value is a container holding arguments * for input and output elements used by the operation, resolved to the wsdl:message parts. - * @throws javax.xml.bind.JAXBException in case wsdl cannot be serialized + * @throws jakarta.xml.bind.JAXBException in case wsdl cannot be serialized */ public Map> parseWsdlPortTypes(final String wsdl) - throws javax.xml.bind.JAXBException { + throws jakarta.xml.bind.JAXBException { final var tDef = wsdlMarshalling.unmarshal(new ByteArrayInputStream(wsdl.getBytes(StandardCharsets.UTF_8))); final var targetNamespace = tDef.getTargetNamespace(); diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/marshalling/SoapMarshalling.java b/sdccc/src/test/java/com/draeger/medical/sdccc/marshalling/SoapMarshalling.java index 3fc9020e..008c34ed 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/marshalling/SoapMarshalling.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/marshalling/SoapMarshalling.java @@ -10,6 +10,7 @@ import com.draeger.medical.dpws.soap.model.Envelope; import com.draeger.medical.sdccc.marshalling.guice.MarshallingConfig; import com.google.inject.Inject; +import com.google.inject.name.Named; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; @@ -22,7 +23,6 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.List; -import javax.inject.Named; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantMultiStateTestTest.java b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantMultiStateTestTest.java index 2f09476f..87cc92f0 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantMultiStateTestTest.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantMultiStateTestTest.java @@ -51,7 +51,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.somda.sdc.biceps.provider.preprocessing.HandleDuplicatedException; import org.somda.sdc.dpws.helper.JaxbMarshalling; import org.somda.sdc.dpws.soap.SoapMarshalling; import org.somda.sdc.glue.common.ActionConstants; @@ -390,8 +389,10 @@ public void testRequirementR0097BadStart() throws Exception { messageStorageUtil.addInboundSecureHttpMessage(storage, initial); - final var error = assertThrows(RuntimeException.class, () -> testClass.testRequirement0097()); - assertTrue(error.getCause() instanceof HandleDuplicatedException); + final var error = assertThrows(IllegalArgumentException.class, () -> testClass.testRequirement0097()); + assertTrue( + error.getMessage().contains(PATIENT_CONTEXT_DESCRIPTOR_HANDLE), + "Error does not contain handle " + PATIENT_CONTEXT_DESCRIPTOR_HANDLE); } /** diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelHandleTestTest.java b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelHandleTestTest.java index ef68e82b..cf3c255d 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelHandleTestTest.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/biceps/invariant/InvariantParticipantModelHandleTestTest.java @@ -44,8 +44,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.opentest4j.AssertionFailedError; +import org.somda.sdc.biceps.common.PairException; import org.somda.sdc.biceps.common.storage.PreprocessingException; -import org.somda.sdc.biceps.provider.preprocessing.HandleDuplicatedException; import org.somda.sdc.dpws.helper.JaxbMarshalling; import org.somda.sdc.dpws.soap.SoapMarshalling; import org.somda.sdc.glue.common.ActionConstants; @@ -68,7 +68,7 @@ public class InvariantParticipantModelHandleTestTest { private static final int LOWER_BOUND = 0x21; private static final int UPPER_BOUND = 0x7E; private static final String ERROR_MESSAGE_HANDLE_IS_NOT_UNIQUE = - "contextState handle '%s' is " + "not unique in Mdib version MdibVersion"; + "Context change included handles colliding with descriptors: %s"; private static MessageStorageUtil messageStorageUtil; private static MdibBuilder mdibBuilder; private static MessageBuilder messageBuilder; @@ -277,7 +277,10 @@ public void testR0007ContextReportsIntroducingDuplicateHandles() throws IOExcept messageStorageUtil.addInboundSecureHttpMessage(storage, firstReport); final AssertionFailedError afe = assertThrows(AssertionFailedError.class, testClass::testRequirementR0007); - assertTrue(afe.getMessage().startsWith(String.format(ERROR_MESSAGE_HANDLE_IS_NOT_UNIQUE, "someVmd"))); + final var expectedMessage = String.format(ERROR_MESSAGE_HANDLE_IS_NOT_UNIQUE, "someVmd"); + assertTrue( + afe.getCause().getCause().getMessage().startsWith(expectedMessage), + "Unexpected message, was " + afe.getMessage() + " - expected: " + expectedMessage); } /** @@ -298,10 +301,9 @@ public void testR0007NonUniqueHandles() throws IOException, JAXBException { messageStorageUtil.addInboundSecureHttpMessage(storage, mdib); final RuntimeException exception = assertThrows(RuntimeException.class, testClass::testRequirementR0007); - assertTrue(exception.getMessage().contains(NON_UNIQUE_HANDLE)); - assertTrue( - exception.getCause() instanceof HandleDuplicatedException, - "Wrong kind of Exception: " + exception.getCause()); + // creating the mdib fails when matching descriptor and state types due to duplicate handles, + // causing a PairException + assertTrue(exception.getCause() instanceof PairException, "Wrong kind of Exception: " + exception.getCause()); } /** @@ -316,9 +318,8 @@ public void testR0007NonUniqueHandles2() throws IOException, JAXBException { messageStorageUtil.addInboundSecureHttpMessage(storage, mdib); - final RuntimeException rte = assertThrows(RuntimeException.class, testClass::testRequirementR0007); + final RuntimeException rte = assertThrows(IllegalArgumentException.class, testClass::testRequirementR0007); assertTrue(rte.getMessage().contains(NON_UNIQUE_HANDLE)); - assertTrue(rte.getCause() instanceof HandleDuplicatedException, "Wrong kind of Exception: " + rte.getCause()); } /** diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectSecurityConsiderationsTestTest.java b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectSecurityConsiderationsTestTest.java index 3535cba2..eb393bf8 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectSecurityConsiderationsTestTest.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/tests/mdpws/direct/DirectSecurityConsiderationsTestTest.java @@ -163,8 +163,8 @@ public void testRequirementR0015BadSoapFault() throws Exception { when(testClient.getTargetXAddrs()).thenReturn(xAddresses); final var mockFaultMessage = mock(SoapMessage.class, Mockito.RETURNS_DEEP_STUBS); - final javax.xml.bind.JAXBElement mockJaxbFault = - mock(javax.xml.bind.JAXBElement.class, Mockito.RETURNS_DEEP_STUBS); + final jakarta.xml.bind.JAXBElement mockJaxbFault = + mock(jakarta.xml.bind.JAXBElement.class, Mockito.RETURNS_DEEP_STUBS); when(mockFaultMessage.getOriginalEnvelope().getBody().getAny().get(0)).thenReturn(mockJaxbFault); final var mockFault = mock(Fault.class, Mockito.RETURNS_DEEP_STUBS); diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/util/HibernateConfigInMemoryImpl.java b/sdccc/src/test/java/com/draeger/medical/sdccc/util/HibernateConfigInMemoryImpl.java index 4bf74610..db8989ee 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/util/HibernateConfigInMemoryImpl.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/util/HibernateConfigInMemoryImpl.java @@ -8,9 +8,9 @@ package com.draeger.medical.sdccc.util; import com.draeger.medical.sdccc.messages.HibernateConfigBase; +import com.google.inject.Inject; +import com.google.inject.Singleton; import java.util.UUID; -import javax.inject.Inject; -import javax.inject.Singleton; /** * Hibernate configuration using an in memory database. diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/util/MdibBuilder.java b/sdccc/src/test/java/com/draeger/medical/sdccc/util/MdibBuilder.java index 914e334a..e43d32d5 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/util/MdibBuilder.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/util/MdibBuilder.java @@ -65,9 +65,9 @@ import com.draeger.medical.biceps.model.participant.SystemContextState; import com.draeger.medical.biceps.model.participant.VmdDescriptor; import com.draeger.medical.biceps.model.participant.VmdState; +import com.google.inject.Inject; import java.math.BigDecimal; import java.util.List; -import javax.inject.Inject; import javax.xml.datatype.Duration; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/util/MessageBuilder.java b/sdccc/src/test/java/com/draeger/medical/sdccc/util/MessageBuilder.java index 36e77cc0..cff7b061 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/util/MessageBuilder.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/util/MessageBuilder.java @@ -45,12 +45,12 @@ import com.draeger.medical.dpws.soap.wsdiscovery.model.ResolveMatchType; import com.draeger.medical.dpws.soap.wsdiscovery.model.ResolveMatchesType; import com.draeger.medical.sdccc.marshalling.SoapMarshalling; +import com.google.inject.Inject; import jakarta.xml.bind.JAXBElement; import java.math.BigInteger; import java.util.Collection; import java.util.List; import java.util.UUID; -import javax.inject.Inject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.somda.sdc.dpws.soap.SoapConstants; diff --git a/sdccc/src/test/java/com/draeger/medical/sdccc/util/WsdlParserTest.java b/sdccc/src/test/java/com/draeger/medical/sdccc/util/WsdlParserTest.java index 84aa453f..344c3b55 100644 --- a/sdccc/src/test/java/com/draeger/medical/sdccc/util/WsdlParserTest.java +++ b/sdccc/src/test/java/com/draeger/medical/sdccc/util/WsdlParserTest.java @@ -112,10 +112,10 @@ public void testParsePortTypes() throws Exception { /** * Tests using the method parsePortTypes to parse request-response operations. - * @throws javax.xml.bind.JAXBException when this exception is thrown. + * @throws jakarta.xml.bind.JAXBException when this exception is thrown. */ @Test - public void testParsePortTypesGood() throws javax.xml.bind.JAXBException { + public void testParsePortTypesGood() throws jakarta.xml.bind.JAXBException { final String wsdl = "