From 3a3b81a6a8d175761a207d686b4872e19de3564a Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 8 Dec 2018 17:52:48 -0500 Subject: [PATCH 01/12] Preparing things for OpenJDK 11 --- .travis.yml | 2 +- .../main/java/ca/uhn/fhir/util/PortUtil.java | 41 ++++++++++++++----- .../jpa/model/entity/BaseResourceIndex.java | 20 +++++++++ .../ResourceIndexedSearchParamDate.java | 4 +- .../ResourceIndexedSearchParamNumber.java | 4 +- .../ResourceIndexedSearchParamQuantity.java | 4 +- .../ResourceIndexedSearchParamToken.java | 4 +- .../entity/ResourceIndexedSearchParamUri.java | 4 +- .../fhir/jpa/model/entity/ResourceLink.java | 4 +- hapi-fhir-jpaserver-searchparam/pom.xml | 7 +++- hapi-fhir-testpage-overlay/pom.xml | 6 +++ pom.xml | 10 +++-- src/changes/changes.xml | 2 + 13 files changed, 83 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 333caa4ff7f..4d29c64275c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ dist: trusty language: java jdk: - - oraclejdk9 + - openjdk11 env: global: - MAVEN_OPTS="-Xmx10244M -Xss128M -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=1024M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC" diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java index 93e78db922d..93d709f5639 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.util; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,13 @@ package ca.uhn.fhir.util; * #L% */ +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.ConnectException; +import java.net.InetSocketAddress; import java.net.ServerSocket; +import java.net.Socket; import java.util.LinkedHashSet; /** @@ -28,6 +34,7 @@ import java.util.LinkedHashSet; */ @CoverageIgnore public class PortUtil { + private static final Logger ourLog = LoggerFactory.getLogger(PortUtil.class); private static LinkedHashSet ourPorts = new LinkedHashSet<>(); /* @@ -35,26 +42,38 @@ public class PortUtil { */ private PortUtil() { // nothing - } - + } + /** * This is really only used for unit tests but is included in the library so it can be reused across modules. Use with caution. */ public static int findFreePort() { - ServerSocket server; try { int port; do { - server = new ServerSocket(0); - server.setReuseAddress(true); - port = server.getLocalPort(); - server.close(); + try (ServerSocket server = new ServerSocket(0)) { + server.setReuseAddress(true); + port = server.getLocalPort(); + } } while (!ourPorts.add(port)); - Thread.sleep(500); + // Make sure that we can't connect to the server, meaning the port is + // successfully released + for (int i = 0; i < 20; i++) { + Socket connector = new Socket(); + try { + connector.connect(new InetSocketAddress(port)); + } catch (ConnectException e) { + break; + } + ourLog.info("Port {} is still in use - Waiting...", port); + Thread.sleep(250); + } + + Thread.sleep(1000); + return port; } catch (Exception e) { - //FIXME resource leak throw new Error(e); } } diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java index a80264671cc..c4eb9ad7df9 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.jpa.model.entity; +/*- + * #%L + * HAPI FHIR Model + * %% + * Copyright (C) 2014 - 2018 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import java.io.Serializable; public abstract class BaseResourceIndex implements Serializable { diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java index e0c443fa4d6..9a81e0079c6 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java index 31d29b78cdb..4a43d0eff09 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java index 6689b07f10f..79960e20d73 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java index 90a1fb1ce5e..10d17bcf611 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java index 1cb54974855..bf3d7e969cb 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java index 1c5c9ed537d..af7c517984d 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.entity; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 72b42149b2f..c5ee9d19bfd 100644 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -84,7 +84,6 @@ - org.springframework spring-beans @@ -108,6 +107,12 @@ jscience + + + javax.annotation + javax.annotation-api + + diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index d377521707b..8d41fa54e58 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -88,6 +88,12 @@ test + + + javax.annotation + javax.annotation-api + + aopalliance diff --git a/pom.xml b/pom.xml index 39f7bc79476..6c42c31b450 100644 --- a/pom.xml +++ b/pom.xml @@ -538,8 +538,8 @@ 9.5.1-5_1 1.2_5 1.7.25 - 5.0.8.RELEASE - 2.0.7.RELEASE + 5.1.3.RELEASE + 2.1.3.RELEASE 1.5.6.RELEASE 3.1.4 @@ -628,7 +628,7 @@ com.google.errorprone error_prone_core - 2.3.1 + 2.3.2 com.google.guava @@ -1359,7 +1359,7 @@ com.google.errorprone error_prone_core - 2.3.1 + 2.3.2 org.codehaus.plexus @@ -2222,8 +2222,10 @@ hapi-fhir-cli hapi-fhir-dist examples + example-projects/hapi-fhir-base-example-embedded-ws example-projects/hapi-fhir-standalone-overlay-example example-projects/hapi-fhir-jpaserver-cds-example diff --git a/src/changes/changes.xml b/src/changes/changes.xml index fcb7c7624be..06a29cf65c1 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -12,6 +12,8 @@ latest versions (dependent HAPI modules listed in brackets): +
  • Spring (JPA): 5.0.8 -> 5.1.3
  • +
  • Spring Data (JPA): 2.0.7 -> 2.1.3
  • thymeleaf-spring4 (Testpage Overlay) has been replaced with thymeleaf-spring5
  • ]]> From c2e4773384f22697c47adb12b3b0acbecd549afe Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 8 Dec 2018 17:59:35 -0500 Subject: [PATCH 02/12] Try travis with oracle jdk11 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4d29c64275c..2f255a81a3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ dist: trusty language: java jdk: - - openjdk11 + - oraclejdk11 env: global: - MAVEN_OPTS="-Xmx10244M -Xss128M -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=1024M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC" From 9a97d2166009ef1c74961695741ead731f96ff3f Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 8 Dec 2018 18:06:39 -0500 Subject: [PATCH 03/12] Bump compiler plugin --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6c42c31b450..5c6050e5298 100644 --- a/pom.xml +++ b/pom.xml @@ -534,7 +534,7 @@ 4.0.0.Beta3 5.0.4 9.1.1 - 2.8.4 + 2.8.5 9.5.1-5_1 1.2_5 1.7.25 From 3109a269b3ecabfa0fb78b94f621c2bd1fc81e22 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 8 Dec 2018 18:22:17 -0500 Subject: [PATCH 04/12] Attempting to get ErrorProne working on JDK11 --- .../src/main/java/ca/uhn/fhir/util/PortUtil.java | 4 ++-- pom.xml | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java index 93d709f5639..9b2736154f3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java @@ -9,9 +9,9 @@ package ca.uhn.fhir.util; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/pom.xml b/pom.xml index 5c6050e5298..6f1169a74f7 100644 --- a/pom.xml +++ b/pom.xml @@ -1356,6 +1356,7 @@ 2000m + @@ -2279,7 +2281,17 @@ org.apache.maven.plugins maven-compiler-plugin - javac-with-errorprone + + -XDcompilePolicy=simple + -Xplugin:ErrorProne + + + + com.google.errorprone + error_prone_core + 2.3.2 + + From cda84c4b3a37fbde6ba7fb90384002372a86c48b Mon Sep 17 00:00:00 2001 From: jpoth Date: Fri, 14 Dec 2018 17:11:28 +0100 Subject: [PATCH 05/12] Karaf related fixes for jdk11 --- osgi/hapi-fhir-karaf-features/pom.xml | 22 +++++++++++-------- .../hapi-fhir-karaf-integration-tests/pom.xml | 2 +- .../karaf/dstu3/Dstu3XmlParserTest.java | 5 +++-- pom.xml | 8 +++---- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/osgi/hapi-fhir-karaf-features/pom.xml b/osgi/hapi-fhir-karaf-features/pom.xml index 79738f6f4a8..9aa3455e4d4 100644 --- a/osgi/hapi-fhir-karaf-features/pom.xml +++ b/osgi/hapi-fhir-karaf-features/pom.xml @@ -17,8 +17,12 @@ features.xml - 1.8.6 - 3.2.2 + 1.10.1 + 3.2.2 + 6.0.0 + 1.9.10 + 1.0.1 + 1.10.1 @@ -87,43 +91,43 @@ org.osgi org.osgi.core - 4.3.1 + ${osgi_version} provided org.ops4j.pax.logging pax-logging-api - ${pax-logging-version} + ${pax_logging_version} provided org.ops4j.pax.logging pax-logging-service - ${pax-logging-version} + ${pax_logging_version} provided org.apache.felix org.apache.felix.framework - ${felix-framework-version} + ${felix_framework_version} provided org.apache.felix org.apache.felix.configadmin - 1.8.8 + ${configadmin_version} provided org.apache.aries.blueprint org.apache.aries.blueprint.api - 1.0.1 + ${aries_blueprint_api_version} provided org.apache.aries.blueprint org.apache.aries.blueprint.core - 1.0.1 + ${aries_blueprint_core_version} provided diff --git a/osgi/hapi-fhir-karaf-integration-tests/pom.xml b/osgi/hapi-fhir-karaf-integration-tests/pom.xml index 3e63459153c..3a06288d1f8 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/pom.xml +++ b/osgi/hapi-fhir-karaf-integration-tests/pom.xml @@ -33,7 +33,7 @@ - 4.12.0 + 4.13.1 diff --git a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java index 0f1e15c2108..272f1eb8858 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java +++ b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java @@ -74,6 +74,7 @@ import org.hl7.fhir.dstu3.model.SimpleQuantity; import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.UriType; import org.hl7.fhir.dstu3.model.ValueSet; +import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.Assert; @@ -3196,8 +3197,8 @@ public class Dstu3XmlParserTest { try { ourCtx.newXmlParser().parseResource(Patient.class, input); fail(); - } catch (DataFormatException e) { - assertThat(e.toString(), containsString("Undeclared general entity")); + } catch (FHIRFormatError e) { + assertThat(e.toString(), containsString("unable to parse character reference ")); } } diff --git a/pom.xml b/pom.xml index 6f1169a74f7..5feaac0036f 100644 --- a/pom.xml +++ b/pom.xml @@ -503,13 +503,13 @@ 1.2.0 - 4.1.6 - 1.0.10 + 4.2.2-SNAPSHOT + 1.2 2.6.2 1.11 - 1.4 + 1.6 2.6 - 3.8 + 3.8.1 10.14.2.0 2.0.18 25.0-jre From 226e31b0d9b2f463f10df6cd898dc5cc1f4d2c70 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 22 Dec 2018 15:07:26 -0500 Subject: [PATCH 06/12] Reenable karaf --- pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 5feaac0036f..8b512e78864 100644 --- a/pom.xml +++ b/pom.xml @@ -503,7 +503,7 @@ 1.2.0 - 4.2.2-SNAPSHOT + 4.2.2 1.2 2.6.2 1.11 @@ -2224,10 +2224,8 @@ hapi-fhir-cli hapi-fhir-dist examples - example-projects/hapi-fhir-base-example-embedded-ws example-projects/hapi-fhir-standalone-overlay-example example-projects/hapi-fhir-jpaserver-cds-example From 02608dac19ec19ab15f59ec032b2e7c0125d6919 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 22 Dec 2018 20:00:14 -0500 Subject: [PATCH 07/12] Disable errorprone for now --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2f255a81a3d..911244c5d2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ before_script: script: # - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report # - mvn -Dci=true -e -B -P ALLMODULES,NOPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report - - mvn -Dci=true -e -B -P ALLMODULES,REDUCED_JPA_TESTS,ERRORPRONE,JACOCO clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report; + - mvn -Dci=true -e -B -P ALLMODULES,REDUCED_JPA_TESTS,JACOCO clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report; From 596320d200622fd42851f99323a56dd0ac025b60 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sun, 23 Dec 2018 14:32:37 -0500 Subject: [PATCH 08/12] downgrade JDK once more --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb54f367cd1..11b3449e4f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,9 @@ dist: trusty language: java jdk: - - openjdk11 + - oraclejdk9 + # - openjdk11 + env: global: - MAVEN_OPTS="-Xmx10244M -Xss128M -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=1024M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC" From 28218c9bba1a967c627ca2fa8d4b20087c35fc88 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sun, 23 Dec 2018 15:14:43 -0500 Subject: [PATCH 09/12] Version bump for build JDK --- .travis.yml | 4 ++-- .../test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 11b3449e4f6..0e76d0c2cec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ dist: trusty language: java jdk: - - oraclejdk9 - # - openjdk11 + - openjdk11 + #- oraclejdk9 env: global: diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java index 9e82d7f39f5..467ce1ed30b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java @@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; +import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.util.ExpungeOptions; import ca.uhn.fhir.rest.api.server.IBundleProvider; From 5bcf62ba44c189986442a88fa2bfbe1c5777a51a Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Thu, 27 Dec 2018 10:26:28 -0500 Subject: [PATCH 10/12] Enable logging in karaf tests --- .../hapi-fhir-karaf-integration-tests/pom.xml | 20 +++++++++++++++++-- .../karaf/dstu3/Dstu3JsonParserTest.java | 5 ++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/osgi/hapi-fhir-karaf-integration-tests/pom.xml b/osgi/hapi-fhir-karaf-integration-tests/pom.xml index 3a06288d1f8..871de6ee4f9 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/pom.xml +++ b/osgi/hapi-fhir-karaf-integration-tests/pom.xml @@ -97,7 +97,11 @@ hapi-fhir-validation ${project.version} - + + org.ops4j.pax.url + pax-url-aether + 2.5.4 + @@ -158,7 +162,19 @@ 1.3_1 runtime - + + + org.slf4j + jcl-over-slf4j + + + ch.qos.logback + logback-classic + true + + + + diff --git a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3JsonParserTest.java b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3JsonParserTest.java index 1253568cdbb..44e4244aac4 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3JsonParserTest.java +++ b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3JsonParserTest.java @@ -54,6 +54,7 @@ import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.karaf.options.LogLevelOption; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; @@ -76,6 +77,7 @@ import static org.ops4j.pax.exam.CoreOptions.mavenBundle; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.when; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; /** @@ -97,7 +99,8 @@ public class Dstu3JsonParserTest { mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(), when(false) .useOptions( - debugConfiguration("5005", true)) + debugConfiguration("5005", true)), + logLevel(LogLevelOption.LogLevel.DEBUG) ); } From 1bd63f44544d02d1044db654288fcd8495c48542 Mon Sep 17 00:00:00 2001 From: jpoth Date: Tue, 8 Jan 2019 18:16:43 +0100 Subject: [PATCH 11/12] Add JKD11 support for Karaf --- .../main/java/ca/uhn/fhir/util/XmlUtil.java | 3 + .../src/main/resources/features.xml | 21 ++---- .../hapi-fhir-karaf-integration-tests/pom.xml | 60 ++++++++------- .../integration/karaf/PaxExamOptions.java | 75 ++++++++++++++++--- .../karaf/dstu3/Dstu3XmlParserTest.java | 5 +- 5 files changed, 112 insertions(+), 52 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java index 6c166b1ecdf..2213bdc0246 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java @@ -1687,6 +1687,9 @@ public class XmlUtil { XMLInputFactory inputFactory; try { inputFactory = XMLInputFactory.newInstance(); + if (inputFactory.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) { + inputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, true); + } throwUnitTestExceptionIfConfiguredToDoSo(); } catch (Throwable e) { throw new ConfigurationException("Unable to initialize StAX - XML processing is disabled", e); diff --git a/osgi/hapi-fhir-karaf-features/src/main/resources/features.xml b/osgi/hapi-fhir-karaf-features/src/main/resources/features.xml index b9ebbd52150..0f13e59ba10 100644 --- a/osgi/hapi-fhir-karaf-features/src/main/resources/features.xml +++ b/osgi/hapi-fhir-karaf-features/src/main/resources/features.xml @@ -56,12 +56,8 @@ hapi-fhir hapi-fhir-utilities - - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version} - - - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version} - + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version} + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version} mvn:ca.uhn.hapi.fhir/hapi-fhir-structures-hl7org-dstu2/${project.version} @@ -84,18 +80,17 @@ - - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version} - - - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version} - + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version} + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version} mvn:org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle/${aries_spifly_version} mvn:com.google.code.findbugs/jsr305/${jsr305_version} mvn:com.helger/ph-commons/${ph_commons_version} mvn:com.helger/ph-collection/${ph_commons_version} + + mvn:javax.jws/javax.jws-api/1.1 mvn:com.helger/ph-xml/${ph_commons_version} - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/${jaxb_bundle_version} + mvn:com.sun.xml.bind/jaxb-impl/${jaxb_core_version} + mvn:com.sun.xml.bind/jaxb-core/${jaxb_core_version} mvn:com.helger/ph-jaxb/${ph_commons_version} mvn:com.helger/ph-schematron/${ph_schematron_version} diff --git a/osgi/hapi-fhir-karaf-integration-tests/pom.xml b/osgi/hapi-fhir-karaf-integration-tests/pom.xml index 871de6ee4f9..1eb55e4244d 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/pom.xml +++ b/osgi/hapi-fhir-karaf-integration-tests/pom.xml @@ -97,11 +97,11 @@ hapi-fhir-validation ${project.version}
    - - org.ops4j.pax.url - pax-url-aether - 2.5.4 - + + org.ops4j.pax.url + pax-url-aether + 2.5.4 + @@ -129,8 +129,8 @@ tar.gz - org.ops4j.pax.logging - pax-logging-api + * + * @@ -150,30 +150,35 @@
    org.apache.karaf.features - enterprise + standard ${apache_karaf_version} features xml test - - org.apache.servicemix.bundles - org.apache.servicemix.bundles.hamcrest - 1.3_1 - runtime - - - - org.slf4j - jcl-over-slf4j - - - ch.qos.logback - logback-classic - true - - - + + org.apache.karaf.features + enterprise + ${apache_karaf_version} + features + xml + test + + + org.apache.servicemix.bundles + org.apache.servicemix.bundles.hamcrest + 1.3_1 + runtime + + + org.slf4j + jcl-over-slf4j + + + ch.qos.logback + logback-classic + true + @@ -197,6 +202,9 @@ 1 false + + ${apache_karaf_version} + diff --git a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/PaxExamOptions.java b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/PaxExamOptions.java index fd73eb00156..e82ac252834 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/PaxExamOptions.java +++ b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/PaxExamOptions.java @@ -1,12 +1,19 @@ package ca.uhn.fhir.tests.integration.karaf; +import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil; +import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; import org.ops4j.pax.exam.karaf.options.LogLevelOption; import org.ops4j.pax.exam.options.DefaultCompositeOption; +import org.ops4j.pax.exam.options.extra.VMOption; import java.io.File; +import java.net.ServerSocket; import static org.ops4j.pax.exam.CoreOptions.maven; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; +import static org.ops4j.pax.exam.CoreOptions.when; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; @@ -16,15 +23,51 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; public enum PaxExamOptions { KARAF( karafDistributionConfiguration() - .frameworkUrl( - maven() - .groupId("org.apache.karaf") - .artifactId("apache-karaf") - .versionAsInProject() - .type("zip")) - .name("Apache Karaf") - .useDeployFolder(false) - .unpackDirectory(new File("target/paxexam/unpack/")), + .frameworkUrl( + maven() + .groupId("org.apache.karaf") + .artifactId("apache-karaf") + .versionAsInProject() + .type("tar.gz")) + .name("Apache Karaf") + .useDeployFolder(false) + .unpackDirectory(new File("target/paxexam/unpack/")), + when(JavaVersionUtil.getMajorVersion() >= 9) + .useOptions( + systemProperty("pax.exam.osgi.unresolved.fail").value("true"), + systemProperty("java.awt.headless").value("true"), + KarafDistributionOption.logLevel(LogLevelOption.LogLevel.INFO), + KarafDistributionOption.editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", Integer.toString(getAvailablePort(9080, 9999))), + KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", Integer.toString(getAvailablePort(1099, 9999))), + KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", Integer.toString(getAvailablePort(44444, 66666))), + KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", Integer.toString(getAvailablePort(8101, 8888))), + new VMOption("--add-reads=java.xml=java.logging"), + new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"), + new VMOption("--patch-module"), + new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + + System.getProperty("karaf.version", "4.2.2") + ".jar"), + new VMOption("--patch-module"), + new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" + + System.getProperty("karaf.version", "4.2.2") + ".jar"), + new VMOption("--add-opens"), + new VMOption("java.base/java.security=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.base/java.net=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.base/java.lang=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.base/java.util=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"), + new VMOption("--add-opens"), + new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"), + new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"), + new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"), + new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"), + new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"), + new VMOption("-classpath"), + new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*") + ), keepRuntimeFolder(), configureConsole().ignoreLocalConsole(), logLevel(LogLevelOption.LogLevel.INFO) @@ -33,7 +76,7 @@ public enum PaxExamOptions { features( maven() .groupId("org.apache.karaf.features") - .artifactId("enterprise") + .artifactId("standard") .type("xml") .classifier("features") .versionAsInProject(), @@ -136,6 +179,18 @@ public enum PaxExamOptions { this.options = options; } + public static int getAvailablePort(int min, int max) { + for (int i = min; i <= max; i++) { + try (ServerSocket socket = new ServerSocket(i)) { + return socket.getLocalPort(); + } catch (Exception e) { + System.err.println("Port " + i + " not available, trying next one"); + continue; // try next port + } + } + throw new IllegalStateException("Can't find available network ports"); + } + public Option option() { return new DefaultCompositeOption(options); } diff --git a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java index 272f1eb8858..0f1e15c2108 100644 --- a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java +++ b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu3/Dstu3XmlParserTest.java @@ -74,7 +74,6 @@ import org.hl7.fhir.dstu3.model.SimpleQuantity; import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.UriType; import org.hl7.fhir.dstu3.model.ValueSet; -import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.Assert; @@ -3197,8 +3196,8 @@ public class Dstu3XmlParserTest { try { ourCtx.newXmlParser().parseResource(Patient.class, input); fail(); - } catch (FHIRFormatError e) { - assertThat(e.toString(), containsString("unable to parse character reference ")); + } catch (DataFormatException e) { + assertThat(e.toString(), containsString("Undeclared general entity")); } } From bef3b956d86b76d8c0a4e33c946784e3e1b28cd4 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Wed, 9 Jan 2019 13:48:31 -0500 Subject: [PATCH 12/12] Add changelog entry --- src/changes/changes.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index ae549874c08..7f77730f380 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -7,6 +7,11 @@ + + HAPI FHIR is now built using OpenJDK 11. Users are recommended to upgrade to this version + of Java if this is feasible. We are not yet dropping support for Java 8 (aka 1.8), although + we may do so in an upcoming release. + The version of a few dependencies have been bumped to the latest versions (dependent HAPI modules listed in brackets):