Skip to content

Commit

Permalink
#448: update HAPI FHIR, Camel, Groovy, Spring Boot
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Ohr committed Sep 19, 2024
1 parent af030dc commit 1cac9e0
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 89 deletions.
10 changes: 0 additions & 10 deletions boot/ipf-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- IPF Support -->
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected Methanol.Builder newHttpClientBuilder() {
protected synchronized Methanol getNativeHttpClient() {
if (httpClient == null) {
var builder = httpClientBuilder()
.version(HttpClient.Version.HTTP_2)
.version(HttpClient.Version.HTTP_1_1)
.followRedirects(HttpClient.Redirect.NORMAL)
.priority(1)
.cookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_NONE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ class XacmlToFhirTranslator {
static Bundle translatePpq1To4Response(
Bundle ppq4Request,
AssertionBasedRequestType ppq1Request,
EprPolicyRepositoryResponse ppq1Response)
EprPolicyRepositoryResponse ppq1Response,
String baseUrl = "http://localhost/fhir")
{
if (ppq1Response.status == 'urn:e-health-suisse:2015:response-status:success') {
Bundle ppq4Response = new Bundle(
Expand All @@ -244,7 +245,7 @@ class XacmlToFhirTranslator {
consentId = ChPpqmUtils.extractConsentIdFromUrl(ppq4RequestEntry.request.url)
}
ppq4Response.entry << new Bundle.BundleEntryComponent(
fullUrl: 'Consent?identifier=' + consentId,
fullUrl: "$baseUrl/Consent?identifier=$consentId",
response: new Bundle.BundleEntryResponseComponent(
status: (ppq1Request instanceof AddPolicyRequest) ? '201' : '200',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static void beforeAll() {
Xacml20Utils.initializeHerasaf();
}

private static void doTest(String templateId, Consent consent, String httpMethod, String expectedError) throws Exception {
private static void doTest(String templateId, Consent consent, String httpMethod, String expectedError) {
log.debug("Consent:\n{}", PARSER.encodeResourceToString(consent));

consent.getIdentifier().stream()
Expand Down Expand Up @@ -105,47 +105,47 @@ private static void doTest(String templateId, Consent consent, String httpMethod
}

@Test
public void testConsent201Creation1() throws Exception {
public void testConsent201Creation1() {
Consent consent = create201Consent(createUuid(), "123456789012345678");
doTest("201", consent, "POST", null);
}

@Test
public void testConsent202Creation1() throws Exception {
public void testConsent202Creation1() {
Consent consent = create202Consent(createUuid(), "123456789012345678",
"urn:e-health-suisse:2015:policies:access-level:normal");
doTest("202", consent, "POST", null);
}

@Test
public void testConsent203Creation1() throws Exception {
public void testConsent203Creation1() {
Consent consent = create203Consent(createUuid(), "123456789012345678",
"urn:e-health-suisse:2015:policies:provide-level:restricted");
doTest("203", consent, "POST", null);
}

@Test
public void testConsent301Creation1() throws Exception {
public void testConsent301Creation1() {
Consent consent = create301Consent(createUuid(), "123456789012345678", "3210987654321",
"urn:e-health-suisse:2015:policies:access-level:normal", null, new Date());
doTest("301", consent, "POST", null);
}

@Test
public void testConsent302Creation1() throws Exception {
public void testConsent302Creation1() {
Consent consent = create302Consent(createUuid(), "123456789012345678", "urn:oid:1.2.3.4.5",
"urn:e-health-suisse:2015:policies:access-level:restricted", null, new Date());
doTest("302", consent, "POST", null);
}

@Test
public void testConsent303Creation1() throws Exception {
public void testConsent303Creation1() {
Consent consent = create303Consent(createUuid(), "123456789012345678", "rep123", null, null);
doTest("303", consent, "POST", null);
}

@Test
public void testConsent304Creation1() throws Exception {
public void testConsent304Creation1() {
Consent consent = create304Consent(createUuid(), "123456789012345678", "3210987654321",
"urn:e-health-suisse:2015:policies:access-level:delegation-and-normal", null, new Date());
doTest("304", consent, "POST", null);
Expand Down
8 changes: 4 additions & 4 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
<properties>
<gpg-plugin-version>1.6</gpg-plugin-version>
<bouncycastle-version>1.78</bouncycastle-version>
<camel-version>4.4.3</camel-version>
<camel-version>4.8.0</camel-version>
<!-- resolve dependency convergence between guava and hapi caffeine -->
<checker-qual-version>3.19.0</checker-qual-version>
<cxf-version>4.0.5</cxf-version>
<commons-io-version>2.16.1</commons-io-version>
<commons-compress-version>1.27.1</commons-compress-version>
<equinox-app-version>1.3.200-v20130910-1609</equinox-app-version>
<equinox-common-version>3.6.200-v20130402-1505</equinox-common-version>
<groovy-version>4.0.22</groovy-version>
<groovy-version>4.0.23</groovy-version>
<hapi-version>2.5.1</hapi-version>
<hapi-fhir-version>7.2.3</hapi-fhir-version>
<hapi-fhir-version>7.4.0</hapi-fhir-version>
<herasaf-version>3.0.2</herasaf-version>
<ipf-gazelle-version>3.0.0</ipf-gazelle-version>
<httpclient5-version>5.3.1</httpclient5-version>
Expand All @@ -39,7 +39,7 @@
<ph-commons-version>11.1.0</ph-commons-version>
<saxon-he-version>12.5</saxon-he-version>
<simple-syslog-version>0.0.16</simple-syslog-version>
<spring-boot-version>3.3.3</spring-boot-version>
<spring-boot-version>3.3.4</spring-boot-version>
<velocity-version>2.3</velocity-version>
<vibur-version>25.0</vibur-version>
<woodstox-version>7.0.0</woodstox-version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.openehealth.ipf.platform.camel.ihe.fhir.iti68;

import org.apache.camel.Exchange;
import org.apache.camel.http.common.HttpMessage;
import org.openehealth.ipf.commons.audit.AuditContext;
import org.openehealth.ipf.commons.audit.codes.EventOutcomeIndicator;
import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy;
Expand All @@ -27,8 +28,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.servlet.http.HttpServletRequest;

/**
* Audit Interceptor for ITI-68. Note that the ParticipantObjectIdentificationType for the document
* is not populated automatically, because the location of the parameters depends upon the actual
Expand Down Expand Up @@ -102,7 +101,7 @@ private Iti68AuditDataset createAndEnrichAuditDatasetFromRequest(AuditStrategy<I
try {
var auditDataset = strategy.createAuditDataset();

var request = exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST, HttpServletRequest.class);
var request = exchange.getMessage(HttpMessage.class).getRequest();
auditDataset.setSourceUserId("unknown");
auditDataset.setDestinationUserId(request.getRequestURL().toString());
auditDataset.setRemoteAddress(request.getRemoteAddr());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.openehealth.ipf.platform.camel.ihe.fhir.iti68bin;

import org.apache.camel.Exchange;
import org.apache.camel.http.common.HttpMessage;
import org.openehealth.ipf.commons.audit.AuditContext;
import org.openehealth.ipf.commons.audit.codes.EventOutcomeIndicator;
import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy;
Expand All @@ -27,8 +28,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.servlet.http.HttpServletRequest;

/**
* Audit Interceptor for ITI-68-BIN. Note that the ParticipantObjectIdentificationType for the document
* is not populated automatically, because the location of the parameters depends upon the actual
Expand Down Expand Up @@ -101,7 +100,7 @@ private FhirAuditDataset createAndEnrichAuditDatasetFromRequest(AuditStrategy<Fh
try {
var auditDataset = strategy.createAuditDataset();

var request = exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST, HttpServletRequest.class);
var request = exchange.getMessage(HttpMessage.class).getRequest();
auditDataset.setSourceUserId("unknown");
auditDataset.setDestinationUserId(request.getRequestURL().toString());
auditDataset.setRemoteAddress(request.getRemoteAddr());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testRetrieveDocument() {
producerTemplate.requestBody("direct:input", null, byte[].class);
fail();
} catch (CamelExecutionException e) {
assertTrue(e.getCause() instanceof HttpOperationFailedException);
assertInstanceOf(HttpOperationFailedException.class, e.getCause());

// Check ATNA Audit
var sender = getAuditSender();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.openehealth.ipf.platform.camel.ihe.fhir.iti68;

import org.apache.camel.Exchange;
import org.apache.camel.http.common.HttpMessage;
import org.openehealth.ipf.commons.audit.AuditContext;
import org.openehealth.ipf.commons.audit.codes.EventOutcomeIndicator;
import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy;
Expand All @@ -27,8 +28,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.servlet.http.HttpServletRequest;

/**
* Audit Interceptor for ITI-68. Note that the ParticipantObjectIdentificationType for the document
* is not populated automatically, because the location of the parametzers depends upon the actual
Expand Down Expand Up @@ -102,7 +101,7 @@ private Iti68AuditDataset createAndEnrichAuditDatasetFromRequest(AuditStrategy<I
try {
var auditDataset = strategy.createAuditDataset();

var request = exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST, HttpServletRequest.class);
var request = exchange.getMessage(HttpMessage.class).getRequest();
auditDataset.setSourceUserId("unknown");
auditDataset.setDestinationUserId(request.getRequestURL().toString());
auditDataset.setRemoteAddress(request.getRemoteAddr());
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<lombok-version>1.18.34</lombok-version>
<mockserver-version>5.15.0</mockserver-version>
<quickcheck-version>0.6</quickcheck-version>
<tomcat-version>10.1.28</tomcat-version>
<tomcat-version>10.1.30</tomcat-version>
<xbean-spring-version>4.25</xbean-spring-version>
</properties>

Expand Down

0 comments on commit 1cac9e0

Please sign in to comment.