From dd8ebc193560208726c10328b8c45f4ad45e4fb1 Mon Sep 17 00:00:00 2001
From: Thomas Papke <web@thopap.de>
Date: Mon, 29 Apr 2024 19:54:16 +0200
Subject: [PATCH] #414 Re-Enable Test

---
 commons/ihe/hl7v3model/pom.xml                |  7 +++++
 .../responses/PixV3QueryResponseTest.java     |  2 --
 .../PixV3QueryRequestTransformerTest.java     |  2 --
 .../PixV3QueryResponseTransformerTest.java    | 30 ++++++++++---------
 .../xacml20/chppq/MessageValidationTest.java  |  9 +++---
 5 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/commons/ihe/hl7v3model/pom.xml b/commons/ihe/hl7v3model/pom.xml
index e66fb5779d..92e546e73e 100644
--- a/commons/ihe/hl7v3model/pom.xml
+++ b/commons/ihe/hl7v3model/pom.xml
@@ -25,6 +25,13 @@
             <groupId>net.sf.saxon</groupId>
             <artifactId>Saxon-HE</artifactId>
         </dependency>
+        
+        <!-- Test dependencies -->
+        <dependency>
+            <groupId>org.glassfish.jaxb</groupId>
+            <artifactId>jaxb-runtime</artifactId>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
 
diff --git a/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/responses/PixV3QueryResponseTest.java b/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/responses/PixV3QueryResponseTest.java
index 3d3d5c6ea4..f201a8d1f3 100644
--- a/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/responses/PixV3QueryResponseTest.java
+++ b/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/responses/PixV3QueryResponseTest.java
@@ -16,14 +16,12 @@
 package org.openehealth.ipf.commons.ihe.hl7v3.core.responses;
 
 import net.ihe.gazelle.hl7v3.datatypes.II;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.openehealth.ipf.commons.ihe.hl7v3.core.metadata.Device;
 import org.openehealth.ipf.commons.ihe.hl7v3.core.requests.PixV3QueryRequest;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-@Disabled("disabled due to javax dependency in gazelle lib")
 public class PixV3QueryResponseTest {
 
     @Test
diff --git a/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/requests/PixV3QueryRequestTransformerTest.java b/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/requests/PixV3QueryRequestTransformerTest.java
index 4fc4e54fc7..0bf9183026 100644
--- a/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/requests/PixV3QueryRequestTransformerTest.java
+++ b/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/requests/PixV3QueryRequestTransformerTest.java
@@ -17,7 +17,6 @@
 
 import net.ihe.gazelle.hl7v3.datatypes.*;
 import net.ihe.gazelle.hl7v3.prpain201309UV02.PRPAIN201309UV02Type;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.openehealth.ipf.commons.ihe.core.HL7DTM;
 import org.openehealth.ipf.commons.ihe.hl7v3.core.metadata.Device;
@@ -33,7 +32,6 @@
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-@Disabled("disabled due to javax dependency in gazelle lib")
 public class PixV3QueryRequestTransformerTest {
 
     @Test
diff --git a/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/responses/PixV3QueryResponseTransformerTest.java b/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/responses/PixV3QueryResponseTransformerTest.java
index bf3de07b51..05a827ab33 100644
--- a/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/responses/PixV3QueryResponseTransformerTest.java
+++ b/commons/ihe/hl7v3model/src/test/java/org/openehealth/ipf/commons/ihe/hl7v3/core/transform/responses/PixV3QueryResponseTransformerTest.java
@@ -15,28 +15,30 @@
  */
 package org.openehealth.ipf.commons.ihe.hl7v3.core.transform.responses;
 
-import org.openehealth.ipf.commons.ihe.hl7v3.core.transform.requests.PixV3QueryRequestTransformerTest;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+import jakarta.xml.bind.JAXBContext;
+import jakarta.xml.bind.Marshaller;
 import net.ihe.gazelle.hl7v3.coctmt150003UV03.COCTMT150003UV03Organization;
-import net.ihe.gazelle.hl7v3.datatypes.*;
+import net.ihe.gazelle.hl7v3.datatypes.CE;
+import net.ihe.gazelle.hl7v3.datatypes.ED;
+import net.ihe.gazelle.hl7v3.datatypes.II;
+import net.ihe.gazelle.hl7v3.datatypes.ON;
+import net.ihe.gazelle.hl7v3.datatypes.PN;
+import net.ihe.gazelle.hl7v3.datatypes.ST;
 import net.ihe.gazelle.hl7v3.mccimt000300UV01.MCCIMT000300UV01AcknowledgementDetail;
 import net.ihe.gazelle.hl7v3.prpain201310UV02.PRPAIN201310UV02Type;
 import net.ihe.gazelle.hl7v3.prpamt201304UV02.PRPAMT201304UV02OtherIDs;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.openehealth.ipf.commons.ihe.core.HL7DTM;
 import org.openehealth.ipf.commons.ihe.hl7v3.core.responses.PixV3QueryResponse;
+import org.openehealth.ipf.commons.ihe.hl7v3.core.transform.requests.PixV3QueryRequestTransformerTest;
 
-import jakarta.xml.bind.JAXBContext;
-import jakarta.xml.bind.Marshaller;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-@Disabled("disabled due to javax dependency in gazelle lib")
 public class PixV3QueryResponseTransformerTest {
 
     @Test
diff --git a/commons/ihe/xacml20/impl/src/test/java/org/openehealth/ipf/commons/ihe/xacml20/chppq/MessageValidationTest.java b/commons/ihe/xacml20/impl/src/test/java/org/openehealth/ipf/commons/ihe/xacml20/chppq/MessageValidationTest.java
index 2efc246821..afa2c256f7 100644
--- a/commons/ihe/xacml20/impl/src/test/java/org/openehealth/ipf/commons/ihe/xacml20/chppq/MessageValidationTest.java
+++ b/commons/ihe/xacml20/impl/src/test/java/org/openehealth/ipf/commons/ihe/xacml20/chppq/MessageValidationTest.java
@@ -16,11 +16,11 @@
 package org.openehealth.ipf.commons.ihe.xacml20.chppq;
 
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.openehealth.ipf.commons.ihe.xacml20.Xacml20Utils;
 
 import jakarta.xml.bind.JAXBElement;
+import jakarta.xml.bind.JAXBIntrospector;
 
 import static org.openehealth.ipf.commons.ihe.xacml20.Xacml20MessageValidator.*;
 
@@ -28,7 +28,6 @@
  * @since 3.5.1
  * @author Dmytro Rud
  */
-@Disabled("disabled due to javax dependency in herasaf lib")
 public class MessageValidationTest {
 
     @BeforeAll
@@ -40,10 +39,10 @@ private static <T> T loadFile(String fn) throws Exception {
         var stream = MessageValidationTest.class.getClassLoader().getResourceAsStream("messages/" + fn);
         var unmarshaller = Xacml20Utils.JAXB_CONTEXT.createUnmarshaller();
         var object = unmarshaller.unmarshal(stream);
-        if (object instanceof JAXBElement) {
-            object = ((JAXBElement) object).getValue();
+        if (object instanceof JAXBElement objectValue) {
+            object = objectValue;
         }
-        return (T) object;
+        return (T) JAXBIntrospector.getValue(object);
     }
 
     @Test