From 7688be12315a4b69b9eec94c12e81d7a2e3b1429 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Thu, 3 May 2018 18:34:29 -0400
Subject: [PATCH 01/31] Work on getting java9 building
---
hapi-fhir-client-okhttp/pom.xml | 18 +--
hapi-fhir-jaxrsserver-base/pom.xml | 21 ++++
.../AbstractJaxRsConformanceProvider.java | 11 +-
.../server/AbstractJaxRsResourceProvider.java | 4 +-
.../server/util/JaxRsMethodBindings.java | 2 +-
.../client/GenericJaxRsClientDstu2Test.java | 103 ++++++++---------
.../client/GenericJaxRsClientDstu3Test.java | 106 +++++++++---------
.../client/JaxRsRestfulClientFactoryTest.java | 69 ++++++------
...xRsConformanceProviderDstu2Hl7OrgTest.java | 42 ++++---
...ctJaxRsConformanceProviderDstu2_1Test.java | 44 ++++----
...ractJaxRsConformanceProviderDstu3Test.java | 42 ++++---
...bstractJaxRsConformanceProviderR4Test.java | 42 ++++---
.../AbstractJaxRsConformanceProviderTest.java | 42 ++++---
...bstractJaxRsResourceProviderDstu3Test.java | 40 ++++---
.../AbstractJaxRsResourceProviderTest.java | 54 +++++----
.../server/util/JaxRsRequestDstu3Test.java | 50 ++++-----
.../jaxrs/server/util/JaxRsRequestTest.java | 49 ++++----
hapi-fhir-jaxrsserver-example/pom.xml | 20 +---
.../JaxRsPatientProviderDstu3Test.java | 6 +-
.../example/JaxRsPatientProviderTest.java | 6 +-
hapi-fhir-jpaserver-base/pom.xml | 12 +-
.../uhn/fhir/rest/server/SearchDstu2Test.java | 65 ++++++-----
.../java/ca/uhn/fhir/util/PatternMatcher.java | 68 -----------
.../rest/server/SearchHl7OrgDstu2Test.java | 34 +++---
.../ca/uhn/fhir/util/PatternMatcherB.java | 68 -----------
.../rest/client/LoggingInterceptorTest.java | 45 ++++----
pom.xml | 29 ++++-
27 files changed, 484 insertions(+), 608 deletions(-)
delete mode 100644 hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcher.java
delete mode 100644 hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcherB.java
diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml
index 8d89fc9e33d..09406e4c5f1 100644
--- a/hapi-fhir-client-okhttp/pom.xml
+++ b/hapi-fhir-client-okhttp/pom.xml
@@ -80,23 +80,13 @@
test
- org.glassfish.jersey.core
- jersey-server
+ org.jboss.resteasy
+ resteasy-jaxrs
test
- org.glassfish.jersey.containers
- jersey-container-servlet-core
- test
-
-
- org.glassfish.jersey.containers
- jersey-container-jetty-http
- test
-
-
- org.glassfish.jersey.media
- jersey-media-moxy
+ org.jboss.resteasy
+ resteasy-client
test
diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml
index 9b982f73cd8..6730331ca59 100644
--- a/hapi-fhir-jaxrsserver-base/pom.xml
+++ b/hapi-fhir-jaxrsserver-base/pom.xml
@@ -88,6 +88,11 @@
provided
+
+ javax.annotation
+ javax.annotation-api
+
+
org.codehaus.woodstox
@@ -109,6 +114,20 @@
jetty-servlet
test
+
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+ test
+
+
+ org.jboss.resteasy
+ resteasy-client
+ test
+
+
+
+
ch.qos.logback
logback-classic
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java
index 04c4c03a725..5c0a63cfc60 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java
@@ -69,6 +69,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
private org.hl7.fhir.dstu2016may.model.Conformance myDstu2_1Conformance;
private org.hl7.fhir.instance.model.Conformance myDstu2Hl7OrgConformance;
private ca.uhn.fhir.model.dstu2.resource.Conformance myDstu2Conformance;
+ private boolean myInitialized;
/**
* Constructor allowing the description, servername and server to be set
@@ -112,7 +113,11 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
* conformance
*/
@PostConstruct
- protected void setUpPostConstruct() {
+ protected synchronized void setUpPostConstruct() {
+ if (myInitialized) {
+ return;
+ }
+
for (Entry, IResourceProvider> provider : getProviders().entrySet()) {
addProvider(provider.getValue(), provider.getKey());
}
@@ -155,6 +160,8 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
default:
throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion);
}
+
+ myInitialized = true;
}
/**
@@ -184,6 +191,8 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
@GET
@Path("/metadata")
public Response conformance() throws IOException {
+ setUpPostConstruct();
+
Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA);
IRestfulResponse response = request.build().getResponse();
response.addHeader(Constants.HEADER_CORS_ALLOW_ORIGIN, "*");
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
index f2496727e9d..66008729e8e 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
@@ -47,8 +47,8 @@ import ca.uhn.fhir.rest.server.method.BaseMethodBinding;
* a large amount of the fhir api functionality using JAXRS
* @author Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare
*/
-@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
-@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML, Constants.CT_FHIR_JSON_NEW, Constants.CT_FHIR_XML_NEW })
+@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML })
+@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML, Constants.CT_FHIR_JSON_NEW, Constants.CT_FHIR_XML_NEW, "application/octet-stream" })
@Interceptors(JaxRsExceptionInterceptor.class)
public abstract class AbstractJaxRsResourceProvider extends AbstractJaxRsProvider
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java
index d25c0824046..db9d1cd5f06 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java
@@ -118,7 +118,7 @@ public class JaxRsMethodBindings {
*/
public BaseMethodBinding> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
String bindingKey = StringUtils.defaultIfBlank(theBindingKey, DEFAULT_METHOD_KEY);
- ConcurrentHashMap> map = operationBindings.get(operationType);
+ ConcurrentHashMap> map = getMapForOperation(operationType);
if(map == null || !map.containsKey(bindingKey)) {
throw new NotImplementedOperationException("Operation not implemented");
} else {
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu2Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu2Test.java
index bb32b1c0ab1..31ff4627c24 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu2Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu2Test.java
@@ -6,6 +6,7 @@ import static org.junit.Assert.*;
import java.io.IOException;
import java.util.*;
+import javax.annotation.Priority;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -81,7 +82,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testAcceptHeaderFetchConformance() throws Exception {
+ public void testAcceptHeaderFetchConformance() {
IParser p = ourCtx.newXmlParser();
Conformance conf = new Conformance();
@@ -115,7 +116,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testAcceptHeaderPreflightConformance() throws Exception {
+ public void testAcceptHeaderPreflightConformance() {
final IParser p = ourCtx.newXmlParser();
final Conformance conf = new Conformance();
@@ -145,7 +146,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testAcceptHeaderPreflightConformancePreferJson() throws Exception {
+ public void testAcceptHeaderPreflightConformancePreferJson() {
final IParser p = ourCtx.newXmlParser();
final Conformance conf = new Conformance();
@@ -175,7 +176,7 @@ public class GenericJaxRsClientDstu2Test {
@Test
@SuppressWarnings("deprecation")
- public void testConformance() throws Exception {
+ public void testConformance() {
IParser p = ourCtx.newXmlParser();
Conformance conf = new Conformance();
@@ -198,7 +199,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testProviderWhereWeForgotToSetTheContext() throws Exception {
+ public void testProviderWhereWeForgotToSetTheContext() {
JaxRsRestfulClientFactory clientFactory = new JaxRsRestfulClientFactory(); // no ctx
clientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
@@ -214,7 +215,7 @@ public class GenericJaxRsClientDstu2Test {
@Test
- public void testCreate() throws Exception {
+ public void testCreate() {
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
@@ -246,7 +247,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testCreateConditional() throws Exception {
+ public void testCreateConditional() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -290,7 +291,7 @@ public class GenericJaxRsClientDstu2Test {
@Test
- public void testCreatePrefer() throws Exception {
+ public void testCreatePrefer() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -315,7 +316,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testCreateReturningResourceBody() throws Exception {
+ public void testCreateReturningResourceBody() {
Patient p = new Patient();
p.setId("123");
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
@@ -338,7 +339,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testDeleteConditional() throws Exception {
+ public void testDeleteConditional() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
@@ -363,7 +364,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testDelete() throws Exception {
+ public void testDelete() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
@@ -377,7 +378,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testHistory() throws Exception {
+ public void testHistory() {
final String msg = getPatientFeedWithOneResult();
@@ -474,7 +475,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testMetaAdd() throws Exception {
+ public void testMetaAdd() {
IParser p = ourCtx.newXmlParser();
MetaDt inMeta = new MetaDt().addProfile("urn:profile:in");
@@ -507,7 +508,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testMetaGet() throws Exception {
+ public void testMetaGet() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -563,7 +564,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationAsGetWithInParameters() throws Exception {
+ public void testOperationAsGetWithInParameters() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -642,7 +643,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationAsGetWithNoInParameters() throws Exception {
+ public void testOperationAsGetWithNoInParameters() {
IParser p = ourCtx.newXmlParser();
Parameters outParams = new Parameters();
@@ -713,7 +714,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationWithBundleResponseJson() throws Exception {
+ public void testOperationWithBundleResponseJson() {
ourResponseContentType = Constants.CT_FHIR_JSON;
final String respString = "{\n" + " \"resourceType\":\"Bundle\",\n" + " \"id\":\"8cef5f2a-0ba9-43a5-be26-c8dde9ff0e19\",\n" + " \"base\":\"http://localhost:" + ourPort + "/fhir\"\n" + "}";
@@ -743,7 +744,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationWithBundleResponseXml() throws Exception {
+ public void testOperationWithBundleResponseXml() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -780,7 +781,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationWithInlineParams() throws Exception {
+ public void testOperationWithInlineParams() {
IParser p = ourCtx.newXmlParser();
Parameters outParams = new Parameters();
@@ -899,7 +900,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationWithProfiledDatatypeParam() throws IOException, Exception {
+ public void testOperationWithProfiledDatatypeParam() {
IParser p = ourCtx.newXmlParser();
Parameters outParams = new Parameters();
@@ -948,7 +949,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationWithListOfParameterResponse() throws Exception {
+ public void testOperationWithListOfParameterResponse() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -1023,7 +1024,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testOperationWithNoInParameters() throws Exception {
+ public void testOperationWithNoInParameters() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -1102,7 +1103,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testPageNext() throws Exception {
+ public void testPageNext() {
ourResponseContentType = Constants.CT_FHIR_XML + "; charset=UTF-8";
ourResponseBody = getPatientFeedWithOneResult();
@@ -1129,7 +1130,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testPageNextNoLink() throws Exception {
+ public void testPageNextNoLink() {
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
ca.uhn.fhir.model.dstu2.resource.Bundle sourceBundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
@@ -1141,7 +1142,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testPagePrev() throws Exception {
+ public void testPagePrev() {
@@ -1187,7 +1188,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testReadByUri() throws Exception {
+ public void testReadByUri() {
Patient patient = new Patient();
patient.addName().addFamily("FAM");
@@ -1207,7 +1208,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testReadFluentByUri() throws Exception {
+ public void testReadFluentByUri() {
Patient patient = new Patient();
patient.addName().addFamily("FAM");
@@ -1220,13 +1221,13 @@ public class GenericJaxRsClientDstu2Test {
Patient response;
- response = (Patient) client.read().resource(Patient.class).withUrl(new IdDt("http://localhost:" + ourPort + "/AAA/Patient/123")).execute();
+ response = client.read().resource(Patient.class).withUrl(new IdDt("http://localhost:" + ourPort + "/AAA/Patient/123")).execute();
assertEquals("http://localhost:" + ourPort + "/AAA/Patient/123", ourRequestUri);
assertEquals("FAM", response.getName().get(0).getFamily().get(0).getValue());
}
@Test
- public void testReadUpdatedHeaderDoesntOverwriteResourceValue() throws Exception {
+ public void testReadUpdatedHeaderDoesntOverwriteResourceValue() {
final String input = "\n" +
@@ -1264,7 +1265,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testReadWithElementsParam() throws Exception {
+ public void testReadWithElementsParam() {
String msg = "{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}";
@@ -1287,7 +1288,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testReadWithSummaryInvalid() throws Exception {
+ public void testReadWithSummaryInvalid() {
String msg = "<>>>><<<<>";
@@ -1313,7 +1314,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testReadWithSummaryParamHtml() throws Exception {
+ public void testReadWithSummaryParamHtml() {
String msg = "HELP IM A DIV
";
@@ -1338,7 +1339,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchByString() throws Exception {
+ public void testSearchByString() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1362,7 +1363,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchByUrl() throws Exception {
+ public void testSearchByUrl() {
final String msg = getPatientFeedWithOneResult();
@@ -1469,7 +1470,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchWithElementsParam() throws Exception {
+ public void testSearchWithElementsParam() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1496,7 +1497,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchByPost() throws Exception {
+ public void testSearchByPost() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1533,7 +1534,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchByPostUseJson() throws Exception {
+ public void testSearchByPostUseJson() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1571,7 +1572,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchWithLastUpdated() throws Exception {
+ public void testSearchWithLastUpdated() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1598,7 +1599,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchWithProfileAndSecurity() throws Exception {
+ public void testSearchWithProfileAndSecurity() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1628,7 +1629,7 @@ public class GenericJaxRsClientDstu2Test {
@SuppressWarnings("unused")
@Test
- public void testSearchWithReverseInclude() throws Exception {
+ public void testSearchWithReverseInclude() {
String msg = getPatientFeedWithOneResult();
@@ -1655,7 +1656,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testSearchWithSummaryParam() throws Exception {
+ public void testSearchWithSummaryParam() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1682,7 +1683,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testTransactionWithListOfResources() throws Exception {
+ public void testTransactionWithListOfResources() {
ca.uhn.fhir.model.dstu2.resource.Bundle resp = new ca.uhn.fhir.model.dstu2.resource.Bundle();
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
@@ -1735,7 +1736,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testTransactionWithString() throws Exception {
+ public void testTransactionWithString() {
ca.uhn.fhir.model.dstu2.resource.Bundle req = new ca.uhn.fhir.model.dstu2.resource.Bundle();
Patient patient = new Patient();
@@ -1781,7 +1782,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testTransactionWithTransactionResource() throws Exception {
+ public void testTransactionWithTransactionResource() {
ca.uhn.fhir.model.dstu2.resource.Bundle resp = new ca.uhn.fhir.model.dstu2.resource.Bundle();
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
@@ -1822,7 +1823,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testUpdateConditional() throws Exception {
+ public void testUpdateConditional() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -1877,7 +1878,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testUpdateNonFluent() throws Exception {
+ public void testUpdateNonFluent() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -1907,7 +1908,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testUpdatePrefer() throws Exception {
+ public void testUpdatePrefer() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -1933,7 +1934,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testUpdateReturningResourceBody() throws Exception {
+ public void testUpdateReturningResourceBody() {
Patient p = new Patient();
p.setId("123");
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
@@ -1956,7 +1957,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testValidateFluent() throws Exception {
+ public void testValidateFluent() {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setDiagnostics("FOOBAR");
@@ -2010,7 +2011,7 @@ public class GenericJaxRsClientDstu2Test {
}
@Test
- public void testValidateNonFluent() throws Exception {
+ public void testValidateNonFluent() {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setDiagnostics("FOOBAR");
final String msg = ourCtx.newXmlParser().encodeResourceToString(oo);
@@ -2080,7 +2081,7 @@ public class GenericJaxRsClientDstu2Test {
ourServer.setHandler(new AbstractHandler() {
@Override
- public void handle(String theArg0, Request theRequest, HttpServletRequest theServletRequest, HttpServletResponse theResp) throws IOException, ServletException {
+ public void handle(String theArg0, Request theRequest, HttpServletRequest theServletRequest, HttpServletResponse theResp) throws IOException {
theRequest.setHandled(true);
ourRequestUri = "http:" + theRequest.getHttpURI().toString();
ourRequestUriAll.add(ourRequestUri);
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu3Test.java
index 1492e15e356..2e3d27bb1ef 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/GenericJaxRsClientDstu3Test.java
@@ -79,7 +79,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testAcceptHeaderFetchConformance() throws Exception {
+ public void testAcceptHeaderFetchConformance() {
IParser p = ourCtx.newXmlParser();
CapabilityStatement conf = new CapabilityStatement();
@@ -113,7 +113,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testAcceptHeaderPreflightConformance() throws Exception {
+ public void testAcceptHeaderPreflightConformance() {
final IParser p = ourCtx.newXmlParser();
final CapabilityStatement conf = new CapabilityStatement();
@@ -143,7 +143,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testAcceptHeaderPreflightConformancePreferJson() throws Exception {
+ public void testAcceptHeaderPreflightConformancePreferJson() {
final IParser p = ourCtx.newXmlParser();
final CapabilityStatement conf = new CapabilityStatement();
@@ -172,7 +172,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testConformance() throws Exception {
+ public void testConformance() {
IParser p = ourCtx.newXmlParser();
CapabilityStatement conf = new CapabilityStatement();
@@ -188,7 +188,7 @@ public class GenericJaxRsClientDstu3Test {
//@formatter:off
- CapabilityStatement resp = (CapabilityStatement)client.fetchConformance().ofType(CapabilityStatement.class).execute();
+ CapabilityStatement resp = client.fetchConformance().ofType(CapabilityStatement.class).execute();
//@formatter:on
assertEquals("http://localhost:" + ourPort + "/fhir/metadata", ourRequestUri);
@@ -199,7 +199,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testProviderWhereWeForgotToSetTheContext() throws Exception {
+ public void testProviderWhereWeForgotToSetTheContext() {
JaxRsRestfulClientFactory clientFactory = new JaxRsRestfulClientFactory(); // no ctx
clientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
@@ -215,7 +215,7 @@ public class GenericJaxRsClientDstu3Test {
@Test
- public void testCreate() throws Exception {
+ public void testCreate() {
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
@@ -247,7 +247,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testCreateConditional() throws Exception {
+ public void testCreateConditional() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -289,7 +289,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testCreate2() throws Exception {
+ public void testCreate2() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
@@ -310,7 +310,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testCreatePrefer() throws Exception {
+ public void testCreatePrefer() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -335,7 +335,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testCreateReturningResourceBody() throws Exception {
+ public void testCreateReturningResourceBody() {
Patient p = new Patient();
p.setId("123");
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
@@ -358,7 +358,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testDeleteConditional() throws Exception {
+ public void testDeleteConditional() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
@@ -384,7 +384,7 @@ public class GenericJaxRsClientDstu3Test {
@SuppressWarnings("deprecation")
@Test
- public void testDeleteNonFluent() throws Exception {
+ public void testDeleteNonFluent() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
@@ -398,7 +398,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testHistory() throws Exception {
+ public void testHistory() {
final String msg = getPatientFeedWithOneResult();
@@ -494,7 +494,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testMetaAdd() throws Exception {
+ public void testMetaAdd() {
IParser p = ourCtx.newXmlParser();
Meta inMeta = new Meta().addProfile("urn:profile:in");
@@ -527,7 +527,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testMetaGet() throws Exception {
+ public void testMetaGet() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -583,7 +583,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationAsGetWithInParameters() throws Exception {
+ public void testOperationAsGetWithInParameters() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -662,7 +662,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationAsGetWithNoInParameters() throws Exception {
+ public void testOperationAsGetWithNoInParameters() {
IParser p = ourCtx.newXmlParser();
Parameters outParams = new Parameters();
@@ -733,7 +733,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationWithBundleResponseJson() throws Exception {
+ public void testOperationWithBundleResponseJson() {
ourResponseContentType = Constants.CT_FHIR_JSON;
final String respString = "{\n" + " \"resourceType\":\"Bundle\",\n" + " \"id\":\"8cef5f2a-0ba9-43a5-be26-c8dde9ff0e19\",\n" + " \"base\":\"http://localhost:" + ourPort + "/fhir\"\n" + "}";
@@ -763,7 +763,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationWithBundleResponseXml() throws Exception {
+ public void testOperationWithBundleResponseXml() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -800,7 +800,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationWithInlineParams() throws Exception {
+ public void testOperationWithInlineParams() {
IParser p = ourCtx.newXmlParser();
Parameters outParams = new Parameters();
@@ -919,7 +919,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationWithProfiledDatatypeParam() throws IOException, Exception {
+ public void testOperationWithProfiledDatatypeParam() {
IParser p = ourCtx.newXmlParser();
Parameters outParams = new Parameters();
@@ -968,7 +968,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationWithListOfParameterResponse() throws Exception {
+ public void testOperationWithListOfParameterResponse() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -1043,7 +1043,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testOperationWithNoInParameters() throws Exception {
+ public void testOperationWithNoInParameters() {
IParser p = ourCtx.newXmlParser();
Parameters inParams = new Parameters();
@@ -1122,7 +1122,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testPageNext() throws Exception {
+ public void testPageNext() {
ourResponseContentType = Constants.CT_FHIR_XML + "; charset=UTF-8";
ourResponseBody = getPatientFeedWithOneResult();
@@ -1149,7 +1149,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testPageNextNoLink() throws Exception {
+ public void testPageNextNoLink() {
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
org.hl7.fhir.dstu3.model.Bundle sourceBundle = new org.hl7.fhir.dstu3.model.Bundle();
@@ -1161,7 +1161,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testPagePrev() throws Exception {
+ public void testPagePrev() {
@@ -1207,7 +1207,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testReadByUri() throws Exception {
+ public void testReadByUri() {
Patient patient = new Patient();
patient.addName().setFamily("FAM");
@@ -1227,7 +1227,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testReadFluentByUri() throws Exception {
+ public void testReadFluentByUri() {
Patient patient = new Patient();
patient.addName().setFamily("FAM");
@@ -1240,13 +1240,13 @@ public class GenericJaxRsClientDstu3Test {
Patient response;
- response = (Patient) client.read().resource(Patient.class).withUrl(new IdType("http://localhost:" + ourPort + "/AAA/Patient/123")).execute();
+ response = client.read().resource(Patient.class).withUrl(new IdType("http://localhost:" + ourPort + "/AAA/Patient/123")).execute();
assertEquals("http://localhost:" + ourPort + "/AAA/Patient/123", ourRequestUri);
assertEquals("FAM", response.getName().get(0).getFamily());
}
@Test
- public void testReadUpdatedHeaderDoesntOverwriteResourceValue() throws Exception {
+ public void testReadUpdatedHeaderDoesntOverwriteResourceValue() {
//@formatter:off
final String input = "\n" +
@@ -1286,7 +1286,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testReadWithElementsParam() throws Exception {
+ public void testReadWithElementsParam() {
String msg = "{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}";
@@ -1311,7 +1311,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testReadWithSummaryInvalid() throws Exception {
+ public void testReadWithSummaryInvalid() {
String msg = "<>>>><<<<>";
@@ -1338,7 +1338,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testReadWithSummaryParamHtml() throws Exception {
+ public void testReadWithSummaryParamHtml() {
String msg = "HELP IM A DIV
";
@@ -1365,7 +1365,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchByString() throws Exception {
+ public void testSearchByString() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1391,7 +1391,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchByUrl() throws Exception {
+ public void testSearchByUrl() {
final String msg = getPatientFeedWithOneResult();
@@ -1498,7 +1498,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchWithElementsParam() throws Exception {
+ public void testSearchWithElementsParam() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1525,7 +1525,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchByPost() throws Exception {
+ public void testSearchByPost() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1562,7 +1562,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchByPostUseJson() throws Exception {
+ public void testSearchByPostUseJson() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1600,7 +1600,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchWithLastUpdated() throws Exception {
+ public void testSearchWithLastUpdated() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1627,7 +1627,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchWithProfileAndSecurity() throws Exception {
+ public void testSearchWithProfileAndSecurity() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1657,7 +1657,7 @@ public class GenericJaxRsClientDstu3Test {
@SuppressWarnings("unused")
@Test
- public void testSearchWithReverseInclude() throws Exception {
+ public void testSearchWithReverseInclude() {
String msg = getPatientFeedWithOneResult();
@@ -1684,7 +1684,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testSearchWithSummaryParam() throws Exception {
+ public void testSearchWithSummaryParam() {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
@@ -1711,7 +1711,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testTransactionWithListOfResources() throws Exception {
+ public void testTransactionWithListOfResources() {
org.hl7.fhir.dstu3.model.Bundle resp = new org.hl7.fhir.dstu3.model.Bundle();
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
@@ -1764,7 +1764,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testTransactionWithString() throws Exception {
+ public void testTransactionWithString() {
org.hl7.fhir.dstu3.model.Bundle req = new org.hl7.fhir.dstu3.model.Bundle();
Patient patient = new Patient();
@@ -1810,7 +1810,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testTransactionWithTransactionResource() throws Exception {
+ public void testTransactionWithTransactionResource() {
org.hl7.fhir.dstu3.model.Bundle resp = new org.hl7.fhir.dstu3.model.Bundle();
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
@@ -1851,7 +1851,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testUpdateConditional() throws Exception {
+ public void testUpdateConditional() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -1906,7 +1906,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testUpdateNonFluent() throws Exception {
+ public void testUpdateNonFluent() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -1936,7 +1936,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testUpdatePrefer() throws Exception {
+ public void testUpdatePrefer() {
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
@@ -1962,7 +1962,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testUpdateReturningResourceBody() throws Exception {
+ public void testUpdateReturningResourceBody() {
Patient p = new Patient();
p.setId("123");
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
@@ -1985,7 +1985,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testValidateFluent() throws Exception {
+ public void testValidateFluent() {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setDiagnostics("FOOBAR");
@@ -2039,7 +2039,7 @@ public class GenericJaxRsClientDstu3Test {
}
@Test
- public void testValidateNonFluent() throws Exception {
+ public void testValidateNonFluent() {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setDiagnostics("FOOBAR");
final String msg = ourCtx.newXmlParser().encodeResourceToString(oo);
@@ -2109,7 +2109,7 @@ public class GenericJaxRsClientDstu3Test {
ourServer.setHandler(new AbstractHandler() {
@Override
- public void handle(String theArg0, Request theRequest, HttpServletRequest theServletRequest, HttpServletResponse theResp) throws IOException, ServletException {
+ public void handle(String theArg0, Request theRequest, HttpServletRequest theServletRequest, HttpServletResponse theResp) throws IOException {
theRequest.setHandled(true);
ourRequestUri = "http:" + theRequest.getHttpURI().toString();
ourRequestUriAll.add(ourRequestUri);
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java
index 944e0be9fe2..c90ef75f85d 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java
@@ -3,51 +3,56 @@ package ca.uhn.fhir.jaxrs.client;
import ca.uhn.fhir.context.FhirContext;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ws.rs.client.Client;
import java.util.ArrayList;
import java.util.Arrays;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.*;
/**
* Created by Sebastien Riviere on 31/07/2017.
*/
public class JaxRsRestfulClientFactoryTest {
- private final FhirContext context = FhirContext.forDstu2();
- private JaxRsRestfulClientFactory factory;
+ private static final Logger ourLog = LoggerFactory.getLogger(JaxRsRestfulClientFactoryTest.class);
+ private final FhirContext context = FhirContext.forDstu2();
+ private JaxRsRestfulClientFactory factory;
- @Before
- public void setUp() {
- factory = new JaxRsRestfulClientFactory(context);
- }
+ @Test
+ public void emptyConstructorTest() {
+ assertNotNull(new JaxRsRestfulClientFactory());
+ }
- @Test
- public void emptyConstructorTest() {
- assertNotNull(new JaxRsRestfulClientFactory());
- }
+ @Test
+ public void getDefaultNativeClientTest() {
+ assertNotNull(factory.getNativeClientClient());
+ }
- @Test
- public void getDefaultNativeClientTest() {
- assertNotNull(factory.getNativeClientClient());
- }
+ @Test
+ public void getNativeClientEmptyRegisteredComponentListTest() {
+ factory.register(new ArrayList<>());
+ final Client result = factory.getNativeClientClient();
+ assertNotNull(result);
+ ourLog.info("Classes: {}", result.getConfiguration().getClasses());
+ assertThat(result.getConfiguration().getClasses(), not(hasItem(ca.uhn.fhir.jaxrs.client.MyFilter.class)));
+ }
- @Test
- public void getNativeClientEmptyRegisteredComponentListTest() {
- factory.register(new ArrayList>());
- final Client result = factory.getNativeClientClient();
- assertNotNull(result);
- assertTrue(result.getConfiguration().getClasses().isEmpty());
- }
+ @Test
+ public void getNativeClientRegisteredComponentListTest() {
+ factory.register(Arrays.asList(MyFilter.class, String.class));
+ final Client result = factory.getNativeClientClient();
+ assertNotNull(result);
+ ourLog.info("Classes: {}", result.getConfiguration().getClasses());
+ assertThat(result.getConfiguration().getClasses(), hasItem(ca.uhn.fhir.jaxrs.client.MyFilter.class));
+ }
- @Test
- public void getNativeClientRegisteredComponentListTest() {
- factory.register(Arrays.asList(MyFilter.class, String.class));
- final Client result = factory.getNativeClientClient();
- assertNotNull(result);
- assertEquals(1, result.getConfiguration().getClasses().size());
- }
-}
\ No newline at end of file
+ @Before
+ public void setUp() {
+ factory = new JaxRsRestfulClientFactory(context);
+ }
+}
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java
index eac40d8bce2..3d616361585 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2Hl7OrgTest.java
@@ -1,27 +1,24 @@
package ca.uhn.fhir.jaxrs.server;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2Hl7Org;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2Hl7Org;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.server.IResourceProvider;
+import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
+import org.junit.Before;
+import org.junit.Test;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.*;
-
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2Hl7Org;
-import org.glassfish.jersey.internal.MapPropertiesDelegate;
-import org.glassfish.jersey.server.ContainerRequest;
-import org.junit.Before;
-import org.junit.Test;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2Hl7Org;
-import ca.uhn.fhir.rest.api.Constants;
-import ca.uhn.fhir.rest.server.IResourceProvider;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
@@ -29,16 +26,17 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
private static final String REQUESTURI = BASEURI + "/metadata";
AbstractJaxRsConformanceProvider provider;
private ConcurrentHashMap, IResourceProvider> providers;
- private ContainerRequest headers;
+ private ResteasyHttpHeaders headers;
private MultivaluedHashMap queryParameters;
@Before
public void setUp() throws Exception {
- // headers
- headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
- new MapPropertiesDelegate());
// uri info
- queryParameters = new MultivaluedHashMap();
+ queryParameters = new MultivaluedHashMap<>();
+ // headers
+// headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
+// new MapPropertiesDelegate());
+ headers = new ResteasyHttpHeaders(queryParameters);
providers = new ConcurrentHashMap, IResourceProvider>();
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java
index 115e68d9210..1f90215d370 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu2_1Test.java
@@ -1,27 +1,24 @@
package ca.uhn.fhir.jaxrs.server;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2_1;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2_1;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.server.IResourceProvider;
+import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
+import org.junit.Before;
+import org.junit.Test;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.*;
-
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2_1;
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2_1;
-import org.glassfish.jersey.internal.MapPropertiesDelegate;
-import org.glassfish.jersey.server.ContainerRequest;
-import org.junit.Before;
-import org.junit.Test;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.rest.api.Constants;
-import ca.uhn.fhir.rest.server.IResourceProvider;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderDstu2_1Test {
@@ -29,19 +26,20 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test {
private static final String REQUESTURI = BASEURI + "/metadata";
AbstractJaxRsConformanceProvider provider;
private ConcurrentHashMap, IResourceProvider> providers;
- private ContainerRequest headers;
+ private ResteasyHttpHeaders headers;
private MultivaluedHashMap queryParameters;
@Before
public void setUp() throws Exception {
- // headers
- headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
- new MapPropertiesDelegate());
// uri info
- queryParameters = new MultivaluedHashMap();
+ queryParameters = new MultivaluedHashMap<>();
+ // headers
+// headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
+// new MapPropertiesDelegate());
+ headers = new ResteasyHttpHeaders(queryParameters);
- providers = new ConcurrentHashMap, IResourceProvider>();
+ providers = new ConcurrentHashMap<>();
provider = createConformanceProvider(providers);
}
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java
index d738f76456a..da4cae5a22b 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java
@@ -1,27 +1,24 @@
package ca.uhn.fhir.jaxrs.server;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.*;
-
-import org.glassfish.jersey.internal.MapPropertiesDelegate;
-import org.glassfish.jersey.server.ContainerRequest;
-import org.junit.Before;
-import org.junit.Test;
-
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProvider;
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu3;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.IResourceProvider;
+import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderDstu3Test {
@@ -29,16 +26,17 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
private static final String REQUESTURI = BASEURI + "/metadata";
AbstractJaxRsConformanceProvider provider;
private ConcurrentHashMap, IResourceProvider> providers;
- private ContainerRequest headers;
+ private ResteasyHttpHeaders headers;
private MultivaluedHashMap queryParameters;
@Before
public void setUp() throws Exception {
- // headers
- headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
- new MapPropertiesDelegate());
// uri info
- queryParameters = new MultivaluedHashMap();
+ queryParameters = new MultivaluedHashMap<>();
+ // headers
+// headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
+// new MapPropertiesDelegate());
+ headers = new ResteasyHttpHeaders(queryParameters);
providers = new ConcurrentHashMap, IResourceProvider>();
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java
index 80c86d751d5..8e4fda5ec47 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderR4Test.java
@@ -1,27 +1,24 @@
package ca.uhn.fhir.jaxrs.server;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderR4;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderR4;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.server.IResourceProvider;
+import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
+import org.junit.Before;
+import org.junit.Test;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.*;
-
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderR4;
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderR4;
-import org.glassfish.jersey.internal.MapPropertiesDelegate;
-import org.glassfish.jersey.server.ContainerRequest;
-import org.junit.Before;
-import org.junit.Test;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.rest.api.Constants;
-import ca.uhn.fhir.rest.server.IResourceProvider;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderR4Test {
@@ -29,16 +26,17 @@ public class AbstractJaxRsConformanceProviderR4Test {
private static final String REQUESTURI = BASEURI + "/metadata";
AbstractJaxRsConformanceProvider provider;
private ConcurrentHashMap, IResourceProvider> providers;
- private ContainerRequest headers;
+ private ResteasyHttpHeaders headers;
private MultivaluedHashMap queryParameters;
@Before
public void setUp() throws Exception {
- // headers
- headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
- new MapPropertiesDelegate());
// uri info
- queryParameters = new MultivaluedHashMap();
+ queryParameters = new MultivaluedHashMap<>();
+ // headers
+// headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
+// new MapPropertiesDelegate());
+ headers = new ResteasyHttpHeaders(queryParameters);
providers = new ConcurrentHashMap, IResourceProvider>();
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java
index 5a8b71377fb..5176f04cb46 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderTest.java
@@ -1,26 +1,23 @@
package ca.uhn.fhir.jaxrs.server;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.*;
-
-import org.glassfish.jersey.internal.MapPropertiesDelegate;
-import org.glassfish.jersey.server.ContainerRequest;
-import org.junit.Before;
-import org.junit.Test;
-
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProvider;
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProvider;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.IResourceProvider;
+import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class AbstractJaxRsConformanceProviderTest {
@@ -28,16 +25,17 @@ public class AbstractJaxRsConformanceProviderTest {
private static final String REQUESTURI = BASEURI + "/metadata";
AbstractJaxRsConformanceProvider provider;
private ConcurrentHashMap, IResourceProvider> providers;
- private ContainerRequest headers;
+ private ResteasyHttpHeaders headers;
private MultivaluedHashMap queryParameters;
@Before
public void setUp() throws Exception {
- // headers
- headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
- new MapPropertiesDelegate());
// uri info
- queryParameters = new MultivaluedHashMap();
+ queryParameters = new MultivaluedHashMap<>();
+ // headers
+// headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
+// new MapPropertiesDelegate());
+ headers = new ResteasyHttpHeaders(queryParameters);
providers = new ConcurrentHashMap, IResourceProvider>();
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
index f90bc8c6bad..1547836ee4c 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
@@ -135,7 +135,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
@Test
public void testConformance() {
final CapabilityStatement conf = client.fetchConformance().ofType(CapabilityStatement.class).execute();
- assertEquals(conf.getRest().get(0).getResource().get(0).getType().toString(), "Patient");
+ assertEquals(conf.getRest().get(0).getResource().get(0).getType(), "Patient");
}
@Test
@@ -149,7 +149,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
client.setEncoding(EncodingEnum.JSON);
final MethodOutcome response = client.create().resource(toCreate).prefer(PreferReturnEnum.REPRESENTATION)
.execute();
- IBaseResource resource = (IBaseResource) response.getResource();
+ IBaseResource resource = response.getResource();
compareResultId(1, resource);
assertEquals("myIdentifier", patientCaptor.getValue().getIdentifier().get(0).getValue());
}
@@ -162,7 +162,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
}
@Test
- public void testConditionalDelete() throws Exception {
+ public void testConditionalDelete() {
when(mock.delete(idCaptor.capture(), conditionalCaptor.capture())).thenReturn(new MethodOutcome());
client.delete().resourceConditionalByType("Patient").where(Patient.IDENTIFIER.exactly().identifier("2")).execute();
assertEquals("Patient?identifier=2&_format=json", conditionalCaptor.getValue());
@@ -187,7 +187,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
assertEquals("outputValue", ((StringType)outParams.getParameter().get(0).getValue()).getValueAsString());
}
- class StringTypeMatcher extends ArgumentMatcher {
+ class StringTypeMatcher implements ArgumentMatcher {
private StringType myStringType;
public StringTypeMatcher(StringType stringType) {
@@ -195,8 +195,8 @@ public class AbstractJaxRsResourceProviderDstu3Test {
}
@Override
- public boolean matches(Object argument) {
- return myStringType.getValue().equals(((StringType)argument).getValue());
+ public boolean matches(StringType argument) {
+ return myStringType.getValue().equals(argument.getValue());
}
}
@@ -214,8 +214,14 @@ public class AbstractJaxRsResourceProviderDstu3Test {
inParams.addParameter().setName("dummy").setValue(new StringType("myAwesomeDummyValue"));
// invoke
- Parameters outParams = client.operation().onInstance(new IdType("Patient", "1")).named("$someCustomOperation")
- .withParameters(inParams).useHttpGet().execute();
+ Parameters outParams = client
+ .operation()
+ .onInstance(new IdType("Patient", "1"))
+ .named("$someCustomOperation")
+ .withParameters(inParams)
+ .useHttpGet()
+ .execute();
+
// verify
assertEquals("outputValue", ((StringType)outParams.getParameter().get(0).getValue()).getValueAsString());
}
@@ -248,7 +254,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
/** */
@Test
public void testSearchPost() {
- when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
+ when(mock.search(ArgumentMatchers.isNull(), ArgumentMatchers.isNull()))
.thenReturn(createPatients(1, 13));
org.hl7.fhir.dstu3.model.Bundle result = client.search().forResource("Patient").usingStyle(SearchStyleEnum.POST)
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class).execute();
@@ -275,12 +281,12 @@ public class AbstractJaxRsResourceProviderDstu3Test {
/** Search - Multi-valued Parameters (ANY/OR) */
@Test
public void testSearchUsingGenericClientBySearchWithMultiValues() {
- when(mock.search(any(StringParam.class), Matchers.isNotNull(StringAndListParam.class)))
+ when(mock.search(any(StringParam.class), ArgumentMatchers.notNull()))
.thenReturn(Arrays.asList(createPatient(1)));
final Bundle results = client.search().forResource(Patient.class)
.where(Patient.ADDRESS.matches().values("Toronto")).and(Patient.ADDRESS.matches().values("Ontario"))
.and(Patient.ADDRESS.matches().values("Canada"))
- .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("SHORTNAME", "TOYS")).returnBundle(Bundle.class).execute();
+ .where(Patient.NAME.matches().value("SHORTNAME")).returnBundle(Bundle.class).execute();
IBaseResource resource = results.getEntry().get(0).getResource();
compareResultId(1, resource);
@@ -291,7 +297,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
@Test
public void testSearchWithPaging() {
// Perform a search
- when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
+ when(mock.search(ArgumentMatchers.isNull(), ArgumentMatchers.isNull()))
.thenReturn(createPatients(1, 13));
final org.hl7.fhir.dstu3.model.Bundle results = client.search().forResource(Patient.class).count(8).returnBundle(org.hl7.fhir.dstu3.model.Bundle.class)
.execute();
@@ -416,17 +422,17 @@ public class AbstractJaxRsResourceProviderDstu3Test {
System.out.println(ourPort);
jettyServer = new Server(ourPort);
jettyServer.setHandler(context);
- ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*");
+ ServletHolder jerseyServlet = context.addServlet(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class, "/*");
jerseyServlet.setInitOrder(0);
//@formatter:off
- jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
+ jerseyServlet.setInitParameter("resteasy.resources",
StringUtils.join(Arrays.asList(
TestJaxRsMockPatientRestProviderDstu3.class.getCanonicalName(),
- JaxRsExceptionInterceptor.class.getCanonicalName(),
+// JaxRsExceptionInterceptor.class.getCanonicalName(),
TestJaxRsConformanceRestProviderDstu3.class.getCanonicalName(),
TestJaxRsMockPageProviderDstu3.class.getCanonicalName()
- ), ";"));
+ ), ","));
//@formatter:on
jettyServer.start();
@@ -441,7 +447,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
}
@AfterClass
- public static void tearDownClass() throws Exception {
+ public static void tearDownClass() {
try {
jettyServer.destroy();
} catch (Exception e) {
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
index 4098e353385..b18367821e7 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
@@ -17,6 +17,7 @@ import org.junit.*;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatcher;
import org.mockito.Matchers;
import ca.uhn.fhir.context.FhirContext;
@@ -127,7 +128,7 @@ public class AbstractJaxRsResourceProviderTest {
@Test
public void testConformance() {
final Conformance conf = client.fetchConformance().ofType(Conformance.class).execute();
- assertEquals(conf.getRest().get(0).getResource().get(0).getType().toString(), "Patient");
+ assertEquals(conf.getRest().get(0).getResource().get(0).getType(), "Patient");
}
@Test
@@ -154,7 +155,7 @@ public class AbstractJaxRsResourceProviderTest {
}
@Test
- public void testConditionalDelete() throws Exception {
+ public void testConditionalDelete() {
when(mock.delete(idCaptor.capture(), conditionalCaptor.capture())).thenReturn(new MethodOutcome());
client.delete().resourceConditionalByType("Patient").where(Patient.IDENTIFIER.exactly().identifier("2")).execute();
assertEquals("Patient?identifier=2&_format=json", conditionalCaptor.getValue());
@@ -226,9 +227,12 @@ public class AbstractJaxRsResourceProviderTest {
/** */
@Test
public void testSearchPost() {
- when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
+ when(mock.search(isNull(), isNull()))
.thenReturn(createPatients(1, 13));
- Bundle result = client.search().forResource("Patient").usingStyle(SearchStyleEnum.POST)
+ Bundle result = client
+ .search()
+ .forResource("Patient")
+ .usingStyle(SearchStyleEnum.POST)
.returnBundle(Bundle.class).execute();
IResource resource = result.getEntry().get(0).getResource();
compareResultId(1, resource);
@@ -253,12 +257,12 @@ public class AbstractJaxRsResourceProviderTest {
/** Search - Multi-valued Parameters (ANY/OR) */
@Test
public void testSearchUsingGenericClientBySearchWithMultiValues() {
- when(mock.search(any(StringParam.class), Matchers.isNotNull(StringAndListParam.class)))
+ when(mock.search(any(StringParam.class), any(StringAndListParam.class)))
.thenReturn(Arrays.asList(createPatient(1)));
Bundle results = client.search().forResource(Patient.class)
.where(Patient.ADDRESS.matches().values("Toronto")).and(Patient.ADDRESS.matches().values("Ontario"))
.and(Patient.ADDRESS.matches().values("Canada"))
- .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("SHORTNAME", "TOYS")).returnBundle(Bundle.class).execute();
+ .where(Patient.NAME.matches().value("SHORTNAME")).returnBundle(Bundle.class).execute();
IResource resource = results.getEntry().get(0).getResource();
compareResultId(1, resource);
@@ -269,7 +273,7 @@ public class AbstractJaxRsResourceProviderTest {
@Test
public void testSearchWithPaging() {
// Perform a search
- when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
+ when(mock.search(isNull(), isNull()))
.thenReturn(createPatients(1, 13));
final Bundle results = client.search().forResource(Patient.class).limitTo(8).returnBundle(Bundle.class)
.execute();
@@ -370,24 +374,17 @@ public class AbstractJaxRsResourceProviderTest {
}
private T withId(final T id) {
- return argThat(new BaseMatcher() {
- @Override
- public void describeTo(Description arg0) {
- }
-
- @Override
- public boolean matches(Object other) {
- IdDt thisId;
- IdDt otherId;
- if (id instanceof IdDt) {
- thisId = (IdDt) id;
- otherId = (IdDt) other;
- } else {
- thisId = ((IResource) id).getId();
- otherId = ((IResource) other).getId();
- }
- return thisId.getIdPartAsLong().equals(otherId.getIdPartAsLong());
+ return argThat(other -> {
+ IdDt thisId;
+ IdDt otherId;
+ if (id instanceof IdDt) {
+ thisId = (IdDt) id;
+ otherId = (IdDt) other;
+ } else {
+ thisId = ((IResource) id).getId();
+ otherId = ((IResource) other).getId();
}
+ return thisId.getIdPartAsLong().equals(otherId.getIdPartAsLong());
});
}
@@ -399,17 +396,16 @@ public class AbstractJaxRsResourceProviderTest {
System.out.println(ourPort);
jettyServer = new Server(ourPort);
jettyServer.setHandler(context);
- ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*");
+ ServletHolder jerseyServlet = context.addServlet(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class, "/*");
jerseyServlet.setInitOrder(0);
//@formatter:off
- jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
+ jerseyServlet.setInitParameter("resteasy.resources",
StringUtils.join(Arrays.asList(
TestJaxRsMockPatientRestProvider.class.getCanonicalName(),
- JaxRsExceptionInterceptor.class.getCanonicalName(),
TestJaxRsConformanceRestProvider.class.getCanonicalName(),
TestJaxRsMockPageProvider.class.getCanonicalName()
- ), ";"));
+ ), ","));
//@formatter:on
jettyServer.start();
@@ -424,7 +420,7 @@ public class AbstractJaxRsResourceProviderTest {
}
@AfterClass
- public static void tearDownClass() throws Exception {
+ public static void tearDownClass() {
try {
jettyServer.destroy();
} catch (Exception e) {
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestDstu3Test.java
index 87331c24b4d..4fde9eaba3b 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestDstu3Test.java
@@ -1,34 +1,22 @@
package ca.uhn.fhir.jaxrs.server.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.UriInfo;
-
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3;
+import ca.uhn.fhir.rest.api.RequestTypeEnum;
+import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import org.apache.commons.lang3.StringUtils;
-import org.glassfish.jersey.internal.MapPropertiesDelegate;
-import org.glassfish.jersey.server.ContainerRequest;
+import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
import org.junit.Before;
import org.junit.Test;
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProvider;
-import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3;
-import ca.uhn.fhir.jaxrs.server.util.JaxRsRequest;
-import ca.uhn.fhir.jaxrs.server.util.JaxRsResponse;
-import ca.uhn.fhir.rest.api.RequestTypeEnum;
-import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
public class JaxRsRequestDstu3Test {
@@ -38,7 +26,7 @@ public class JaxRsRequestDstu3Test {
private JaxRsRequest details;
private MultivaluedMap queryParameters = new MultivaluedHashMap();
- private ContainerRequest headers;
+ private ResteasyHttpHeaders headers;
private TestJaxRsDummyPatientProviderDstu3 provider;
@Before
@@ -52,11 +40,11 @@ public class JaxRsRequestDstu3Test {
String headerValue = "location_value";
String headerValue2 = "location_value_2";
assertTrue(StringUtils.isBlank(details.getHeader(headerKey)));
- headers.header(headerKey, headerValue);
+ queryParameters.add(headerKey, headerValue);
assertEquals(headerValue, details.getHeader(headerKey));
assertEquals(Arrays.asList(headerValue), details.getHeaders(headerKey));
- headers.header(headerKey, headerValue2);
+ queryParameters.add(headerKey, headerValue2);
assertEquals(headerValue, details.getHeader(headerKey));
assertEquals(Arrays.asList(headerValue, headerValue2), details.getHeaders(headerKey));
}
@@ -98,9 +86,9 @@ public class JaxRsRequestDstu3Test {
assertEquals(this.provider, details.getServer());
}
- public JaxRsRequest createRequestDetails() throws URISyntaxException {
- //headers
- headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null, new MapPropertiesDelegate());
+ public JaxRsRequest createRequestDetails() {
+ // headers
+ headers = new ResteasyHttpHeaders(queryParameters);
//uri info
UriInfo uriInfo = mock(UriInfo.class);
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestTest.java
index 7be1a639290..87c55cbcdd4 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequestTest.java
@@ -1,31 +1,22 @@
package ca.uhn.fhir.jaxrs.server.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.commons.lang3.StringUtils;
-import org.glassfish.jersey.internal.MapPropertiesDelegate;
-import org.glassfish.jersey.server.ContainerRequest;
-import org.junit.Before;
-import org.junit.Test;
-
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProvider;
import ca.uhn.fhir.rest.api.RequestTypeEnum;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
+import org.apache.commons.lang3.StringUtils;
+import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
public class JaxRsRequestTest {
@@ -35,7 +26,7 @@ public class JaxRsRequestTest {
private JaxRsRequest details;
private MultivaluedMap queryParameters = new MultivaluedHashMap();
- private ContainerRequest headers;
+ private ResteasyHttpHeaders headers;
private TestJaxRsDummyPatientProvider provider;
@Before
@@ -49,11 +40,11 @@ public class JaxRsRequestTest {
String headerValue = "location_value";
String headerValue2 = "location_value_2";
assertTrue(StringUtils.isBlank(details.getHeader(headerKey)));
- headers.header(headerKey, headerValue);
+ queryParameters.add(headerKey, headerValue);
assertEquals(headerValue, details.getHeader(headerKey));
assertEquals(Arrays.asList(headerValue), details.getHeaders(headerKey));
- headers.header(headerKey, headerValue2);
+ queryParameters.add(headerKey, headerValue2);
assertEquals(headerValue, details.getHeader(headerKey));
assertEquals(Arrays.asList(headerValue, headerValue2), details.getHeaders(headerKey));
}
@@ -96,8 +87,10 @@ public class JaxRsRequestTest {
}
public JaxRsRequest createRequestDetails() throws URISyntaxException {
- //headers
- headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null, new MapPropertiesDelegate());
+ // headers
+// headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
+// new MapPropertiesDelegate());
+ headers = new ResteasyHttpHeaders(queryParameters);
//uri info
UriInfo uriInfo = mock(UriInfo.class);
diff --git a/hapi-fhir-jaxrsserver-example/pom.xml b/hapi-fhir-jaxrsserver-example/pom.xml
index ab8ef5ad04a..41ff8d0aeb7 100644
--- a/hapi-fhir-jaxrsserver-example/pom.xml
+++ b/hapi-fhir-jaxrsserver-example/pom.xml
@@ -58,24 +58,12 @@
${jetty_version}
- org.glassfish.jersey.core
- jersey-server
- ${jersey_version}
+ org.jboss.resteasy
+ resteasy-jaxrs
- org.glassfish.jersey.containers
- jersey-container-servlet-core
- ${jersey_version}
-
-
- org.glassfish.jersey.containers
- jersey-container-jetty-http
- ${jersey_version}
-
-
- org.glassfish.jersey.media
- jersey-media-moxy
- ${jersey_version}
+ org.jboss.resteasy
+ resteasy-client
ch.qos.logback
diff --git a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java
index 994d4a654ae..566c74ff728 100644
--- a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java
@@ -43,15 +43,15 @@ public class JaxRsPatientProviderDstu3Test {
System.out.println(ourPort);
jettyServer = new Server(ourPort);
jettyServer.setHandler(context);
- ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*");
+ ServletHolder jerseyServlet = context.addServlet(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class, "/*");
jerseyServlet.setInitOrder(0);
//@formatter:off
- jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
+ jerseyServlet.setInitParameter("resteasy.resources",
StringUtils.join(Arrays.asList(
JaxRsConformanceProviderDstu3.class.getCanonicalName(),
JaxRsPatientRestProviderDstu3.class.getCanonicalName(),
JaxRsPageProviderDstu3.class.getCanonicalName()
- ), ";"));
+ ), ","));
//@formatter:on
jettyServer.start();
diff --git a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java
index b4e27cf6469..5161b30d1d7 100644
--- a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java
+++ b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java
@@ -47,15 +47,15 @@ public class JaxRsPatientProviderTest {
System.out.println(ourPort);
jettyServer = new Server(ourPort);
jettyServer.setHandler(context);
- ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*");
+ ServletHolder jerseyServlet = context.addServlet(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class, "/*");
jerseyServlet.setInitOrder(0);
//@formatter:off
- jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
+ jerseyServlet.setInitParameter("resteasy.resources",
StringUtils.join(Arrays.asList(
JaxRsConformanceProvider.class.getCanonicalName(),
JaxRsPatientRestProvider.class.getCanonicalName(),
JaxRsPageProvider.class.getCanonicalName()
- ), ";"));
+ ), ","));
//@formatter:on
jettyServer.start();
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 3a3b8566e53..f6e5681a9ca 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -210,7 +210,17 @@
provided
-
+
+
+ javax.annotation
+ javax.annotation-api
+
+
+ javax.xml.bind
+ jaxb-api
+
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
index 3fb369a4113..01b964b3245 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
@@ -1,21 +1,31 @@
package ca.uhn.fhir.rest.server;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.startsWith;
-import static org.hamcrest.Matchers.stringContainsInOrder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.model.api.IResource;
+import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
+import ca.uhn.fhir.model.dstu2.resource.Bundle;
+import ca.uhn.fhir.model.dstu2.resource.Bundle.Link;
+import ca.uhn.fhir.model.dstu2.resource.Patient;
+import ca.uhn.fhir.model.primitive.InstantDt;
+import ca.uhn.fhir.rest.annotation.Create;
+import ca.uhn.fhir.rest.annotation.RequiredParam;
+import ca.uhn.fhir.rest.annotation.ResourceParam;
+import ca.uhn.fhir.rest.annotation.Search;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.api.MethodOutcome;
+import ca.uhn.fhir.rest.api.server.IBundleProvider;
+import ca.uhn.fhir.rest.param.*;
+import ca.uhn.fhir.util.PortUtil;
+import ca.uhn.fhir.util.TestUtil;
+import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.*;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -26,21 +36,18 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.*;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.model.api.IResource;
-import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
-import ca.uhn.fhir.model.dstu2.resource.Bundle;
-import ca.uhn.fhir.model.dstu2.resource.Bundle.Link;
-import ca.uhn.fhir.model.dstu2.resource.Patient;
-import ca.uhn.fhir.model.primitive.InstantDt;
-import ca.uhn.fhir.rest.annotation.*;
-import ca.uhn.fhir.rest.api.Constants;
-import ca.uhn.fhir.rest.api.MethodOutcome;
-import ca.uhn.fhir.rest.api.server.IBundleProvider;
-import ca.uhn.fhir.rest.param.*;
-import ca.uhn.fhir.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
public class SearchDstu2Test {
@@ -142,14 +149,14 @@ public class SearchDstu2Test {
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
- assertThat(responseContent, PatternMatcher.pattern("id value..[0-9a-f-]+\\\""));
+ assertThat(responseContent, matchesPattern("id value..[0-9a-f-]+\\\""));
}
@Test
public void testSearchBlacklist01Failing() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchBlacklist01&ref.black1=value");
HttpResponse status = ourClient.execute(httpGet);
- String responseContent = IOUtils.toString(status.getEntity().getContent());
+ String responseContent = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(400, status.getStatusLine().getStatusCode());
@@ -159,7 +166,7 @@ public class SearchDstu2Test {
public void testSearchBlacklist01Passing() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchBlacklist01&ref.white1=value");
HttpResponse status = ourClient.execute(httpGet);
- String responseContent = IOUtils.toString(status.getEntity().getContent());
+ String responseContent = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcher.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcher.java
deleted file mode 100644
index cf126c64ee7..00000000000
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcher.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package ca.uhn.fhir.util;
-
-import java.util.regex.Pattern;
-
-import org.hamcrest.Factory;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-
-/**
- * Tests if the argument is a {@link CharSequence} that matches a regular expression.
- */
-public class PatternMatcher extends TypeSafeMatcher {
-
- /**
- * Creates a matcher that matches if the examined {@link CharSequence} matches the specified regular expression.
- *
- * For example:
- *
- *
- * assertThat("myStringOfNote", pattern("[0-9]+"))
- *
- *
- * @param regex
- * the regular expression that the returned matcher will use to match any examined {@link CharSequence}
- */
- @Factory
- public static Matcher pattern(String regex) {
- return pattern(Pattern.compile(regex));
- }
-
- /**
- * Creates a matcher that matches if the examined {@link CharSequence} matches the specified {@link Pattern}.
- *
- * For example:
- *
- *
- * assertThat("myStringOfNote", Pattern.compile("[0-9]+"))
- *
- *
- * @param pattern
- * the pattern that the returned matcher will use to match any examined {@link CharSequence}
- */
- @Factory
- public static Matcher pattern(Pattern pattern) {
- return new PatternMatcher(pattern);
- }
-
- private final Pattern pattern;
-
- public PatternMatcher(Pattern pattern) {
- this.pattern = pattern;
- }
-
- @Override
- public boolean matchesSafely(CharSequence item) {
- return pattern.matcher(item).find();
- }
-
- @Override
- public void describeMismatchSafely(CharSequence item, org.hamcrest.Description mismatchDescription) {
- mismatchDescription.appendText("was \"").appendText(String.valueOf(item)).appendText("\"");
- }
-
- @Override
- public void describeTo(org.hamcrest.Description description) {
- description.appendText("a string with pattern \"").appendText(String.valueOf(pattern)).appendText("\"");
- }
-}
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java
index b3c02031c5f..9c4aed53fa5 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java
@@ -1,15 +1,11 @@
package ca.uhn.fhir.rest.server;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.stringContainsInOrder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.model.primitive.InstantDt;
+import ca.uhn.fhir.rest.annotation.Search;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.api.server.IBundleProvider;
+import ca.uhn.fhir.util.PortUtil;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
@@ -22,15 +18,15 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.hl7.fhir.instance.model.Bundle;
import org.hl7.fhir.instance.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.*;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.model.primitive.InstantDt;
-import ca.uhn.fhir.rest.annotation.Search;
-import ca.uhn.fhir.rest.api.Constants;
-import ca.uhn.fhir.rest.api.server.IBundleProvider;
-import ca.uhn.fhir.util.PatternMatcherB;
-import ca.uhn.fhir.util.PortUtil;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
public class SearchHl7OrgDstu2Test {
@@ -86,7 +82,7 @@ public class SearchHl7OrgDstu2Test {
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
- assertThat(responseContent, PatternMatcherB.pattern("id value..[0-9a-f-]+\\\""));
+ assertThat(responseContent, matchesPattern("id value..[0-9a-f-]+\\\""));
}
@Test
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcherB.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcherB.java
deleted file mode 100644
index 814e6c009dd..00000000000
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcherB.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package ca.uhn.fhir.util;
-
-import java.util.regex.Pattern;
-
-import org.hamcrest.Factory;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-
-/**
- * Tests if the argument is a {@link CharSequence} that matches a regular expression.
- */
-public class PatternMatcherB extends TypeSafeMatcher {
-
- /**
- * Creates a matcher that matches if the examined {@link CharSequence} matches the specified regular expression.
- *
- * For example:
- *
- *
- * assertThat("myStringOfNote", pattern("[0-9]+"))
- *
- *
- * @param regex
- * the regular expression that the returned matcher will use to match any examined {@link CharSequence}
- */
- @Factory
- public static Matcher pattern(String regex) {
- return pattern(Pattern.compile(regex));
- }
-
- /**
- * Creates a matcher that matches if the examined {@link CharSequence} matches the specified {@link Pattern}.
- *
- * For example:
- *
- *
- * assertThat("myStringOfNote", Pattern.compile("[0-9]+"))
- *
- *
- * @param pattern
- * the pattern that the returned matcher will use to match any examined {@link CharSequence}
- */
- @Factory
- public static Matcher pattern(Pattern pattern) {
- return new PatternMatcherB(pattern);
- }
-
- private final Pattern pattern;
-
- public PatternMatcherB(Pattern pattern) {
- this.pattern = pattern;
- }
-
- @Override
- public boolean matchesSafely(CharSequence item) {
- return pattern.matcher(item).find();
- }
-
- @Override
- public void describeMismatchSafely(CharSequence item, org.hamcrest.Description mismatchDescription) {
- mismatchDescription.appendText("was \"").appendText(String.valueOf(item)).appendText("\"");
- }
-
- @Override
- public void describeTo(org.hamcrest.Description description) {
- description.appendText("a string with pattern \"").appendText(String.valueOf(pattern)).appendText("\"");
- }
-}
diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java
index 8eff0b9e38e..1fc31bb48b3 100644
--- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java
+++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/LoggingInterceptorTest.java
@@ -1,24 +1,5 @@
package ca.uhn.fhir.rest.client;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.net.URL;
-
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.hl7.fhir.r4.model.IdType;
-import org.hl7.fhir.r4.model.Patient;
-import org.junit.*;
-import org.mockito.ArgumentMatcher;
-import org.slf4j.LoggerFactory;
-
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Read;
@@ -35,6 +16,20 @@ import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.Appender;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Patient;
+import org.junit.*;
+import org.mockito.ArgumentMatcher;
+import org.slf4j.LoggerFactory;
+
+import java.net.URL;
+
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.Mockito.*;
public class LoggingInterceptorTest {
@@ -78,8 +73,8 @@ public class LoggingInterceptorTest {
verify(myMockAppender, times(2)).doAppend(argThat(new ArgumentMatcher() {
@Override
- public boolean matches(final Object argument) {
- String formattedMessage = ((LoggingEvent) argument).getFormattedMessage();
+ public boolean matches(final ILoggingEvent argument) {
+ String formattedMessage = argument.getFormattedMessage();
System.out.flush();
System.out.println("** Got Message: " + formattedMessage);
System.out.flush();
@@ -103,8 +98,8 @@ public class LoggingInterceptorTest {
verify(myMockAppender, times(1)).doAppend(argThat(new ArgumentMatcher() {
@Override
- public boolean matches(final Object argument) {
- String formattedMessage = ((LoggingEvent) argument).getFormattedMessage();
+ public boolean matches(final ILoggingEvent argument) {
+ String formattedMessage = argument.getFormattedMessage();
System.out.println("Verifying: " + formattedMessage);
return formattedMessage.replace("; ", ";").toLowerCase().contains("Content-Type: application/fhir+xml;charset=utf-8".toLowerCase());
}
@@ -118,8 +113,8 @@ public class LoggingInterceptorTest {
verify(myMockAppender, times(1)).doAppend(argThat(new ArgumentMatcher() {
@Override
- public boolean matches(final Object argument) {
- String formattedMessage = ((LoggingEvent) argument).getFormattedMessage();
+ public boolean matches(final ILoggingEvent argument) {
+ String formattedMessage = argument.getFormattedMessage();
System.out.println("Verifying: " + formattedMessage);
return formattedMessage.replace("; ", ";").toLowerCase().contains("Content-Type: application/fhir+xml;charset=utf-8".toLowerCase());
}
diff --git a/pom.xml b/pom.xml
index 0a6b3e4d698..a5be4ba8269 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,7 +79,7 @@
org.mockito
- mockito-all
+ mockito-core
test
@@ -442,7 +442,7 @@
3.6
10.14.1.0
2.0.18
- 23.0
+ 25.0-jre
2.8.1
2.3.0
2.3.0
@@ -461,6 +461,7 @@
1.8
2.7.1
4.4.11
+ 4.0.0.Beta3
9.5.1-5_1
1.2_5
5.0.3.RELEASE
@@ -620,6 +621,11 @@
txtmark
0.16
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
javax.ejb
ejb-api
@@ -944,7 +950,7 @@
javax.json
1.0.4
-
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+ ${resteasy_version}
+
+
+ org.jboss.resteasy
+ resteasy-client
+ ${resteasy_version}
org.jscience
@@ -1011,8 +1027,8 @@
org.mockito
- mockito-all
- 1.10.19
+ mockito-core
+ 2.18.3
org.slf4j
@@ -1270,7 +1286,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.20.1
+ 2.21.0
true
random
@@ -1501,6 +1517,7 @@
org.apache.maven.plugins
maven-enforcer-plugin
+ 1.4.1
enforce-java
From 5be11b53b9b4ee5641a66c2795a0be4fce121627 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Tue, 29 May 2018 09:08:00 -0400
Subject: [PATCH 02/31] Fix java9 support
---
pom.xml | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index a8f2529629d..fc2e0ee5dd0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1024,7 +1024,7 @@
org.glassfish.jersey.media
jersey-media-moxy
${jersey_version}
- -->
+
org.jboss.resteasy
resteasy-jaxrs
@@ -1408,10 +1408,8 @@
org.jacoco
-
- jacoco-maven-plugin
-
- 0.7.9
+ jacoco-maven-plugin
+ 0.8.1
org.apache.maven.plugins
From a52805e5047f0a14c1c0d2af0f296f51ce3fac8d Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 05:45:08 -0400
Subject: [PATCH 03/31] Work on JDK9 support
---
hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 10 ++-
hapi-fhir-jpaserver-base/pom.xml | 29 ++++++++
hapi-fhir-structures-dstu2.1/pom.xml | 23 ++++++
.../uhn/fhir/parser/XmlParserDstu2_1Test.java | 2 +-
.../rest/client/GenericClientDstu2_1Test.java | 4 +-
.../rest/client/RestfulClientFactoryTest.java | 5 +-
.../rest/server/InterceptorDstu2_1Test.java | 54 +++++++-------
hapi-fhir-structures-dstu2/pom.xml | 23 +++++-
.../uhn/fhir/parser/XmlParserDstu2Test.java | 4 +-
.../client/RestfulClientFactoryDstu2Test.java | 5 +-
.../uhn/fhir/rest/server/SearchDstu2Test.java | 2 +-
hapi-fhir-structures-dstu3/pom.xml | 22 ++++++
.../uhn/fhir/parser/JsonParserDstu3Test.java | 10 +--
.../uhn/fhir/parser/XmlParserDstu3Test.java | 2 +-
.../rest/client/GenericClientDstu3Test.java | 4 +-
.../rest/server/InterceptorDstu3Test.java | 73 +++++++++----------
hapi-fhir-structures-hl7org-dstu2/pom.xml | 29 ++++++--
.../rest/server/SearchHl7OrgDstu2Test.java | 2 +-
hapi-fhir-structures-r4/pom.xml | 23 +++++-
.../fhir/rest/client/GenericClientR4Test.java | 4 +-
.../ca/uhn/fhir/util/GraphQLEngineTest.java | 3 +-
hapi-fhir-validation/pom.xml | 22 +++++-
pom.xml | 12 ++-
src/site/markdown/doc_jdk9_guide.md | 3 +
24 files changed, 267 insertions(+), 103 deletions(-)
create mode 100644 src/site/markdown/doc_jdk9_guide.md
diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
index 825a239d6e6..659791daaaf 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
@@ -183,15 +183,19 @@
javax.xml.bind
jaxb-api
- org.glassfish.jaxb
- jaxb-runtime
+ com.sun.xml.bind
+ jaxb-core
+
+
+ com.sun.xml.bind
+ jaxb-impl
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 45871865dc1..c3d0c71b805 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -212,10 +212,22 @@
javax.annotation
javax.annotation-api
+
+ javax.activation
+ javax.activation-api
+
javax.xml.bind
jaxb-api
+
+ com.sun.xml.bind
+ jaxb-core
+
+
+ com.sun.xml.bind
+ jaxb-impl
+
@@ -575,11 +587,28 @@
These have been added as explicit dependencies
as JDK9 no longer includes them by default
-->
+
+ javax.xml.bind
+ jaxb-api
+ ${jaxb_api_version}
+
+
+ com.sun.xml.bind
+ jaxb-core
+ ${jaxb_core_version}
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ ${jaxb_core_version}
+
+
diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml
index badbfe1cdf0..b6669a291b7 100644
--- a/hapi-fhir-structures-dstu2.1/pom.xml
+++ b/hapi-fhir-structures-dstu2.1/pom.xml
@@ -192,6 +192,8 @@
spring-web
test
+
+
com.helger
ph-schematron
@@ -202,6 +204,27 @@
ph-commons
test
+
+ javax.activation
+ javax.activation-api
+ test
+
+
+ javax.xml.bind
+ jaxb-api
+ test
+
+
+ com.sun.xml.bind
+ jaxb-core
+ test
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ test
+
+
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java
index f83dcc8365f..6068e4ab68d 100644
--- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2_1Test.java
@@ -2440,7 +2440,7 @@ public class XmlParserDstu2_1Test {
assertThat(patient.getIdentifier().get(0).getType().getCoding(), IsEmptyCollection.empty());
ArgumentCaptor capt = ArgumentCaptor.forClass(String.class);
- verify(errorHandler, times(1)).unknownAttribute(any(IParseLocation.class), capt.capture());
+ verify(errorHandler, times(1)).unknownAttribute(nullable(IParseLocation.class), capt.capture());
assertEquals("value", capt.getValue());
}
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java
index 103de11e628..b5e97db9d0a 100644
--- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2_1Test.java
@@ -470,7 +470,7 @@ public class GenericClientDstu2_1Test {
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
- when(myHttpResponse.getEntity().getContent()).thenThrow(IllegalStateException.class, RuntimeException.class, Exception.class);
+ when(myHttpResponse.getEntity().getContent()).thenThrow(IllegalStateException.class, RuntimeException.class, IOException.class);
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
@@ -492,7 +492,7 @@ public class GenericClientDstu2_1Test {
client.read().resource(Patient.class).withId("1").execute();
fail();
} catch (FhirClientConnectionException e) {
- assertEquals("java.lang.Exception", e.getMessage());
+ assertThat(e.getMessage(), containsString("java.io.IOException"));
}
}
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryTest.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryTest.java
index a53179c184b..63607620375 100644
--- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryTest.java
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryTest.java
@@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.client;
import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -45,10 +46,10 @@ public class RestfulClientFactoryTest {
when(ctx.getVersion()).thenReturn(FhirVersionEnum.DSTU2_1.getVersionImplementation());
when(ctx.getRestfulClientFactory()).thenReturn(restfulClientFactory);
- when(restfulClientFactory.getHttpClient(any(StringBuilder.class), (Map>)any(Map.class), any(String.class), any(RequestTypeEnum.class), any(List.class))).thenReturn(httpClient);
+ when(restfulClientFactory.getHttpClient(any(StringBuilder.class), (Map>)nullable(Map.class), nullable(String.class), any(RequestTypeEnum.class), any(List.class))).thenReturn(httpClient);
IHttpRequest httpRequest = mock(IHttpRequest.class);
- when(httpClient.createGetRequest(any(FhirContext.class), any(EncodingEnum.class))).thenReturn(httpRequest);
+ when(httpClient.createGetRequest(any(FhirContext.class), nullable(EncodingEnum.class))).thenReturn(httpRequest);
IHttpResponse httpResponse = mock(IHttpResponse.class);
when(httpRequest.execute()).thenReturn(httpResponse);
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu2_1Test.java
index 76b6acd16af..9b54ae480aa 100644
--- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu2_1Test.java
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu2_1Test.java
@@ -2,12 +2,9 @@ package ca.uhn.fhir.rest.server;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.*;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
@@ -27,6 +24,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+import org.hl7.fhir.dstu2016may.model.OperationOutcome;
import org.hl7.fhir.dstu2016may.model.Patient;
import org.junit.*;
import org.mockito.ArgumentCaptor;
@@ -43,9 +41,11 @@ import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetai
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.PortUtil;
import ca.uhn.fhir.util.TestUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class InterceptorDstu2_1Test {
-
+ private static final Logger ourLog = LoggerFactory.getLogger(InterceptorDstu2_1Test.class);
private static CloseableHttpClient ourClient;
private static FhirContext ourCtx = FhirContext.forDstu2_1();
private static int ourPort;
@@ -56,22 +56,22 @@ public class InterceptorDstu2_1Test {
@Before
public void before() {
- myInterceptor1 = mock(IServerInterceptor.class);
- myInterceptor2 = mock(IServerInterceptor.class);
+ myInterceptor1 = mock(IServerInterceptor.class, withSettings().verboseLogging());
+ myInterceptor2 = mock(IServerInterceptor.class, withSettings().verboseLogging());
ourServlet.setInterceptors(myInterceptor1, myInterceptor2);
}
@Test
public void testValidate() throws Exception {
- when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
- when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.outgoingResponse(any(ServletRequestDetails.class), any(OperationOutcome.class))).thenReturn(true);
+ when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
when(myInterceptor2.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor2.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor2.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
- when(myInterceptor2.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor2.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
+ when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
//@formatter:off
String input =
@@ -95,30 +95,32 @@ public class InterceptorDstu2_1Test {
"}";
//@formatter:on
+ ourLog.info("Starting call");
+
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/$validate");
httpPost.setEntity(new StringEntity(input, ContentType.create(Constants.CT_FHIR_JSON, "UTF-8")));
HttpResponse status = ourClient.execute(httpPost);
IOUtils.closeQuietly(status.getEntity().getContent());
InOrder order = inOrder(myInterceptor1, myInterceptor2);
- order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
ArgumentCaptor opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
ArgumentCaptor arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
order.verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
- order.verify(myInterceptor2, times(1)).incomingRequestPreHandled(any(RestOperationTypeEnum.class), any(ActionRequestDetails.class));
- order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(IResource.class));
- order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), any(IResource.class));
- order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
+ order.verify(myInterceptor2, times(1)).incomingRequestPreHandled(nullable(RestOperationTypeEnum.class), nullable(ActionRequestDetails.class));
+ order.verify(myInterceptor2, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
+ order.verify(myInterceptor2, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
+ order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
// Avoid concurrency issues
Thread.sleep(500);
- order.verify(myInterceptor2, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
- order.verify(myInterceptor1, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
+ order.verify(myInterceptor2, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
+ order.verify(myInterceptor1, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
verifyNoMoreInteractions(myInterceptor1);
verifyNoMoreInteractions(myInterceptor2);
diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml
index 180cff57381..dd6a7a2201b 100644
--- a/hapi-fhir-structures-dstu2/pom.xml
+++ b/hapi-fhir-structures-dstu2/pom.xml
@@ -102,14 +102,31 @@
thymeleaf
test
+
+
com.helger
ph-schematron
- test
+ test
- com.helger
- ph-commons
+ javax.activation
+ javax.activation-api
+ test
+
+
+ javax.xml.bind
+ jaxb-api
+ test
+
+
+ com.sun.xml.bind
+ jaxb-core
+ test
+
+
+ com.sun.xml.bind
+ jaxb-impl
test
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java
index a40d5b3633b..78028b2150f 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java
@@ -21,6 +21,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Matchers;
import org.mockito.internal.stubbing.answers.ThrowsException;
import org.xmlunit.builder.DiffBuilder;
import org.xmlunit.builder.Input;
@@ -2551,7 +2553,7 @@ public class XmlParserDstu2Test {
assertThat(patient.getIdentifier().get(0).getType().getValueAsEnum(), IsEmptyCollection.empty());
ArgumentCaptor capt = ArgumentCaptor.forClass(String.class);
- verify(errorHandler, times(1)).unknownAttribute(any(IParseLocation.class), capt.capture());
+ verify(errorHandler, times(1)).unknownAttribute(ArgumentMatchers.nullable(IParseLocation.class), capt.capture());
assertEquals("value", capt.getValue());
}
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java
index a9167b3d8ae..18e138fcab3 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/RestfulClientFactoryDstu2Test.java
@@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.client;
import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -44,10 +45,10 @@ public class RestfulClientFactoryDstu2Test {
when(ctx.getVersion()).thenReturn(FhirVersionEnum.DSTU2.getVersionImplementation());
when(ctx.getRestfulClientFactory()).thenReturn(restfulClientFactory);
- when(restfulClientFactory.getHttpClient(any(StringBuilder.class), (Map>)any(Map.class), any(String.class), any(RequestTypeEnum.class), any(List.class))).thenReturn(httpClient);
+ when(restfulClientFactory.getHttpClient(nullable(StringBuilder.class), (Map>)nullable(Map.class), nullable(String.class), nullable(RequestTypeEnum.class), nullable(List.class))).thenReturn(httpClient);
IHttpRequest httpRequest = mock(IHttpRequest.class);
- when(httpClient.createGetRequest(any(FhirContext.class), any(EncodingEnum.class))).thenReturn(httpRequest);
+ when(httpClient.createGetRequest(any(FhirContext.class), nullable(EncodingEnum.class))).thenReturn(httpRequest);
IHttpResponse httpResponse = mock(IHttpResponse.class);
when(httpRequest.execute()).thenReturn(httpResponse);
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
index 01b964b3245..ba663e29c59 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
@@ -149,7 +149,7 @@ public class SearchDstu2Test {
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
- assertThat(responseContent, matchesPattern("id value..[0-9a-f-]+\\\""));
+ assertThat(responseContent, matchesPattern(".*id value..[0-9a-f-]+\\\".*"));
}
@Test
diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml
index aadd8c16353..45b430c375a 100644
--- a/hapi-fhir-structures-dstu3/pom.xml
+++ b/hapi-fhir-structures-dstu3/pom.xml
@@ -216,6 +216,8 @@
thymeleaf
test
+
+
com.helger
ph-schematron
@@ -226,6 +228,26 @@
ph-commons
test
+
+ javax.activation
+ javax.activation-api
+ test
+
+
+ javax.xml.bind
+ jaxb-api
+ test
+
+
+ com.sun.xml.bind
+ jaxb-core
+ test
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ test
+
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
index d0650db4ef5..f92b51f5c41 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
@@ -1361,7 +1361,7 @@ public class JsonParserDstu3Test {
ArgumentCaptor expected = ArgumentCaptor.forClass(ValueType.class);
ArgumentCaptor expectedScalarType = ArgumentCaptor.forClass(ScalarType.class);
ArgumentCaptor foundScalarType = ArgumentCaptor.forClass(ScalarType.class);
- verify(errorHandler, times(2)).incorrectJsonType(any(IParseLocation.class), elementName.capture(), expected.capture(), expectedScalarType.capture(), found.capture(), foundScalarType.capture());
+ verify(errorHandler, times(2)).incorrectJsonType(nullable(IParseLocation.class), elementName.capture(), expected.capture(), expectedScalarType.capture(), found.capture(), foundScalarType.capture());
assertEquals(ValueType.SCALAR, found.getAllValues().get(0));
assertEquals(ValueType.SCALAR, expected.getAllValues().get(0));
@@ -2344,13 +2344,13 @@ public class JsonParserDstu3Test {
ArgumentCaptor actual = ArgumentCaptor.forClass(ValueType.class);
ArgumentCaptor expectedScalar = ArgumentCaptor.forClass(ScalarType.class);
ArgumentCaptor actualScalar = ArgumentCaptor.forClass(ScalarType.class);
- verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), elementName.capture(), expected.capture(), expectedScalar.capture(), actual.capture(),
+ verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.nullable(IParseLocation.class), elementName.capture(), expected.capture(), expectedScalar.capture(), actual.capture(),
actualScalar.capture());
- verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), Mockito.eq("_id"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(), Mockito.eq(ValueType.SCALAR),
+ verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.nullable(IParseLocation.class), Mockito.eq("_id"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(), Mockito.eq(ValueType.SCALAR),
actualScalar.capture());
- verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), Mockito.eq("__v"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(), Mockito.eq(ValueType.SCALAR),
+ verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.nullable(IParseLocation.class), Mockito.eq("__v"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(), Mockito.eq(ValueType.SCALAR),
actualScalar.capture());
- verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), Mockito.eq("_status"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(),
+ verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.nullable(IParseLocation.class), Mockito.eq("_status"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(),
Mockito.eq(ValueType.SCALAR), actualScalar.capture());
assertEquals("_id", elementName.getAllValues().get(0));
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java
index 4414ec18937..2b6a8dcfa0f 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java
@@ -2960,7 +2960,7 @@ public class XmlParserDstu3Test {
assertThat(patient.getIdentifier().get(0).getType().getCoding(), IsEmptyCollection.empty());
ArgumentCaptor capt = ArgumentCaptor.forClass(String.class);
- verify(errorHandler, times(1)).unknownAttribute(any(IParseLocation.class), capt.capture());
+ verify(errorHandler, times(1)).unknownAttribute(nullable(IParseLocation.class), capt.capture());
assertEquals("value", capt.getValue());
}
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java
index 59265c38c73..b3d0195683b 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu3Test.java
@@ -496,7 +496,7 @@ public class GenericClientDstu3Test {
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
- when(myHttpResponse.getEntity().getContent()).thenThrow(IllegalStateException.class, RuntimeException.class, Exception.class);
+ when(myHttpResponse.getEntity().getContent()).thenThrow(IllegalStateException.class, RuntimeException.class, IOException.class);
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
@@ -518,7 +518,7 @@ public class GenericClientDstu3Test {
client.read().resource(Patient.class).withId("1").execute();
fail();
} catch (FhirClientConnectionException e) {
- assertEquals("java.lang.Exception", e.getMessage());
+ assertThat(e.getMessage(), containsString("java.io.IOException"));
}
}
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java
index 8d6b536ea4b..badc56cfe41 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/InterceptorDstu3Test.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.rest.server;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.MethodOutcome;
@@ -32,7 +31,6 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.OperationOutcome;
import org.hl7.fhir.dstu3.model.Patient;
-import org.hl7.fhir.instance.model.api.IBaseResource;
import org.junit.*;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
@@ -45,7 +43,6 @@ import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.*;
-import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;
public class InterceptorDstu3Test {
@@ -117,14 +114,14 @@ public class InterceptorDstu3Test {
public void testResourceResponseIncluded() throws Exception {
ourServlet.setInterceptors(myInterceptor1, myInterceptor2);
- when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
- when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor2.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor2.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor2.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
- when(myInterceptor2.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
+ when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor2.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor2.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
+ when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
String input = createInput();
@@ -134,24 +131,24 @@ public class InterceptorDstu3Test {
IOUtils.closeQuietly(status.getEntity().getContent());
InOrder order = inOrder(myInterceptor1, myInterceptor2);
- order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
ArgumentCaptor opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
ArgumentCaptor arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
order.verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
- order.verify(myInterceptor2, times(1)).incomingRequestPreHandled(any(RestOperationTypeEnum.class), any(ActionRequestDetails.class));
- order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(IBaseResource.class));
- order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), any(IBaseResource.class));
- order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
+ order.verify(myInterceptor2, times(1)).incomingRequestPreHandled(nullable(RestOperationTypeEnum.class), nullable(ActionRequestDetails.class));
+ order.verify(myInterceptor2, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
+ order.verify(myInterceptor2, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
+ order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
// Avoid concurrency issues
Thread.sleep(500);
- order.verify(myInterceptor2, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
- order.verify(myInterceptor1, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
+ order.verify(myInterceptor2, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
+ order.verify(myInterceptor1, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
verifyNoMoreInteractions(myInterceptor1);
verifyNoMoreInteractions(myInterceptor2);
@@ -163,10 +160,10 @@ public class InterceptorDstu3Test {
public void testResponseWithNothing() throws Exception {
ourServlet.setInterceptors(myInterceptor1);
- when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
- when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
+ when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
String input = createInput();
@@ -180,14 +177,14 @@ public class InterceptorDstu3Test {
}
InOrder order = inOrder(myInterceptor1);
- verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
- verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
+ verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
ArgumentCaptor opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
ArgumentCaptor arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
- ArgumentCaptor rdCapt = ArgumentCaptor.forClass(RequestDetails.class);
- ArgumentCaptor resourceCapt = ArgumentCaptor.forClass(IBaseResource.class);
+ ArgumentCaptor rdCapt = ArgumentCaptor.forClass(ServletRequestDetails.class);
+ ArgumentCaptor resourceCapt = ArgumentCaptor.forClass(OperationOutcome.class);
verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
- verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), resourceCapt.capture());
+ verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), resourceCapt.capture());
assertEquals(1, resourceCapt.getAllValues().size());
assertEquals(null, resourceCapt.getAllValues().get(0));
@@ -198,9 +195,9 @@ public class InterceptorDstu3Test {
public void testResponseWithOperationOutcome() throws Exception {
ourServlet.setInterceptors(myInterceptor1);
- when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
- when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
+ when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
String input = createInput();
@@ -210,13 +207,13 @@ public class InterceptorDstu3Test {
IOUtils.closeQuietly(status.getEntity().getContent());
InOrder order = inOrder(myInterceptor1);
- order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
- order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
+ order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
ArgumentCaptor opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
ArgumentCaptor arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
- ArgumentCaptor resourceCapt = ArgumentCaptor.forClass(IBaseResource.class);
+ ArgumentCaptor resourceCapt = ArgumentCaptor.forClass(OperationOutcome.class);
order.verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
- order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), resourceCapt.capture());
+ order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), resourceCapt.capture());
assertEquals(1, resourceCapt.getAllValues().size());
assertEquals(OperationOutcome.class, resourceCapt.getAllValues().get(0).getClass());
diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml
index 189b05df86b..0854e47c4c0 100644
--- a/hapi-fhir-structures-hl7org-dstu2/pom.xml
+++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml
@@ -121,23 +121,38 @@
thymeleaf
test
+
+
com.helger
ph-schematron
test
-
-
- Saxon-HE
- net.sf.saxon
-
-
com.helger
ph-commons
test
-
+
+ javax.activation
+ javax.activation-api
+ test
+
+
+ javax.xml.bind
+ jaxb-api
+ test
+
+
+ com.sun.xml.bind
+ jaxb-core
+ test
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ test
+
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java
index 9c4aed53fa5..7eb68475f53 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java
@@ -82,7 +82,7 @@ public class SearchHl7OrgDstu2Test {
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
- assertThat(responseContent, matchesPattern("id value..[0-9a-f-]+\\\""));
+ assertThat(responseContent, matchesPattern(".*id value..[0-9a-f-]+\\\".*"));
}
@Test
diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml
index ed768aefb74..538acaa1fc8 100644
--- a/hapi-fhir-structures-r4/pom.xml
+++ b/hapi-fhir-structures-r4/pom.xml
@@ -124,6 +124,8 @@
thymeleaf
test
+
+
com.helger
ph-schematron
@@ -134,7 +136,26 @@
ph-commons
test
-
+
+ javax.activation
+ javax.activation-api
+ test
+
+
+ javax.xml.bind
+ jaxb-api
+ test
+
+
+ com.sun.xml.bind
+ jaxb-core
+ test
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ test
+
diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientR4Test.java
index 18876a64970..e1533df51eb 100644
--- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientR4Test.java
+++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientR4Test.java
@@ -437,7 +437,7 @@ public class GenericClientR4Test {
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
- when(myHttpResponse.getEntity().getContent()).thenThrow(IllegalStateException.class, RuntimeException.class, Exception.class);
+ when(myHttpResponse.getEntity().getContent()).thenThrow(IllegalStateException.class, RuntimeException.class, IOException.class);
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
@@ -459,7 +459,7 @@ public class GenericClientR4Test {
client.read().resource(Patient.class).withId("1").execute();
fail();
} catch (FhirClientConnectionException e) {
- assertEquals("java.lang.Exception", e.getMessage());
+ assertThat(e.getMessage(), containsString("java.io.IOException"));
}
}
diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java
index 605e24be0f0..20a8947815f 100644
--- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java
+++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java
@@ -15,6 +15,7 @@ import org.mockito.stubbing.Answer;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -34,7 +35,7 @@ public class GraphQLEngineTest {
private GraphQLEngine.IGraphQLStorageServices createStorageServices() throws FHIRException {
GraphQLEngine.IGraphQLStorageServices retVal = mock(GraphQLEngine.IGraphQLStorageServices.class);
- when(retVal.lookup(any(Object.class), any(Resource.class), any(Reference.class))).thenAnswer(new Answer() {
+ when(retVal.lookup(nullable(Object.class), nullable(Resource.class), nullable(Reference.class))).thenAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) {
Object appInfo = invocation.getArguments()[0];
diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml
index d8de1dfe5c2..30be83e3c30 100644
--- a/hapi-fhir-validation/pom.xml
+++ b/hapi-fhir-validation/pom.xml
@@ -172,16 +172,34 @@
jetty-http
test
+
+
com.helger
ph-schematron
test
- com.helger
- ph-commons
+ javax.activation
+ javax.activation-api
test
+
+ javax.xml.bind
+ jaxb-api
+ test
+
+
+ com.sun.xml.bind
+ jaxb-core
+ test
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ test
+
+
org.apache.httpcomponents
httpclient
diff --git a/pom.xml b/pom.xml
index fc2e0ee5dd0..4108528e6e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -478,6 +478,7 @@
${user.home}/sites/scm/hapi-fhir
+ 1.2.0
4.1.4
1.0.10
2.6.2
@@ -488,8 +489,9 @@
2.0.18
25.0-jre
2.8.1
+ 2.2.11_1
2.3.0
- 2.3.0
+ 2.3.0
2.25.1
9.4.8.v20171121
3.0.2
@@ -500,7 +502,6 @@
5.7.1.Final
4.4.6
4.5.3
- 2.2.11_1
5.5.4
2.5.3
1.8
@@ -671,6 +672,11 @@
txtmark
0.16
+
+ javax.activation
+ javax.activation-api
+ ${activation_api_version}
+
javax.annotation
javax.annotation-api
@@ -1000,11 +1006,13 @@
javax.json
1.0.4
+
org.glassfish.jersey.core
jersey-server
diff --git a/src/site/markdown/doc_jdk9_guide.md b/src/site/markdown/doc_jdk9_guide.md
new file mode 100644
index 00000000000..7e5994d2f13
--- /dev/null
+++ b/src/site/markdown/doc_jdk9_guide.md
@@ -0,0 +1,3 @@
+# Using HAPI FHIR with JDK9 / JDK10+
+
+
From 5a96482860755267fc6330218060473f216fa210 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 08:04:01 -0400
Subject: [PATCH 04/31] More work o JDK9 tests
---
.../r4/FhirResourceDaoR4InterceptorTest.java | 9 +++++----
.../search/SearchCoordinatorSvcImplTest.java | 4 +---
.../FhirInstanceValidatorDstu3Test.java | 18 ++++++++++--------
.../FhirInstanceValidatorR4Test.java | 17 +++++++++--------
4 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java
index 3b8fec3f5d7..8664331dc2c 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java
@@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.dao.DeleteMethodOutcome;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.interceptor.IServerOperationInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter;
+import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
@@ -567,8 +568,8 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test {
@Test
public void testServerOperationPreDelete() {
- doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourcePreDelete(any(RequestDetails.class), any(IBaseResource.class));
- doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourceDeleted(any(RequestDetails.class), any(IBaseResource.class));
+ doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourcePreDelete(nullable(ServletRequestDetails.class), any(Patient.class));
+ doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourceDeleted(nullable(ServletRequestDetails.class), any(Patient.class));
Patient p = new Patient();
p.setActive(false);
@@ -578,8 +579,8 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test {
myPatientDao.delete(id);
InOrder inorder = inOrder(myJpaInterceptor);
- inorder.verify(myJpaInterceptor, times(1)).resourcePreDelete(any(RequestDetails.class), any(IBaseResource.class));
- inorder.verify(myJpaInterceptor, times(1)).resourceDeleted(any(RequestDetails.class), any(IBaseResource.class));
+ inorder.verify(myJpaInterceptor, times(1)).resourcePreDelete(nullable(ServletRequestDetails.class), any(Patient.class));
+ inorder.verify(myJpaInterceptor, times(1)).resourceDeleted(nullable(ServletRequestDetails.class), any(Patient.class));
// resourcePreDelete
assertEquals(idPart, myIds.get(0).getIdPart());
assertEquals("1", myIds.get(0).getVersionIdPart());
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java
index 9126cec246a..df9fe378a08 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java
@@ -31,7 +31,7 @@ import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
@@ -143,8 +143,6 @@ public class SearchCoordinatorSvcImplTest {
Iterator iter = new FailAfterNIterator(new SlowIterator(pids.iterator(), 2), 300);
when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(iter);
- doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
-
IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNotNull(result.getUuid());
assertEquals(null, result.size());
diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java
index c8dd5e99539..75a548bc53b 100644
--- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java
+++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java
@@ -37,6 +37,7 @@ import java.util.zip.GZIPInputStream;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -48,6 +49,7 @@ public class FhirInstanceValidatorDstu3Test {
private static FhirContext ourCtx = FhirContext.forDstu3();
@Rule
public TestRule watcher = new TestWatcher() {
+ @Override
protected void starting(Description description) {
ourLog.info("Starting test: " + description.getMethodName());
}
@@ -84,19 +86,19 @@ public class FhirInstanceValidatorDstu3Test {
myValidConcepts = new ArrayList<>();
- when(myMockSupport.expandValueSet(any(FhirContext.class), any(ConceptSetComponent.class))).thenAnswer(new Answer() {
+ when(myMockSupport.expandValueSet(any(FhirContext.class), nullable(ConceptSetComponent.class))).thenAnswer(new Answer() {
@Override
public ValueSetExpansionComponent answer(InvocationOnMock theInvocation) {
ConceptSetComponent arg = (ConceptSetComponent) theInvocation.getArguments()[0];
ValueSetExpansionComponent retVal = mySupportedCodeSystemsForExpansion.get(arg.getSystem());
if (retVal == null) {
- retVal = myDefaultValidationSupport.expandValueSet(any(FhirContext.class), arg);
+ retVal = myDefaultValidationSupport.expandValueSet(nullable(FhirContext.class), arg);
}
ourLog.debug("expandValueSet({}) : {}", new Object[] {theInvocation.getArguments()[0], retVal});
return retVal;
}
});
- when(myMockSupport.isCodeSystemSupported(any(FhirContext.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.isCodeSystemSupported(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public Boolean answer(InvocationOnMock theInvocation) {
boolean retVal = myValidSystems.contains(theInvocation.getArguments()[1]);
@@ -104,7 +106,7 @@ public class FhirInstanceValidatorDstu3Test {
return retVal;
}
});
- when(myMockSupport.fetchResource(any(FhirContext.class), any(Class.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.fetchResource(nullable(FhirContext.class), nullable(Class.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public IBaseResource answer(InvocationOnMock theInvocation) throws Throwable {
IBaseResource retVal = null;
@@ -134,7 +136,7 @@ public class FhirInstanceValidatorDstu3Test {
return retVal;
}
});
- when(myMockSupport.validateCode(any(FhirContext.class), any(String.class), any(String.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.validateCode(nullable(FhirContext.class), nullable(String.class), nullable(String.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public CodeValidationResult answer(InvocationOnMock theInvocation) {
FhirContext ctx = (FhirContext) theInvocation.getArguments()[0];
@@ -150,7 +152,7 @@ public class FhirInstanceValidatorDstu3Test {
return retVal;
}
});
- when(myMockSupport.fetchCodeSystem(any(FhirContext.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.fetchCodeSystem(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public CodeSystem answer(InvocationOnMock theInvocation) {
CodeSystem retVal = myDefaultValidationSupport.fetchCodeSystem((FhirContext) theInvocation.getArguments()[0], (String) theInvocation.getArguments()[1]);
@@ -161,7 +163,7 @@ public class FhirInstanceValidatorDstu3Test {
myStructureDefinitions = new HashMap<>();
myValueSets = new HashMap<>();
myCodeSystems = new HashMap<>();
- when(myMockSupport.fetchStructureDefinition(any(FhirContext.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.fetchStructureDefinition(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public StructureDefinition answer(InvocationOnMock theInvocation) {
String url = (String) theInvocation.getArguments()[1];
@@ -173,7 +175,7 @@ public class FhirInstanceValidatorDstu3Test {
return retVal;
}
});
- when(myMockSupport.fetchAllStructureDefinitions(any(FhirContext.class))).thenAnswer(new Answer>() {
+ when(myMockSupport.fetchAllStructureDefinitions(nullable(FhirContext.class))).thenAnswer(new Answer>() {
@Override
public List answer(InvocationOnMock theInvocation) {
List retVal = myDefaultValidationSupport.fetchAllStructureDefinitions((FhirContext) theInvocation.getArguments()[0]);
diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
index ad6ba758608..0ae6332859d 100644
--- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
+++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java
@@ -43,6 +43,7 @@ import java.util.zip.GZIPInputStream;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -102,19 +103,19 @@ public class FhirInstanceValidatorR4Test {
myValidConcepts = new ArrayList<>();
- when(myMockSupport.expandValueSet(any(FhirContext.class), any(ConceptSetComponent.class))).thenAnswer(new Answer() {
+ when(myMockSupport.expandValueSet(nullable(FhirContext.class), nullable(ConceptSetComponent.class))).thenAnswer(new Answer() {
@Override
public ValueSetExpansionComponent answer(InvocationOnMock theInvocation) throws Throwable {
ConceptSetComponent arg = (ConceptSetComponent) theInvocation.getArguments()[ 0 ];
ValueSetExpansionComponent retVal = mySupportedCodeSystemsForExpansion.get(arg.getSystem());
if (retVal == null) {
- retVal = myDefaultValidationSupport.expandValueSet(any(FhirContext.class), arg);
+ retVal = myDefaultValidationSupport.expandValueSet(nullable(FhirContext.class), arg);
}
ourLog.debug("expandValueSet({}) : {}", new Object[] {theInvocation.getArguments()[ 0 ], retVal});
return retVal;
}
});
- when(myMockSupport.isCodeSystemSupported(any(FhirContext.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.isCodeSystemSupported(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public Boolean answer(InvocationOnMock theInvocation) throws Throwable {
boolean retVal = myValidSystems.contains(theInvocation.getArguments()[ 1 ]);
@@ -122,7 +123,7 @@ public class FhirInstanceValidatorR4Test {
return retVal;
}
});
- when(myMockSupport.fetchResource(any(FhirContext.class), any(Class.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.fetchResource(nullable(FhirContext.class), nullable(Class.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public IBaseResource answer(InvocationOnMock theInvocation) throws Throwable {
IBaseResource retVal;
@@ -136,7 +137,7 @@ public class FhirInstanceValidatorR4Test {
return retVal;
}
});
- when(myMockSupport.validateCode(any(FhirContext.class), any(String.class), any(String.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.validateCode(nullable(FhirContext.class), nullable(String.class), nullable(String.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public CodeValidationResult answer(InvocationOnMock theInvocation) throws Throwable {
FhirContext ctx = (FhirContext) theInvocation.getArguments()[ 0 ];
@@ -152,7 +153,7 @@ public class FhirInstanceValidatorR4Test {
return retVal;
}
});
- when(myMockSupport.fetchCodeSystem(any(FhirContext.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.fetchCodeSystem(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public CodeSystem answer(InvocationOnMock theInvocation) throws Throwable {
CodeSystem retVal = myDefaultValidationSupport.fetchCodeSystem((FhirContext) theInvocation.getArguments()[ 0 ], (String) theInvocation.getArguments()[ 1 ]);
@@ -160,7 +161,7 @@ public class FhirInstanceValidatorR4Test {
return retVal;
}
});
- when(myMockSupport.fetchStructureDefinition(any(FhirContext.class), any(String.class))).thenAnswer(new Answer() {
+ when(myMockSupport.fetchStructureDefinition(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer() {
@Override
public StructureDefinition answer(InvocationOnMock theInvocation) throws Throwable {
StructureDefinition retVal = myDefaultValidationSupport.fetchStructureDefinition((FhirContext) theInvocation.getArguments()[ 0 ], (String) theInvocation.getArguments()[ 1 ]);
@@ -168,7 +169,7 @@ public class FhirInstanceValidatorR4Test {
return retVal;
}
});
- when(myMockSupport.fetchAllStructureDefinitions(any(FhirContext.class))).thenAnswer(new Answer>() {
+ when(myMockSupport.fetchAllStructureDefinitions(nullable(FhirContext.class))).thenAnswer(new Answer>() {
@Override
public List answer(InvocationOnMock theInvocation) throws Throwable {
List retVal = myDefaultValidationSupport.fetchAllStructureDefinitions((FhirContext) theInvocation.getArguments()[ 0 ]);
From 833a46d07e9232cd7b114d613a0c361c74f03e6f Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 08:27:09 -0400
Subject: [PATCH 05/31] Work on test compilation
---
hapi-fhir-jpaserver-base/pom.xml | 7 +++++++
pom.xml | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index c3d0c71b805..9ce273f031f 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -390,6 +390,13 @@
com.sun.mail
javax.mail
+ provided
+
+
+ javax.activation
+ activation
+
+
javax.validation
diff --git a/pom.xml b/pom.xml
index 4108528e6e1..7dd874905c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -628,7 +628,7 @@
com.sun.mail
javax.mail
- 1.6.0
+ 1.6.1
commons-cli
From 554653d883920837ae295285147d2bf699ffbbc6 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 08:34:18 -0400
Subject: [PATCH 06/31] Fix ambiguous imports
---
...bstractJaxRsResourceProviderDstu3Test.java | 56 +++++++++++-------
.../AbstractJaxRsResourceProviderTest.java | 57 +++++++++++--------
2 files changed, 66 insertions(+), 47 deletions(-)
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
index 1547836ee4c..1e647ed6324 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
@@ -1,11 +1,24 @@
package ca.uhn.fhir.jaxrs.server;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
-import java.util.*;
-
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory;
+import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsResponseException;
+import ca.uhn.fhir.jaxrs.server.test.RandomServerPortProvider;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsConformanceRestProviderDstu3;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPageProviderDstu3;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu3;
+import ca.uhn.fhir.model.primitive.UriDt;
+import ca.uhn.fhir.rest.api.EncodingEnum;
+import ca.uhn.fhir.rest.api.MethodOutcome;
+import ca.uhn.fhir.rest.api.PreferReturnEnum;
+import ca.uhn.fhir.rest.api.SearchStyleEnum;
+import ca.uhn.fhir.rest.client.api.IGenericClient;
+import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
+import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
+import ca.uhn.fhir.rest.param.StringAndListParam;
+import ca.uhn.fhir.rest.param.StringParam;
+import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
+import ca.uhn.fhir.util.TestUtil;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -16,22 +29,21 @@ import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.junit.*;
import org.junit.runners.MethodSorters;
-import org.mockito.*;
+import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatcher;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Matchers;
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory;
-import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsExceptionInterceptor;
-import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsResponseException;
-import ca.uhn.fhir.jaxrs.server.test.*;
-import ca.uhn.fhir.model.primitive.UriDt;
-import ca.uhn.fhir.rest.api.*;
-import ca.uhn.fhir.rest.client.api.IGenericClient;
-import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
-import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
-import ca.uhn.fhir.rest.param.StringAndListParam;
-import ca.uhn.fhir.rest.param.StringParam;
-import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
-import ca.uhn.fhir.util.TestUtil;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.*;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AbstractJaxRsResourceProviderDstu3Test {
@@ -242,7 +254,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
/** Search - Compartments */
@Test
- public void testSearchCompartements() {
+ public void testSearchCompartments() {
when(mock.searchCompartment(any(IdType.class))).thenReturn(Arrays.asList((IBaseResource) createPatient(1)));
org.hl7.fhir.dstu3.model.Bundle response = client.search().forResource(Patient.class).withIdAndCompartment("1", "Condition")
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class).execute();
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
index b18367821e7..c894545b2b2 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
@@ -1,36 +1,23 @@
package ca.uhn.fhir.jaxrs.server;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
-import java.util.*;
-
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
-import org.junit.*;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-import org.mockito.ArgumentCaptor;
-import org.mockito.ArgumentMatcher;
-import org.mockito.Matchers;
-
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory;
-import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsExceptionInterceptor;
import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsResponseException;
-import ca.uhn.fhir.jaxrs.server.test.*;
+import ca.uhn.fhir.jaxrs.server.test.RandomServerPortProvider;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsConformanceRestProvider;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPageProvider;
+import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProvider;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu2.resource.*;
-import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
-import ca.uhn.fhir.model.primitive.*;
-import ca.uhn.fhir.rest.api.*;
+import ca.uhn.fhir.model.primitive.DateDt;
+import ca.uhn.fhir.model.primitive.IdDt;
+import ca.uhn.fhir.model.primitive.StringDt;
+import ca.uhn.fhir.model.primitive.UriDt;
+import ca.uhn.fhir.rest.api.EncodingEnum;
+import ca.uhn.fhir.rest.api.MethodOutcome;
+import ca.uhn.fhir.rest.api.PreferReturnEnum;
+import ca.uhn.fhir.rest.api.SearchStyleEnum;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
@@ -38,6 +25,26 @@ import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.util.TestUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
+import org.junit.*;
+import org.junit.runners.MethodSorters;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Matchers;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.*;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AbstractJaxRsResourceProviderTest {
From 35a827eac38026d27c0cbe7600f283822de013e5 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 08:54:16 -0400
Subject: [PATCH 07/31] Support for JDK10 working now
---
.travis.yml | 2 +-
hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 22 +++++++++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index f9bc7cd8dc9..27529dc77a4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ sudo: required
language: java
jdk:
- - oraclejdk8
+ - oraclejdk9
env:
global:
- MAVEN_OPTS="-Xmx1024m"
diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
index 659791daaaf..09bf0259062 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
@@ -166,13 +166,22 @@
thymeleaf-spring4
+
com.helger
ph-schematron
- Saxon-HE
- net.sf.saxon
+ org.glassfish.jaxb
+ jaxb-runtime
+
+
+ org.glassfish.jaxb
+ jaxb-core
+
+
+ com.sun.istack
+ istack-commons-runtime
@@ -180,11 +189,10 @@
com.helger
ph-commons
-
-
+
+ javax.activation
+ javax.activation-api
+
javax.xml.bind
jaxb-api
From 34853b52651e2313448ade8bf6b8d0372753388f Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 08:58:08 -0400
Subject: [PATCH 08/31] One more try at travis
---
.travis.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.travis.yml b/.travis.yml
index 27529dc77a4..25f12192ebf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,7 @@
# Use VM based build environment
sudo: required
+dist: trusty
language: java
jdk:
From be74312955e182e7ae21d68c99f6f3565583f61c Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 09:07:50 -0400
Subject: [PATCH 09/31] Update errorprone
---
.travis.yml | 2 +-
pom.xml | 35 +++++++----------------------------
2 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 25f12192ebf..2224832b867 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,5 +26,5 @@ 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_JDK8,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,ERRORPRONE,JACOCO clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
diff --git a/pom.xml b/pom.xml
index 7dd874905c9..ff2dde0abd6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -598,7 +598,7 @@
com.google.errorprone
error_prone_core
- 2.0.19
+ 2.3.1
com.google.guava
@@ -909,7 +909,7 @@
org.codehaus.plexus
plexus-compiler-javac-errorprone
- 2.8.2
+ 2.8.4
org.codehaus.plexus
@@ -1275,22 +1275,22 @@
com.google.errorprone
error_prone_core
- 2.0.19
+ 2.3.1
org.codehaus.plexus
plexus-compiler-api
- 2.8.2
+ 2.8.4
org.codehaus.plexus
plexus-compiler-javac
- 2.8.2
+ 2.8.4
org.codehaus.plexus
plexus-compiler-javac-errorprone
- 2.8.2
+ 2.8.4
org.codehaus.plexus
@@ -2168,7 +2168,7 @@
- ERRORPRONE_JDK8
+ ERRORPRONE
@@ -2181,27 +2181,6 @@
-
- ERRORPRONE_JDK9
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- javac-with-errorprone
-
-
-
- com.google.errorprone
- error_prone_core
- 2.2.0
-
-
-
-
-
-
OWASP
From 4abbd5487b8fabdf10b94b55eb28a4aaa4d0cb79 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 09:12:02 -0400
Subject: [PATCH 10/31] Update appveyor
---
appveyor.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/appveyor.yml b/appveyor.yml
index 6c34946c639..200116b6084 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,4 +4,6 @@ cache:
- C:\maven\
- C:\Users\appveyor\.m2\repository
build_script:
- - cmd: mvn -P MINPARALLEL,ALLMODULES clean install
+ - SET JAVA_HOME=C:\Program Files\Java\jdk10
+ - SET PATH=C:\Program Files\Java\jdk10\bin;%PATH%
+ - cmd: mvn -P MINPARALLEL,ALLMODULES clean install
From 0e48506956f2ef70658e1a4a749cff8aee97d243 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 09:15:12 -0400
Subject: [PATCH 11/31] Fix test flagged by errorprone
---
.../test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java
index 9d11a807696..c80a47ed911 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryDstu2Test.java
@@ -110,6 +110,7 @@ public class BinaryDstu2Test {
}
+ @Test
public void testCreateWrongType() throws Exception {
Binary res = new Binary();
res.setContent(new byte[] { 1, 2, 3, 4 });
@@ -122,8 +123,7 @@ public class BinaryDstu2Test {
HttpResponse status = ourClient.execute(http);
assertEquals(201, status.getStatusLine().getStatusCode());
- assertEquals("text/plain", ourLast.getContentType());
- assertArrayEquals(new byte[] { 1, 2, 3, 4 }, ourLast.getContent());
+ assertEquals("application/json+fhir;charset=utf-8", ourLast.getContentType().replace(" ","").toLowerCase());
}
From 5cd0e9a6e81661308cf77e838dd47b1b49eb1f9b Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 09:25:30 -0400
Subject: [PATCH 12/31] Fix broken test
---
.../test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java
index ff2b594744e..7ab22ea398b 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeDstu2Test.java
@@ -19,6 +19,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.*;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.api.BundleInclusionRule;
@@ -159,7 +160,8 @@ public class IncludeDstu2Test {
}
- // @Test
+ @Test
+ @Ignore
public void testMixedContainedAndNonContained() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
HttpResponse status = ourClient.execute(httpGet);
From d819d685eee6f3a3b0a3ce0d8a76160fb948dc44 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 09:57:41 -0400
Subject: [PATCH 13/31] Test fix
---
.../src/main/java/ca/uhn/fhir/util/XmlUtil.java | 4 ++--
.../java/ca/uhn/fhir/util/XmlUtilDstu3Test.java | 14 +++++---------
hapi-fhir-validation/pom.xml | 2 ++
3 files changed, 9 insertions(+), 11 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 c33dc3d5ce7..cb4aba958dd 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
@@ -1757,8 +1757,8 @@ public class XmlUtil {
private static void throwUnitTestExceptionIfConfiguredToDoSo() throws FactoryConfigurationError, XMLStreamException {
if (ourNextException != null) {
- if (ourNextException instanceof FactoryConfigurationError) {
- throw ((FactoryConfigurationError)ourNextException);
+ if (ourNextException instanceof javax.xml.stream.FactoryConfigurationError) {
+ throw ((javax.xml.stream.FactoryConfigurationError)ourNextException);
}
throw (XMLStreamException)ourNextException;
}
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java
index 5190f31778a..562eb43e5af 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/util/XmlUtilDstu3Test.java
@@ -2,7 +2,7 @@ package ca.uhn.fhir.util;
import static org.junit.Assert.fail;
-import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLStreamException;
import org.hl7.fhir.dstu3.model.Patient;
@@ -37,7 +37,8 @@ public class XmlUtilDstu3Test {
// good
}
}
-
+
+ @Test
public void testXmlFactoryThrowsXmlStreamException() {
XmlUtil.setThrowExceptionForUnitTest(new XMLStreamException("FOO"));
@@ -54,19 +55,14 @@ public class XmlUtilDstu3Test {
// good
}
}
-
+
+ @Test
public void testXmlFactoryThrowsFactoryConfigurationError() {
XmlUtil.setThrowExceptionForUnitTest(new FactoryConfigurationError("FOO"));
try {
ourCtx.newXmlParser().parseResource("AAAAA");
fail();
- } catch (DataFormatException e) {
- // good
- }
- try {
- ourCtx.newXmlParser().encodeResourceToString(myPatient);
- fail();
} catch (ConfigurationException e) {
// good
}
diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml
index 30be83e3c30..654cc2001d2 100644
--- a/hapi-fhir-validation/pom.xml
+++ b/hapi-fhir-validation/pom.xml
@@ -204,6 +204,8 @@
org.apache.httpcomponents
httpclient
+
+
From be1e0df9e2009ac3c22f1adae312278f6be84d7d Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 10:48:53 -0400
Subject: [PATCH 14/31] Fix test flagged by errorprone
---
.../uhn/fhir/parser/RoundTripDstu3Test.java | 2 +-
.../uhn/fhir/model/ModelInheritanceTest.java | 391 +++++++-----------
2 files changed, 149 insertions(+), 244 deletions(-)
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java
index 36431f3dc3a..b8dec3f1072 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java
@@ -30,7 +30,7 @@ public class RoundTripDstu3Test {
}
-// @Test
+ @Test
public void testRoundTrip() throws Exception {
ZipInputStream is = new ZipInputStream(new FileInputStream("src/test/resources/examples.zip"));
try {
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java
index 56baf0ad0e7..5588f8976a1 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/ModelInheritanceTest.java
@@ -1,280 +1,185 @@
package ca.uhn.fhir.model;
-import static org.hamcrest.Matchers.endsWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-import org.hl7.fhir.instance.model.Address;
-import org.hl7.fhir.instance.model.BackboneElement;
-import org.hl7.fhir.instance.model.Base;
-import org.hl7.fhir.instance.model.Binary;
-import org.hl7.fhir.instance.model.BooleanType;
-import org.hl7.fhir.instance.model.Bundle;
-import org.hl7.fhir.instance.model.CodeType;
-import org.hl7.fhir.instance.model.Coding;
-import org.hl7.fhir.instance.model.DecimalType;
-import org.hl7.fhir.instance.model.DomainResource;
-import org.hl7.fhir.instance.model.Element;
-import org.hl7.fhir.instance.model.Enumeration;
-import org.hl7.fhir.instance.model.Extension;
-import org.hl7.fhir.instance.model.IdType;
-import org.hl7.fhir.instance.model.Identifier;
-import org.hl7.fhir.instance.model.IntegerType;
-import org.hl7.fhir.instance.model.List_;
-import org.hl7.fhir.instance.model.Meta;
-import org.hl7.fhir.instance.model.Money;
-import org.hl7.fhir.instance.model.Narrative;
-import org.hl7.fhir.instance.model.Parameters;
-import org.hl7.fhir.instance.model.PrimitiveType;
-import org.hl7.fhir.instance.model.Quantity;
-import org.hl7.fhir.instance.model.Reference;
-import org.hl7.fhir.instance.model.Resource;
-import org.hl7.fhir.instance.model.StringType;
-import org.hl7.fhir.instance.model.Timing;
-import org.hl7.fhir.instance.model.Type;
-import org.hl7.fhir.instance.model.api.IAnyResource;
-import org.hl7.fhir.instance.model.api.IBase;
-import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
-import org.hl7.fhir.instance.model.api.IBaseBinary;
-import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
-import org.hl7.fhir.instance.model.api.IBaseBundle;
-import org.hl7.fhir.instance.model.api.IBaseCoding;
-import org.hl7.fhir.instance.model.api.IBaseDatatype;
-import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
-import org.hl7.fhir.instance.model.api.IBaseDecimalDatatype;
-import org.hl7.fhir.instance.model.api.IBaseEnumeration;
-import org.hl7.fhir.instance.model.api.IBaseExtension;
-import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
-import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
-import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
-import org.hl7.fhir.instance.model.api.IBaseMetaType;
-import org.hl7.fhir.instance.model.api.IBaseParameters;
-import org.hl7.fhir.instance.model.api.IBaseReference;
-import org.hl7.fhir.instance.model.api.IBaseXhtml;
-import org.hl7.fhir.instance.model.api.ICompositeType;
-import org.hl7.fhir.instance.model.api.IDomainResource;
-import org.hl7.fhir.instance.model.api.IIdType;
-import org.hl7.fhir.instance.model.api.INarrative;
-import org.hl7.fhir.instance.model.api.IPrimitiveType;
-import org.hl7.fhir.utilities.xhtml.XhtmlNode;
-import org.junit.Test;
-
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
import ca.uhn.fhir.model.api.annotation.Block;
-import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
+import org.hl7.fhir.instance.model.*;
+import org.hl7.fhir.instance.model.api.*;
+import org.hl7.fhir.utilities.xhtml.XhtmlNode;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.endsWith;
+import static org.junit.Assert.*;
public class ModelInheritanceTest {
- /*
- *
- * Other changes:
- *
- * Reference:
- * * Add "resource" field, plus constructors and getter/setters for that field
- *
- * Narrative:
- * * Add getValueAsDiv and setValueAsDiv
- *
- * XhtmlParser and XhtmlEncoder:
- * * Do we need a better exception declaration?
- *
- * ElementDefinition
- * * Backbone elements (eg .ElementDefinitionSlicingComponent) do not extend BackboneElement or have a @Block annotation for some reason
- *
- * Extension
- * * Should URL not be StringType since it can't take extensions?
- *
- */
+ /*
+ *
+ * Other changes:
+ *
+ * Reference:
+ * * Add "resource" field, plus constructors and getter/setters for that field
+ *
+ * Narrative:
+ * * Add getValueAsDiv and setValueAsDiv
+ *
+ * XhtmlParser and XhtmlEncoder:
+ * * Do we need a better exception declaration?
+ *
+ * ElementDefinition
+ * * Backbone elements (eg .ElementDefinitionSlicingComponent) do not extend BackboneElement or have a @Block annotation for some reason
+ *
+ * Extension
+ * * Should URL not be StringType since it can't take extensions?
+ *
+ */
- private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
-
- /**
- * Disabled for now...
- */
-// @Test
- public void testDatatypeNames() {
- for (BaseRuntimeElementDefinition> next : ourCtx.getElementDefinitions()) {
- if (next instanceof BaseRuntimeElementCompositeDefinition || next instanceof RuntimePrimitiveDatatypeDefinition) {
- String name = next.getImplementingClass().getName();
- // TODO: these are all badly named
- if (name.endsWith(".Enumeration")) {
- continue;
- }
- if (name.endsWith(".Reference")) {
- continue;
- }
- if (name.endsWith(".Extension")) {
- continue;
- }
- if (name.endsWith(".Attachment")) {
- continue;
- }
- if (name.endsWith(".Period")) {
- continue;
- }
- if (name.endsWith(".Address")) {
- continue;
- }
- assertThat(name, endsWith("Type"));
-
- }
- }
- }
-
- @Test
- public void testList() {
- assertEquals("List", ourCtx.getResourceDefinition(List_.class).getName());
- }
-
- /**
- * This one should apply to all composite types
- */
- @Test
- public void testAddress() {
- assertTrue(ICompositeType.class.isAssignableFrom(Address.class));
- }
+ private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
- @Test
- public void testXhtml() {
- assertTrue(IBaseXhtml.class.isAssignableFrom(XhtmlNode.class));
- }
+ /**
+ * This one should apply to all composite types
+ */
+ @Test
+ public void testAddress() {
+ assertTrue(ICompositeType.class.isAssignableFrom(Address.class));
+ }
- @Test
- public void testBackboneElement() {
- assertTrue(IBaseBackboneElement.class.isAssignableFrom(BackboneElement.class));
- assertTrue(IBaseHasExtensions.class.isAssignableFrom(BackboneElement.class));
- assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(BackboneElement.class));
- }
+ @Test
+ public void testBackboneElement() {
+ assertTrue(IBaseBackboneElement.class.isAssignableFrom(BackboneElement.class));
+ assertTrue(IBaseHasExtensions.class.isAssignableFrom(BackboneElement.class));
+ assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(BackboneElement.class));
+ }
- @Test
- public void testBase() {
- assertTrue(IBase.class.isAssignableFrom(Base.class));
- }
+ @Test
+ public void testBase() {
+ assertTrue(IBase.class.isAssignableFrom(Base.class));
+ }
- @Test
- public void testProfiledDatatype() {
- assertEquals(StringType.class, CodeType.class.getSuperclass());
- assertEquals(StringType.class, CodeType.class.getAnnotation(DatatypeDef.class).profileOf());
- assertEquals(Quantity.class, Money.class.getSuperclass());
- assertEquals(Quantity.class, Money.class.getAnnotation(DatatypeDef.class).profileOf());
- }
-
-
- @Test
- public void testBinary() {
- assertTrue(IBaseBinary.class.isAssignableFrom(Binary.class));
- }
+ @Test
+ public void testBinary() {
+ assertTrue(IBaseBinary.class.isAssignableFrom(Binary.class));
+ }
-
- @Test
- public void testBooleanType() {
- assertTrue(IBaseBooleanDatatype.class.isAssignableFrom(BooleanType.class));
- }
+ @Test
+ public void testBooleanType() {
+ assertTrue(IBaseBooleanDatatype.class.isAssignableFrom(BooleanType.class));
+ }
+ @Test
+ public void testBundle() {
+ assertTrue(IBaseBundle.class.isAssignableFrom(Bundle.class));
+ }
- @Test
- public void testBundle() {
- assertTrue(IBaseBundle.class.isAssignableFrom(Bundle.class));
- }
+ @Test
+ public void testCoding() {
+ assertTrue(IBaseCoding.class.isAssignableFrom(Coding.class));
+ }
- @Test
- public void testCoding() {
- assertTrue(IBaseCoding.class.isAssignableFrom(Coding.class));
- }
+ @Test
+ public void testDecimalType() {
+ assertTrue(IBaseDecimalDatatype.class.isAssignableFrom(DecimalType.class));
+ }
- @Test
- public void testDecimalType() {
- assertTrue(IBaseDecimalDatatype.class.isAssignableFrom(DecimalType.class));
- }
+ @Test
+ public void testDomainResource() {
+ assertTrue(IBaseHasExtensions.class.isAssignableFrom(DomainResource.class));
+ assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(DomainResource.class));
+ assertTrue(IDomainResource.class.isAssignableFrom(DomainResource.class));
+ }
- @Test
- public void testDomainResource() {
- assertTrue(IBaseHasExtensions.class.isAssignableFrom(DomainResource.class));
- assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(DomainResource.class));
- assertTrue(IDomainResource.class.isAssignableFrom(DomainResource.class));
- }
+ @Test
+ public void testElement() {
+ assertTrue(IBaseHasExtensions.class.isAssignableFrom(Element.class));
+ }
- @Test
- public void testElement() {
- assertTrue(IBaseHasExtensions.class.isAssignableFrom(Element.class));
- }
+ @Test
+ public void testEnumeration() {
+ assertTrue(IBaseEnumeration.class.isAssignableFrom(Enumeration.class));
- @Test
- public void testEnumeration() {
- assertTrue(IBaseEnumeration.class.isAssignableFrom(Enumeration.class));
-
- DatatypeDef def = Enumeration.class.getAnnotation(DatatypeDef.class);
- assertTrue(def.isSpecialization());
- }
+ DatatypeDef def = Enumeration.class.getAnnotation(DatatypeDef.class);
+ assertTrue(def.isSpecialization());
+ }
- /**
- * Should be "implements IBaseExtension"
- */
- @Test
- public void testExtension() {
- assertTrue(IBaseExtension.class.isAssignableFrom(Extension.class));
- assertTrue(IBaseHasExtensions.class.isAssignableFrom(Extension.class));
- }
+ /**
+ * Should be "implements IBaseExtension"
+ */
+ @Test
+ public void testExtension() {
+ assertTrue(IBaseExtension.class.isAssignableFrom(Extension.class));
+ assertTrue(IBaseHasExtensions.class.isAssignableFrom(Extension.class));
+ }
- public void testIdentifierUse() throws Exception {
- Child child = Identifier.class.getField("use").getAnnotation(Child.class);
-// assertEquals(IdentifierUseEnumFactory.class, child.enumFactory());
- }
+ @Test
+ public void testIdType() {
+ assertTrue(IIdType.class.isAssignableFrom(IdType.class));
+ }
- public void testIdType() {
- assertTrue(IIdType.class.isAssignableFrom(IdType.class));
- }
+ @Test
+ public void testIntegerType() {
+ assertTrue(IBaseIntegerDatatype.class.isAssignableFrom(IntegerType.class));
+ }
- @Test
- public void testIntegerType() {
- assertTrue(IBaseIntegerDatatype.class.isAssignableFrom(IntegerType.class));
- }
+ @Test
+ public void testList() {
+ assertEquals("List", ourCtx.getResourceDefinition(List_.class).getName());
+ }
- @Test
- public void testMeta() {
- assertTrue(IBaseMetaType.class.isAssignableFrom(Meta.class));
- }
+ @Test
+ public void testMeta() {
+ assertTrue(IBaseMetaType.class.isAssignableFrom(Meta.class));
+ }
- @Test
- public void testNarrative() {
- assertTrue(INarrative.class.isAssignableFrom(Narrative.class));
- }
+ @Test
+ public void testNarrative() {
+ assertTrue(INarrative.class.isAssignableFrom(Narrative.class));
+ }
- @Test
- public void testPrimitiveType() {
- assertTrue(IPrimitiveType.class.isAssignableFrom(PrimitiveType.class));
- assertTrue(IBaseHasExtensions.class.isAssignableFrom(PrimitiveType.class));
- }
+ @Test
+ public void testParameters() {
+ assertTrue(IBaseParameters.class.isAssignableFrom(Parameters.class));
+ }
- @Test
- public void testReference() {
- assertTrue(IBaseReference.class.isAssignableFrom(Reference.class));
- }
+ @Test
+ public void testPrimitiveType() {
+ assertTrue(IPrimitiveType.class.isAssignableFrom(PrimitiveType.class));
+ assertTrue(IBaseHasExtensions.class.isAssignableFrom(PrimitiveType.class));
+ }
- @Test
- public void testParameters() {
- assertTrue(IBaseParameters.class.isAssignableFrom(Parameters.class));
- }
+ @Test
+ public void testProfiledDatatype() {
+ assertEquals(StringType.class, CodeType.class.getSuperclass());
+ assertEquals(StringType.class, CodeType.class.getAnnotation(DatatypeDef.class).profileOf());
+ assertEquals(Quantity.class, Money.class.getSuperclass());
+ assertEquals(Quantity.class, Money.class.getAnnotation(DatatypeDef.class).profileOf());
+ }
- @Test
- public void testResource() {
- assertTrue(IAnyResource.class.isAssignableFrom(Resource.class));
- }
+ @Test
+ public void testReference() {
+ assertTrue(IBaseReference.class.isAssignableFrom(Reference.class));
+ }
- @Test
- public void testTiming_TimingRepeatComponent() {
- assertTrue(IBaseDatatypeElement.class.isAssignableFrom(Timing.TimingRepeatComponent.class));
- assertNotNull(Timing.TimingRepeatComponent.class.getAnnotation(Block.class));
- }
+ @Test
+ public void testResource() {
+ assertTrue(IAnyResource.class.isAssignableFrom(Resource.class));
+ }
- @Test
- public void testType() {
- assertTrue(IBaseDatatype.class.isAssignableFrom(Type.class));
- }
+ @Test
+ public void testTiming_TimingRepeatComponent() {
+ assertTrue(IBaseDatatypeElement.class.isAssignableFrom(Timing.TimingRepeatComponent.class));
+ assertNotNull(Timing.TimingRepeatComponent.class.getAnnotation(Block.class));
+ }
+
+ @Test
+ public void testType() {
+ assertTrue(IBaseDatatype.class.isAssignableFrom(Type.class));
+ }
+
+ @Test
+ public void testXhtml() {
+ assertTrue(IBaseXhtml.class.isAssignableFrom(XhtmlNode.class));
+ }
}
From d127a8904740301ce676948de4eb5c8c9ea46fa4 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 11:01:43 -0400
Subject: [PATCH 15/31] Some test fixes
---
hapi-fhir-jpaserver-base/pom.xml | 4 +++
.../parser/JsonParserHl7OrgDstu2Test.java | 36 -------------------
.../fhir/parser/XmlParserHl7OrgDstu2Test.java | 31 ----------------
.../rest/server/BinaryHl7OrgDstu2Test.java | 17 ---------
.../rest/server/IncludeHl7OrgDstu2Test.java | 14 --------
.../ca/uhn/fhir/rest/server/IncludeTest.java | 14 --------
...estionnaireResponseValidatorDstu3Test.java | 35 ------------------
pom.xml | 13 ++++---
src/changes/changes.xml | 14 ++++++++
9 files changed, 27 insertions(+), 151 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 9ce273f031f..866c5f4c05f 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -398,6 +398,10 @@
+
+ com.sun.activation
+ javax.activation
+
javax.validation
validation-api
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java
index 83b91ada0e0..63abe1ead90 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserHl7OrgDstu2Test.java
@@ -1016,42 +1016,6 @@ public class JsonParserHl7OrgDstu2Test {
//@formatter:on
}
- /*
- * Narrative generation is disabled for HL7org structs for now
- */
- // @Test
- public void testNarrativeGeneration() throws DataFormatException, IOException {
-
- Patient patient = new Patient();
- patient.addName().addFamily("Smith");
- Organization org = new Organization();
- patient.getManagingOrganization().setResource(org);
-
- INarrativeGenerator gen = new INarrativeGenerator() {
-
- @Override
- public void generateNarrative(FhirContext theContext, IBaseResource theResource, INarrative theNarrative) {
- try {
- theNarrative.setDivAsString("help
");
- } catch (Exception e) {
- throw new Error(e);
- }
- theNarrative.setStatusAsString("generated");
- }
-
- };
-
- FhirContext context = ourCtx;
- context.setNarrativeGenerator(gen);
- IParser p = context.newJsonParser();
- p.encodeResourceToWriter(patient, new OutputStreamWriter(System.out));
- String str = p.encodeResourceToString(patient);
-
- ourLog.info(str);
-
- assertThat(str, StringContains.containsString(",\"text\":{\"status\":\"generated\",\"div\":\"help
\"},"));
- }
-
@Test
public void testNestedContainedResources() {
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java
index c7a32847157..c8cbbc1b711 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java
@@ -1502,37 +1502,6 @@ public class XmlParserHl7OrgDstu2Test {
" "));
}
- // Narrative generation not currently supported for HL7org structures
- public void testNarrativeGeneration() throws DataFormatException, IOException {
-
- Patient patient = new Patient();
- patient.addName().addFamily("Smith");
- Organization org = new Organization();
- patient.getManagingOrganization().setResource(org);
-
- INarrativeGenerator gen = new INarrativeGenerator() {
-
- @Override
- public void generateNarrative(FhirContext theContext, IBaseResource theResource, INarrative theNarrative) {
- try {
- theNarrative.setDivAsString("help
");
- } catch (Exception e) {
- throw new Error(e);
- }
- theNarrative.setStatusAsString("generated");
- }
-
- };
-
- FhirContext context = ourCtx;
- context.setNarrativeGenerator(gen);
- IParser p = context.newXmlParser();
- String str = p.encodeResourceToString(patient);
-
- ourLog.info(str);
-
- assertThat(str, StringContains.containsString(",\"text\":{\"status\":\"generated\",\"div\":\"help
\"},"));
- }
@Test
public void testNestedContainedResources() {
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryHl7OrgDstu2Test.java
index 9c8d392e86b..249613807c5 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryHl7OrgDstu2Test.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryHl7OrgDstu2Test.java
@@ -99,23 +99,6 @@ public class BinaryHl7OrgDstu2Test {
}
- public void testCreateWrongType() throws Exception {
- Binary res = new Binary();
- res.setContent(new byte[] { 1, 2, 3, 4 });
- res.setContentType("text/plain");
- String stringContent = ourCtx.newJsonParser().encodeResourceToString(res);
-
- HttpPost http = new HttpPost("http://localhost:" + ourPort + "/Binary");
- http.setEntity(new StringEntity(stringContent, ContentType.create(Constants.CT_FHIR_JSON, "UTF-8")));
-
- HttpResponse status = ourClient.execute(http);
- assertEquals(201, status.getStatusLine().getStatusCode());
-
- assertEquals("text/plain", ourLast.getContentType());
- assertArrayEquals(new byte[] { 1, 2, 3, 4 }, ourLast.getContent());
-
- }
-
@Test
public void testRead() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeHl7OrgDstu2Test.java
index b0339e5728c..1f8187af980 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeHl7OrgDstu2Test.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeHl7OrgDstu2Test.java
@@ -95,20 +95,6 @@ public class IncludeHl7OrgDstu2Test {
assertEquals("foo", p.getName().get(0).getFamily().get(0).getValue());
}
- // @Test
- public void testMixedContainedAndNonContained() throws Exception {
- HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
- HttpResponse status = ourClient.execute(httpGet);
- String responseContent = IOUtils.toString(status.getEntity().getContent());
- IOUtils.closeQuietly(status.getEntity().getContent());
-
- ourLog.info(responseContent);
-
- assertEquals(200, status.getStatusLine().getStatusCode());
- Bundle bundle = ourCtx.newXmlParser().parseResource(Bundle.class, responseContent);
- assertEquals(4, bundle.getEntry().size());
- }
-
@Test
public void testIIncludedResourcesNonContained() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=normalInclude&_pretty=true");
diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java
index 87c27d7362d..a821eda93b0 100644
--- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java
+++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java
@@ -185,20 +185,6 @@ public class IncludeTest {
}
}
- // @Test
- public void testMixedContainedAndNonContained() throws Exception {
- HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
- HttpResponse status = ourClient.execute(httpGet);
- String responseContent = IOUtils.toString(status.getEntity().getContent());
- IOUtils.closeQuietly(status.getEntity().getContent());
-
- ourLog.info(responseContent);
-
- assertEquals(200, status.getStatusLine().getStatusCode());
- Bundle bundle = ourCtx.newXmlParser().parseResource(Bundle.class, responseContent);
- assertEquals(4, bundle.getEntry().size());
- }
-
@Test
public void testNoIncludes() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello");
diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java
index b3f987828de..190de326218 100644
--- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java
+++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java
@@ -693,41 +693,6 @@ public class QuestionnaireResponseValidatorDstu3Test {
assertThat(errors.toString(), containsString("LinkId \"link1\" not found in questionnaire"));
}
- // @Test
- public void validateHealthConnexExample() throws Exception {
- String input = IOUtils.toString(QuestionnaireResponseValidatorDstu3Test.class.getResourceAsStream("/questionnaireanswers-0f431c50ddbe4fff8e0dd6b7323625fc.xml"));
-
- QuestionnaireResponse qa = ourCtx.newXmlParser().parseResource(QuestionnaireResponse.class, input);
- ValidationResult errors = myVal.validateWithResult(qa);
- assertEquals(errors.toString(), 0, errors.getMessages().size());
-
- /*
- * Now change a coded value
- */
- //@formatter:off
- input = input.replaceAll(
- "\n" +
- " \n" +
- " \n" +
- " \n" +
- " \n" +
- "
\n" +
- " ",
- "\n" +
- " \n" +
- " \n" +
- " \n" +
- " \n" +
- "
\n" +
- " ");
- assertThat(input, containsString("GGG"));
- //@formatter:on
-
- qa = ourCtx.newXmlParser().parseResource(QuestionnaireResponse.class, input);
- errors = myVal.validateWithResult(qa);
- assertEquals(errors.toString(), 10, errors.getMessages().size());
- }
-
@AfterClass
public static void afterClassClearContext() {
myDefaultValidationSupport.flush();
diff --git a/pom.xml b/pom.xml
index ff2dde0abd6..df9dc841959 100644
--- a/pom.xml
+++ b/pom.xml
@@ -493,13 +493,13 @@
2.3.0
2.3.0
2.25.1
- 9.4.8.v20171121
+ 9.4.10.v20180503
3.0.2
- 5.2.16.Final
+ 5.3.1.Final
5.4.1.Final
- 5.7.1.Final
+ 5.10.1.Final
4.4.6
4.5.3
5.5.4
@@ -510,7 +510,7 @@
9.1.1
9.5.1-5_1
1.2_5
- 5.0.3.RELEASE
+ 5.0.6.RELEASE
1.5.6.RELEASE
3.1.4
3.0.9.RELEASE
@@ -625,6 +625,11 @@
okhttp
3.8.1
+
+ com.sun.activation
+ javax.activation
+ 1.2.0
+
com.sun.mail
javax.mail
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d2a2bb8a867..1156a3d50fd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -6,6 +6,20 @@
HAPI FHIR Changelog
+
+
+ The version of a few dependencies have been bumped to the
+ latest versions (dependent HAPI modules listed in brackets):
+
+ Spring Framework (JPA): 5.0.3.RELEASE -> 5.0.6.RELEASE
+ Hibernate OR (JPA): 5.2.16.Final -> 5.3.1.Final
+ Hibernate Search (JPA): 5.7.1.Final -> 5.10.1.Final
+ Jetty (CLI): 9.4.8.v20171121 -> 9.4.10.v20180503
+
+ ]]>
+
+
The version of a few dependencies have been bumped to the
From 1fcb374d40a3213027c4b7f46e3469678c15cd0b Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 15:03:11 -0400
Subject: [PATCH 16/31] Test fixes
---
.../QuestionnaireResponseValidatorR4Test.java | 35 +------------------
1 file changed, 1 insertion(+), 34 deletions(-)
diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java
index 88deba53264..11c23a34400 100644
--- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java
+++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java
@@ -451,6 +451,7 @@ public class QuestionnaireResponseValidatorR4Test {
assertThat(errors.getMessages(), empty());
}
+ @Test
public void testMissingRequiredAnswer() {
Questionnaire q = new Questionnaire();
q.addItem().setLinkId("link0")
@@ -691,40 +692,6 @@ public class QuestionnaireResponseValidatorR4Test {
assertThat(errors.toString(), containsString("No issues"));
}
- // @Test
- public void validateHealthConnexExample() throws Exception {
- String input = IOUtils.toString(QuestionnaireResponseValidatorR4Test.class.getResourceAsStream("/questionnaireanswers-0f431c50ddbe4fff8e0dd6b7323625fc.xml"));
-
- QuestionnaireResponse qa = ourCtx.newXmlParser().parseResource(QuestionnaireResponse.class, input);
- ValidationResult errors = myVal.validateWithResult(qa);
- assertEquals(errors.toString(), 0, errors.getMessages().size());
-
- /*
- * Now change a coded value
- */
- //@formatter:off
- input = input.replaceAll(
- "\n" +
- " \n" +
- " \n" +
- " \n" +
- " \n" +
- "
\n" +
- " ",
- "\n" +
- " \n" +
- " \n" +
- " \n" +
- " \n" +
- "
\n" +
- " ");
- assertThat(input, containsString("GGG"));
- //@formatter:on
-
- qa = ourCtx.newXmlParser().parseResource(QuestionnaireResponse.class, input);
- errors = myVal.validateWithResult(qa);
- assertEquals(errors.toString(), 10, errors.getMessages().size());
- }
@AfterClass
public static void afterClassClearContext() {
From 2684e2b030e05aa4d592ecaf19fb00b319db4b0a Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 30 May 2018 16:17:36 -0400
Subject: [PATCH 17/31] Build fixes
---
.../src/test/java/ca/uhn/fhir/jpa/dao/SearchBuilderTest.java | 5 -----
.../ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java | 4 ++++
.../ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java | 5 +++++
.../java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java | 4 ++++
.../ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java | 4 +++-
.../uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java | 3 ++-
.../ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java | 3 ++-
7 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/SearchBuilderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/SearchBuilderTest.java
index a1856c78aaf..11761730577 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/SearchBuilderTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/SearchBuilderTest.java
@@ -21,11 +21,6 @@ public class SearchBuilderTest {
}
- @Test
- public void testAA() {
- assertTrue(123.00004f <= 123.0001f);
- }
-
@Test
public void testCalculateMultiplierEqualNoDecimal() {
BigDecimal in = new BigDecimal("200");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
index 16e14b7bd40..79539d19f88 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
@@ -2435,6 +2435,8 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
assertThat(actual, contains(id3, id2, id1));
}
+ @Test
+ @Ignore
public void testSortByQuantity() {
Observation res;
@@ -2700,6 +2702,8 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
}
+ @Test
+ @Ignore
public void testSortByUri() {
ConceptMap res = new ConceptMap();
res.addElement().addTarget().addDependsOn().setElement("http://foo2");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
index f363e68ff75..b621d9615ad 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
@@ -2938,6 +2938,9 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
assertThat(actual, contains(toValues(id3, id2, id1)));
}
+ @Test
+ @Ignore
+
public void testSortByQuantity() {
Observation res;
@@ -3203,6 +3206,8 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
}
+ @Test
+ @Ignore
public void testSortByUri() {
ConceptMap res = new ConceptMap();
res.addGroup().setSource("http://foo2");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
index 7299e08fdda..5144f0fcfa7 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
@@ -3140,6 +3140,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
assertThat(actual, contains(toValues(id3, id2, id1)));
}
+ @Test
+ @Ignore
public void testSortByQuantity() {
Observation res;
@@ -3405,6 +3407,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
}
+ @Test
+ @Ignore
public void testSortByUri() {
ConceptMap res = new ConceptMap();
res.addGroup().setSource("http://foo2");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java
index 2251b60546a..99340a794c3 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java
@@ -20,6 +20,7 @@ import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
+import org.junit.Ignore;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -316,7 +317,8 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test {
/**
* This is Gramahe's test transaction - it requires some set up in order to work
*/
- // @Test
+ @Test
+ @Ignore
public void testTransactionFromBundle3() throws Exception {
InputStream bundleRes = SystemProviderDstu2Test.class.getResourceAsStream("/grahame-transaction.xml");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java
index e1aed6e2c73..d0f575e63c6 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java
@@ -519,7 +519,8 @@ public class SystemProviderDstu3Test extends BaseJpaDstu3Test {
/**
* This is Gramahe's test transaction - it requires some set up in order to work
*/
- // @Test
+ @Test
+ @Ignore
public void testTransactionFromBundle3() throws Exception {
InputStream bundleRes = SystemProviderDstu3Test.class.getResourceAsStream("/grahame-transaction.xml");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java
index d9301b73a9b..0a74eb50b8b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java
@@ -476,7 +476,8 @@ public class SystemProviderR4Test extends BaseJpaR4Test {
/**
* This is Gramahe's test transaction - it requires some set up in order to work
*/
- // @Test
+ @Test
+ @Ignore
public void testTransactionFromBundle3() throws Exception {
InputStream bundleRes = SystemProviderR4Test.class.getResourceAsStream("/grahame-transaction.xml");
From bb5d4110a2e69d82c98c8658636c992fe9479b08 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 21:23:20 -0400
Subject: [PATCH 18/31] Test fixes
---
.../ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java | 13 ++++++-------
.../ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java | 11 ++++++-----
.../java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java | 11 ++++++-----
src/changes/changes.xml | 5 +++++
4 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
index f509a9a0c6a..079856d31df 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
@@ -14,7 +14,6 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
import ca.uhn.fhir.jpa.util.ResourceCountCache;
-import ca.uhn.fhir.jpa.util.SingleItemLoadingCache;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
@@ -42,7 +41,6 @@ import org.springframework.transaction.support.TransactionTemplate;
import javax.persistence.EntityManager;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Map;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
@@ -181,12 +179,13 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
}
@Before
- @Transactional
public void beforeFlushFT() {
- FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
- ftem.purgeAll(ResourceTable.class);
- ftem.purgeAll(ResourceIndexedSearchParamString.class);
- ftem.flushToIndexes();
+ runInTransaction(() -> {
+ FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
+ ftem.purgeAll(ResourceTable.class);
+ ftem.purgeAll(ResourceIndexedSearchParamString.class);
+ ftem.flushToIndexes();
+ });
myDaoConfig.setSchedulingDisabled(true);
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
index 7c04b2d22eb..971b6342282 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
@@ -274,12 +274,13 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
}
@Before
- @Transactional
public void beforeFlushFT() {
- FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
- ftem.purgeAll(ResourceTable.class);
- ftem.purgeAll(ResourceIndexedSearchParamString.class);
- ftem.flushToIndexes();
+ runInTransaction(() -> {
+ FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
+ ftem.purgeAll(ResourceTable.class);
+ ftem.purgeAll(ResourceIndexedSearchParamString.class);
+ ftem.flushToIndexes();
+ });
myDaoConfig.setSchedulingDisabled(true);
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
index bcea6129cd7..5c48b74c639 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
@@ -282,12 +282,13 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
}
@Before
- @Transactional
public void beforeFlushFT() {
- FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
- ftem.purgeAll(ResourceTable.class);
- ftem.purgeAll(ResourceIndexedSearchParamString.class);
- ftem.flushToIndexes();
+ runInTransaction(()->{
+ FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
+ ftem.purgeAll(ResourceTable.class);
+ ftem.purgeAll(ResourceIndexedSearchParamString.class);
+ ftem.flushToIndexes();
+ });
myDaoConfig.setSchedulingDisabled(true);
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1156a3d50fd..19e2f842052 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -7,6 +7,11 @@
+
+ HAPI FHIR now supports JDK 9 and JDK 10, both for building HAPI FHIR
+ as well as for use. JDK 8 remains supported and is the minimum requirement
+ in order to build or use HAPI FHIR.
+
The version of a few dependencies have been bumped to the
latest versions (dependent HAPI modules listed in brackets):
From c2afd9728d74665a42569db734c4c4ad2d2fb384 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 21:57:17 -0400
Subject: [PATCH 19/31] More test fixes
---
.../fhir/jpa/dao/FulltextSearchSvcImpl.java | 35 ++++++++++++++-----
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
index 0b8fe0975a8..dc9c14c61ed 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
@@ -43,7 +43,9 @@ import org.hibernate.search.query.dsl.QueryBuilder;
import org.hl7.fhir.dstu3.model.BaseResource;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.support.TransactionTemplate;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -57,10 +59,14 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
private EntityManager myEntityManager;
+ @PersistenceContext(type = PersistenceContextType.TRANSACTION)
+ private PlatformTransactionManager myTxManager;
@Autowired
protected IForcedIdDao myForcedIdDao;
+ private Boolean ourDisabled;
+
/**
* Constructor
*/
@@ -73,7 +79,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
return;
}
for (List extends IQueryParameterType> nextAnd : theTerms) {
- Set terms = new HashSet();
+ Set terms = new HashSet<>();
for (IQueryParameterType nextOr : nextAnd) {
StringParam nextOrString = (StringParam) nextOr;
String nextValueTrimmed = StringUtils.defaultString(nextOrString.getValue()).trim();
@@ -229,15 +235,25 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
@Override
public boolean isDisabled() {
- try {
- FullTextEntityManager em = org.hibernate.search.jpa.Search.getFullTextEntityManager(myEntityManager);
- em.getSearchFactory().buildQueryBuilder().forEntity(ResourceTable.class).get();
- } catch (Exception e) {
- ourLog.trace("FullText test failed", e);
- ourLog.debug("Hibernate Search (Lucene) appears to be disabled on this server, fulltext will be disabled");
- return true;
+ Boolean retVal = ourDisabled;
+
+ if (retVal == null) {
+ retVal = new TransactionTemplate(myTxManager).execute(t -> {
+ try {
+ FullTextEntityManager em = org.hibernate.search.jpa.Search.getFullTextEntityManager(myEntityManager);
+ em.getSearchFactory().buildQueryBuilder().forEntity(ResourceTable.class).get();
+ return Boolean.FALSE;
+ } catch (Exception e) {
+ ourLog.trace("FullText test failed", e);
+ ourLog.debug("Hibernate Search (Lucene) appears to be disabled on this server, fulltext will be disabled");
+ return Boolean.TRUE;
+ }
+ });
+ ourDisabled = retVal;
}
- return false;
+
+ assert retVal != null;
+ return retVal;
}
@Transactional()
@@ -246,6 +262,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
return doSearch(theResourceName, theParams, null);
}
+ @Transactional()
@Override
public List suggestKeywords(String theContext, String theSearchParam, String theText) {
Validate.notBlank(theContext, "theContext must be provided");
From 2f07066c59c8376f402eccade905bf37340325d1 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 30 May 2018 21:59:41 -0400
Subject: [PATCH 20/31] Test fixes
---
.../main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
index dc9c14c61ed..0e2f9a96e3b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
@@ -59,7 +59,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
private EntityManager myEntityManager;
- @PersistenceContext(type = PersistenceContextType.TRANSACTION)
+ @Autowired
private PlatformTransactionManager myTxManager;
@Autowired
From abcf7852b1cb5773d82c58660153590901acc2a2 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Thu, 31 May 2018 09:10:34 -0400
Subject: [PATCH 21/31] Tests pasing locally
---
hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 4 ----
.../server/AbstractJaxRsResourceProviderDstu3Test.java | 5 -----
.../jaxrs/server/AbstractJaxRsResourceProviderTest.java | 5 -----
.../server/example/JaxRsPatientProviderDstu3Test.java | 5 -----
.../jaxrs/server/example/JaxRsPatientProviderTest.java | 5 -----
hapi-fhir-jpaserver-base/pom.xml | 8 ++------
.../uhn/fhir/jpa/search/ElasticsearchMappingProvider.java | 2 +-
.../uhn/fhir/jpa/demo/elasticsearch/FhirServerConfig.java | 2 +-
.../test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java | 4 ++--
9 files changed, 6 insertions(+), 34 deletions(-)
diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
index 09bf0259062..ef8a954304c 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
@@ -189,10 +189,6 @@
com.helger
ph-commons
-
- javax.activation
- javax.activation-api
-
javax.xml.bind
jaxb-api
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
index 1e647ed6324..67edd32385c 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderDstu3Test.java
@@ -238,11 +238,6 @@ public class AbstractJaxRsResourceProviderDstu3Test {
assertEquals("outputValue", ((StringType)outParams.getParameter().get(0).getValue()).getValueAsString());
}
- /** Search using other query options */
- public void testOther() {
- // missing
- }
-
@Test
public void testRead() {
when(mock.find(idCaptor.capture())).thenReturn(createPatient(1));
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
index c894545b2b2..588363f8c79 100644
--- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProviderTest.java
@@ -206,11 +206,6 @@ public class AbstractJaxRsResourceProviderTest {
assertEquals("outputValue", ((StringDt) outParams.getParameter().get(0).getValue()).getValueAsString());
}
- /** Search using other query options */
- public void testOther() {
- // missing
- }
-
@Test
public void testRead() {
when(mock.find(idCaptor.capture())).thenReturn(createPatient(1));
diff --git a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java
index 566c74ff728..210180ec2e0 100644
--- a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java
+++ b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderDstu3Test.java
@@ -108,11 +108,6 @@ public class JaxRsPatientProviderDstu3Test {
}
}
- /** Search using other query options */
- public void testOther() {
- //missing
- }
-
/** */
@Test
public void testSearchPost() {
diff --git a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java
index 5161b30d1d7..6900b6ae4dc 100644
--- a/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java
+++ b/hapi-fhir-jaxrsserver-example/src/test/java/ca/uhn/fhir/jaxrs/server/example/JaxRsPatientProviderTest.java
@@ -119,11 +119,6 @@ public class JaxRsPatientProviderTest {
}
}
- /** Search using other query options */
- public void testOther() {
- // missing
- }
-
/** */
@Test
public void testSearchPost() {
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 866c5f4c05f..4fe3a27a788 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -212,10 +212,6 @@
javax.annotation
javax.annotation-api
-
- javax.activation
- javax.activation-api
-
javax.xml.bind
jaxb-api
@@ -402,10 +398,10 @@
com.sun.activation
javax.activation
-
+
javax.el
javax.el-api
diff --git a/hapi-fhir-jpaserver-elasticsearch/src/main/java/ca/uhn/fhir/jpa/search/ElasticsearchMappingProvider.java b/hapi-fhir-jpaserver-elasticsearch/src/main/java/ca/uhn/fhir/jpa/search/ElasticsearchMappingProvider.java
index 2fe8b5824aa..0337b6f64b4 100644
--- a/hapi-fhir-jpaserver-elasticsearch/src/main/java/ca/uhn/fhir/jpa/search/ElasticsearchMappingProvider.java
+++ b/hapi-fhir-jpaserver-elasticsearch/src/main/java/ca/uhn/fhir/jpa/search/ElasticsearchMappingProvider.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.search;
*/
import org.hibernate.search.elasticsearch.analyzer.definition.ElasticsearchAnalysisDefinitionRegistryBuilder;
-import org.hibernate.search.elasticsearch.analyzer.definition.spi.ElasticsearchAnalysisDefinitionProvider;
+import org.hibernate.search.elasticsearch.analyzer.definition.ElasticsearchAnalysisDefinitionProvider;
public class ElasticsearchMappingProvider implements ElasticsearchAnalysisDefinitionProvider {
diff --git a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/elasticsearch/FhirServerConfig.java b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/elasticsearch/FhirServerConfig.java
index 5bc09d6419c..f9e6e502c43 100644
--- a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/elasticsearch/FhirServerConfig.java
+++ b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/elasticsearch/FhirServerConfig.java
@@ -76,7 +76,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
extraProperties.put("hibernate.cache.use_minimal_puts", "false");
// the belowing properties are used for ElasticSearch integration
- extraProperties.put(ElasticsearchEnvironment.ANALYZER_DEFINITION_PROVIDER, ElasticsearchMappingProvider.class.getName());
+ extraProperties.put(ElasticsearchEnvironment.ANALYSIS_DEFINITION_PROVIDER, ElasticsearchMappingProvider.class.getName());
extraProperties.put("hibernate.search.default.indexmanager", "elasticsearch");
extraProperties.put("hibernate.search.default.elasticsearch.host", "http://127.0.0.1:9200");
extraProperties.put("hibernate.search.default.elasticsearch.index_schema_management_strategy", "CREATE");
diff --git a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java
index cee616e9b8e..16d8a4c29eb 100644
--- a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java
+++ b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java
@@ -2,12 +2,12 @@ package ca.uhn.fhir.jpa.test;
import java.util.Properties;
-import javax.persistence.EntityManagerFactory;
+//import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
-import org.hibernate.jpa.HibernatePersistenceProvider;
+//import org.hibernate.jpa.HibernatePersistenceProvider;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
From 35d5d3adb5c3c6ecce1293422b4ad85d3e5c538d Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Thu, 31 May 2018 11:30:27 -0400
Subject: [PATCH 22/31] Disable useless test
---
.../uhn/fhir/parser/RoundTripDstu3Test.java | 97 -------------------
1 file changed, 97 deletions(-)
delete mode 100644 hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java
deleted file mode 100644
index b8dec3f1072..00000000000
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/RoundTripDstu3Test.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package ca.uhn.fhir.parser;
-
-import java.io.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import javax.xml.stream.*;
-import javax.xml.stream.events.XMLEvent;
-
-import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.AfterClass;
-import org.junit.Test;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.util.TestUtil;
-import ca.uhn.fhir.util.XmlUtil;
-
-public class RoundTripDstu3Test {
- private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RoundTripDstu3Test.class);
- private static FhirContext ourCtx = FhirContext.forDstu3();
-
- @Test
- public void testIt() {
- // Just so this doesn't complain until we enable roundtrip test
- }
-
- @AfterClass
- public static void afterClassClearContext() {
- TestUtil.clearAllStaticFieldsForUnitTest();
- }
-
-
- @Test
- public void testRoundTrip() throws Exception {
- ZipInputStream is = new ZipInputStream(new FileInputStream("src/test/resources/examples.zip"));
- try {
- while (true) {
- ZipEntry nextEntry = is.getNextEntry();
- if (nextEntry == null) {
- break;
- }
-
- ByteArrayOutputStream oos = new ByteArrayOutputStream();
- byte[] buffer = new byte[2048];
- int len = 0;
- while ((len = is.read(buffer)) > 0) {
- oos.write(buffer, 0, len);
- }
-
- String exampleText = oos.toString("UTF-8");
- ourLog.info("Next file: {} - Size: {} bytes", nextEntry.getName(), exampleText.length());
- if (!nextEntry.getName().contains("diagnosticreport-examples-lab")) {
- continue;
- }
-
- IBaseResource parsed = ourCtx.newXmlParser().parseResource(exampleText);
- String encodedXml = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(parsed);
-
- exampleText = cleanXml(exampleText);
- encodedXml = cleanXml(encodedXml);
-
- XmlParserDstu3Test.compareXml(exampleText, encodedXml);
-// DetailedDiff d = new DetailedDiff(new Diff(new StringReader(exampleText), new StringReader(encodedXml)));
-//
-// boolean similar = d.similar();
-// if (!similar) {
-// exampleText = exampleText.replace(" xmlns=\"http://hl7.org/fhir\"", "");
-// encodedXml = encodedXml.replace(" xmlns=\"http://hl7.org/fhir\"", "");
-// if (exampleText.length() != encodedXml.length()) {
-// assertTrue(d.toString(), similar);
-// }
-// }
-
- }
-
- } finally {
- is.close();
- }
- }
-
- private String cleanXml(String exampleText) throws Error, Exception {
- XMLEventReader read = XmlUtil.createXmlReader(new StringReader(exampleText));
- StringWriter sw = new StringWriter();
- XMLEventWriter write = XmlUtil.createXmlWriter(sw);
- while (read.hasNext()) {
- XMLEvent nextEvent = read.nextEvent();
- if (nextEvent.getEventType() == XMLStreamConstants.COMMENT) {
- continue;
- }
- write.add(nextEvent);
- }
- write.add(read);
- sw.close();
- return sw.toString().replaceAll("", "").replace("\n", " ").replace("\r", " ").replaceAll(">\\s+<", "><").replaceAll("<\\?.*\\?>", "").replaceAll("\\s+", " ");
- }
-
-}
From 543c9a0a1943b4a552682f7884aeb6be4d229694 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Thu, 31 May 2018 12:20:55 -0400
Subject: [PATCH 23/31] Bump the failsafe plugin version
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index df9dc841959..2452c7f58be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1332,7 +1332,7 @@
org.apache.maven.plugins
maven-failsafe-plugin
- 2.20
+ 2.21.0
org.apache.maven.plugins
From 1999e23dc9f46a85e633491f85616c9ed42b262d Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Thu, 31 May 2018 13:33:39 -0400
Subject: [PATCH 24/31] Test fixes for android
---
.../test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java | 1 +
.../ca/uhn/fhir/android/client/GenericClientDstu3IT.java | 8 +-------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java
index cc937981fc8..a038a2d56de 100644
--- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java
+++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java
@@ -72,6 +72,7 @@ public class BuiltJarDstu2IT {
* android uses) and see if this passes
*/
@SuppressWarnings("deprecation")
+ @Test
public void testClient() {
FhirContext ctx = FhirContext.forDstu2();
try {
diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java
index aada3596319..96d535cbf88 100644
--- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java
+++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java
@@ -190,7 +190,7 @@ public class GenericClientDstu3IT {
@Test
public void testClientFailures() throws Exception {
ResponseBody body = mock(ResponseBody.class);
- when(body.source()).thenThrow(IllegalStateException.class, RuntimeException.class, Exception.class);
+ when(body.source()).thenThrow(IllegalStateException.class, RuntimeException.class);
myHttpResponse = new Response.Builder()
.request(myRequest)
@@ -216,12 +216,6 @@ public class GenericClientDstu3IT {
assertEquals("java.lang.RuntimeException", e.toString());
}
- try {
- client.read().resource(Patient.class).withId("1").execute();
- fail();
- } catch (FhirClientConnectionException e) {
- assertEquals("java.lang.Exception", e.getMessage());
- }
}
From 2b7e0a87c8807650c3ba362201ba06001c36595a Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Thu, 31 May 2018 16:15:10 -0400
Subject: [PATCH 25/31] More JDK10 fixes
---
.../fhir/jpa/cds/example/CdsExampleTests.java | 4 ++-
hapi-fhir-jacoco/pom.xml | 15 +++++++++
.../dstu2hl7org/XmlParserHl7OrgDstu2Test.java | 32 -------------------
3 files changed, 18 insertions(+), 33 deletions(-)
diff --git a/example-projects/hapi-fhir-jpaserver-cds-example/src/test/java/ca/uhn/fhir/jpa/cds/example/CdsExampleTests.java b/example-projects/hapi-fhir-jpaserver-cds-example/src/test/java/ca/uhn/fhir/jpa/cds/example/CdsExampleTests.java
index 1cf434289ad..5501598b2d8 100644
--- a/example-projects/hapi-fhir-jpaserver-cds-example/src/test/java/ca/uhn/fhir/jpa/cds/example/CdsExampleTests.java
+++ b/example-projects/hapi-fhir-jpaserver-cds-example/src/test/java/ca/uhn/fhir/jpa/cds/example/CdsExampleTests.java
@@ -14,6 +14,7 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.Ignore;
import java.io.*;
import java.net.HttpURLConnection;
@@ -188,7 +189,8 @@ public class CdsExampleTests {
Assert.assertTrue(procedureRequest.getDoNotPerform());
}
- //@Test
+ @Test
+ @Ignore
public void CdsHooksPatientViewTest() throws IOException {
putResource("cds-bcs-library.json", "patient-view");
putResource("cds-bcs-patient.json", "Patient-6532");
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 293592374f1..ed60ffa5b98 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -77,6 +77,21 @@
${project.version}
+
+ javax.mail
+ javax.mail-api
+
+
+ com.sun.mail
+ javax.mail
+
+
+ javax.activation
+ activation
+
+
+
+
com.helger
ph-schematron
diff --git a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu2hl7org/XmlParserHl7OrgDstu2Test.java b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu2hl7org/XmlParserHl7OrgDstu2Test.java
index ea8c81ed73b..fa5861368be 100644
--- a/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu2hl7org/XmlParserHl7OrgDstu2Test.java
+++ b/osgi/hapi-fhir-karaf-integration-tests/src/test/java/ca/uhn/fhir/tests/integration/karaf/dstu2hl7org/XmlParserHl7OrgDstu2Test.java
@@ -1228,38 +1228,6 @@ public class XmlParserHl7OrgDstu2Test {
" "));
}
- // Narrative generation not currently supported for HL7org structures
- public void testNarrativeGeneration() throws DataFormatException, IOException {
-
- org.hl7.fhir.instance.model.Patient patient = new org.hl7.fhir.instance.model.Patient();
- patient.addName().addFamily("Smith");
- Organization org = new Organization();
- patient.getManagingOrganization().setResource(org);
-
- INarrativeGenerator gen = new INarrativeGenerator() {
-
- @Override
- public void generateNarrative(FhirContext theContext, IBaseResource theResource, INarrative theNarrative) {
- try {
- theNarrative.setDivAsString("help
");
- } catch (Exception e) {
- throw new Error(e);
- }
- theNarrative.setStatusAsString("generated");
- }
-
- };
-
- FhirContext context = ourCtx;
- context.setNarrativeGenerator(gen);
- IParser p = context.newXmlParser();
- String str = p.encodeResourceToString(patient);
-
- ourLog.info(str);
-
- assertThat(str, StringContains.containsString(",\"text\":{\"status\":\"generated\",\"div\":\"help
\"},"));
- }
-
@Test
public void testNestedContainedResources() {
From dfd0381d7f4347314a88e1c0dab3aa3a2685ecbc Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Thu, 31 May 2018 17:07:17 -0400
Subject: [PATCH 26/31] Fewer tests on CI
---
appveyor.yml | 2 +-
.../hapi-fhir-karaf-integration-tests/pom.xml | 20 +++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/appveyor.yml b/appveyor.yml
index 200116b6084..8a1b3c96a0b 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,4 +6,4 @@ cache:
build_script:
- SET JAVA_HOME=C:\Program Files\Java\jdk10
- SET PATH=C:\Program Files\Java\jdk10\bin;%PATH%
- - cmd: mvn -P MINPARALLEL,ALLMODULES clean install
+ - cmd: mvn -P MINPARALLEL,ALLMODULES,REDUCED_JPA_TESTS clean install
diff --git a/osgi/hapi-fhir-karaf-integration-tests/pom.xml b/osgi/hapi-fhir-karaf-integration-tests/pom.xml
index 7a1919f6ac8..d8d98bd71ae 100644
--- a/osgi/hapi-fhir-karaf-integration-tests/pom.xml
+++ b/osgi/hapi-fhir-karaf-integration-tests/pom.xml
@@ -185,4 +185,24 @@
+
+
+
+
+ REDUCED_JPA_TESTS
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+
+
+
From f016656a924b0902a9e2fb31106116c2a6f452a3 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Thu, 31 May 2018 20:42:41 -0400
Subject: [PATCH 27/31] More attempts at getting the build going
---
.travis.yml | 3 +--
hapi-fhir-jacoco/pom.xml | 7 +++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 2224832b867..72e6dd3adc5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,5 +26,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,ERRORPRONE,JACOCO clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index ed60ffa5b98..b4251306934 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -345,6 +345,13 @@
../hapi-fhir-client-okhttp/src/main/java
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.0
+
+
org.codehaus.mojo
From 8027f757589b96b761bba2bae0de1bcf00988d76 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Fri, 1 Jun 2018 06:28:22 -0400
Subject: [PATCH 28/31] Remove versioneye from readme, as it has been
discontinued
---
README.md | 6 ++----
src/site/xdoc/index.xml | 2 --
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index cb214c1d377..ad66edaa9d7 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,19 @@
-hapi-fhir
+HAPI FHIR
=========
HAPI FHIR - Java API for HL7 FHIR Clients and Servers
[![Coverage Status](https://coveralls.io/repos/jamesagnew/hapi-fhir/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamesagnew/hapi-fhir?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg)](http://search.maven.org/#search|ga|1|ca.uhn.hapi.fhir)
-[![Dependency Status](https://www.versioneye.com/user/projects/55e1d0d9c6d8f2001c00043e/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55e1d0d9c6d8f2001c00043e)
[![License](https://img.shields.io/badge/license-apache%202.0-60C060.svg)](http://jamesagnew.github.io/hapi-fhir/license.html)
* Linux Build: [![Build Status](https://travis-ci.org/jamesagnew/hapi-fhir.svg?branch=master)](https://travis-ci.org/jamesagnew/hapi-fhir)
* Windows Build:
-
Complete project documentation is available here:
http://jamesagnew.github.io/hapi-fhir/
A demonstration of this project is available here:
-http://fhirtest.uhn.ca/
+http://hapi.fhir.org/
This project is Open Source, licensed under the Apache Software License 2.0.
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index ba18e7cbbba..cd79eae3cbb 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -23,8 +23,6 @@
-
-
From a9cb4dae2f8b7774a13a3fa773716f5c97eaed61 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Fri, 1 Jun 2018 07:07:24 -0400
Subject: [PATCH 29/31] Allow storage of messages
---
.../java/ca/uhn/fhir/jpa/dao/DaoConfig.java | 55 ++++++++++++++++---
.../jpa/dao/FhirResourceDaoBundleDstu2.java | 9 ++-
.../dao/dstu3/FhirResourceDaoBundleDstu3.java | 7 ++-
.../jpa/dao/r4/FhirResourceDaoBundleR4.java | 10 +++-
...hirResourceDaoR4UniqueSearchParamTest.java | 3 +-
src/changes/changes.xml | 5 ++
6 files changed, 73 insertions(+), 16 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
index f6d2f33cf31..b8c5f38f313 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
@@ -3,9 +3,11 @@ package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum;
import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
+import com.google.common.collect.Sets;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.time.DateUtils;
+import org.hl7.fhir.r4.model.Bundle;
import java.util.*;
@@ -18,9 +20,9 @@ import java.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.
@@ -62,6 +64,19 @@ public class DaoConfig {
* @see #setMaximumSearchResultCountInTransaction(Integer)
*/
private static final Integer DEFAULT_MAXIMUM_SEARCH_RESULT_COUNT_IN_TRANSACTION = null;
+ /**
+ * Default {@link #setBundleTypesAllowedForStorage(Set)} value:
+ *
+ * collection
+ * document
+ * message
+ *
+ */
+ private static final Set DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE = Collections.unmodifiableSet(new TreeSet<>(Sets.newHashSet(
+ Bundle.BundleType.COLLECTION.toCode(),
+ Bundle.BundleType.DOCUMENT.toCode(),
+ Bundle.BundleType.MESSAGE.toCode()
+ )));
private IndexEnabledEnum myIndexMissingFieldsEnabled = IndexEnabledEnum.DISABLED;
/**
* update setter javadoc if default changes
@@ -128,6 +143,7 @@ public class DaoConfig {
private boolean myMarkResourcesForReindexingUponSearchParameterChange;
private boolean myExpungeEnabled;
private int myReindexThreadCount;
+ private Set myBundleTypesAllowedForStorage;
/**
* Constructor
@@ -138,6 +154,7 @@ public class DaoConfig {
setSubscriptionPurgeInactiveAfterMillis(Long.MAX_VALUE);
setMarkResourcesForReindexingUponSearchParameterChange(true);
setReindexThreadCount(Runtime.getRuntime().availableProcessors());
+ setBundleTypesAllowedForStorage(DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE);
}
/**
@@ -154,6 +171,26 @@ public class DaoConfig {
myTreatReferencesAsLogical.add(theTreatReferencesAsLogical);
}
+ /**
+ * This setting specifies the bundle types (Bundle.type
) that
+ * are allowed to be stored as-is on the /Bundle endpoint.
+ *
+ * @see #DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE
+ */
+ public Set getBundleTypesAllowedForStorage() {
+ return myBundleTypesAllowedForStorage;
+ }
+
+ /**
+ * This setting specifies the bundle types (Bundle.type
) that
+ * are allowed to be stored as-is on the /Bundle endpoint.
+ *
+ * @see #DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE
+ */
+ public void setBundleTypesAllowedForStorage(Set theBundleTypesAllowedForStorage) {
+ myBundleTypesAllowedForStorage = theBundleTypesAllowedForStorage;
+ }
+
/**
* Specifies the highest number that a client is permitted to use in a
* Cache-Control: nostore, max-results=NNN
@@ -418,11 +455,8 @@ public class DaoConfig {
/**
* This may be used to optionally register server interceptors directly against the DAOs.
*/
- public void setInterceptors(IServerInterceptor... theInterceptor) {
- setInterceptors(new ArrayList());
- if (theInterceptor != null && theInterceptor.length != 0) {
- getInterceptors().addAll(Arrays.asList(theInterceptor));
- }
+ public void setInterceptors(List theInterceptors) {
+ myInterceptors = theInterceptors;
}
/**
@@ -1164,8 +1198,11 @@ public class DaoConfig {
/**
* This may be used to optionally register server interceptors directly against the DAOs.
*/
- public void setInterceptors(List theInterceptors) {
- myInterceptors = theInterceptors;
+ public void setInterceptors(IServerInterceptor... theInterceptor) {
+ setInterceptors(new ArrayList());
+ if (theInterceptor != null && theInterceptor.length != 0) {
+ getInterceptors().addAll(Arrays.asList(theInterceptor));
+ }
}
/**
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java
index d005be9e6e0..8ebd3a89f60 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoBundleDstu2.java
@@ -25,14 +25,19 @@ import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
+import java.util.Set;
+
+import static org.apache.commons.lang3.StringUtils.defaultString;
+
public class FhirResourceDaoBundleDstu2 extends FhirResourceDaoDstu2 {
@Override
protected void preProcessResourceForStorage(Bundle theResource) {
super.preProcessResourceForStorage(theResource);
- if (theResource.getTypeElement().getValueAsEnum() != BundleTypeEnum.DOCUMENT && theResource.getTypeElement().getValueAsEnum() != BundleTypeEnum.COLLECTION) {
- String message = "Unable to store a Bundle resource on this server with a Bundle.type of: " + (theResource.getTypeElement().getValueAsEnum() != null ? theResource.getTypeElement().getValueAsEnum().getCode() : "(missing)");
+ Set allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
+ if (!allowedBundleTypes.contains(defaultString(theResource.getType()))) {
+ String message = "Unable to store a Bundle resource on this server with a Bundle.type value of: " + (theResource.getType() != null ? theResource.getType() : "(missing)");
throw new UnprocessableEntityException(message);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java
index d1f1f178684..317778c9b71 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java
@@ -25,13 +25,18 @@ import org.hl7.fhir.dstu3.model.Bundle.BundleType;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
+import java.util.Set;
+
+import static org.apache.commons.lang3.StringUtils.defaultString;
+
public class FhirResourceDaoBundleDstu3 extends FhirResourceDaoDstu3 {
@Override
protected void preProcessResourceForStorage(Bundle theResource) {
super.preProcessResourceForStorage(theResource);
- if (theResource.getType() != BundleType.DOCUMENT && theResource.getType() != BundleType.COLLECTION) {
+ Set allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
+ if (!allowedBundleTypes.contains(defaultString(theResource.getType().toCode()))) {
String message = "Unable to store a Bundle resource on this server with a Bundle.type value of: " + (theResource.getType() != null ? theResource.getType().toCode() : "(missing)");
throw new UnprocessableEntityException(message);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java
index 73929d9bffe..bc247a88605 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java
@@ -25,19 +25,23 @@ import org.hl7.fhir.r4.model.Bundle.BundleType;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
+import java.util.Set;
+import java.util.TreeSet;
+
+import static org.apache.commons.lang3.StringUtils.defaultString;
+
public class FhirResourceDaoBundleR4 extends FhirResourceDaoR4 {
@Override
protected void preProcessResourceForStorage(Bundle theResource) {
super.preProcessResourceForStorage(theResource);
- if (theResource.getType() != BundleType.DOCUMENT && theResource.getType() != BundleType.COLLECTION) {
+ Set allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
+ if (!allowedBundleTypes.contains(defaultString(theResource.getType().toCode()))) {
String message = "Unable to store a Bundle resource on this server with a Bundle.type value of: " + (theResource.getType() != null ? theResource.getType().toCode() : "(missing)");
throw new UnprocessableEntityException(message);
}
}
-
-
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java
index 167524a8ff3..a5ba5ad8da2 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java
@@ -46,12 +46,13 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
public void after() {
myDaoConfig.setDefaultSearchParamsCanBeOverridden(new DaoConfig().isDefaultSearchParamsCanBeOverridden());
myDaoConfig.setUniqueIndexesCheckedBeforeSave(new DaoConfig().isUniqueIndexesCheckedBeforeSave());
+ myDaoConfig.setSchedulingDisabled(new DaoConfig().isSchedulingDisabled());
}
@Before
public void before() {
myDaoConfig.setDefaultSearchParamsCanBeOverridden(true);
- myDaoConfig.setSchedulingDisabled(new DaoConfig().isSchedulingDisabled());
+ myDaoConfig.setSchedulingDisabled(true);
}
private void createUniqueBirthdateAndGenderSps() {
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6748607e650..c13b75994ff 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,11 @@
]]>
+
+ The JPA server now has a configuration item in the DaoConfig to specify which bundle types
+ may be stored as-is on the /Bundle endpoint. By default the following types
+ are allowed: collection, document, message.
+
From 7f87def432ec174041169579191ac359490a8aff Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Fri, 1 Jun 2018 07:40:33 -0400
Subject: [PATCH 30/31] Fix tests
---
.../src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java | 1 +
.../ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java | 2 +-
.../java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java | 2 +-
.../ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java | 4 ++--
.../ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java | 2 +-
5 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
index b8c5f38f313..bd49b51fdd0 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
@@ -188,6 +188,7 @@ public class DaoConfig {
* @see #DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE
*/
public void setBundleTypesAllowedForStorage(Set theBundleTypesAllowedForStorage) {
+ Validate.notNull(theBundleTypesAllowedForStorage, "theBundleTypesAllowedForStorage must not be null");
myBundleTypesAllowedForStorage = theBundleTypesAllowedForStorage;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java
index 317778c9b71..752836baddc 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoBundleDstu3.java
@@ -36,7 +36,7 @@ public class FhirResourceDaoBundleDstu3 extends FhirResourceDaoDstu3 {
super.preProcessResourceForStorage(theResource);
Set allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
- if (!allowedBundleTypes.contains(defaultString(theResource.getType().toCode()))) {
+ if (theResource.getType() == null || !allowedBundleTypes.contains(defaultString(theResource.getType().toCode()))) {
String message = "Unable to store a Bundle resource on this server with a Bundle.type value of: " + (theResource.getType() != null ? theResource.getType().toCode() : "(missing)");
throw new UnprocessableEntityException(message);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java
index bc247a88605..0aaa99f2685 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoBundleR4.java
@@ -37,7 +37,7 @@ public class FhirResourceDaoBundleR4 extends FhirResourceDaoR4 {
super.preProcessResourceForStorage(theResource);
Set allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
- if (!allowedBundleTypes.contains(defaultString(theResource.getType().toCode()))) {
+ if (theResource.getType() == null || !allowedBundleTypes.contains(defaultString(theResource.getType().toCode()))) {
String message = "Unable to store a Bundle resource on this server with a Bundle.type value of: " + (theResource.getType() != null ? theResource.getType().toCode() : "(missing)");
throw new UnprocessableEntityException(message);
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
index 79539d19f88..7d9e6df1f57 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
@@ -319,7 +319,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
myBundleDao.create(bundle, mySrd);
fail();
} catch (UnprocessableEntityException e) {
- assertEquals("Unable to store a Bundle resource on this server with a Bundle.type of: (missing)", e.getMessage());
+ assertEquals("Unable to store a Bundle resource on this server with a Bundle.type value of: (missing)", e.getMessage());
}
bundle = new Bundle();
@@ -329,7 +329,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
myBundleDao.create(bundle, mySrd);
fail();
} catch (UnprocessableEntityException e) {
- assertEquals("Unable to store a Bundle resource on this server with a Bundle.type of: batch-response", e.getMessage());
+ assertEquals("Unable to store a Bundle resource on this server with a Bundle.type value of: batch-response", e.getMessage());
}
bundle = new Bundle();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java
index 13dbedd304f..289f63e8f3e 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java
@@ -135,7 +135,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
client.create().resource(resBody).execute().getId();
fail();
} catch (UnprocessableEntityException e) {
- assertThat(e.getMessage(), containsString("Unable to store a Bundle resource on this server with a Bundle.type of: transaction"));
+ assertThat(e.getMessage(), containsString("Unable to store a Bundle resource on this server with a Bundle.type value of: transaction"));
}
}
From fedf4a870acb577421235ee5eb7d6618ed77ff42 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Fri, 1 Jun 2018 07:40:51 -0400
Subject: [PATCH 31/31] License header updates
---
.../src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
index bd49b51fdd0..d2d3595f6bc 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
@@ -20,9 +20,9 @@ import java.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.