Merge branch 'master' into master
This commit is contained in:
commit
8f1effe5e3
|
@ -4,10 +4,11 @@
|
||||||
|
|
||||||
# Use VM based build environment
|
# Use VM based build environment
|
||||||
sudo: required
|
sudo: required
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
language: java
|
language: java
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk9
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- MAVEN_OPTS="-Xmx1024m"
|
- MAVEN_OPTS="-Xmx1024m"
|
||||||
|
@ -25,5 +26,4 @@ before_script:
|
||||||
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 -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,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
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
hapi-fhir
|
HAPI FHIR
|
||||||
=========
|
=========
|
||||||
|
|
||||||
HAPI FHIR - Java API for HL7 FHIR Clients and Servers
|
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)
|
[![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)
|
[![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)
|
[![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)
|
* Linux Build: [![Build Status](https://travis-ci.org/jamesagnew/hapi-fhir.svg?branch=master)](https://travis-ci.org/jamesagnew/hapi-fhir)
|
||||||
* Windows Build: <a href="https://ci.appveyor.com/project/jamesagnew/hapi-fhir"><img src="https://ci.appveyor.com/api/projects/status/github/jamesagnew/hapi-fhir?branch=master&svg=true"></a>
|
* Windows Build: <a href="https://ci.appveyor.com/project/jamesagnew/hapi-fhir"><img src="https://ci.appveyor.com/api/projects/status/github/jamesagnew/hapi-fhir?branch=master&svg=true"></a>
|
||||||
|
|
||||||
|
|
||||||
Complete project documentation is available here:
|
Complete project documentation is available here:
|
||||||
http://jamesagnew.github.io/hapi-fhir/
|
http://jamesagnew.github.io/hapi-fhir/
|
||||||
|
|
||||||
A demonstration of this project is available here:
|
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.
|
This project is Open Source, licensed under the Apache Software License 2.0.
|
||||||
|
|
|
@ -4,4 +4,6 @@ cache:
|
||||||
- C:\maven\
|
- C:\maven\
|
||||||
- C:\Users\appveyor\.m2\repository
|
- C:\Users\appveyor\.m2\repository
|
||||||
build_script:
|
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,REDUCED_JPA_TESTS clean install
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
@ -188,7 +189,8 @@ public class CdsExampleTests {
|
||||||
Assert.assertTrue(procedureRequest.getDoNotPerform());
|
Assert.assertTrue(procedureRequest.getDoNotPerform());
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void CdsHooksPatientViewTest() throws IOException {
|
public void CdsHooksPatientViewTest() throws IOException {
|
||||||
putResource("cds-bcs-library.json", "patient-view");
|
putResource("cds-bcs-library.json", "patient-view");
|
||||||
putResource("cds-bcs-patient.json", "Patient-6532");
|
putResource("cds-bcs-patient.json", "Patient-6532");
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class BuiltJarDstu2IT {
|
||||||
* android uses) and see if this passes
|
* android uses) and see if this passes
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@Test
|
||||||
public void testClient() {
|
public void testClient() {
|
||||||
FhirContext ctx = FhirContext.forDstu2();
|
FhirContext ctx = FhirContext.forDstu2();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class GenericClientDstu3IT {
|
||||||
@Test
|
@Test
|
||||||
public void testClientFailures() throws Exception {
|
public void testClientFailures() throws Exception {
|
||||||
ResponseBody body = mock(ResponseBody.class);
|
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()
|
myHttpResponse = new Response.Builder()
|
||||||
.request(myRequest)
|
.request(myRequest)
|
||||||
|
@ -216,12 +216,6 @@ public class GenericClientDstu3IT {
|
||||||
assertEquals("java.lang.RuntimeException", e.toString());
|
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1757,8 +1757,8 @@ public class XmlUtil {
|
||||||
|
|
||||||
private static void throwUnitTestExceptionIfConfiguredToDoSo() throws FactoryConfigurationError, XMLStreamException {
|
private static void throwUnitTestExceptionIfConfiguredToDoSo() throws FactoryConfigurationError, XMLStreamException {
|
||||||
if (ourNextException != null) {
|
if (ourNextException != null) {
|
||||||
if (ourNextException instanceof FactoryConfigurationError) {
|
if (ourNextException instanceof javax.xml.stream.FactoryConfigurationError) {
|
||||||
throw ((FactoryConfigurationError)ourNextException);
|
throw ((javax.xml.stream.FactoryConfigurationError)ourNextException);
|
||||||
}
|
}
|
||||||
throw (XMLStreamException)ourNextException;
|
throw (XMLStreamException)ourNextException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,13 +166,22 @@
|
||||||
<artifactId>thymeleaf-spring4</artifactId>
|
<artifactId>thymeleaf-spring4</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dependencies for Schematron -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>Saxon-HE</artifactId>
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
<groupId>net.sf.saxon</groupId>
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.sun.istack</groupId>
|
||||||
|
<artifactId>istack-commons-runtime</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -180,18 +189,17 @@
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-commons</artifactId>
|
<artifactId>ph-commons</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--
|
|
||||||
These have been added as explicit dependencies
|
|
||||||
as JDK9 no longer includes them by default
|
|
||||||
-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.xml.bind</groupId>
|
<groupId>javax.xml.bind</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jaxb</groupId>
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
<artifactId>jaxb-runtime</artifactId>
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,23 +80,13 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>jersey-server</artifactId>
|
<artifactId>resteasy-jaxrs</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.containers</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>jersey-container-servlet-core</artifactId>
|
<artifactId>resteasy-client</artifactId>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.containers</groupId>
|
|
||||||
<artifactId>jersey-container-jetty-http</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.media</groupId>
|
|
||||||
<artifactId>jersey-media-moxy</artifactId>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,21 @@
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.mail</groupId>
|
||||||
|
<artifactId>javax.mail-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.mail</groupId>
|
||||||
|
<artifactId>javax.mail</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
|
@ -330,6 +345,13 @@
|
||||||
<sourceDirectory>../hapi-fhir-client-okhttp/src/main/java</sourceDirectory>
|
<sourceDirectory>../hapi-fhir-client-okhttp/src/main/java</sourceDirectory>
|
||||||
</sourceDirectories>
|
</sourceDirectories>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
|
|
@ -88,6 +88,11 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Unit test dependencies -->
|
<!-- Unit test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.woodstox</groupId>
|
<groupId>org.codehaus.woodstox</groupId>
|
||||||
|
@ -109,6 +114,20 @@
|
||||||
<artifactId>jetty-servlet</artifactId>
|
<artifactId>jetty-servlet</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-jaxrs</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-client</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>org.glassfish.jersey.core</groupId>
|
||||||
<artifactId>jersey-server</artifactId>
|
<artifactId>jersey-server</artifactId>
|
||||||
|
@ -129,6 +148,8 @@
|
||||||
<artifactId>jersey-media-moxy</artifactId>
|
<artifactId>jersey-media-moxy</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
|
|
|
@ -69,6 +69,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
||||||
private org.hl7.fhir.dstu2016may.model.Conformance myDstu2_1Conformance;
|
private org.hl7.fhir.dstu2016may.model.Conformance myDstu2_1Conformance;
|
||||||
private org.hl7.fhir.instance.model.Conformance myDstu2Hl7OrgConformance;
|
private org.hl7.fhir.instance.model.Conformance myDstu2Hl7OrgConformance;
|
||||||
private ca.uhn.fhir.model.dstu2.resource.Conformance myDstu2Conformance;
|
private ca.uhn.fhir.model.dstu2.resource.Conformance myDstu2Conformance;
|
||||||
|
private boolean myInitialized;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor allowing the description, servername and server to be set
|
* Constructor allowing the description, servername and server to be set
|
||||||
|
@ -112,7 +113,11 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
||||||
* conformance
|
* conformance
|
||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
protected void setUpPostConstruct() {
|
protected synchronized void setUpPostConstruct() {
|
||||||
|
if (myInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (Entry<Class<? extends IResourceProvider>, IResourceProvider> provider : getProviders().entrySet()) {
|
for (Entry<Class<? extends IResourceProvider>, IResourceProvider> provider : getProviders().entrySet()) {
|
||||||
addProvider(provider.getValue(), provider.getKey());
|
addProvider(provider.getValue(), provider.getKey());
|
||||||
}
|
}
|
||||||
|
@ -155,6 +160,8 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
||||||
default:
|
default:
|
||||||
throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion);
|
throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,6 +191,8 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
||||||
@GET
|
@GET
|
||||||
@Path("/metadata")
|
@Path("/metadata")
|
||||||
public Response conformance() throws IOException {
|
public Response conformance() throws IOException {
|
||||||
|
setUpPostConstruct();
|
||||||
|
|
||||||
Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA);
|
Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA);
|
||||||
IRestfulResponse response = request.build().getResponse();
|
IRestfulResponse response = request.build().getResponse();
|
||||||
response.addHeader(Constants.HEADER_CORS_ALLOW_ORIGIN, "*");
|
response.addHeader(Constants.HEADER_CORS_ALLOW_ORIGIN, "*");
|
||||||
|
|
|
@ -47,8 +47,8 @@ import ca.uhn.fhir.rest.server.method.BaseMethodBinding;
|
||||||
* a large amount of the fhir api functionality using JAXRS
|
* a large amount of the fhir api functionality using JAXRS
|
||||||
* @author Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare
|
* @author Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare
|
||||||
*/
|
*/
|
||||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
|
@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 })
|
@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)
|
@Interceptors(JaxRsExceptionInterceptor.class)
|
||||||
public abstract class AbstractJaxRsResourceProvider<R extends IBaseResource> extends AbstractJaxRsProvider
|
public abstract class AbstractJaxRsResourceProvider<R extends IBaseResource> extends AbstractJaxRsProvider
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class JaxRsMethodBindings {
|
||||||
*/
|
*/
|
||||||
public BaseMethodBinding<?> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
|
public BaseMethodBinding<?> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
|
||||||
String bindingKey = StringUtils.defaultIfBlank(theBindingKey, DEFAULT_METHOD_KEY);
|
String bindingKey = StringUtils.defaultIfBlank(theBindingKey, DEFAULT_METHOD_KEY);
|
||||||
ConcurrentHashMap<String, BaseMethodBinding<?>> map = operationBindings.get(operationType);
|
ConcurrentHashMap<String, BaseMethodBinding<?>> map = getMapForOperation(operationType);
|
||||||
if(map == null || !map.containsKey(bindingKey)) {
|
if(map == null || !map.containsKey(bindingKey)) {
|
||||||
throw new NotImplementedOperationException("Operation not implemented");
|
throw new NotImplementedOperationException("Operation not implemented");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import static org.junit.Assert.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import javax.annotation.Priority;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -81,7 +82,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAcceptHeaderFetchConformance() throws Exception {
|
public void testAcceptHeaderFetchConformance() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Conformance conf = new Conformance();
|
Conformance conf = new Conformance();
|
||||||
|
@ -115,7 +116,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAcceptHeaderPreflightConformance() throws Exception {
|
public void testAcceptHeaderPreflightConformance() {
|
||||||
final IParser p = ourCtx.newXmlParser();
|
final IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
final Conformance conf = new Conformance();
|
final Conformance conf = new Conformance();
|
||||||
|
@ -145,7 +146,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAcceptHeaderPreflightConformancePreferJson() throws Exception {
|
public void testAcceptHeaderPreflightConformancePreferJson() {
|
||||||
final IParser p = ourCtx.newXmlParser();
|
final IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
final Conformance conf = new Conformance();
|
final Conformance conf = new Conformance();
|
||||||
|
@ -175,7 +176,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void testConformance() throws Exception {
|
public void testConformance() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Conformance conf = new Conformance();
|
Conformance conf = new Conformance();
|
||||||
|
@ -198,7 +199,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProviderWhereWeForgotToSetTheContext() throws Exception {
|
public void testProviderWhereWeForgotToSetTheContext() {
|
||||||
JaxRsRestfulClientFactory clientFactory = new JaxRsRestfulClientFactory(); // no ctx
|
JaxRsRestfulClientFactory clientFactory = new JaxRsRestfulClientFactory(); // no ctx
|
||||||
clientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
|
clientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
|
||||||
|
|
||||||
|
@ -214,7 +215,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() {
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,7 +247,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateConditional() throws Exception {
|
public void testCreateConditional() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -290,7 +291,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreatePrefer() throws Exception {
|
public void testCreatePrefer() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -315,7 +316,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateReturningResourceBody() throws Exception {
|
public void testCreateReturningResourceBody() {
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setId("123");
|
p.setId("123");
|
||||||
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||||
|
@ -338,7 +339,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteConditional() throws Exception {
|
public void testDeleteConditional() {
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
@ -363,7 +364,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDelete() throws Exception {
|
public void testDelete() {
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
@ -377,7 +378,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHistory() throws Exception {
|
public void testHistory() {
|
||||||
|
|
||||||
final String msg = getPatientFeedWithOneResult();
|
final String msg = getPatientFeedWithOneResult();
|
||||||
|
|
||||||
|
@ -474,7 +475,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMetaAdd() throws Exception {
|
public void testMetaAdd() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
MetaDt inMeta = new MetaDt().addProfile("urn:profile:in");
|
MetaDt inMeta = new MetaDt().addProfile("urn:profile:in");
|
||||||
|
@ -507,7 +508,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMetaGet() throws Exception {
|
public void testMetaGet() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -563,7 +564,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationAsGetWithInParameters() throws Exception {
|
public void testOperationAsGetWithInParameters() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -642,7 +643,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationAsGetWithNoInParameters() throws Exception {
|
public void testOperationAsGetWithNoInParameters() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters outParams = new Parameters();
|
Parameters outParams = new Parameters();
|
||||||
|
@ -713,7 +714,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithBundleResponseJson() throws Exception {
|
public void testOperationWithBundleResponseJson() {
|
||||||
|
|
||||||
ourResponseContentType = Constants.CT_FHIR_JSON;
|
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" + "}";
|
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
|
@Test
|
||||||
public void testOperationWithBundleResponseXml() throws Exception {
|
public void testOperationWithBundleResponseXml() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -780,7 +781,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithInlineParams() throws Exception {
|
public void testOperationWithInlineParams() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters outParams = new Parameters();
|
Parameters outParams = new Parameters();
|
||||||
|
@ -899,7 +900,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithProfiledDatatypeParam() throws IOException, Exception {
|
public void testOperationWithProfiledDatatypeParam() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters outParams = new Parameters();
|
Parameters outParams = new Parameters();
|
||||||
|
@ -948,7 +949,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithListOfParameterResponse() throws Exception {
|
public void testOperationWithListOfParameterResponse() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -1023,7 +1024,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithNoInParameters() throws Exception {
|
public void testOperationWithNoInParameters() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -1102,7 +1103,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPageNext() throws Exception {
|
public void testPageNext() {
|
||||||
|
|
||||||
ourResponseContentType = Constants.CT_FHIR_XML + "; charset=UTF-8";
|
ourResponseContentType = Constants.CT_FHIR_XML + "; charset=UTF-8";
|
||||||
ourResponseBody = getPatientFeedWithOneResult();
|
ourResponseBody = getPatientFeedWithOneResult();
|
||||||
|
@ -1129,7 +1130,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPageNextNoLink() throws Exception {
|
public void testPageNextNoLink() {
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
|
||||||
ca.uhn.fhir.model.dstu2.resource.Bundle sourceBundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
ca.uhn.fhir.model.dstu2.resource.Bundle sourceBundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||||
|
@ -1141,7 +1142,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPagePrev() throws Exception {
|
public void testPagePrev() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1187,7 +1188,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadByUri() throws Exception {
|
public void testReadByUri() {
|
||||||
|
|
||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addName().addFamily("FAM");
|
patient.addName().addFamily("FAM");
|
||||||
|
@ -1207,7 +1208,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadFluentByUri() throws Exception {
|
public void testReadFluentByUri() {
|
||||||
|
|
||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addName().addFamily("FAM");
|
patient.addName().addFamily("FAM");
|
||||||
|
@ -1220,13 +1221,13 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
|
|
||||||
Patient response;
|
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("http://localhost:" + ourPort + "/AAA/Patient/123", ourRequestUri);
|
||||||
assertEquals("FAM", response.getName().get(0).getFamily().get(0).getValue());
|
assertEquals("FAM", response.getName().get(0).getFamily().get(0).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadUpdatedHeaderDoesntOverwriteResourceValue() throws Exception {
|
public void testReadUpdatedHeaderDoesntOverwriteResourceValue() {
|
||||||
|
|
||||||
|
|
||||||
final String input = "<Bundle xmlns=\"http://hl7.org/fhir\">\n" +
|
final String input = "<Bundle xmlns=\"http://hl7.org/fhir\">\n" +
|
||||||
|
@ -1264,7 +1265,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}";
|
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
|
@Test
|
||||||
public void testReadWithSummaryInvalid() throws Exception {
|
public void testReadWithSummaryInvalid() {
|
||||||
String msg = "<>>>><<<<>";
|
String msg = "<>>>><<<<>";
|
||||||
|
|
||||||
|
|
||||||
|
@ -1313,7 +1314,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadWithSummaryParamHtml() throws Exception {
|
public void testReadWithSummaryParamHtml() {
|
||||||
String msg = "<div>HELP IM A DIV</div>";
|
String msg = "<div>HELP IM A DIV</div>";
|
||||||
|
|
||||||
|
|
||||||
|
@ -1338,7 +1339,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}}]}";
|
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
|
@Test
|
||||||
public void testSearchByUrl() throws Exception {
|
public void testSearchByUrl() {
|
||||||
|
|
||||||
final String msg = getPatientFeedWithOneResult();
|
final String msg = getPatientFeedWithOneResult();
|
||||||
|
|
||||||
|
@ -1469,7 +1470,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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")
|
@SuppressWarnings("unused")
|
||||||
@Test
|
@Test
|
||||||
public void testSearchWithReverseInclude() throws Exception {
|
public void testSearchWithReverseInclude() {
|
||||||
|
|
||||||
String msg = getPatientFeedWithOneResult();
|
String msg = getPatientFeedWithOneResult();
|
||||||
|
|
||||||
|
@ -1655,7 +1656,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}}]}";
|
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
|
@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();
|
ca.uhn.fhir.model.dstu2.resource.Bundle resp = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||||
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
||||||
|
@ -1735,7 +1736,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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();
|
ca.uhn.fhir.model.dstu2.resource.Bundle req = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
|
@ -1781,7 +1782,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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();
|
ca.uhn.fhir.model.dstu2.resource.Bundle resp = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||||
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
||||||
|
@ -1822,7 +1823,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateConditional() throws Exception {
|
public void testUpdateConditional() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -1877,7 +1878,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateNonFluent() throws Exception {
|
public void testUpdateNonFluent() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -1907,7 +1908,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdatePrefer() throws Exception {
|
public void testUpdatePrefer() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -1933,7 +1934,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateReturningResourceBody() throws Exception {
|
public void testUpdateReturningResourceBody() {
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setId("123");
|
p.setId("123");
|
||||||
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||||
|
@ -1956,7 +1957,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidateFluent() throws Exception {
|
public void testValidateFluent() {
|
||||||
|
|
||||||
OperationOutcome oo = new OperationOutcome();
|
OperationOutcome oo = new OperationOutcome();
|
||||||
oo.addIssue().setDiagnostics("FOOBAR");
|
oo.addIssue().setDiagnostics("FOOBAR");
|
||||||
|
@ -2010,7 +2011,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidateNonFluent() throws Exception {
|
public void testValidateNonFluent() {
|
||||||
OperationOutcome oo = new OperationOutcome();
|
OperationOutcome oo = new OperationOutcome();
|
||||||
oo.addIssue().setDiagnostics("FOOBAR");
|
oo.addIssue().setDiagnostics("FOOBAR");
|
||||||
final String msg = ourCtx.newXmlParser().encodeResourceToString(oo);
|
final String msg = ourCtx.newXmlParser().encodeResourceToString(oo);
|
||||||
|
@ -2080,7 +2081,7 @@ public class GenericJaxRsClientDstu2Test {
|
||||||
ourServer.setHandler(new AbstractHandler() {
|
ourServer.setHandler(new AbstractHandler() {
|
||||||
|
|
||||||
@Override
|
@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);
|
theRequest.setHandled(true);
|
||||||
ourRequestUri = "http:" + theRequest.getHttpURI().toString();
|
ourRequestUri = "http:" + theRequest.getHttpURI().toString();
|
||||||
ourRequestUriAll.add(ourRequestUri);
|
ourRequestUriAll.add(ourRequestUri);
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAcceptHeaderFetchConformance() throws Exception {
|
public void testAcceptHeaderFetchConformance() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
CapabilityStatement conf = new CapabilityStatement();
|
CapabilityStatement conf = new CapabilityStatement();
|
||||||
|
@ -113,7 +113,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAcceptHeaderPreflightConformance() throws Exception {
|
public void testAcceptHeaderPreflightConformance() {
|
||||||
final IParser p = ourCtx.newXmlParser();
|
final IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
final CapabilityStatement conf = new CapabilityStatement();
|
final CapabilityStatement conf = new CapabilityStatement();
|
||||||
|
@ -143,7 +143,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAcceptHeaderPreflightConformancePreferJson() throws Exception {
|
public void testAcceptHeaderPreflightConformancePreferJson() {
|
||||||
final IParser p = ourCtx.newXmlParser();
|
final IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
final CapabilityStatement conf = new CapabilityStatement();
|
final CapabilityStatement conf = new CapabilityStatement();
|
||||||
|
@ -172,7 +172,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConformance() throws Exception {
|
public void testConformance() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
CapabilityStatement conf = new CapabilityStatement();
|
CapabilityStatement conf = new CapabilityStatement();
|
||||||
|
@ -188,7 +188,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
|
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
CapabilityStatement resp = (CapabilityStatement)client.fetchConformance().ofType(CapabilityStatement.class).execute();
|
CapabilityStatement resp = client.fetchConformance().ofType(CapabilityStatement.class).execute();
|
||||||
|
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
assertEquals("http://localhost:" + ourPort + "/fhir/metadata", ourRequestUri);
|
assertEquals("http://localhost:" + ourPort + "/fhir/metadata", ourRequestUri);
|
||||||
|
@ -199,7 +199,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProviderWhereWeForgotToSetTheContext() throws Exception {
|
public void testProviderWhereWeForgotToSetTheContext() {
|
||||||
JaxRsRestfulClientFactory clientFactory = new JaxRsRestfulClientFactory(); // no ctx
|
JaxRsRestfulClientFactory clientFactory = new JaxRsRestfulClientFactory(); // no ctx
|
||||||
clientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
|
clientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() {
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateConditional() throws Exception {
|
public void testCreateConditional() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -289,7 +289,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate2() throws Exception {
|
public void testCreate2() {
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
@ -310,7 +310,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreatePrefer() throws Exception {
|
public void testCreatePrefer() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -335,7 +335,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateReturningResourceBody() throws Exception {
|
public void testCreateReturningResourceBody() {
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setId("123");
|
p.setId("123");
|
||||||
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||||
|
@ -358,7 +358,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteConditional() throws Exception {
|
public void testDeleteConditional() {
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
@ -384,7 +384,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteNonFluent() throws Exception {
|
public void testDeleteNonFluent() {
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
@ -398,7 +398,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHistory() throws Exception {
|
public void testHistory() {
|
||||||
|
|
||||||
final String msg = getPatientFeedWithOneResult();
|
final String msg = getPatientFeedWithOneResult();
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMetaAdd() throws Exception {
|
public void testMetaAdd() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Meta inMeta = new Meta().addProfile("urn:profile:in");
|
Meta inMeta = new Meta().addProfile("urn:profile:in");
|
||||||
|
@ -527,7 +527,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMetaGet() throws Exception {
|
public void testMetaGet() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -583,7 +583,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationAsGetWithInParameters() throws Exception {
|
public void testOperationAsGetWithInParameters() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -662,7 +662,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationAsGetWithNoInParameters() throws Exception {
|
public void testOperationAsGetWithNoInParameters() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters outParams = new Parameters();
|
Parameters outParams = new Parameters();
|
||||||
|
@ -733,7 +733,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithBundleResponseJson() throws Exception {
|
public void testOperationWithBundleResponseJson() {
|
||||||
|
|
||||||
ourResponseContentType = Constants.CT_FHIR_JSON;
|
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" + "}";
|
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
|
@Test
|
||||||
public void testOperationWithBundleResponseXml() throws Exception {
|
public void testOperationWithBundleResponseXml() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -800,7 +800,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithInlineParams() throws Exception {
|
public void testOperationWithInlineParams() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters outParams = new Parameters();
|
Parameters outParams = new Parameters();
|
||||||
|
@ -919,7 +919,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithProfiledDatatypeParam() throws IOException, Exception {
|
public void testOperationWithProfiledDatatypeParam() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters outParams = new Parameters();
|
Parameters outParams = new Parameters();
|
||||||
|
@ -968,7 +968,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithListOfParameterResponse() throws Exception {
|
public void testOperationWithListOfParameterResponse() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -1043,7 +1043,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOperationWithNoInParameters() throws Exception {
|
public void testOperationWithNoInParameters() {
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
Parameters inParams = new Parameters();
|
Parameters inParams = new Parameters();
|
||||||
|
@ -1122,7 +1122,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPageNext() throws Exception {
|
public void testPageNext() {
|
||||||
|
|
||||||
ourResponseContentType = Constants.CT_FHIR_XML + "; charset=UTF-8";
|
ourResponseContentType = Constants.CT_FHIR_XML + "; charset=UTF-8";
|
||||||
ourResponseBody = getPatientFeedWithOneResult();
|
ourResponseBody = getPatientFeedWithOneResult();
|
||||||
|
@ -1149,7 +1149,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPageNextNoLink() throws Exception {
|
public void testPageNextNoLink() {
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort + "/fhir");
|
||||||
|
|
||||||
org.hl7.fhir.dstu3.model.Bundle sourceBundle = new org.hl7.fhir.dstu3.model.Bundle();
|
org.hl7.fhir.dstu3.model.Bundle sourceBundle = new org.hl7.fhir.dstu3.model.Bundle();
|
||||||
|
@ -1161,7 +1161,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPagePrev() throws Exception {
|
public void testPagePrev() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1207,7 +1207,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadByUri() throws Exception {
|
public void testReadByUri() {
|
||||||
|
|
||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addName().setFamily("FAM");
|
patient.addName().setFamily("FAM");
|
||||||
|
@ -1227,7 +1227,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadFluentByUri() throws Exception {
|
public void testReadFluentByUri() {
|
||||||
|
|
||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addName().setFamily("FAM");
|
patient.addName().setFamily("FAM");
|
||||||
|
@ -1240,13 +1240,13 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
|
|
||||||
Patient response;
|
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("http://localhost:" + ourPort + "/AAA/Patient/123", ourRequestUri);
|
||||||
assertEquals("FAM", response.getName().get(0).getFamily());
|
assertEquals("FAM", response.getName().get(0).getFamily());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadUpdatedHeaderDoesntOverwriteResourceValue() throws Exception {
|
public void testReadUpdatedHeaderDoesntOverwriteResourceValue() {
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
final String input = "<Bundle xmlns=\"http://hl7.org/fhir\">\n" +
|
final String input = "<Bundle xmlns=\"http://hl7.org/fhir\">\n" +
|
||||||
|
@ -1286,7 +1286,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}";
|
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
|
@Test
|
||||||
public void testReadWithSummaryInvalid() throws Exception {
|
public void testReadWithSummaryInvalid() {
|
||||||
String msg = "<>>>><<<<>";
|
String msg = "<>>>><<<<>";
|
||||||
|
|
||||||
|
|
||||||
|
@ -1338,7 +1338,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadWithSummaryParamHtml() throws Exception {
|
public void testReadWithSummaryParamHtml() {
|
||||||
String msg = "<div>HELP IM A DIV</div>";
|
String msg = "<div>HELP IM A DIV</div>";
|
||||||
|
|
||||||
|
|
||||||
|
@ -1365,7 +1365,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}}]}";
|
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
|
@Test
|
||||||
public void testSearchByUrl() throws Exception {
|
public void testSearchByUrl() {
|
||||||
|
|
||||||
final String msg = getPatientFeedWithOneResult();
|
final String msg = getPatientFeedWithOneResult();
|
||||||
|
|
||||||
|
@ -1498,7 +1498,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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
|
@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\"}]}}]}";
|
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")
|
@SuppressWarnings("unused")
|
||||||
@Test
|
@Test
|
||||||
public void testSearchWithReverseInclude() throws Exception {
|
public void testSearchWithReverseInclude() {
|
||||||
|
|
||||||
String msg = getPatientFeedWithOneResult();
|
String msg = getPatientFeedWithOneResult();
|
||||||
|
|
||||||
|
@ -1684,7 +1684,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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\"}]}}]}";
|
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
|
@Test
|
||||||
public void testTransactionWithListOfResources() throws Exception {
|
public void testTransactionWithListOfResources() {
|
||||||
|
|
||||||
org.hl7.fhir.dstu3.model.Bundle resp = new org.hl7.fhir.dstu3.model.Bundle();
|
org.hl7.fhir.dstu3.model.Bundle resp = new org.hl7.fhir.dstu3.model.Bundle();
|
||||||
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
||||||
|
@ -1764,7 +1764,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionWithString() throws Exception {
|
public void testTransactionWithString() {
|
||||||
|
|
||||||
org.hl7.fhir.dstu3.model.Bundle req = new org.hl7.fhir.dstu3.model.Bundle();
|
org.hl7.fhir.dstu3.model.Bundle req = new org.hl7.fhir.dstu3.model.Bundle();
|
||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
|
@ -1810,7 +1810,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionWithTransactionResource() throws Exception {
|
public void testTransactionWithTransactionResource() {
|
||||||
|
|
||||||
org.hl7.fhir.dstu3.model.Bundle resp = new org.hl7.fhir.dstu3.model.Bundle();
|
org.hl7.fhir.dstu3.model.Bundle resp = new org.hl7.fhir.dstu3.model.Bundle();
|
||||||
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
resp.addEntry().getResponse().setLocation("Patient/1/_history/1");
|
||||||
|
@ -1851,7 +1851,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateConditional() throws Exception {
|
public void testUpdateConditional() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -1906,7 +1906,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateNonFluent() throws Exception {
|
public void testUpdateNonFluent() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -1936,7 +1936,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdatePrefer() throws Exception {
|
public void testUpdatePrefer() {
|
||||||
|
|
||||||
|
|
||||||
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
ourResponseStatus = Constants.STATUS_HTTP_204_NO_CONTENT;
|
||||||
|
@ -1962,7 +1962,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateReturningResourceBody() throws Exception {
|
public void testUpdateReturningResourceBody() {
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setId("123");
|
p.setId("123");
|
||||||
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
final String formatted = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||||
|
@ -1985,7 +1985,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidateFluent() throws Exception {
|
public void testValidateFluent() {
|
||||||
|
|
||||||
OperationOutcome oo = new OperationOutcome();
|
OperationOutcome oo = new OperationOutcome();
|
||||||
oo.addIssue().setDiagnostics("FOOBAR");
|
oo.addIssue().setDiagnostics("FOOBAR");
|
||||||
|
@ -2039,7 +2039,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidateNonFluent() throws Exception {
|
public void testValidateNonFluent() {
|
||||||
OperationOutcome oo = new OperationOutcome();
|
OperationOutcome oo = new OperationOutcome();
|
||||||
oo.addIssue().setDiagnostics("FOOBAR");
|
oo.addIssue().setDiagnostics("FOOBAR");
|
||||||
final String msg = ourCtx.newXmlParser().encodeResourceToString(oo);
|
final String msg = ourCtx.newXmlParser().encodeResourceToString(oo);
|
||||||
|
@ -2109,7 +2109,7 @@ public class GenericJaxRsClientDstu3Test {
|
||||||
ourServer.setHandler(new AbstractHandler() {
|
ourServer.setHandler(new AbstractHandler() {
|
||||||
|
|
||||||
@Override
|
@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);
|
theRequest.setHandled(true);
|
||||||
ourRequestUri = "http:" + theRequest.getHttpURI().toString();
|
ourRequestUri = "http:" + theRequest.getHttpURI().toString();
|
||||||
ourRequestUriAll.add(ourRequestUri);
|
ourRequestUriAll.add(ourRequestUri);
|
||||||
|
|
|
@ -3,51 +3,56 @@ package ca.uhn.fhir.jaxrs.client;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.hamcrest.CoreMatchers.hasItem;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.hamcrest.core.IsNot.not;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Sebastien Riviere on 31/07/2017.
|
* Created by Sebastien Riviere on 31/07/2017.
|
||||||
*/
|
*/
|
||||||
public class JaxRsRestfulClientFactoryTest {
|
public class JaxRsRestfulClientFactoryTest {
|
||||||
|
|
||||||
private final FhirContext context = FhirContext.forDstu2();
|
private static final Logger ourLog = LoggerFactory.getLogger(JaxRsRestfulClientFactoryTest.class);
|
||||||
private JaxRsRestfulClientFactory factory;
|
private final FhirContext context = FhirContext.forDstu2();
|
||||||
|
private JaxRsRestfulClientFactory factory;
|
||||||
|
|
||||||
@Before
|
@Test
|
||||||
public void setUp() {
|
public void emptyConstructorTest() {
|
||||||
factory = new JaxRsRestfulClientFactory(context);
|
assertNotNull(new JaxRsRestfulClientFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void emptyConstructorTest() {
|
public void getDefaultNativeClientTest() {
|
||||||
assertNotNull(new JaxRsRestfulClientFactory());
|
assertNotNull(factory.getNativeClientClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getDefaultNativeClientTest() {
|
public void getNativeClientEmptyRegisteredComponentListTest() {
|
||||||
assertNotNull(factory.getNativeClientClient());
|
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
|
@Test
|
||||||
public void getNativeClientEmptyRegisteredComponentListTest() {
|
public void getNativeClientRegisteredComponentListTest() {
|
||||||
factory.register(new ArrayList<Class<?>>());
|
factory.register(Arrays.asList(MyFilter.class, String.class));
|
||||||
final Client result = factory.getNativeClientClient();
|
final Client result = factory.getNativeClientClient();
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertTrue(result.getConfiguration().getClasses().isEmpty());
|
ourLog.info("Classes: {}", result.getConfiguration().getClasses());
|
||||||
}
|
assertThat(result.getConfiguration().getClasses(), hasItem(ca.uhn.fhir.jaxrs.client.MyFilter.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Before
|
||||||
public void getNativeClientRegisteredComponentListTest() {
|
public void setUp() {
|
||||||
factory.register(Arrays.asList(MyFilter.class, String.class));
|
factory = new JaxRsRestfulClientFactory(context);
|
||||||
final Client result = factory.getNativeClientClient();
|
}
|
||||||
assertNotNull(result);
|
|
||||||
assertEquals(1, result.getConfiguration().getClasses().size());
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,27 +1,24 @@
|
||||||
package ca.uhn.fhir.jaxrs.server;
|
package ca.uhn.fhir.jaxrs.server;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import static org.junit.Assert.assertTrue;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2Hl7Org;
|
||||||
import static org.mockito.Mockito.mock;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2Hl7Org;
|
||||||
import static org.mockito.Mockito.when;
|
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.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import javax.ws.rs.HttpMethod;
|
import static org.junit.Assert.*;
|
||||||
import javax.ws.rs.core.*;
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
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;
|
|
||||||
|
|
||||||
public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
|
public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
|
||||||
|
|
||||||
|
@ -29,16 +26,17 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
|
||||||
private static final String REQUESTURI = BASEURI + "/metadata";
|
private static final String REQUESTURI = BASEURI + "/metadata";
|
||||||
AbstractJaxRsConformanceProvider provider;
|
AbstractJaxRsConformanceProvider provider;
|
||||||
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
||||||
private ContainerRequest headers;
|
private ResteasyHttpHeaders headers;
|
||||||
private MultivaluedHashMap<String, String> queryParameters;
|
private MultivaluedHashMap<String, String> queryParameters;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// headers
|
|
||||||
headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
|
|
||||||
new MapPropertiesDelegate());
|
|
||||||
// uri info
|
// uri info
|
||||||
queryParameters = new MultivaluedHashMap<String, String>();
|
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<Class<? extends IResourceProvider>, IResourceProvider>();
|
providers = new ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider>();
|
||||||
|
|
|
@ -1,27 +1,24 @@
|
||||||
package ca.uhn.fhir.jaxrs.server;
|
package ca.uhn.fhir.jaxrs.server;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import static org.junit.Assert.assertTrue;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2_1;
|
||||||
import static org.mockito.Mockito.mock;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2_1;
|
||||||
import static org.mockito.Mockito.when;
|
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.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import javax.ws.rs.HttpMethod;
|
import static org.junit.Assert.*;
|
||||||
import javax.ws.rs.core.*;
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
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;
|
|
||||||
|
|
||||||
public class AbstractJaxRsConformanceProviderDstu2_1Test {
|
public class AbstractJaxRsConformanceProviderDstu2_1Test {
|
||||||
|
|
||||||
|
@ -29,19 +26,20 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test {
|
||||||
private static final String REQUESTURI = BASEURI + "/metadata";
|
private static final String REQUESTURI = BASEURI + "/metadata";
|
||||||
AbstractJaxRsConformanceProvider provider;
|
AbstractJaxRsConformanceProvider provider;
|
||||||
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
||||||
private ContainerRequest headers;
|
private ResteasyHttpHeaders headers;
|
||||||
private MultivaluedHashMap<String, String> queryParameters;
|
private MultivaluedHashMap<String, String> queryParameters;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// headers
|
|
||||||
headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
|
|
||||||
new MapPropertiesDelegate());
|
|
||||||
// uri info
|
// uri info
|
||||||
queryParameters = new MultivaluedHashMap<String, String>();
|
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<Class<? extends IResourceProvider>, IResourceProvider>();
|
providers = new ConcurrentHashMap<>();
|
||||||
provider = createConformanceProvider(providers);
|
provider = createConformanceProvider(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,24 @@
|
||||||
package ca.uhn.fhir.jaxrs.server;
|
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.context.FhirContext;
|
||||||
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProvider;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProvider;
|
||||||
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu3;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu3;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
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 {
|
public class AbstractJaxRsConformanceProviderDstu3Test {
|
||||||
|
|
||||||
|
@ -29,16 +26,17 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
|
||||||
private static final String REQUESTURI = BASEURI + "/metadata";
|
private static final String REQUESTURI = BASEURI + "/metadata";
|
||||||
AbstractJaxRsConformanceProvider provider;
|
AbstractJaxRsConformanceProvider provider;
|
||||||
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
||||||
private ContainerRequest headers;
|
private ResteasyHttpHeaders headers;
|
||||||
private MultivaluedHashMap<String, String> queryParameters;
|
private MultivaluedHashMap<String, String> queryParameters;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// headers
|
|
||||||
headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
|
|
||||||
new MapPropertiesDelegate());
|
|
||||||
// uri info
|
// uri info
|
||||||
queryParameters = new MultivaluedHashMap<String, String>();
|
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<Class<? extends IResourceProvider>, IResourceProvider>();
|
providers = new ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider>();
|
||||||
|
|
|
@ -1,27 +1,24 @@
|
||||||
package ca.uhn.fhir.jaxrs.server;
|
package ca.uhn.fhir.jaxrs.server;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import static org.junit.Assert.assertTrue;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderR4;
|
||||||
import static org.mockito.Mockito.mock;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderR4;
|
||||||
import static org.mockito.Mockito.when;
|
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.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import javax.ws.rs.HttpMethod;
|
import static org.junit.Assert.*;
|
||||||
import javax.ws.rs.core.*;
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
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;
|
|
||||||
|
|
||||||
public class AbstractJaxRsConformanceProviderR4Test {
|
public class AbstractJaxRsConformanceProviderR4Test {
|
||||||
|
|
||||||
|
@ -29,16 +26,17 @@ public class AbstractJaxRsConformanceProviderR4Test {
|
||||||
private static final String REQUESTURI = BASEURI + "/metadata";
|
private static final String REQUESTURI = BASEURI + "/metadata";
|
||||||
AbstractJaxRsConformanceProvider provider;
|
AbstractJaxRsConformanceProvider provider;
|
||||||
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
||||||
private ContainerRequest headers;
|
private ResteasyHttpHeaders headers;
|
||||||
private MultivaluedHashMap<String, String> queryParameters;
|
private MultivaluedHashMap<String, String> queryParameters;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// headers
|
|
||||||
headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
|
|
||||||
new MapPropertiesDelegate());
|
|
||||||
// uri info
|
// uri info
|
||||||
queryParameters = new MultivaluedHashMap<String, String>();
|
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<Class<? extends IResourceProvider>, IResourceProvider>();
|
providers = new ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider>();
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
package ca.uhn.fhir.jaxrs.server;
|
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.TestJaxRsDummyPatientProvider;
|
||||||
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProvider;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProvider;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
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 {
|
public class AbstractJaxRsConformanceProviderTest {
|
||||||
|
|
||||||
|
@ -28,16 +25,17 @@ public class AbstractJaxRsConformanceProviderTest {
|
||||||
private static final String REQUESTURI = BASEURI + "/metadata";
|
private static final String REQUESTURI = BASEURI + "/metadata";
|
||||||
AbstractJaxRsConformanceProvider provider;
|
AbstractJaxRsConformanceProvider provider;
|
||||||
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
private ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> providers;
|
||||||
private ContainerRequest headers;
|
private ResteasyHttpHeaders headers;
|
||||||
private MultivaluedHashMap<String, String> queryParameters;
|
private MultivaluedHashMap<String, String> queryParameters;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// headers
|
|
||||||
headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
|
|
||||||
new MapPropertiesDelegate());
|
|
||||||
// uri info
|
// uri info
|
||||||
queryParameters = new MultivaluedHashMap<String, String>();
|
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<Class<? extends IResourceProvider>, IResourceProvider>();
|
providers = new ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider>();
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
package ca.uhn.fhir.jaxrs.server;
|
package ca.uhn.fhir.jaxrs.server;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import static org.mockito.Matchers.*;
|
import ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory;
|
||||||
import static org.mockito.Mockito.*;
|
import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsResponseException;
|
||||||
|
import ca.uhn.fhir.jaxrs.server.test.RandomServerPortProvider;
|
||||||
import java.util.*;
|
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.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
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.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.runners.MethodSorters;
|
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 java.util.ArrayList;
|
||||||
import ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory;
|
import java.util.Arrays;
|
||||||
import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsExceptionInterceptor;
|
import java.util.List;
|
||||||
import ca.uhn.fhir.jaxrs.server.interceptor.JaxRsResponseException;
|
|
||||||
import ca.uhn.fhir.jaxrs.server.test.*;
|
import static org.junit.Assert.*;
|
||||||
import ca.uhn.fhir.model.primitive.UriDt;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import ca.uhn.fhir.rest.api.*;
|
import static org.mockito.ArgumentMatchers.argThat;
|
||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
import static org.mockito.ArgumentMatchers.isNull;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
import static org.mockito.Mockito.*;
|
||||||
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;
|
|
||||||
|
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class AbstractJaxRsResourceProviderDstu3Test {
|
public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
|
@ -135,7 +147,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
@Test
|
@Test
|
||||||
public void testConformance() {
|
public void testConformance() {
|
||||||
final CapabilityStatement conf = client.fetchConformance().ofType(CapabilityStatement.class).execute();
|
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
|
@Test
|
||||||
|
@ -149,7 +161,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
client.setEncoding(EncodingEnum.JSON);
|
client.setEncoding(EncodingEnum.JSON);
|
||||||
final MethodOutcome response = client.create().resource(toCreate).prefer(PreferReturnEnum.REPRESENTATION)
|
final MethodOutcome response = client.create().resource(toCreate).prefer(PreferReturnEnum.REPRESENTATION)
|
||||||
.execute();
|
.execute();
|
||||||
IBaseResource resource = (IBaseResource) response.getResource();
|
IBaseResource resource = response.getResource();
|
||||||
compareResultId(1, resource);
|
compareResultId(1, resource);
|
||||||
assertEquals("myIdentifier", patientCaptor.getValue().getIdentifier().get(0).getValue());
|
assertEquals("myIdentifier", patientCaptor.getValue().getIdentifier().get(0).getValue());
|
||||||
}
|
}
|
||||||
|
@ -162,7 +174,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConditionalDelete() throws Exception {
|
public void testConditionalDelete() {
|
||||||
when(mock.delete(idCaptor.capture(), conditionalCaptor.capture())).thenReturn(new MethodOutcome());
|
when(mock.delete(idCaptor.capture(), conditionalCaptor.capture())).thenReturn(new MethodOutcome());
|
||||||
client.delete().resourceConditionalByType("Patient").where(Patient.IDENTIFIER.exactly().identifier("2")).execute();
|
client.delete().resourceConditionalByType("Patient").where(Patient.IDENTIFIER.exactly().identifier("2")).execute();
|
||||||
assertEquals("Patient?identifier=2&_format=json", conditionalCaptor.getValue());
|
assertEquals("Patient?identifier=2&_format=json", conditionalCaptor.getValue());
|
||||||
|
@ -187,7 +199,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
assertEquals("outputValue", ((StringType)outParams.getParameter().get(0).getValue()).getValueAsString());
|
assertEquals("outputValue", ((StringType)outParams.getParameter().get(0).getValue()).getValueAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
class StringTypeMatcher extends ArgumentMatcher<StringType> {
|
class StringTypeMatcher implements ArgumentMatcher<StringType> {
|
||||||
private StringType myStringType;
|
private StringType myStringType;
|
||||||
|
|
||||||
public StringTypeMatcher(StringType stringType) {
|
public StringTypeMatcher(StringType stringType) {
|
||||||
|
@ -195,8 +207,8 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Object argument) {
|
public boolean matches(StringType argument) {
|
||||||
return myStringType.getValue().equals(((StringType)argument).getValue());
|
return myStringType.getValue().equals(argument.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -214,17 +226,18 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
inParams.addParameter().setName("dummy").setValue(new StringType("myAwesomeDummyValue"));
|
inParams.addParameter().setName("dummy").setValue(new StringType("myAwesomeDummyValue"));
|
||||||
|
|
||||||
// invoke
|
// invoke
|
||||||
Parameters outParams = client.operation().onInstance(new IdType("Patient", "1")).named("$someCustomOperation")
|
Parameters outParams = client
|
||||||
.withParameters(inParams).useHttpGet().execute();
|
.operation()
|
||||||
|
.onInstance(new IdType("Patient", "1"))
|
||||||
|
.named("$someCustomOperation")
|
||||||
|
.withParameters(inParams)
|
||||||
|
.useHttpGet()
|
||||||
|
.execute();
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
assertEquals("outputValue", ((StringType)outParams.getParameter().get(0).getValue()).getValueAsString());
|
assertEquals("outputValue", ((StringType)outParams.getParameter().get(0).getValue()).getValueAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Search using other query options */
|
|
||||||
public void testOther() {
|
|
||||||
// missing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
public void testRead() {
|
||||||
when(mock.find(idCaptor.capture())).thenReturn(createPatient(1));
|
when(mock.find(idCaptor.capture())).thenReturn(createPatient(1));
|
||||||
|
@ -236,7 +249,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
|
|
||||||
/** Search - Compartments */
|
/** Search - Compartments */
|
||||||
@Test
|
@Test
|
||||||
public void testSearchCompartements() {
|
public void testSearchCompartments() {
|
||||||
when(mock.searchCompartment(any(IdType.class))).thenReturn(Arrays.asList((IBaseResource) createPatient(1)));
|
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")
|
org.hl7.fhir.dstu3.model.Bundle response = client.search().forResource(Patient.class).withIdAndCompartment("1", "Condition")
|
||||||
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class).execute();
|
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class).execute();
|
||||||
|
@ -248,7 +261,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
/** */
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void testSearchPost() {
|
public void testSearchPost() {
|
||||||
when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
|
when(mock.search(ArgumentMatchers.isNull(), ArgumentMatchers.isNull()))
|
||||||
.thenReturn(createPatients(1, 13));
|
.thenReturn(createPatients(1, 13));
|
||||||
org.hl7.fhir.dstu3.model.Bundle result = client.search().forResource("Patient").usingStyle(SearchStyleEnum.POST)
|
org.hl7.fhir.dstu3.model.Bundle result = client.search().forResource("Patient").usingStyle(SearchStyleEnum.POST)
|
||||||
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class).execute();
|
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class).execute();
|
||||||
|
@ -275,12 +288,12 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
/** Search - Multi-valued Parameters (ANY/OR) */
|
/** Search - Multi-valued Parameters (ANY/OR) */
|
||||||
@Test
|
@Test
|
||||||
public void testSearchUsingGenericClientBySearchWithMultiValues() {
|
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)));
|
.thenReturn(Arrays.asList(createPatient(1)));
|
||||||
final Bundle results = client.search().forResource(Patient.class)
|
final Bundle results = client.search().forResource(Patient.class)
|
||||||
.where(Patient.ADDRESS.matches().values("Toronto")).and(Patient.ADDRESS.matches().values("Ontario"))
|
.where(Patient.ADDRESS.matches().values("Toronto")).and(Patient.ADDRESS.matches().values("Ontario"))
|
||||||
.and(Patient.ADDRESS.matches().values("Canada"))
|
.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();
|
IBaseResource resource = results.getEntry().get(0).getResource();
|
||||||
|
|
||||||
compareResultId(1, resource);
|
compareResultId(1, resource);
|
||||||
|
@ -291,7 +304,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
@Test
|
@Test
|
||||||
public void testSearchWithPaging() {
|
public void testSearchWithPaging() {
|
||||||
// Perform a search
|
// Perform a search
|
||||||
when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
|
when(mock.search(ArgumentMatchers.isNull(), ArgumentMatchers.isNull()))
|
||||||
.thenReturn(createPatients(1, 13));
|
.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)
|
final org.hl7.fhir.dstu3.model.Bundle results = client.search().forResource(Patient.class).count(8).returnBundle(org.hl7.fhir.dstu3.model.Bundle.class)
|
||||||
.execute();
|
.execute();
|
||||||
|
@ -416,17 +429,17 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
System.out.println(ourPort);
|
System.out.println(ourPort);
|
||||||
jettyServer = new Server(ourPort);
|
jettyServer = new Server(ourPort);
|
||||||
jettyServer.setHandler(context);
|
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);
|
jerseyServlet.setInitOrder(0);
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
|
jerseyServlet.setInitParameter("resteasy.resources",
|
||||||
StringUtils.join(Arrays.asList(
|
StringUtils.join(Arrays.asList(
|
||||||
TestJaxRsMockPatientRestProviderDstu3.class.getCanonicalName(),
|
TestJaxRsMockPatientRestProviderDstu3.class.getCanonicalName(),
|
||||||
JaxRsExceptionInterceptor.class.getCanonicalName(),
|
// JaxRsExceptionInterceptor.class.getCanonicalName(),
|
||||||
TestJaxRsConformanceRestProviderDstu3.class.getCanonicalName(),
|
TestJaxRsConformanceRestProviderDstu3.class.getCanonicalName(),
|
||||||
TestJaxRsMockPageProviderDstu3.class.getCanonicalName()
|
TestJaxRsMockPageProviderDstu3.class.getCanonicalName()
|
||||||
), ";"));
|
), ","));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
jettyServer.start();
|
jettyServer.start();
|
||||||
|
@ -441,7 +454,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownClass() throws Exception {
|
public static void tearDownClass() {
|
||||||
try {
|
try {
|
||||||
jettyServer.destroy();
|
jettyServer.destroy();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -1,35 +1,23 @@
|
||||||
package ca.uhn.fhir.jaxrs.server;
|
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.Matchers;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory;
|
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.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.api.IResource;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
|
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.*;
|
import ca.uhn.fhir.model.dstu2.resource.*;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
import ca.uhn.fhir.model.primitive.DateDt;
|
||||||
import ca.uhn.fhir.model.primitive.*;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.rest.api.*;
|
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.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
||||||
|
@ -37,6 +25,26 @@ import ca.uhn.fhir.rest.param.StringAndListParam;
|
||||||
import ca.uhn.fhir.rest.param.StringParam;
|
import ca.uhn.fhir.rest.param.StringParam;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
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)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class AbstractJaxRsResourceProviderTest {
|
public class AbstractJaxRsResourceProviderTest {
|
||||||
|
@ -127,7 +135,7 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
@Test
|
@Test
|
||||||
public void testConformance() {
|
public void testConformance() {
|
||||||
final Conformance conf = client.fetchConformance().ofType(Conformance.class).execute();
|
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
|
@Test
|
||||||
|
@ -154,7 +162,7 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConditionalDelete() throws Exception {
|
public void testConditionalDelete() {
|
||||||
when(mock.delete(idCaptor.capture(), conditionalCaptor.capture())).thenReturn(new MethodOutcome());
|
when(mock.delete(idCaptor.capture(), conditionalCaptor.capture())).thenReturn(new MethodOutcome());
|
||||||
client.delete().resourceConditionalByType("Patient").where(Patient.IDENTIFIER.exactly().identifier("2")).execute();
|
client.delete().resourceConditionalByType("Patient").where(Patient.IDENTIFIER.exactly().identifier("2")).execute();
|
||||||
assertEquals("Patient?identifier=2&_format=json", conditionalCaptor.getValue());
|
assertEquals("Patient?identifier=2&_format=json", conditionalCaptor.getValue());
|
||||||
|
@ -198,11 +206,6 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
assertEquals("outputValue", ((StringDt) outParams.getParameter().get(0).getValue()).getValueAsString());
|
assertEquals("outputValue", ((StringDt) outParams.getParameter().get(0).getValue()).getValueAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Search using other query options */
|
|
||||||
public void testOther() {
|
|
||||||
// missing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
public void testRead() {
|
||||||
when(mock.find(idCaptor.capture())).thenReturn(createPatient(1));
|
when(mock.find(idCaptor.capture())).thenReturn(createPatient(1));
|
||||||
|
@ -226,9 +229,12 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
/** */
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void testSearchPost() {
|
public void testSearchPost() {
|
||||||
when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
|
when(mock.search(isNull(), isNull()))
|
||||||
.thenReturn(createPatients(1, 13));
|
.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();
|
.returnBundle(Bundle.class).execute();
|
||||||
IResource resource = result.getEntry().get(0).getResource();
|
IResource resource = result.getEntry().get(0).getResource();
|
||||||
compareResultId(1, resource);
|
compareResultId(1, resource);
|
||||||
|
@ -253,12 +259,12 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
/** Search - Multi-valued Parameters (ANY/OR) */
|
/** Search - Multi-valued Parameters (ANY/OR) */
|
||||||
@Test
|
@Test
|
||||||
public void testSearchUsingGenericClientBySearchWithMultiValues() {
|
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)));
|
.thenReturn(Arrays.asList(createPatient(1)));
|
||||||
Bundle results = client.search().forResource(Patient.class)
|
Bundle results = client.search().forResource(Patient.class)
|
||||||
.where(Patient.ADDRESS.matches().values("Toronto")).and(Patient.ADDRESS.matches().values("Ontario"))
|
.where(Patient.ADDRESS.matches().values("Toronto")).and(Patient.ADDRESS.matches().values("Ontario"))
|
||||||
.and(Patient.ADDRESS.matches().values("Canada"))
|
.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();
|
IResource resource = results.getEntry().get(0).getResource();
|
||||||
|
|
||||||
compareResultId(1, resource);
|
compareResultId(1, resource);
|
||||||
|
@ -269,7 +275,7 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSearchWithPaging() {
|
public void testSearchWithPaging() {
|
||||||
// Perform a search
|
// Perform a search
|
||||||
when(mock.search(any(StringParam.class), Matchers.isNull(StringAndListParam.class)))
|
when(mock.search(isNull(), isNull()))
|
||||||
.thenReturn(createPatients(1, 13));
|
.thenReturn(createPatients(1, 13));
|
||||||
final Bundle results = client.search().forResource(Patient.class).limitTo(8).returnBundle(Bundle.class)
|
final Bundle results = client.search().forResource(Patient.class).limitTo(8).returnBundle(Bundle.class)
|
||||||
.execute();
|
.execute();
|
||||||
|
@ -370,24 +376,17 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T withId(final T id) {
|
private <T> T withId(final T id) {
|
||||||
return argThat(new BaseMatcher<T>() {
|
return argThat(other -> {
|
||||||
@Override
|
IdDt thisId;
|
||||||
public void describeTo(Description arg0) {
|
IdDt otherId;
|
||||||
}
|
if (id instanceof IdDt) {
|
||||||
|
thisId = (IdDt) id;
|
||||||
@Override
|
otherId = (IdDt) other;
|
||||||
public boolean matches(Object other) {
|
} else {
|
||||||
IdDt thisId;
|
thisId = ((IResource) id).getId();
|
||||||
IdDt otherId;
|
otherId = ((IResource) other).getId();
|
||||||
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 thisId.getIdPartAsLong().equals(otherId.getIdPartAsLong());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,17 +398,16 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
System.out.println(ourPort);
|
System.out.println(ourPort);
|
||||||
jettyServer = new Server(ourPort);
|
jettyServer = new Server(ourPort);
|
||||||
jettyServer.setHandler(context);
|
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);
|
jerseyServlet.setInitOrder(0);
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
|
jerseyServlet.setInitParameter("resteasy.resources",
|
||||||
StringUtils.join(Arrays.asList(
|
StringUtils.join(Arrays.asList(
|
||||||
TestJaxRsMockPatientRestProvider.class.getCanonicalName(),
|
TestJaxRsMockPatientRestProvider.class.getCanonicalName(),
|
||||||
JaxRsExceptionInterceptor.class.getCanonicalName(),
|
|
||||||
TestJaxRsConformanceRestProvider.class.getCanonicalName(),
|
TestJaxRsConformanceRestProvider.class.getCanonicalName(),
|
||||||
TestJaxRsMockPageProvider.class.getCanonicalName()
|
TestJaxRsMockPageProvider.class.getCanonicalName()
|
||||||
), ";"));
|
), ","));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
jettyServer.start();
|
jettyServer.start();
|
||||||
|
@ -424,7 +422,7 @@ public class AbstractJaxRsResourceProviderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownClass() throws Exception {
|
public static void tearDownClass() {
|
||||||
try {
|
try {
|
||||||
jettyServer.destroy();
|
jettyServer.destroy();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -1,34 +1,22 @@
|
||||||
package ca.uhn.fhir.jaxrs.server.util;
|
package ca.uhn.fhir.jaxrs.server.util;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3;
|
||||||
import static org.junit.Assert.assertTrue;
|
import ca.uhn.fhir.rest.api.RequestTypeEnum;
|
||||||
import static org.mockito.Mockito.doReturn;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
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.apache.commons.lang3.StringUtils;
|
||||||
import org.glassfish.jersey.internal.MapPropertiesDelegate;
|
import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
|
||||||
import org.glassfish.jersey.server.ContainerRequest;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProvider;
|
import javax.ws.rs.core.MultivaluedHashMap;
|
||||||
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
import ca.uhn.fhir.jaxrs.server.util.JaxRsRequest;
|
import javax.ws.rs.core.UriInfo;
|
||||||
import ca.uhn.fhir.jaxrs.server.util.JaxRsResponse;
|
import java.io.IOException;
|
||||||
import ca.uhn.fhir.rest.api.RequestTypeEnum;
|
import java.net.URISyntaxException;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
public class JaxRsRequestDstu3Test {
|
public class JaxRsRequestDstu3Test {
|
||||||
|
|
||||||
|
@ -38,7 +26,7 @@ public class JaxRsRequestDstu3Test {
|
||||||
|
|
||||||
private JaxRsRequest details;
|
private JaxRsRequest details;
|
||||||
private MultivaluedMap<String, String> queryParameters = new MultivaluedHashMap<String, String>();
|
private MultivaluedMap<String, String> queryParameters = new MultivaluedHashMap<String, String>();
|
||||||
private ContainerRequest headers;
|
private ResteasyHttpHeaders headers;
|
||||||
private TestJaxRsDummyPatientProviderDstu3 provider;
|
private TestJaxRsDummyPatientProviderDstu3 provider;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -52,11 +40,11 @@ public class JaxRsRequestDstu3Test {
|
||||||
String headerValue = "location_value";
|
String headerValue = "location_value";
|
||||||
String headerValue2 = "location_value_2";
|
String headerValue2 = "location_value_2";
|
||||||
assertTrue(StringUtils.isBlank(details.getHeader(headerKey)));
|
assertTrue(StringUtils.isBlank(details.getHeader(headerKey)));
|
||||||
headers.header(headerKey, headerValue);
|
queryParameters.add(headerKey, headerValue);
|
||||||
assertEquals(headerValue, details.getHeader(headerKey));
|
assertEquals(headerValue, details.getHeader(headerKey));
|
||||||
assertEquals(Arrays.asList(headerValue), details.getHeaders(headerKey));
|
assertEquals(Arrays.asList(headerValue), details.getHeaders(headerKey));
|
||||||
|
|
||||||
headers.header(headerKey, headerValue2);
|
queryParameters.add(headerKey, headerValue2);
|
||||||
assertEquals(headerValue, details.getHeader(headerKey));
|
assertEquals(headerValue, details.getHeader(headerKey));
|
||||||
assertEquals(Arrays.asList(headerValue, headerValue2), details.getHeaders(headerKey));
|
assertEquals(Arrays.asList(headerValue, headerValue2), details.getHeaders(headerKey));
|
||||||
}
|
}
|
||||||
|
@ -98,9 +86,9 @@ public class JaxRsRequestDstu3Test {
|
||||||
assertEquals(this.provider, details.getServer());
|
assertEquals(this.provider, details.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public JaxRsRequest createRequestDetails() throws URISyntaxException {
|
public JaxRsRequest createRequestDetails() {
|
||||||
//headers
|
// headers
|
||||||
headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null, new MapPropertiesDelegate());
|
headers = new ResteasyHttpHeaders(queryParameters);
|
||||||
|
|
||||||
//uri info
|
//uri info
|
||||||
UriInfo uriInfo = mock(UriInfo.class);
|
UriInfo uriInfo = mock(UriInfo.class);
|
||||||
|
|
|
@ -1,31 +1,22 @@
|
||||||
package ca.uhn.fhir.jaxrs.server.util;
|
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.jaxrs.server.test.TestJaxRsDummyPatientProvider;
|
||||||
import ca.uhn.fhir.rest.api.RequestTypeEnum;
|
import ca.uhn.fhir.rest.api.RequestTypeEnum;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
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 {
|
public class JaxRsRequestTest {
|
||||||
|
|
||||||
|
@ -35,7 +26,7 @@ public class JaxRsRequestTest {
|
||||||
|
|
||||||
private JaxRsRequest details;
|
private JaxRsRequest details;
|
||||||
private MultivaluedMap<String, String> queryParameters = new MultivaluedHashMap<String, String>();
|
private MultivaluedMap<String, String> queryParameters = new MultivaluedHashMap<String, String>();
|
||||||
private ContainerRequest headers;
|
private ResteasyHttpHeaders headers;
|
||||||
private TestJaxRsDummyPatientProvider provider;
|
private TestJaxRsDummyPatientProvider provider;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -49,11 +40,11 @@ public class JaxRsRequestTest {
|
||||||
String headerValue = "location_value";
|
String headerValue = "location_value";
|
||||||
String headerValue2 = "location_value_2";
|
String headerValue2 = "location_value_2";
|
||||||
assertTrue(StringUtils.isBlank(details.getHeader(headerKey)));
|
assertTrue(StringUtils.isBlank(details.getHeader(headerKey)));
|
||||||
headers.header(headerKey, headerValue);
|
queryParameters.add(headerKey, headerValue);
|
||||||
assertEquals(headerValue, details.getHeader(headerKey));
|
assertEquals(headerValue, details.getHeader(headerKey));
|
||||||
assertEquals(Arrays.asList(headerValue), details.getHeaders(headerKey));
|
assertEquals(Arrays.asList(headerValue), details.getHeaders(headerKey));
|
||||||
|
|
||||||
headers.header(headerKey, headerValue2);
|
queryParameters.add(headerKey, headerValue2);
|
||||||
assertEquals(headerValue, details.getHeader(headerKey));
|
assertEquals(headerValue, details.getHeader(headerKey));
|
||||||
assertEquals(Arrays.asList(headerValue, headerValue2), details.getHeaders(headerKey));
|
assertEquals(Arrays.asList(headerValue, headerValue2), details.getHeaders(headerKey));
|
||||||
}
|
}
|
||||||
|
@ -96,8 +87,10 @@ public class JaxRsRequestTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public JaxRsRequest createRequestDetails() throws URISyntaxException {
|
public JaxRsRequest createRequestDetails() throws URISyntaxException {
|
||||||
//headers
|
// headers
|
||||||
headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null, new MapPropertiesDelegate());
|
// headers = new ContainerRequest(new URI(BASEURI), new URI(REQUESTURI), HttpMethod.GET, null,
|
||||||
|
// new MapPropertiesDelegate());
|
||||||
|
headers = new ResteasyHttpHeaders(queryParameters);
|
||||||
|
|
||||||
//uri info
|
//uri info
|
||||||
UriInfo uriInfo = mock(UriInfo.class);
|
UriInfo uriInfo = mock(UriInfo.class);
|
||||||
|
|
|
@ -58,24 +58,12 @@
|
||||||
<version>${jetty_version}</version>
|
<version>${jetty_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>jersey-server</artifactId>
|
<artifactId>resteasy-jaxrs</artifactId>
|
||||||
<version>${jersey_version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.containers</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>jersey-container-servlet-core</artifactId>
|
<artifactId>resteasy-client</artifactId>
|
||||||
<version>${jersey_version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.containers</groupId>
|
|
||||||
<artifactId>jersey-container-jetty-http</artifactId>
|
|
||||||
<version>${jersey_version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.media</groupId>
|
|
||||||
<artifactId>jersey-media-moxy</artifactId>
|
|
||||||
<version>${jersey_version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
|
|
@ -43,15 +43,15 @@ public class JaxRsPatientProviderDstu3Test {
|
||||||
System.out.println(ourPort);
|
System.out.println(ourPort);
|
||||||
jettyServer = new Server(ourPort);
|
jettyServer = new Server(ourPort);
|
||||||
jettyServer.setHandler(context);
|
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);
|
jerseyServlet.setInitOrder(0);
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
|
jerseyServlet.setInitParameter("resteasy.resources",
|
||||||
StringUtils.join(Arrays.asList(
|
StringUtils.join(Arrays.asList(
|
||||||
JaxRsConformanceProviderDstu3.class.getCanonicalName(),
|
JaxRsConformanceProviderDstu3.class.getCanonicalName(),
|
||||||
JaxRsPatientRestProviderDstu3.class.getCanonicalName(),
|
JaxRsPatientRestProviderDstu3.class.getCanonicalName(),
|
||||||
JaxRsPageProviderDstu3.class.getCanonicalName()
|
JaxRsPageProviderDstu3.class.getCanonicalName()
|
||||||
), ";"));
|
), ","));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
jettyServer.start();
|
jettyServer.start();
|
||||||
|
|
||||||
|
@ -108,11 +108,6 @@ public class JaxRsPatientProviderDstu3Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Search using other query options */
|
|
||||||
public void testOther() {
|
|
||||||
//missing
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void testSearchPost() {
|
public void testSearchPost() {
|
||||||
|
|
|
@ -47,15 +47,15 @@ public class JaxRsPatientProviderTest {
|
||||||
System.out.println(ourPort);
|
System.out.println(ourPort);
|
||||||
jettyServer = new Server(ourPort);
|
jettyServer = new Server(ourPort);
|
||||||
jettyServer.setHandler(context);
|
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);
|
jerseyServlet.setInitOrder(0);
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
|
jerseyServlet.setInitParameter("resteasy.resources",
|
||||||
StringUtils.join(Arrays.asList(
|
StringUtils.join(Arrays.asList(
|
||||||
JaxRsConformanceProvider.class.getCanonicalName(),
|
JaxRsConformanceProvider.class.getCanonicalName(),
|
||||||
JaxRsPatientRestProvider.class.getCanonicalName(),
|
JaxRsPatientRestProvider.class.getCanonicalName(),
|
||||||
JaxRsPageProvider.class.getCanonicalName()
|
JaxRsPageProvider.class.getCanonicalName()
|
||||||
), ";"));
|
), ","));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
jettyServer.start();
|
jettyServer.start();
|
||||||
|
|
||||||
|
@ -119,11 +119,6 @@ public class JaxRsPatientProviderTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Search using other query options */
|
|
||||||
public void testOther() {
|
|
||||||
// missing
|
|
||||||
}
|
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void testSearchPost() {
|
public void testSearchPost() {
|
||||||
|
|
|
@ -205,7 +205,25 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Dependencies that need to be added since JDK9
|
||||||
|
-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Test Database -->
|
<!-- Test Database -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -368,11 +386,22 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.mail</groupId>
|
<groupId>com.sun.mail</groupId>
|
||||||
<artifactId>javax.mail</artifactId>
|
<artifactId>javax.mail</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>com.sun.activation</groupId>
|
||||||
|
<artifactId>javax.activation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.el</groupId>
|
<groupId>javax.el</groupId>
|
||||||
<artifactId>javax.el-api</artifactId>
|
<artifactId>javax.el-api</artifactId>
|
||||||
|
@ -565,11 +594,28 @@
|
||||||
These have been added as explicit dependencies
|
These have been added as explicit dependencies
|
||||||
as JDK9 no longer includes them by default
|
as JDK9 no longer includes them by default
|
||||||
-->
|
-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>${jaxb_api_version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<version>${jaxb_core_version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<version>${jaxb_core_version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!--
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jaxb</groupId>
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
<artifactId>jaxb-runtime</artifactId>
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
<version>${jaxb_runtime_version}</version>
|
<version>${jaxb_runtime_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -3,9 +3,11 @@ package ca.uhn.fhir.jpa.dao;
|
||||||
import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum;
|
import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum;
|
||||||
import ca.uhn.fhir.jpa.util.JpaConstants;
|
import ca.uhn.fhir.jpa.util.JpaConstants;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
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.ObjectUtils;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.apache.commons.lang3.time.DateUtils;
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
|
import org.hl7.fhir.r4.model.Bundle;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -62,6 +64,19 @@ public class DaoConfig {
|
||||||
* @see #setMaximumSearchResultCountInTransaction(Integer)
|
* @see #setMaximumSearchResultCountInTransaction(Integer)
|
||||||
*/
|
*/
|
||||||
private static final Integer DEFAULT_MAXIMUM_SEARCH_RESULT_COUNT_IN_TRANSACTION = null;
|
private static final Integer DEFAULT_MAXIMUM_SEARCH_RESULT_COUNT_IN_TRANSACTION = null;
|
||||||
|
/**
|
||||||
|
* Default {@link #setBundleTypesAllowedForStorage(Set)} value:
|
||||||
|
* <ul>
|
||||||
|
* <li>collection</li>
|
||||||
|
* <li>document</li>
|
||||||
|
* <li>message</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
private static final Set<String> 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;
|
private IndexEnabledEnum myIndexMissingFieldsEnabled = IndexEnabledEnum.DISABLED;
|
||||||
/**
|
/**
|
||||||
* update setter javadoc if default changes
|
* update setter javadoc if default changes
|
||||||
|
@ -128,6 +143,7 @@ public class DaoConfig {
|
||||||
private boolean myMarkResourcesForReindexingUponSearchParameterChange;
|
private boolean myMarkResourcesForReindexingUponSearchParameterChange;
|
||||||
private boolean myExpungeEnabled;
|
private boolean myExpungeEnabled;
|
||||||
private int myReindexThreadCount;
|
private int myReindexThreadCount;
|
||||||
|
private Set<String> myBundleTypesAllowedForStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -138,6 +154,7 @@ public class DaoConfig {
|
||||||
setSubscriptionPurgeInactiveAfterMillis(Long.MAX_VALUE);
|
setSubscriptionPurgeInactiveAfterMillis(Long.MAX_VALUE);
|
||||||
setMarkResourcesForReindexingUponSearchParameterChange(true);
|
setMarkResourcesForReindexingUponSearchParameterChange(true);
|
||||||
setReindexThreadCount(Runtime.getRuntime().availableProcessors());
|
setReindexThreadCount(Runtime.getRuntime().availableProcessors());
|
||||||
|
setBundleTypesAllowedForStorage(DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,6 +171,27 @@ public class DaoConfig {
|
||||||
myTreatReferencesAsLogical.add(theTreatReferencesAsLogical);
|
myTreatReferencesAsLogical.add(theTreatReferencesAsLogical);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This setting specifies the bundle types (<code>Bundle.type</code>) that
|
||||||
|
* are allowed to be stored as-is on the /Bundle endpoint.
|
||||||
|
*
|
||||||
|
* @see #DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE
|
||||||
|
*/
|
||||||
|
public Set<String> getBundleTypesAllowedForStorage() {
|
||||||
|
return myBundleTypesAllowedForStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This setting specifies the bundle types (<code>Bundle.type</code>) that
|
||||||
|
* are allowed to be stored as-is on the /Bundle endpoint.
|
||||||
|
*
|
||||||
|
* @see #DEFAULT_BUNDLE_TYPES_ALLOWED_FOR_STORAGE
|
||||||
|
*/
|
||||||
|
public void setBundleTypesAllowedForStorage(Set<String> theBundleTypesAllowedForStorage) {
|
||||||
|
Validate.notNull(theBundleTypesAllowedForStorage, "theBundleTypesAllowedForStorage must not be null");
|
||||||
|
myBundleTypesAllowedForStorage = theBundleTypesAllowedForStorage;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the highest number that a client is permitted to use in a
|
* Specifies the highest number that a client is permitted to use in a
|
||||||
* <code>Cache-Control: nostore, max-results=NNN</code>
|
* <code>Cache-Control: nostore, max-results=NNN</code>
|
||||||
|
@ -418,11 +456,8 @@ public class DaoConfig {
|
||||||
/**
|
/**
|
||||||
* This may be used to optionally register server interceptors directly against the DAOs.
|
* This may be used to optionally register server interceptors directly against the DAOs.
|
||||||
*/
|
*/
|
||||||
public void setInterceptors(IServerInterceptor... theInterceptor) {
|
public void setInterceptors(List<IServerInterceptor> theInterceptors) {
|
||||||
setInterceptors(new ArrayList<IServerInterceptor>());
|
myInterceptors = theInterceptors;
|
||||||
if (theInterceptor != null && theInterceptor.length != 0) {
|
|
||||||
getInterceptors().addAll(Arrays.asList(theInterceptor));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1164,8 +1199,11 @@ public class DaoConfig {
|
||||||
/**
|
/**
|
||||||
* This may be used to optionally register server interceptors directly against the DAOs.
|
* This may be used to optionally register server interceptors directly against the DAOs.
|
||||||
*/
|
*/
|
||||||
public void setInterceptors(List<IServerInterceptor> theInterceptors) {
|
public void setInterceptors(IServerInterceptor... theInterceptor) {
|
||||||
myInterceptors = theInterceptors;
|
setInterceptors(new ArrayList<IServerInterceptor>());
|
||||||
|
if (theInterceptor != null && theInterceptor.length != 0) {
|
||||||
|
getInterceptors().addAll(Arrays.asList(theInterceptor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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.model.dstu2.valueset.BundleTypeEnum;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
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<Bundle> {
|
public class FhirResourceDaoBundleDstu2 extends FhirResourceDaoDstu2<Bundle> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preProcessResourceForStorage(Bundle theResource) {
|
protected void preProcessResourceForStorage(Bundle theResource) {
|
||||||
super.preProcessResourceForStorage(theResource);
|
super.preProcessResourceForStorage(theResource);
|
||||||
|
|
||||||
if (theResource.getTypeElement().getValueAsEnum() != BundleTypeEnum.DOCUMENT && theResource.getTypeElement().getValueAsEnum() != BundleTypeEnum.COLLECTION) {
|
Set<String> allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
|
||||||
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)");
|
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);
|
throw new UnprocessableEntityException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,9 @@ import org.hibernate.search.query.dsl.QueryBuilder;
|
||||||
import org.hl7.fhir.dstu3.model.BaseResource;
|
import org.hl7.fhir.dstu3.model.BaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
@ -57,10 +59,14 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
|
|
||||||
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
|
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
|
||||||
private EntityManager myEntityManager;
|
private EntityManager myEntityManager;
|
||||||
|
@Autowired
|
||||||
|
private PlatformTransactionManager myTxManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected IForcedIdDao myForcedIdDao;
|
protected IForcedIdDao myForcedIdDao;
|
||||||
|
|
||||||
|
private Boolean ourDisabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -73,7 +79,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theTerms) {
|
for (List<? extends IQueryParameterType> nextAnd : theTerms) {
|
||||||
Set<String> terms = new HashSet<String>();
|
Set<String> terms = new HashSet<>();
|
||||||
for (IQueryParameterType nextOr : nextAnd) {
|
for (IQueryParameterType nextOr : nextAnd) {
|
||||||
StringParam nextOrString = (StringParam) nextOr;
|
StringParam nextOrString = (StringParam) nextOr;
|
||||||
String nextValueTrimmed = StringUtils.defaultString(nextOrString.getValue()).trim();
|
String nextValueTrimmed = StringUtils.defaultString(nextOrString.getValue()).trim();
|
||||||
|
@ -229,15 +235,25 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDisabled() {
|
public boolean isDisabled() {
|
||||||
try {
|
Boolean retVal = ourDisabled;
|
||||||
FullTextEntityManager em = org.hibernate.search.jpa.Search.getFullTextEntityManager(myEntityManager);
|
|
||||||
em.getSearchFactory().buildQueryBuilder().forEntity(ResourceTable.class).get();
|
if (retVal == null) {
|
||||||
} catch (Exception e) {
|
retVal = new TransactionTemplate(myTxManager).execute(t -> {
|
||||||
ourLog.trace("FullText test failed", e);
|
try {
|
||||||
ourLog.debug("Hibernate Search (Lucene) appears to be disabled on this server, fulltext will be disabled");
|
FullTextEntityManager em = org.hibernate.search.jpa.Search.getFullTextEntityManager(myEntityManager);
|
||||||
return true;
|
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()
|
@Transactional()
|
||||||
|
@ -246,6 +262,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
return doSearch(theResourceName, theParams, null);
|
return doSearch(theResourceName, theParams, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional()
|
||||||
@Override
|
@Override
|
||||||
public List<Suggestion> suggestKeywords(String theContext, String theSearchParam, String theText) {
|
public List<Suggestion> suggestKeywords(String theContext, String theSearchParam, String theText) {
|
||||||
Validate.notBlank(theContext, "theContext must be provided");
|
Validate.notBlank(theContext, "theContext must be provided");
|
||||||
|
|
|
@ -25,13 +25,18 @@ import org.hl7.fhir.dstu3.model.Bundle.BundleType;
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
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<Bundle> {
|
public class FhirResourceDaoBundleDstu3 extends FhirResourceDaoDstu3<Bundle> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preProcessResourceForStorage(Bundle theResource) {
|
protected void preProcessResourceForStorage(Bundle theResource) {
|
||||||
super.preProcessResourceForStorage(theResource);
|
super.preProcessResourceForStorage(theResource);
|
||||||
|
|
||||||
if (theResource.getType() != BundleType.DOCUMENT && theResource.getType() != BundleType.COLLECTION) {
|
Set<String> allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
|
||||||
|
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)");
|
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);
|
throw new UnprocessableEntityException(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,19 +25,23 @@ import org.hl7.fhir.r4.model.Bundle.BundleType;
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
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<Bundle> {
|
public class FhirResourceDaoBundleR4 extends FhirResourceDaoR4<Bundle> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preProcessResourceForStorage(Bundle theResource) {
|
protected void preProcessResourceForStorage(Bundle theResource) {
|
||||||
super.preProcessResourceForStorage(theResource);
|
super.preProcessResourceForStorage(theResource);
|
||||||
|
|
||||||
if (theResource.getType() != BundleType.DOCUMENT && theResource.getType() != BundleType.COLLECTION) {
|
Set<String> allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage();
|
||||||
|
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)");
|
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);
|
throw new UnprocessableEntityException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,6 @@ public class SearchBuilderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAA() {
|
|
||||||
assertTrue(123.00004f <= 123.0001f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCalculateMultiplierEqualNoDecimal() {
|
public void testCalculateMultiplierEqualNoDecimal() {
|
||||||
BigDecimal in = new BigDecimal("200");
|
BigDecimal in = new BigDecimal("200");
|
||||||
|
|
|
@ -14,7 +14,6 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||||
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
|
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
|
||||||
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
|
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
|
||||||
import ca.uhn.fhir.jpa.util.ResourceCountCache;
|
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.CodeableConceptDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
|
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
|
||||||
|
@ -42,7 +41,6 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
@ -181,12 +179,13 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@Transactional
|
|
||||||
public void beforeFlushFT() {
|
public void beforeFlushFT() {
|
||||||
FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
|
runInTransaction(() -> {
|
||||||
ftem.purgeAll(ResourceTable.class);
|
FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
|
||||||
ftem.purgeAll(ResourceIndexedSearchParamString.class);
|
ftem.purgeAll(ResourceTable.class);
|
||||||
ftem.flushToIndexes();
|
ftem.purgeAll(ResourceIndexedSearchParamString.class);
|
||||||
|
ftem.flushToIndexes();
|
||||||
|
});
|
||||||
|
|
||||||
myDaoConfig.setSchedulingDisabled(true);
|
myDaoConfig.setSchedulingDisabled(true);
|
||||||
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||||
|
|
|
@ -319,7 +319,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
myBundleDao.create(bundle, mySrd);
|
myBundleDao.create(bundle, mySrd);
|
||||||
fail();
|
fail();
|
||||||
} catch (UnprocessableEntityException e) {
|
} 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();
|
bundle = new Bundle();
|
||||||
|
@ -329,7 +329,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
myBundleDao.create(bundle, mySrd);
|
myBundleDao.create(bundle, mySrd);
|
||||||
fail();
|
fail();
|
||||||
} catch (UnprocessableEntityException e) {
|
} 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();
|
bundle = new Bundle();
|
||||||
|
@ -2435,6 +2435,8 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
assertThat(actual, contains(id3, id2, id1));
|
assertThat(actual, contains(id3, id2, id1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testSortByQuantity() {
|
public void testSortByQuantity() {
|
||||||
Observation res;
|
Observation res;
|
||||||
|
|
||||||
|
@ -2700,6 +2702,8 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testSortByUri() {
|
public void testSortByUri() {
|
||||||
ConceptMap res = new ConceptMap();
|
ConceptMap res = new ConceptMap();
|
||||||
res.addElement().addTarget().addDependsOn().setElement("http://foo2");
|
res.addElement().addTarget().addDependsOn().setElement("http://foo2");
|
||||||
|
|
|
@ -274,12 +274,13 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@Transactional
|
|
||||||
public void beforeFlushFT() {
|
public void beforeFlushFT() {
|
||||||
FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
|
runInTransaction(() -> {
|
||||||
ftem.purgeAll(ResourceTable.class);
|
FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
|
||||||
ftem.purgeAll(ResourceIndexedSearchParamString.class);
|
ftem.purgeAll(ResourceTable.class);
|
||||||
ftem.flushToIndexes();
|
ftem.purgeAll(ResourceIndexedSearchParamString.class);
|
||||||
|
ftem.flushToIndexes();
|
||||||
|
});
|
||||||
|
|
||||||
myDaoConfig.setSchedulingDisabled(true);
|
myDaoConfig.setSchedulingDisabled(true);
|
||||||
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||||
|
|
|
@ -2938,6 +2938,9 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
||||||
assertThat(actual, contains(toValues(id3, id2, id1)));
|
assertThat(actual, contains(toValues(id3, id2, id1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
|
||||||
public void testSortByQuantity() {
|
public void testSortByQuantity() {
|
||||||
Observation res;
|
Observation res;
|
||||||
|
|
||||||
|
@ -3203,6 +3206,8 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testSortByUri() {
|
public void testSortByUri() {
|
||||||
ConceptMap res = new ConceptMap();
|
ConceptMap res = new ConceptMap();
|
||||||
res.addGroup().setSource("http://foo2");
|
res.addGroup().setSource("http://foo2");
|
||||||
|
|
|
@ -282,12 +282,13 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@Transactional
|
|
||||||
public void beforeFlushFT() {
|
public void beforeFlushFT() {
|
||||||
FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
|
runInTransaction(()->{
|
||||||
ftem.purgeAll(ResourceTable.class);
|
FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
|
||||||
ftem.purgeAll(ResourceIndexedSearchParamString.class);
|
ftem.purgeAll(ResourceTable.class);
|
||||||
ftem.flushToIndexes();
|
ftem.purgeAll(ResourceIndexedSearchParamString.class);
|
||||||
|
ftem.flushToIndexes();
|
||||||
|
});
|
||||||
|
|
||||||
myDaoConfig.setSchedulingDisabled(true);
|
myDaoConfig.setSchedulingDisabled(true);
|
||||||
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.dao.DeleteMethodOutcome;
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.IServerOperationInterceptor;
|
import ca.uhn.fhir.rest.server.interceptor.IServerOperationInterceptor;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter;
|
import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter;
|
||||||
|
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.util.TestUtil;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
@ -567,8 +568,8 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test {
|
||||||
@Test
|
@Test
|
||||||
public void testServerOperationPreDelete() {
|
public void testServerOperationPreDelete() {
|
||||||
|
|
||||||
doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourcePreDelete(any(RequestDetails.class), any(IBaseResource.class));
|
doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourcePreDelete(nullable(ServletRequestDetails.class), any(Patient.class));
|
||||||
doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourceDeleted(any(RequestDetails.class), any(IBaseResource.class));
|
doAnswer(new MyOneResourceAnswer()).when(myJpaInterceptor).resourceDeleted(nullable(ServletRequestDetails.class), any(Patient.class));
|
||||||
|
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setActive(false);
|
p.setActive(false);
|
||||||
|
@ -578,8 +579,8 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test {
|
||||||
myPatientDao.delete(id);
|
myPatientDao.delete(id);
|
||||||
|
|
||||||
InOrder inorder = inOrder(myJpaInterceptor);
|
InOrder inorder = inOrder(myJpaInterceptor);
|
||||||
inorder.verify(myJpaInterceptor, times(1)).resourcePreDelete(any(RequestDetails.class), any(IBaseResource.class));
|
inorder.verify(myJpaInterceptor, times(1)).resourcePreDelete(nullable(ServletRequestDetails.class), any(Patient.class));
|
||||||
inorder.verify(myJpaInterceptor, times(1)).resourceDeleted(any(RequestDetails.class), any(IBaseResource.class));
|
inorder.verify(myJpaInterceptor, times(1)).resourceDeleted(nullable(ServletRequestDetails.class), any(Patient.class));
|
||||||
// resourcePreDelete
|
// resourcePreDelete
|
||||||
assertEquals(idPart, myIds.get(0).getIdPart());
|
assertEquals(idPart, myIds.get(0).getIdPart());
|
||||||
assertEquals("1", myIds.get(0).getVersionIdPart());
|
assertEquals("1", myIds.get(0).getVersionIdPart());
|
||||||
|
|
|
@ -3140,6 +3140,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
assertThat(actual, contains(toValues(id3, id2, id1)));
|
assertThat(actual, contains(toValues(id3, id2, id1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testSortByQuantity() {
|
public void testSortByQuantity() {
|
||||||
Observation res;
|
Observation res;
|
||||||
|
|
||||||
|
@ -3405,6 +3407,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testSortByUri() {
|
public void testSortByUri() {
|
||||||
ConceptMap res = new ConceptMap();
|
ConceptMap res = new ConceptMap();
|
||||||
res.addGroup().setSource("http://foo2");
|
res.addGroup().setSource("http://foo2");
|
||||||
|
|
|
@ -46,12 +46,13 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
|
||||||
public void after() {
|
public void after() {
|
||||||
myDaoConfig.setDefaultSearchParamsCanBeOverridden(new DaoConfig().isDefaultSearchParamsCanBeOverridden());
|
myDaoConfig.setDefaultSearchParamsCanBeOverridden(new DaoConfig().isDefaultSearchParamsCanBeOverridden());
|
||||||
myDaoConfig.setUniqueIndexesCheckedBeforeSave(new DaoConfig().isUniqueIndexesCheckedBeforeSave());
|
myDaoConfig.setUniqueIndexesCheckedBeforeSave(new DaoConfig().isUniqueIndexesCheckedBeforeSave());
|
||||||
|
myDaoConfig.setSchedulingDisabled(new DaoConfig().isSchedulingDisabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
myDaoConfig.setDefaultSearchParamsCanBeOverridden(true);
|
myDaoConfig.setDefaultSearchParamsCanBeOverridden(true);
|
||||||
myDaoConfig.setSchedulingDisabled(new DaoConfig().isSchedulingDisabled());
|
myDaoConfig.setSchedulingDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createUniqueBirthdateAndGenderSps() {
|
private void createUniqueBirthdateAndGenderSps() {
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
client.create().resource(resBody).execute().getId();
|
client.create().resource(resBody).execute().getId();
|
||||||
fail();
|
fail();
|
||||||
} catch (UnprocessableEntityException e) {
|
} 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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
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
|
* This is Gramahe's test transaction - it requires some set up in order to work
|
||||||
*/
|
*/
|
||||||
// @Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testTransactionFromBundle3() throws Exception {
|
public void testTransactionFromBundle3() throws Exception {
|
||||||
|
|
||||||
InputStream bundleRes = SystemProviderDstu2Test.class.getResourceAsStream("/grahame-transaction.xml");
|
InputStream bundleRes = SystemProviderDstu2Test.class.getResourceAsStream("/grahame-transaction.xml");
|
||||||
|
|
|
@ -519,7 +519,8 @@ public class SystemProviderDstu3Test extends BaseJpaDstu3Test {
|
||||||
/**
|
/**
|
||||||
* This is Gramahe's test transaction - it requires some set up in order to work
|
* This is Gramahe's test transaction - it requires some set up in order to work
|
||||||
*/
|
*/
|
||||||
// @Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testTransactionFromBundle3() throws Exception {
|
public void testTransactionFromBundle3() throws Exception {
|
||||||
|
|
||||||
InputStream bundleRes = SystemProviderDstu3Test.class.getResourceAsStream("/grahame-transaction.xml");
|
InputStream bundleRes = SystemProviderDstu3Test.class.getResourceAsStream("/grahame-transaction.xml");
|
||||||
|
|
|
@ -476,7 +476,8 @@ public class SystemProviderR4Test extends BaseJpaR4Test {
|
||||||
/**
|
/**
|
||||||
* This is Gramahe's test transaction - it requires some set up in order to work
|
* This is Gramahe's test transaction - it requires some set up in order to work
|
||||||
*/
|
*/
|
||||||
// @Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testTransactionFromBundle3() throws Exception {
|
public void testTransactionFromBundle3() throws Exception {
|
||||||
|
|
||||||
InputStream bundleRes = SystemProviderR4Test.class.getResourceAsStream("/grahame-transaction.xml");
|
InputStream bundleRes = SystemProviderR4Test.class.getResourceAsStream("/grahame-transaction.xml");
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.mockito.Captor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
@ -143,8 +143,6 @@ public class SearchCoordinatorSvcImplTest {
|
||||||
Iterator<Long> iter = new FailAfterNIterator<Long>(new SlowIterator<Long>(pids.iterator(), 2), 300);
|
Iterator<Long> iter = new FailAfterNIterator<Long>(new SlowIterator<Long>(pids.iterator(), 2), 300);
|
||||||
when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(iter);
|
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());
|
IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
|
||||||
assertNotNull(result.getUuid());
|
assertNotNull(result.getUuid());
|
||||||
assertEquals(null, result.size());
|
assertEquals(null, result.size());
|
||||||
|
|
|
@ -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.ElasticsearchAnalysisDefinitionRegistryBuilder;
|
||||||
import org.hibernate.search.elasticsearch.analyzer.definition.spi.ElasticsearchAnalysisDefinitionProvider;
|
import org.hibernate.search.elasticsearch.analyzer.definition.ElasticsearchAnalysisDefinitionProvider;
|
||||||
|
|
||||||
public class ElasticsearchMappingProvider implements ElasticsearchAnalysisDefinitionProvider {
|
public class ElasticsearchMappingProvider implements ElasticsearchAnalysisDefinitionProvider {
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
|
||||||
extraProperties.put("hibernate.cache.use_minimal_puts", "false");
|
extraProperties.put("hibernate.cache.use_minimal_puts", "false");
|
||||||
|
|
||||||
// the belowing properties are used for ElasticSearch integration
|
// 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.indexmanager", "elasticsearch");
|
||||||
extraProperties.put("hibernate.search.default.elasticsearch.host", "http://127.0.0.1:9200");
|
extraProperties.put("hibernate.search.default.elasticsearch.host", "http://127.0.0.1:9200");
|
||||||
extraProperties.put("hibernate.search.default.elasticsearch.index_schema_management_strategy", "CREATE");
|
extraProperties.put("hibernate.search.default.elasticsearch.index_schema_management_strategy", "CREATE");
|
||||||
|
|
|
@ -192,6 +192,8 @@
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dependencies for Schematron -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
|
@ -202,6 +204,27 @@
|
||||||
<artifactId>ph-commons</artifactId>
|
<artifactId>ph-commons</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>javax.activation-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
|
|
|
@ -2440,7 +2440,7 @@ public class XmlParserDstu2_1Test {
|
||||||
assertThat(patient.getIdentifier().get(0).getType().getCoding(), IsEmptyCollection.empty());
|
assertThat(patient.getIdentifier().get(0).getType().getCoding(), IsEmptyCollection.empty());
|
||||||
|
|
||||||
ArgumentCaptor<String> capt = ArgumentCaptor.forClass(String.class);
|
ArgumentCaptor<String> 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());
|
assertEquals("value", capt.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,7 +470,7 @@ public class GenericClientDstu2_1Test {
|
||||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
|
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().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");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ public class GenericClientDstu2_1Test {
|
||||||
client.read().resource(Patient.class).withId("1").execute();
|
client.read().resource(Patient.class).withId("1").execute();
|
||||||
fail();
|
fail();
|
||||||
} catch (FhirClientConnectionException e) {
|
} catch (FhirClientConnectionException e) {
|
||||||
assertEquals("java.lang.Exception", e.getMessage());
|
assertThat(e.getMessage(), containsString("java.io.IOException"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ca.uhn.fhir.rest.client;
|
package ca.uhn.fhir.rest.client;
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
@ -45,10 +46,10 @@ public class RestfulClientFactoryTest {
|
||||||
when(ctx.getVersion()).thenReturn(FhirVersionEnum.DSTU2_1.getVersionImplementation());
|
when(ctx.getVersion()).thenReturn(FhirVersionEnum.DSTU2_1.getVersionImplementation());
|
||||||
when(ctx.getRestfulClientFactory()).thenReturn(restfulClientFactory);
|
when(ctx.getRestfulClientFactory()).thenReturn(restfulClientFactory);
|
||||||
|
|
||||||
when(restfulClientFactory.getHttpClient(any(StringBuilder.class), (Map<String, List<String>>)any(Map.class), any(String.class), any(RequestTypeEnum.class), any(List.class))).thenReturn(httpClient);
|
when(restfulClientFactory.getHttpClient(any(StringBuilder.class), (Map<String, List<String>>)nullable(Map.class), nullable(String.class), any(RequestTypeEnum.class), any(List.class))).thenReturn(httpClient);
|
||||||
|
|
||||||
IHttpRequest httpRequest = mock(IHttpRequest.class);
|
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);
|
IHttpResponse httpResponse = mock(IHttpResponse.class);
|
||||||
when(httpRequest.execute()).thenReturn(httpResponse);
|
when(httpRequest.execute()).thenReturn(httpResponse);
|
||||||
|
|
|
@ -2,12 +2,9 @@ package ca.uhn.fhir.rest.server;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.inOrder;
|
import static org.mockito.Mockito.*;
|
||||||
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 java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.TimeUnit;
|
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.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletHandler;
|
import org.eclipse.jetty.servlet.ServletHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
|
import org.hl7.fhir.dstu2016may.model.OperationOutcome;
|
||||||
import org.hl7.fhir.dstu2016may.model.Patient;
|
import org.hl7.fhir.dstu2016may.model.Patient;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.mockito.ArgumentCaptor;
|
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.rest.server.servlet.ServletRequestDetails;
|
||||||
import ca.uhn.fhir.util.PortUtil;
|
import ca.uhn.fhir.util.PortUtil;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.util.TestUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class InterceptorDstu2_1Test {
|
public class InterceptorDstu2_1Test {
|
||||||
|
private static final Logger ourLog = LoggerFactory.getLogger(InterceptorDstu2_1Test.class);
|
||||||
private static CloseableHttpClient ourClient;
|
private static CloseableHttpClient ourClient;
|
||||||
private static FhirContext ourCtx = FhirContext.forDstu2_1();
|
private static FhirContext ourCtx = FhirContext.forDstu2_1();
|
||||||
private static int ourPort;
|
private static int ourPort;
|
||||||
|
@ -56,22 +56,22 @@ public class InterceptorDstu2_1Test {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
myInterceptor1 = mock(IServerInterceptor.class);
|
myInterceptor1 = mock(IServerInterceptor.class, withSettings().verboseLogging());
|
||||||
myInterceptor2 = mock(IServerInterceptor.class);
|
myInterceptor2 = mock(IServerInterceptor.class, withSettings().verboseLogging());
|
||||||
ourServlet.setInterceptors(myInterceptor1, myInterceptor2);
|
ourServlet.setInterceptors(myInterceptor1, myInterceptor2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidate() throws Exception {
|
public void testValidate() throws Exception {
|
||||||
when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
|
when(myInterceptor1.outgoingResponse(any(ServletRequestDetails.class), any(OperationOutcome.class))).thenReturn(true);
|
||||||
when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.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.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.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor2.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
|
when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
|
||||||
when(myInterceptor2.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
String input =
|
String input =
|
||||||
|
@ -95,30 +95,32 @@ public class InterceptorDstu2_1Test {
|
||||||
"}";
|
"}";
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
|
ourLog.info("Starting call");
|
||||||
|
|
||||||
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/$validate");
|
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/$validate");
|
||||||
httpPost.setEntity(new StringEntity(input, ContentType.create(Constants.CT_FHIR_JSON, "UTF-8")));
|
httpPost.setEntity(new StringEntity(input, ContentType.create(Constants.CT_FHIR_JSON, "UTF-8")));
|
||||||
HttpResponse status = ourClient.execute(httpPost);
|
HttpResponse status = ourClient.execute(httpPost);
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
InOrder order = inOrder(myInterceptor1, myInterceptor2);
|
InOrder order = inOrder(myInterceptor1, myInterceptor2);
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
||||||
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
|
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)).incomingRequestPreHandled(nullable(RestOperationTypeEnum.class), nullable(ActionRequestDetails.class));
|
||||||
order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(IResource.class));
|
order.verify(myInterceptor2, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
|
||||||
order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.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(any(RequestDetails.class), any(IResource.class));
|
order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
|
||||||
order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
|
|
||||||
// Avoid concurrency issues
|
// Avoid concurrency issues
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
|
|
||||||
order.verify(myInterceptor2, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
|
order.verify(myInterceptor2, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
|
||||||
order.verify(myInterceptor1, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
|
order.verify(myInterceptor1, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
|
||||||
verifyNoMoreInteractions(myInterceptor1);
|
verifyNoMoreInteractions(myInterceptor1);
|
||||||
verifyNoMoreInteractions(myInterceptor2);
|
verifyNoMoreInteractions(myInterceptor2);
|
||||||
|
|
||||||
|
|
|
@ -102,14 +102,31 @@
|
||||||
<artifactId>thymeleaf</artifactId>
|
<artifactId>thymeleaf</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dependencies for Schematron -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
<scope>test</scope><!-- <exclusions> <exclusion> <artifactId>Saxon-HE</artifactId> <groupId>net.sf.saxon</groupId> </exclusion> </exclusions> -->
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>javax.activation</groupId>
|
||||||
<artifactId>ph-commons</artifactId>
|
<artifactId>javax.activation-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import org.mockito.ArgumentMatchers;
|
||||||
|
import org.mockito.Matchers;
|
||||||
import org.mockito.internal.stubbing.answers.ThrowsException;
|
import org.mockito.internal.stubbing.answers.ThrowsException;
|
||||||
import org.xmlunit.builder.DiffBuilder;
|
import org.xmlunit.builder.DiffBuilder;
|
||||||
import org.xmlunit.builder.Input;
|
import org.xmlunit.builder.Input;
|
||||||
|
@ -2551,7 +2553,7 @@ public class XmlParserDstu2Test {
|
||||||
assertThat(patient.getIdentifier().get(0).getType().getValueAsEnum(), IsEmptyCollection.empty());
|
assertThat(patient.getIdentifier().get(0).getType().getValueAsEnum(), IsEmptyCollection.empty());
|
||||||
|
|
||||||
ArgumentCaptor<String> capt = ArgumentCaptor.forClass(String.class);
|
ArgumentCaptor<String> 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());
|
assertEquals("value", capt.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ca.uhn.fhir.rest.client;
|
package ca.uhn.fhir.rest.client;
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
@ -44,10 +45,10 @@ public class RestfulClientFactoryDstu2Test {
|
||||||
when(ctx.getVersion()).thenReturn(FhirVersionEnum.DSTU2.getVersionImplementation());
|
when(ctx.getVersion()).thenReturn(FhirVersionEnum.DSTU2.getVersionImplementation());
|
||||||
when(ctx.getRestfulClientFactory()).thenReturn(restfulClientFactory);
|
when(ctx.getRestfulClientFactory()).thenReturn(restfulClientFactory);
|
||||||
|
|
||||||
when(restfulClientFactory.getHttpClient(any(StringBuilder.class), (Map<String, List<String>>)any(Map.class), any(String.class), any(RequestTypeEnum.class), any(List.class))).thenReturn(httpClient);
|
when(restfulClientFactory.getHttpClient(nullable(StringBuilder.class), (Map<String, List<String>>)nullable(Map.class), nullable(String.class), nullable(RequestTypeEnum.class), nullable(List.class))).thenReturn(httpClient);
|
||||||
|
|
||||||
IHttpRequest httpRequest = mock(IHttpRequest.class);
|
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);
|
IHttpResponse httpResponse = mock(IHttpResponse.class);
|
||||||
when(httpRequest.execute()).thenReturn(httpResponse);
|
when(httpRequest.execute()).thenReturn(httpResponse);
|
||||||
|
|
|
@ -110,6 +110,7 @@ public class BinaryDstu2Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCreateWrongType() throws Exception {
|
public void testCreateWrongType() throws Exception {
|
||||||
Binary res = new Binary();
|
Binary res = new Binary();
|
||||||
res.setContent(new byte[] { 1, 2, 3, 4 });
|
res.setContent(new byte[] { 1, 2, 3, 4 });
|
||||||
|
@ -122,8 +123,7 @@ public class BinaryDstu2Test {
|
||||||
HttpResponse status = ourClient.execute(http);
|
HttpResponse status = ourClient.execute(http);
|
||||||
assertEquals(201, status.getStatusLine().getStatusCode());
|
assertEquals(201, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
assertEquals("text/plain", ourLast.getContentType());
|
assertEquals("application/json+fhir;charset=utf-8", ourLast.getContentType().replace(" ","").toLowerCase());
|
||||||
assertArrayEquals(new byte[] { 1, 2, 3, 4 }, ourLast.getContent());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.*;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
||||||
|
@ -159,7 +160,8 @@ public class IncludeDstu2Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testMixedContainedAndNonContained() throws Exception {
|
public void testMixedContainedAndNonContained() throws Exception {
|
||||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
|
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
|
||||||
HttpResponse status = ourClient.execute(httpGet);
|
HttpResponse status = ourClient.execute(httpGet);
|
||||||
|
|
|
@ -1,21 +1,31 @@
|
||||||
package ca.uhn.fhir.rest.server;
|
package ca.uhn.fhir.rest.server;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import static org.hamcrest.Matchers.not;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import static org.hamcrest.Matchers.startsWith;
|
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
|
||||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||||
import static org.junit.Assert.assertEquals;
|
import ca.uhn.fhir.model.dstu2.resource.Bundle.Link;
|
||||||
import static org.junit.Assert.assertNull;
|
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||||
import static org.junit.Assert.assertThat;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
|
import ca.uhn.fhir.rest.annotation.Create;
|
||||||
import java.util.*;
|
import ca.uhn.fhir.rest.annotation.RequiredParam;
|
||||||
import java.util.concurrent.TimeUnit;
|
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.commons.io.IOUtils;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
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.ContentType;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
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.ServletHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
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 java.util.ArrayList;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import java.util.Collections;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
|
import java.util.List;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
import java.util.concurrent.TimeUnit;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Link;
|
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
import static org.hamcrest.Matchers.*;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import static org.junit.Assert.*;
|
||||||
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.*;
|
|
||||||
|
|
||||||
public class SearchDstu2Test {
|
public class SearchDstu2Test {
|
||||||
|
|
||||||
|
@ -142,14 +149,14 @@ public class SearchDstu2Test {
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
|
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
assertThat(responseContent, PatternMatcher.pattern("id value..[0-9a-f-]+\\\""));
|
assertThat(responseContent, matchesPattern(".*id value..[0-9a-f-]+\\\".*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchBlacklist01Failing() throws Exception {
|
public void testSearchBlacklist01Failing() throws Exception {
|
||||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchBlacklist01&ref.black1=value");
|
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchBlacklist01&ref.black1=value");
|
||||||
HttpResponse status = ourClient.execute(httpGet);
|
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());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
assertEquals(400, status.getStatusLine().getStatusCode());
|
assertEquals(400, status.getStatusLine().getStatusCode());
|
||||||
|
@ -159,7 +166,7 @@ public class SearchDstu2Test {
|
||||||
public void testSearchBlacklist01Passing() throws Exception {
|
public void testSearchBlacklist01Passing() throws Exception {
|
||||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchBlacklist01&ref.white1=value");
|
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchBlacklist01&ref.white1=value");
|
||||||
HttpResponse status = ourClient.execute(httpGet);
|
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());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
|
@ -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<CharSequence> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a matcher that matches if the examined {@link CharSequence} matches the specified regular expression.
|
|
||||||
* <p/>
|
|
||||||
* For example:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* assertThat("myStringOfNote", pattern("[0-9]+"))
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param regex
|
|
||||||
* the regular expression that the returned matcher will use to match any examined {@link CharSequence}
|
|
||||||
*/
|
|
||||||
@Factory
|
|
||||||
public static Matcher<CharSequence> pattern(String regex) {
|
|
||||||
return pattern(Pattern.compile(regex));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a matcher that matches if the examined {@link CharSequence} matches the specified {@link Pattern}.
|
|
||||||
* <p/>
|
|
||||||
* For example:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* assertThat("myStringOfNote", Pattern.compile("[0-9]+"))
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param pattern
|
|
||||||
* the pattern that the returned matcher will use to match any examined {@link CharSequence}
|
|
||||||
*/
|
|
||||||
@Factory
|
|
||||||
public static Matcher<CharSequence> 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("\"");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -216,6 +216,8 @@
|
||||||
<artifactId>thymeleaf</artifactId>
|
<artifactId>thymeleaf</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dependencies for Schematron -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
|
@ -226,6 +228,26 @@
|
||||||
<artifactId>ph-commons</artifactId>
|
<artifactId>ph-commons</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>javax.activation-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- UNIT TEST DEPENDENCIES -->
|
<!-- UNIT TEST DEPENDENCIES -->
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ public class JsonParserDstu3Test {
|
||||||
ArgumentCaptor<ValueType> expected = ArgumentCaptor.forClass(ValueType.class);
|
ArgumentCaptor<ValueType> expected = ArgumentCaptor.forClass(ValueType.class);
|
||||||
ArgumentCaptor<ScalarType> expectedScalarType = ArgumentCaptor.forClass(ScalarType.class);
|
ArgumentCaptor<ScalarType> expectedScalarType = ArgumentCaptor.forClass(ScalarType.class);
|
||||||
ArgumentCaptor<ScalarType> foundScalarType = ArgumentCaptor.forClass(ScalarType.class);
|
ArgumentCaptor<ScalarType> 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, found.getAllValues().get(0));
|
||||||
assertEquals(ValueType.SCALAR, expected.getAllValues().get(0));
|
assertEquals(ValueType.SCALAR, expected.getAllValues().get(0));
|
||||||
|
@ -2344,13 +2344,13 @@ public class JsonParserDstu3Test {
|
||||||
ArgumentCaptor<ValueType> actual = ArgumentCaptor.forClass(ValueType.class);
|
ArgumentCaptor<ValueType> actual = ArgumentCaptor.forClass(ValueType.class);
|
||||||
ArgumentCaptor<ScalarType> expectedScalar = ArgumentCaptor.forClass(ScalarType.class);
|
ArgumentCaptor<ScalarType> expectedScalar = ArgumentCaptor.forClass(ScalarType.class);
|
||||||
ArgumentCaptor<ScalarType> actualScalar = ArgumentCaptor.forClass(ScalarType.class);
|
ArgumentCaptor<ScalarType> 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());
|
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());
|
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());
|
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());
|
Mockito.eq(ValueType.SCALAR), actualScalar.capture());
|
||||||
|
|
||||||
assertEquals("_id", elementName.getAllValues().get(0));
|
assertEquals("_id", elementName.getAllValues().get(0));
|
||||||
|
|
|
@ -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+", " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -2960,7 +2960,7 @@ public class XmlParserDstu3Test {
|
||||||
assertThat(patient.getIdentifier().get(0).getType().getCoding(), IsEmptyCollection.empty());
|
assertThat(patient.getIdentifier().get(0).getType().getCoding(), IsEmptyCollection.empty());
|
||||||
|
|
||||||
ArgumentCaptor<String> capt = ArgumentCaptor.forClass(String.class);
|
ArgumentCaptor<String> 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());
|
assertEquals("value", capt.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -496,7 +496,7 @@ public class GenericClientDstu3Test {
|
||||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
|
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().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");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ public class GenericClientDstu3Test {
|
||||||
client.read().resource(Patient.class).withId("1").execute();
|
client.read().resource(Patient.class).withId("1").execute();
|
||||||
fail();
|
fail();
|
||||||
} catch (FhirClientConnectionException e) {
|
} catch (FhirClientConnectionException e) {
|
||||||
assertEquals("java.lang.Exception", e.getMessage());
|
assertThat(e.getMessage(), containsString("java.io.IOException"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.rest.server;
|
package ca.uhn.fhir.rest.server;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.rest.annotation.*;
|
import ca.uhn.fhir.rest.annotation.*;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
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.IdType;
|
||||||
import org.hl7.fhir.dstu3.model.OperationOutcome;
|
import org.hl7.fhir.dstu3.model.OperationOutcome;
|
||||||
import org.hl7.fhir.dstu3.model.Patient;
|
import org.hl7.fhir.dstu3.model.Patient;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.InOrder;
|
import org.mockito.InOrder;
|
||||||
|
@ -45,7 +43,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.mockito.Matchers.any;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
public class InterceptorDstu3Test {
|
public class InterceptorDstu3Test {
|
||||||
|
@ -117,14 +114,14 @@ public class InterceptorDstu3Test {
|
||||||
public void testResourceResponseIncluded() throws Exception {
|
public void testResourceResponseIncluded() throws Exception {
|
||||||
ourServlet.setInterceptors(myInterceptor1, myInterceptor2);
|
ourServlet.setInterceptors(myInterceptor1, myInterceptor2);
|
||||||
|
|
||||||
when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
|
when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
|
||||||
when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.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.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor2.incomingRequestPostProcessed(any(RequestDetails.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(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
|
when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
|
||||||
when(myInterceptor2.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor2.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
|
|
||||||
String input = createInput();
|
String input = createInput();
|
||||||
|
|
||||||
|
@ -134,24 +131,24 @@ public class InterceptorDstu3Test {
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
InOrder order = inOrder(myInterceptor1, myInterceptor2);
|
InOrder order = inOrder(myInterceptor1, myInterceptor2);
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor2, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor2, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
||||||
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
|
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)).incomingRequestPreHandled(nullable(RestOperationTypeEnum.class), nullable(ActionRequestDetails.class));
|
||||||
order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(IBaseResource.class));
|
order.verify(myInterceptor2, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
|
||||||
order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.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(any(RequestDetails.class), any(IBaseResource.class));
|
order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class));
|
||||||
order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
|
|
||||||
// Avoid concurrency issues
|
// Avoid concurrency issues
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
|
|
||||||
order.verify(myInterceptor2, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
|
order.verify(myInterceptor2, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
|
||||||
order.verify(myInterceptor1, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
|
order.verify(myInterceptor1, times(1)).processingCompletedNormally(nullable(ServletRequestDetails.class));
|
||||||
verifyNoMoreInteractions(myInterceptor1);
|
verifyNoMoreInteractions(myInterceptor1);
|
||||||
verifyNoMoreInteractions(myInterceptor2);
|
verifyNoMoreInteractions(myInterceptor2);
|
||||||
|
|
||||||
|
@ -163,10 +160,10 @@ public class InterceptorDstu3Test {
|
||||||
public void testResponseWithNothing() throws Exception {
|
public void testResponseWithNothing() throws Exception {
|
||||||
ourServlet.setInterceptors(myInterceptor1);
|
ourServlet.setInterceptors(myInterceptor1);
|
||||||
|
|
||||||
when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
|
when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
|
||||||
when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(ResponseDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(ResponseDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
|
|
||||||
String input = createInput();
|
String input = createInput();
|
||||||
|
|
||||||
|
@ -180,14 +177,14 @@ public class InterceptorDstu3Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
InOrder order = inOrder(myInterceptor1);
|
InOrder order = inOrder(myInterceptor1);
|
||||||
verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
|
verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
||||||
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
||||||
ArgumentCaptor<RequestDetails> rdCapt = ArgumentCaptor.forClass(RequestDetails.class);
|
ArgumentCaptor<ServletRequestDetails> rdCapt = ArgumentCaptor.forClass(ServletRequestDetails.class);
|
||||||
ArgumentCaptor<IBaseResource> resourceCapt = ArgumentCaptor.forClass(IBaseResource.class);
|
ArgumentCaptor<OperationOutcome> resourceCapt = ArgumentCaptor.forClass(OperationOutcome.class);
|
||||||
verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
|
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(1, resourceCapt.getAllValues().size());
|
||||||
assertEquals(null, resourceCapt.getAllValues().get(0));
|
assertEquals(null, resourceCapt.getAllValues().get(0));
|
||||||
|
@ -198,9 +195,9 @@ public class InterceptorDstu3Test {
|
||||||
public void testResponseWithOperationOutcome() throws Exception {
|
public void testResponseWithOperationOutcome() throws Exception {
|
||||||
ourServlet.setInterceptors(myInterceptor1);
|
ourServlet.setInterceptors(myInterceptor1);
|
||||||
|
|
||||||
when(myInterceptor1.incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class))).thenReturn(true);
|
when(myInterceptor1.incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class))).thenReturn(true);
|
||||||
when(myInterceptor1.outgoingResponse(any(RequestDetails.class), any(IResource.class))).thenReturn(true);
|
when(myInterceptor1.outgoingResponse(nullable(ServletRequestDetails.class), nullable(OperationOutcome.class))).thenReturn(true);
|
||||||
|
|
||||||
String input = createInput();
|
String input = createInput();
|
||||||
|
|
||||||
|
@ -210,13 +207,13 @@ public class InterceptorDstu3Test {
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
InOrder order = inOrder(myInterceptor1);
|
InOrder order = inOrder(myInterceptor1);
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).incomingRequestPreProcessed(nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(any(RequestDetails.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
|
order.verify(myInterceptor1, times(1)).incomingRequestPostProcessed(nullable(ServletRequestDetails.class), nullable(HttpServletRequest.class), nullable(HttpServletResponse.class));
|
||||||
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
ArgumentCaptor<RestOperationTypeEnum> opTypeCapt = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
||||||
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
ArgumentCaptor<ActionRequestDetails> arTypeCapt = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
||||||
ArgumentCaptor<IBaseResource> resourceCapt = ArgumentCaptor.forClass(IBaseResource.class);
|
ArgumentCaptor<OperationOutcome> resourceCapt = ArgumentCaptor.forClass(OperationOutcome.class);
|
||||||
order.verify(myInterceptor1, times(1)).incomingRequestPreHandled(opTypeCapt.capture(), arTypeCapt.capture());
|
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(1, resourceCapt.getAllValues().size());
|
||||||
assertEquals(OperationOutcome.class, resourceCapt.getAllValues().get(0).getClass());
|
assertEquals(OperationOutcome.class, resourceCapt.getAllValues().get(0).getClass());
|
||||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.util;
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import javax.xml.parsers.FactoryConfigurationError;
|
import javax.xml.stream.FactoryConfigurationError;
|
||||||
import javax.xml.stream.XMLStreamException;
|
import javax.xml.stream.XMLStreamException;
|
||||||
|
|
||||||
import org.hl7.fhir.dstu3.model.Patient;
|
import org.hl7.fhir.dstu3.model.Patient;
|
||||||
|
@ -38,6 +38,7 @@ public class XmlUtilDstu3Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testXmlFactoryThrowsXmlStreamException() {
|
public void testXmlFactoryThrowsXmlStreamException() {
|
||||||
XmlUtil.setThrowExceptionForUnitTest(new XMLStreamException("FOO"));
|
XmlUtil.setThrowExceptionForUnitTest(new XMLStreamException("FOO"));
|
||||||
|
|
||||||
|
@ -55,18 +56,13 @@ public class XmlUtilDstu3Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testXmlFactoryThrowsFactoryConfigurationError() {
|
public void testXmlFactoryThrowsFactoryConfigurationError() {
|
||||||
XmlUtil.setThrowExceptionForUnitTest(new FactoryConfigurationError("FOO"));
|
XmlUtil.setThrowExceptionForUnitTest(new FactoryConfigurationError("FOO"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ourCtx.newXmlParser().parseResource("AAAAA");
|
ourCtx.newXmlParser().parseResource("AAAAA");
|
||||||
fail();
|
fail();
|
||||||
} catch (DataFormatException e) {
|
|
||||||
// good
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
ourCtx.newXmlParser().encodeResourceToString(myPatient);
|
|
||||||
fail();
|
|
||||||
} catch (ConfigurationException e) {
|
} catch (ConfigurationException e) {
|
||||||
// good
|
// good
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,23 +121,38 @@
|
||||||
<artifactId>thymeleaf</artifactId>
|
<artifactId>thymeleaf</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dependencies for Schematron -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>Saxon-HE</artifactId>
|
|
||||||
<groupId>net.sf.saxon</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-commons</artifactId>
|
<artifactId>ph-commons</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>javax.activation-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- UNIT TEST DEPENDENCIES -->
|
<!-- UNIT TEST DEPENDENCIES -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,280 +1,185 @@
|
||||||
package ca.uhn.fhir.model;
|
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.BaseRuntimeElementCompositeDefinition;
|
||||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
|
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
|
||||||
import ca.uhn.fhir.model.api.annotation.Block;
|
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 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 {
|
public class ModelInheritanceTest {
|
||||||
/*
|
/*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Other changes:
|
* Other changes:
|
||||||
*
|
*
|
||||||
* Reference:
|
* Reference:
|
||||||
* * Add "resource" field, plus constructors and getter/setters for that field
|
* * Add "resource" field, plus constructors and getter/setters for that field
|
||||||
*
|
*
|
||||||
* Narrative:
|
* Narrative:
|
||||||
* * Add getValueAsDiv and setValueAsDiv
|
* * Add getValueAsDiv and setValueAsDiv
|
||||||
*
|
*
|
||||||
* XhtmlParser and XhtmlEncoder:
|
* XhtmlParser and XhtmlEncoder:
|
||||||
* * Do we need a better exception declaration?
|
* * Do we need a better exception declaration?
|
||||||
*
|
*
|
||||||
* ElementDefinition
|
* ElementDefinition
|
||||||
* * Backbone elements (eg .ElementDefinitionSlicingComponent) do not extend BackboneElement or have a @Block annotation for some reason
|
* * Backbone elements (eg .ElementDefinitionSlicingComponent) do not extend BackboneElement or have a @Block annotation for some reason
|
||||||
*
|
*
|
||||||
* Extension
|
* Extension
|
||||||
* * Should URL not be StringType since it can't take extensions?
|
* * Should URL not be StringType since it can't take extensions?
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disabled for now...
|
* This one should apply to all composite types
|
||||||
*/
|
*/
|
||||||
// @Test
|
@Test
|
||||||
public void testDatatypeNames() {
|
public void testAddress() {
|
||||||
for (BaseRuntimeElementDefinition<?> next : ourCtx.getElementDefinitions()) {
|
assertTrue(ICompositeType.class.isAssignableFrom(Address.class));
|
||||||
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 testBackboneElement() {
|
||||||
}
|
assertTrue(IBaseBackboneElement.class.isAssignableFrom(BackboneElement.class));
|
||||||
|
assertTrue(IBaseHasExtensions.class.isAssignableFrom(BackboneElement.class));
|
||||||
|
assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(BackboneElement.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testList() {
|
public void testBase() {
|
||||||
assertEquals("List", ourCtx.getResourceDefinition(List_.class).getName());
|
assertTrue(IBase.class.isAssignableFrom(Base.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Test
|
||||||
* This one should apply to all composite types
|
public void testBinary() {
|
||||||
*/
|
assertTrue(IBaseBinary.class.isAssignableFrom(Binary.class));
|
||||||
@Test
|
}
|
||||||
public void testAddress() {
|
|
||||||
assertTrue(ICompositeType.class.isAssignableFrom(Address.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testXhtml() {
|
public void testBooleanType() {
|
||||||
assertTrue(IBaseXhtml.class.isAssignableFrom(XhtmlNode.class));
|
assertTrue(IBaseBooleanDatatype.class.isAssignableFrom(BooleanType.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBackboneElement() {
|
public void testBundle() {
|
||||||
assertTrue(IBaseBackboneElement.class.isAssignableFrom(BackboneElement.class));
|
assertTrue(IBaseBundle.class.isAssignableFrom(Bundle.class));
|
||||||
assertTrue(IBaseHasExtensions.class.isAssignableFrom(BackboneElement.class));
|
}
|
||||||
assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(BackboneElement.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBase() {
|
public void testCoding() {
|
||||||
assertTrue(IBase.class.isAssignableFrom(Base.class));
|
assertTrue(IBaseCoding.class.isAssignableFrom(Coding.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProfiledDatatype() {
|
public void testDecimalType() {
|
||||||
assertEquals(StringType.class, CodeType.class.getSuperclass());
|
assertTrue(IBaseDecimalDatatype.class.isAssignableFrom(DecimalType.class));
|
||||||
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 testDomainResource() {
|
||||||
|
assertTrue(IBaseHasExtensions.class.isAssignableFrom(DomainResource.class));
|
||||||
|
assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(DomainResource.class));
|
||||||
|
assertTrue(IDomainResource.class.isAssignableFrom(DomainResource.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBinary() {
|
public void testElement() {
|
||||||
assertTrue(IBaseBinary.class.isAssignableFrom(Binary.class));
|
assertTrue(IBaseHasExtensions.class.isAssignableFrom(Element.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEnumeration() {
|
||||||
|
assertTrue(IBaseEnumeration.class.isAssignableFrom(Enumeration.class));
|
||||||
|
|
||||||
@Test
|
DatatypeDef def = Enumeration.class.getAnnotation(DatatypeDef.class);
|
||||||
public void testBooleanType() {
|
assertTrue(def.isSpecialization());
|
||||||
assertTrue(IBaseBooleanDatatype.class.isAssignableFrom(BooleanType.class));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be "implements IBaseExtension<Extension>"
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testExtension() {
|
||||||
|
assertTrue(IBaseExtension.class.isAssignableFrom(Extension.class));
|
||||||
|
assertTrue(IBaseHasExtensions.class.isAssignableFrom(Extension.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBundle() {
|
public void testIdType() {
|
||||||
assertTrue(IBaseBundle.class.isAssignableFrom(Bundle.class));
|
assertTrue(IIdType.class.isAssignableFrom(IdType.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCoding() {
|
public void testIntegerType() {
|
||||||
assertTrue(IBaseCoding.class.isAssignableFrom(Coding.class));
|
assertTrue(IBaseIntegerDatatype.class.isAssignableFrom(IntegerType.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDecimalType() {
|
public void testList() {
|
||||||
assertTrue(IBaseDecimalDatatype.class.isAssignableFrom(DecimalType.class));
|
assertEquals("List", ourCtx.getResourceDefinition(List_.class).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDomainResource() {
|
public void testMeta() {
|
||||||
assertTrue(IBaseHasExtensions.class.isAssignableFrom(DomainResource.class));
|
assertTrue(IBaseMetaType.class.isAssignableFrom(Meta.class));
|
||||||
assertTrue(IBaseHasModifierExtensions.class.isAssignableFrom(DomainResource.class));
|
}
|
||||||
assertTrue(IDomainResource.class.isAssignableFrom(DomainResource.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testElement() {
|
public void testNarrative() {
|
||||||
assertTrue(IBaseHasExtensions.class.isAssignableFrom(Element.class));
|
assertTrue(INarrative.class.isAssignableFrom(Narrative.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEnumeration() {
|
public void testParameters() {
|
||||||
assertTrue(IBaseEnumeration.class.isAssignableFrom(Enumeration.class));
|
assertTrue(IBaseParameters.class.isAssignableFrom(Parameters.class));
|
||||||
|
}
|
||||||
|
|
||||||
DatatypeDef def = Enumeration.class.getAnnotation(DatatypeDef.class);
|
@Test
|
||||||
assertTrue(def.isSpecialization());
|
public void testPrimitiveType() {
|
||||||
}
|
assertTrue(IPrimitiveType.class.isAssignableFrom(PrimitiveType.class));
|
||||||
|
assertTrue(IBaseHasExtensions.class.isAssignableFrom(PrimitiveType.class));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
@Test
|
||||||
* Should be "implements IBaseExtension<Extension>"
|
public void testProfiledDatatype() {
|
||||||
*/
|
assertEquals(StringType.class, CodeType.class.getSuperclass());
|
||||||
@Test
|
assertEquals(StringType.class, CodeType.class.getAnnotation(DatatypeDef.class).profileOf());
|
||||||
public void testExtension() {
|
assertEquals(Quantity.class, Money.class.getSuperclass());
|
||||||
assertTrue(IBaseExtension.class.isAssignableFrom(Extension.class));
|
assertEquals(Quantity.class, Money.class.getAnnotation(DatatypeDef.class).profileOf());
|
||||||
assertTrue(IBaseHasExtensions.class.isAssignableFrom(Extension.class));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void testIdentifierUse() throws Exception {
|
@Test
|
||||||
Child child = Identifier.class.getField("use").getAnnotation(Child.class);
|
public void testReference() {
|
||||||
// assertEquals(IdentifierUseEnumFactory.class, child.enumFactory());
|
assertTrue(IBaseReference.class.isAssignableFrom(Reference.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIdType() {
|
@Test
|
||||||
assertTrue(IIdType.class.isAssignableFrom(IdType.class));
|
public void testResource() {
|
||||||
}
|
assertTrue(IAnyResource.class.isAssignableFrom(Resource.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntegerType() {
|
public void testTiming_TimingRepeatComponent() {
|
||||||
assertTrue(IBaseIntegerDatatype.class.isAssignableFrom(IntegerType.class));
|
assertTrue(IBaseDatatypeElement.class.isAssignableFrom(Timing.TimingRepeatComponent.class));
|
||||||
}
|
assertNotNull(Timing.TimingRepeatComponent.class.getAnnotation(Block.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMeta() {
|
public void testType() {
|
||||||
assertTrue(IBaseMetaType.class.isAssignableFrom(Meta.class));
|
assertTrue(IBaseDatatype.class.isAssignableFrom(Type.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNarrative() {
|
public void testXhtml() {
|
||||||
assertTrue(INarrative.class.isAssignableFrom(Narrative.class));
|
assertTrue(IBaseXhtml.class.isAssignableFrom(XhtmlNode.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testPrimitiveType() {
|
|
||||||
assertTrue(IPrimitiveType.class.isAssignableFrom(PrimitiveType.class));
|
|
||||||
assertTrue(IBaseHasExtensions.class.isAssignableFrom(PrimitiveType.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testReference() {
|
|
||||||
assertTrue(IBaseReference.class.isAssignableFrom(Reference.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testParameters() {
|
|
||||||
assertTrue(IBaseParameters.class.isAssignableFrom(Parameters.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testResource() {
|
|
||||||
assertTrue(IAnyResource.class.isAssignableFrom(Resource.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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1016,42 +1016,6 @@ public class JsonParserHl7OrgDstu2Test {
|
||||||
//@formatter:on
|
//@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("<div>help</div>");
|
|
||||||
} 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\":\"<div>help</div>\"},"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedContainedResources() {
|
public void testNestedContainedResources() {
|
||||||
|
|
||||||
|
|
|
@ -1502,37 +1502,6 @@ public class XmlParserHl7OrgDstu2Test {
|
||||||
"<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
|
"<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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("<div>help</div>");
|
|
||||||
} 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\":\"<div>help</div>\"},"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedContainedResources() {
|
public void testNestedContainedResources() {
|
||||||
|
|
|
@ -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
|
@Test
|
||||||
public void testRead() throws Exception {
|
public void testRead() throws Exception {
|
||||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");
|
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");
|
||||||
|
|
|
@ -95,20 +95,6 @@ public class IncludeHl7OrgDstu2Test {
|
||||||
assertEquals("foo", p.getName().get(0).getFamily().get(0).getValue());
|
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
|
@Test
|
||||||
public void testIIncludedResourcesNonContained() throws Exception {
|
public void testIIncludedResourcesNonContained() throws Exception {
|
||||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=normalInclude&_pretty=true");
|
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=normalInclude&_pretty=true");
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
package ca.uhn.fhir.rest.server;
|
package ca.uhn.fhir.rest.server;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import static org.hamcrest.Matchers.not;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
import ca.uhn.fhir.rest.annotation.Search;
|
||||||
import static org.junit.Assert.assertEquals;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import static org.junit.Assert.assertNull;
|
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||||
import static org.junit.Assert.assertThat;
|
import ca.uhn.fhir.util.PortUtil;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
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.Bundle;
|
||||||
import org.hl7.fhir.instance.model.Patient;
|
import org.hl7.fhir.instance.model.Patient;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
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 java.util.List;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import java.util.concurrent.TimeUnit;
|
||||||
import ca.uhn.fhir.rest.annotation.Search;
|
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import static org.hamcrest.Matchers.*;
|
||||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
import static org.junit.Assert.*;
|
||||||
import ca.uhn.fhir.util.PatternMatcherB;
|
|
||||||
import ca.uhn.fhir.util.PortUtil;
|
|
||||||
|
|
||||||
public class SearchHl7OrgDstu2Test {
|
public class SearchHl7OrgDstu2Test {
|
||||||
|
|
||||||
|
@ -86,7 +82,7 @@ public class SearchHl7OrgDstu2Test {
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
|
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
assertThat(responseContent, PatternMatcherB.pattern("id value..[0-9a-f-]+\\\""));
|
assertThat(responseContent, matchesPattern(".*id value..[0-9a-f-]+\\\".*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -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<CharSequence> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a matcher that matches if the examined {@link CharSequence} matches the specified regular expression.
|
|
||||||
* <p/>
|
|
||||||
* For example:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* assertThat("myStringOfNote", pattern("[0-9]+"))
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param regex
|
|
||||||
* the regular expression that the returned matcher will use to match any examined {@link CharSequence}
|
|
||||||
*/
|
|
||||||
@Factory
|
|
||||||
public static Matcher<CharSequence> pattern(String regex) {
|
|
||||||
return pattern(Pattern.compile(regex));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a matcher that matches if the examined {@link CharSequence} matches the specified {@link Pattern}.
|
|
||||||
* <p/>
|
|
||||||
* For example:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* assertThat("myStringOfNote", Pattern.compile("[0-9]+"))
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @param pattern
|
|
||||||
* the pattern that the returned matcher will use to match any examined {@link CharSequence}
|
|
||||||
*/
|
|
||||||
@Factory
|
|
||||||
public static Matcher<CharSequence> 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("\"");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -124,6 +124,8 @@
|
||||||
<artifactId>thymeleaf</artifactId>
|
<artifactId>thymeleaf</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dependencies for Schematron -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
|
@ -134,7 +136,26 @@
|
||||||
<artifactId>ph-commons</artifactId>
|
<artifactId>ph-commons</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>javax.activation-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- UNIT TEST DEPENDENCIES -->
|
<!-- UNIT TEST DEPENDENCIES -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -437,7 +437,7 @@ public class GenericClientR4Test {
|
||||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
|
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().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");
|
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ public class GenericClientR4Test {
|
||||||
client.read().resource(Patient.class).withId("1").execute();
|
client.read().resource(Patient.class).withId("1").execute();
|
||||||
fail();
|
fail();
|
||||||
} catch (FhirClientConnectionException e) {
|
} catch (FhirClientConnectionException e) {
|
||||||
assertEquals("java.lang.Exception", e.getMessage());
|
assertThat(e.getMessage(), containsString("java.io.IOException"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,5 @@
|
||||||
package ca.uhn.fhir.rest.client;
|
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.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||||
import ca.uhn.fhir.rest.annotation.Read;
|
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.ILoggingEvent;
|
||||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||||
import ch.qos.logback.core.Appender;
|
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 {
|
public class LoggingInterceptorTest {
|
||||||
|
|
||||||
|
@ -78,8 +73,8 @@ public class LoggingInterceptorTest {
|
||||||
|
|
||||||
verify(myMockAppender, times(2)).doAppend(argThat(new ArgumentMatcher<ILoggingEvent>() {
|
verify(myMockAppender, times(2)).doAppend(argThat(new ArgumentMatcher<ILoggingEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final Object argument) {
|
public boolean matches(final ILoggingEvent argument) {
|
||||||
String formattedMessage = ((LoggingEvent) argument).getFormattedMessage();
|
String formattedMessage = argument.getFormattedMessage();
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
System.out.println("** Got Message: " + formattedMessage);
|
System.out.println("** Got Message: " + formattedMessage);
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
|
@ -103,8 +98,8 @@ public class LoggingInterceptorTest {
|
||||||
|
|
||||||
verify(myMockAppender, times(1)).doAppend(argThat(new ArgumentMatcher<ILoggingEvent>() {
|
verify(myMockAppender, times(1)).doAppend(argThat(new ArgumentMatcher<ILoggingEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final Object argument) {
|
public boolean matches(final ILoggingEvent argument) {
|
||||||
String formattedMessage = ((LoggingEvent) argument).getFormattedMessage();
|
String formattedMessage = argument.getFormattedMessage();
|
||||||
System.out.println("Verifying: " + formattedMessage);
|
System.out.println("Verifying: " + formattedMessage);
|
||||||
return formattedMessage.replace("; ", ";").toLowerCase().contains("Content-Type: application/fhir+xml;charset=utf-8".toLowerCase());
|
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<ILoggingEvent>() {
|
verify(myMockAppender, times(1)).doAppend(argThat(new ArgumentMatcher<ILoggingEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final Object argument) {
|
public boolean matches(final ILoggingEvent argument) {
|
||||||
String formattedMessage = ((LoggingEvent) argument).getFormattedMessage();
|
String formattedMessage = argument.getFormattedMessage();
|
||||||
System.out.println("Verifying: " + formattedMessage);
|
System.out.println("Verifying: " + formattedMessage);
|
||||||
return formattedMessage.replace("; ", ";").toLowerCase().contains("Content-Type: application/fhir+xml;charset=utf-8".toLowerCase());
|
return formattedMessage.replace("; ", ";").toLowerCase().contains("Content-Type: application/fhir+xml;charset=utf-8".toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
@Test
|
||||||
public void testNoIncludes() throws Exception {
|
public void testNoIncludes() throws Exception {
|
||||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello");
|
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello");
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.mockito.stubbing.Answer;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
@ -34,7 +35,7 @@ public class GraphQLEngineTest {
|
||||||
|
|
||||||
private GraphQLEngine.IGraphQLStorageServices createStorageServices() throws FHIRException {
|
private GraphQLEngine.IGraphQLStorageServices createStorageServices() throws FHIRException {
|
||||||
GraphQLEngine.IGraphQLStorageServices retVal = mock(GraphQLEngine.IGraphQLStorageServices.class);
|
GraphQLEngine.IGraphQLStorageServices retVal = mock(GraphQLEngine.IGraphQLStorageServices.class);
|
||||||
when(retVal.lookup(any(Object.class), any(Resource.class), any(Reference.class))).thenAnswer(new Answer<Object>() {
|
when(retVal.lookup(nullable(Object.class), nullable(Resource.class), nullable(Reference.class))).thenAnswer(new Answer<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object answer(InvocationOnMock invocation) {
|
public Object answer(InvocationOnMock invocation) {
|
||||||
Object appInfo = invocation.getArguments()[0];
|
Object appInfo = invocation.getArguments()[0];
|
||||||
|
|
|
@ -2,12 +2,12 @@ package ca.uhn.fhir.jpa.test;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
//import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.commons.dbcp2.BasicDataSource;
|
import org.apache.commons.dbcp2.BasicDataSource;
|
||||||
import org.apache.commons.lang3.time.DateUtils;
|
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.beans.factory.annotation.Autowire;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
|
@ -172,20 +172,40 @@
|
||||||
<artifactId>jetty-http</artifactId>
|
<artifactId>jetty-http</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dependencies for Schematron -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>com.helger</groupId>
|
||||||
<artifactId>ph-schematron</artifactId>
|
<artifactId>ph-schematron</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.helger</groupId>
|
<groupId>javax.activation</groupId>
|
||||||
<artifactId>ph-commons</artifactId>
|
<artifactId>javax.activation-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
@ -48,6 +49,7 @@ public class FhirInstanceValidatorDstu3Test {
|
||||||
private static FhirContext ourCtx = FhirContext.forDstu3();
|
private static FhirContext ourCtx = FhirContext.forDstu3();
|
||||||
@Rule
|
@Rule
|
||||||
public TestRule watcher = new TestWatcher() {
|
public TestRule watcher = new TestWatcher() {
|
||||||
|
@Override
|
||||||
protected void starting(Description description) {
|
protected void starting(Description description) {
|
||||||
ourLog.info("Starting test: " + description.getMethodName());
|
ourLog.info("Starting test: " + description.getMethodName());
|
||||||
}
|
}
|
||||||
|
@ -84,19 +86,19 @@ public class FhirInstanceValidatorDstu3Test {
|
||||||
|
|
||||||
myValidConcepts = new ArrayList<>();
|
myValidConcepts = new ArrayList<>();
|
||||||
|
|
||||||
when(myMockSupport.expandValueSet(any(FhirContext.class), any(ConceptSetComponent.class))).thenAnswer(new Answer<ValueSetExpansionComponent>() {
|
when(myMockSupport.expandValueSet(any(FhirContext.class), nullable(ConceptSetComponent.class))).thenAnswer(new Answer<ValueSetExpansionComponent>() {
|
||||||
@Override
|
@Override
|
||||||
public ValueSetExpansionComponent answer(InvocationOnMock theInvocation) {
|
public ValueSetExpansionComponent answer(InvocationOnMock theInvocation) {
|
||||||
ConceptSetComponent arg = (ConceptSetComponent) theInvocation.getArguments()[0];
|
ConceptSetComponent arg = (ConceptSetComponent) theInvocation.getArguments()[0];
|
||||||
ValueSetExpansionComponent retVal = mySupportedCodeSystemsForExpansion.get(arg.getSystem());
|
ValueSetExpansionComponent retVal = mySupportedCodeSystemsForExpansion.get(arg.getSystem());
|
||||||
if (retVal == null) {
|
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});
|
ourLog.debug("expandValueSet({}) : {}", new Object[] {theInvocation.getArguments()[0], retVal});
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.isCodeSystemSupported(any(FhirContext.class), any(String.class))).thenAnswer(new Answer<Boolean>() {
|
when(myMockSupport.isCodeSystemSupported(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean answer(InvocationOnMock theInvocation) {
|
public Boolean answer(InvocationOnMock theInvocation) {
|
||||||
boolean retVal = myValidSystems.contains(theInvocation.getArguments()[1]);
|
boolean retVal = myValidSystems.contains(theInvocation.getArguments()[1]);
|
||||||
|
@ -104,7 +106,7 @@ public class FhirInstanceValidatorDstu3Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.fetchResource(any(FhirContext.class), any(Class.class), any(String.class))).thenAnswer(new Answer<IBaseResource>() {
|
when(myMockSupport.fetchResource(nullable(FhirContext.class), nullable(Class.class), nullable(String.class))).thenAnswer(new Answer<IBaseResource>() {
|
||||||
@Override
|
@Override
|
||||||
public IBaseResource answer(InvocationOnMock theInvocation) throws Throwable {
|
public IBaseResource answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
IBaseResource retVal = null;
|
IBaseResource retVal = null;
|
||||||
|
@ -134,7 +136,7 @@ public class FhirInstanceValidatorDstu3Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.validateCode(any(FhirContext.class), any(String.class), any(String.class), any(String.class))).thenAnswer(new Answer<CodeValidationResult>() {
|
when(myMockSupport.validateCode(nullable(FhirContext.class), nullable(String.class), nullable(String.class), nullable(String.class))).thenAnswer(new Answer<CodeValidationResult>() {
|
||||||
@Override
|
@Override
|
||||||
public CodeValidationResult answer(InvocationOnMock theInvocation) {
|
public CodeValidationResult answer(InvocationOnMock theInvocation) {
|
||||||
FhirContext ctx = (FhirContext) theInvocation.getArguments()[0];
|
FhirContext ctx = (FhirContext) theInvocation.getArguments()[0];
|
||||||
|
@ -150,7 +152,7 @@ public class FhirInstanceValidatorDstu3Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.fetchCodeSystem(any(FhirContext.class), any(String.class))).thenAnswer(new Answer<CodeSystem>() {
|
when(myMockSupport.fetchCodeSystem(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer<CodeSystem>() {
|
||||||
@Override
|
@Override
|
||||||
public CodeSystem answer(InvocationOnMock theInvocation) {
|
public CodeSystem answer(InvocationOnMock theInvocation) {
|
||||||
CodeSystem retVal = myDefaultValidationSupport.fetchCodeSystem((FhirContext) theInvocation.getArguments()[0], (String) theInvocation.getArguments()[1]);
|
CodeSystem retVal = myDefaultValidationSupport.fetchCodeSystem((FhirContext) theInvocation.getArguments()[0], (String) theInvocation.getArguments()[1]);
|
||||||
|
@ -161,7 +163,7 @@ public class FhirInstanceValidatorDstu3Test {
|
||||||
myStructureDefinitions = new HashMap<>();
|
myStructureDefinitions = new HashMap<>();
|
||||||
myValueSets = new HashMap<>();
|
myValueSets = new HashMap<>();
|
||||||
myCodeSystems = new HashMap<>();
|
myCodeSystems = new HashMap<>();
|
||||||
when(myMockSupport.fetchStructureDefinition(any(FhirContext.class), any(String.class))).thenAnswer(new Answer<StructureDefinition>() {
|
when(myMockSupport.fetchStructureDefinition(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer<StructureDefinition>() {
|
||||||
@Override
|
@Override
|
||||||
public StructureDefinition answer(InvocationOnMock theInvocation) {
|
public StructureDefinition answer(InvocationOnMock theInvocation) {
|
||||||
String url = (String) theInvocation.getArguments()[1];
|
String url = (String) theInvocation.getArguments()[1];
|
||||||
|
@ -173,7 +175,7 @@ public class FhirInstanceValidatorDstu3Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.fetchAllStructureDefinitions(any(FhirContext.class))).thenAnswer(new Answer<List<StructureDefinition>>() {
|
when(myMockSupport.fetchAllStructureDefinitions(nullable(FhirContext.class))).thenAnswer(new Answer<List<StructureDefinition>>() {
|
||||||
@Override
|
@Override
|
||||||
public List<StructureDefinition> answer(InvocationOnMock theInvocation) {
|
public List<StructureDefinition> answer(InvocationOnMock theInvocation) {
|
||||||
List<StructureDefinition> retVal = myDefaultValidationSupport.fetchAllStructureDefinitions((FhirContext) theInvocation.getArguments()[0]);
|
List<StructureDefinition> retVal = myDefaultValidationSupport.fetchAllStructureDefinitions((FhirContext) theInvocation.getArguments()[0]);
|
||||||
|
|
|
@ -693,41 +693,6 @@ public class QuestionnaireResponseValidatorDstu3Test {
|
||||||
assertThat(errors.toString(), containsString("LinkId \"link1\" not found in questionnaire"));
|
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(
|
|
||||||
"<answer>\n" +
|
|
||||||
" <valueCoding>\n" +
|
|
||||||
" <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" +
|
|
||||||
" <code value=\"2\"/>\n" +
|
|
||||||
" <display value=\"Once/twice\"/>\n" +
|
|
||||||
" </valueCoding>\n" +
|
|
||||||
" </answer>",
|
|
||||||
"<answer>\n" +
|
|
||||||
" <valueCoding>\n" +
|
|
||||||
" <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" +
|
|
||||||
" <code value=\"GGG\"/>\n" +
|
|
||||||
" <display value=\"Once/twice\"/>\n" +
|
|
||||||
" </valueCoding>\n" +
|
|
||||||
" </answer>");
|
|
||||||
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
|
@AfterClass
|
||||||
public static void afterClassClearContext() {
|
public static void afterClassClearContext() {
|
||||||
myDefaultValidationSupport.flush();
|
myDefaultValidationSupport.flush();
|
||||||
|
|
|
@ -43,6 +43,7 @@ import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
@ -102,19 +103,19 @@ public class FhirInstanceValidatorR4Test {
|
||||||
|
|
||||||
myValidConcepts = new ArrayList<>();
|
myValidConcepts = new ArrayList<>();
|
||||||
|
|
||||||
when(myMockSupport.expandValueSet(any(FhirContext.class), any(ConceptSetComponent.class))).thenAnswer(new Answer<ValueSetExpansionComponent>() {
|
when(myMockSupport.expandValueSet(nullable(FhirContext.class), nullable(ConceptSetComponent.class))).thenAnswer(new Answer<ValueSetExpansionComponent>() {
|
||||||
@Override
|
@Override
|
||||||
public ValueSetExpansionComponent answer(InvocationOnMock theInvocation) throws Throwable {
|
public ValueSetExpansionComponent answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
ConceptSetComponent arg = (ConceptSetComponent) theInvocation.getArguments()[ 0 ];
|
ConceptSetComponent arg = (ConceptSetComponent) theInvocation.getArguments()[ 0 ];
|
||||||
ValueSetExpansionComponent retVal = mySupportedCodeSystemsForExpansion.get(arg.getSystem());
|
ValueSetExpansionComponent retVal = mySupportedCodeSystemsForExpansion.get(arg.getSystem());
|
||||||
if (retVal == null) {
|
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});
|
ourLog.debug("expandValueSet({}) : {}", new Object[] {theInvocation.getArguments()[ 0 ], retVal});
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.isCodeSystemSupported(any(FhirContext.class), any(String.class))).thenAnswer(new Answer<Boolean>() {
|
when(myMockSupport.isCodeSystemSupported(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean answer(InvocationOnMock theInvocation) throws Throwable {
|
public Boolean answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
boolean retVal = myValidSystems.contains(theInvocation.getArguments()[ 1 ]);
|
boolean retVal = myValidSystems.contains(theInvocation.getArguments()[ 1 ]);
|
||||||
|
@ -122,7 +123,7 @@ public class FhirInstanceValidatorR4Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.fetchResource(any(FhirContext.class), any(Class.class), any(String.class))).thenAnswer(new Answer<IBaseResource>() {
|
when(myMockSupport.fetchResource(nullable(FhirContext.class), nullable(Class.class), nullable(String.class))).thenAnswer(new Answer<IBaseResource>() {
|
||||||
@Override
|
@Override
|
||||||
public IBaseResource answer(InvocationOnMock theInvocation) throws Throwable {
|
public IBaseResource answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
IBaseResource retVal;
|
IBaseResource retVal;
|
||||||
|
@ -136,7 +137,7 @@ public class FhirInstanceValidatorR4Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.validateCode(any(FhirContext.class), any(String.class), any(String.class), any(String.class))).thenAnswer(new Answer<CodeValidationResult>() {
|
when(myMockSupport.validateCode(nullable(FhirContext.class), nullable(String.class), nullable(String.class), nullable(String.class))).thenAnswer(new Answer<CodeValidationResult>() {
|
||||||
@Override
|
@Override
|
||||||
public CodeValidationResult answer(InvocationOnMock theInvocation) throws Throwable {
|
public CodeValidationResult answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
FhirContext ctx = (FhirContext) theInvocation.getArguments()[ 0 ];
|
FhirContext ctx = (FhirContext) theInvocation.getArguments()[ 0 ];
|
||||||
|
@ -152,7 +153,7 @@ public class FhirInstanceValidatorR4Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.fetchCodeSystem(any(FhirContext.class), any(String.class))).thenAnswer(new Answer<CodeSystem>() {
|
when(myMockSupport.fetchCodeSystem(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer<CodeSystem>() {
|
||||||
@Override
|
@Override
|
||||||
public CodeSystem answer(InvocationOnMock theInvocation) throws Throwable {
|
public CodeSystem answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
CodeSystem retVal = myDefaultValidationSupport.fetchCodeSystem((FhirContext) theInvocation.getArguments()[ 0 ], (String) theInvocation.getArguments()[ 1 ]);
|
CodeSystem retVal = myDefaultValidationSupport.fetchCodeSystem((FhirContext) theInvocation.getArguments()[ 0 ], (String) theInvocation.getArguments()[ 1 ]);
|
||||||
|
@ -160,7 +161,7 @@ public class FhirInstanceValidatorR4Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.fetchStructureDefinition(any(FhirContext.class), any(String.class))).thenAnswer(new Answer<StructureDefinition>() {
|
when(myMockSupport.fetchStructureDefinition(nullable(FhirContext.class), nullable(String.class))).thenAnswer(new Answer<StructureDefinition>() {
|
||||||
@Override
|
@Override
|
||||||
public StructureDefinition answer(InvocationOnMock theInvocation) throws Throwable {
|
public StructureDefinition answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
StructureDefinition retVal = myDefaultValidationSupport.fetchStructureDefinition((FhirContext) theInvocation.getArguments()[ 0 ], (String) theInvocation.getArguments()[ 1 ]);
|
StructureDefinition retVal = myDefaultValidationSupport.fetchStructureDefinition((FhirContext) theInvocation.getArguments()[ 0 ], (String) theInvocation.getArguments()[ 1 ]);
|
||||||
|
@ -168,7 +169,7 @@ public class FhirInstanceValidatorR4Test {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
when(myMockSupport.fetchAllStructureDefinitions(any(FhirContext.class))).thenAnswer(new Answer<List<StructureDefinition>>() {
|
when(myMockSupport.fetchAllStructureDefinitions(nullable(FhirContext.class))).thenAnswer(new Answer<List<StructureDefinition>>() {
|
||||||
@Override
|
@Override
|
||||||
public List<StructureDefinition> answer(InvocationOnMock theInvocation) throws Throwable {
|
public List<StructureDefinition> answer(InvocationOnMock theInvocation) throws Throwable {
|
||||||
List<StructureDefinition> retVal = myDefaultValidationSupport.fetchAllStructureDefinitions((FhirContext) theInvocation.getArguments()[ 0 ]);
|
List<StructureDefinition> retVal = myDefaultValidationSupport.fetchAllStructureDefinitions((FhirContext) theInvocation.getArguments()[ 0 ]);
|
||||||
|
|
|
@ -451,6 +451,7 @@ public class QuestionnaireResponseValidatorR4Test {
|
||||||
assertThat(errors.getMessages(), empty());
|
assertThat(errors.getMessages(), empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testMissingRequiredAnswer() {
|
public void testMissingRequiredAnswer() {
|
||||||
Questionnaire q = new Questionnaire();
|
Questionnaire q = new Questionnaire();
|
||||||
q.addItem().setLinkId("link0")
|
q.addItem().setLinkId("link0")
|
||||||
|
@ -691,40 +692,6 @@ public class QuestionnaireResponseValidatorR4Test {
|
||||||
assertThat(errors.toString(), containsString("No issues"));
|
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(
|
|
||||||
"<answer>\n" +
|
|
||||||
" <valueCoding>\n" +
|
|
||||||
" <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" +
|
|
||||||
" <code value=\"2\"/>\n" +
|
|
||||||
" <display value=\"Once/twice\"/>\n" +
|
|
||||||
" </valueCoding>\n" +
|
|
||||||
" </answer>",
|
|
||||||
"<answer>\n" +
|
|
||||||
" <valueCoding>\n" +
|
|
||||||
" <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" +
|
|
||||||
" <code value=\"GGG\"/>\n" +
|
|
||||||
" <display value=\"Once/twice\"/>\n" +
|
|
||||||
" </valueCoding>\n" +
|
|
||||||
" </answer>");
|
|
||||||
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
|
@AfterClass
|
||||||
public static void afterClassClearContext() {
|
public static void afterClassClearContext() {
|
||||||
|
|
|
@ -185,4 +185,24 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<!--
|
||||||
|
These tests often fail on Travis so don't run them there
|
||||||
|
-->
|
||||||
|
<id>REDUCED_JPA_TESTS</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1228,38 +1228,6 @@ public class XmlParserHl7OrgDstu2Test {
|
||||||
"<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
|
"<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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("<div>help</div>");
|
|
||||||
} 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\":\"<div>help</div>\"},"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedContainedResources() {
|
public void testNestedContainedResources() {
|
||||||
|
|
||||||
|
|
106
pom.xml
106
pom.xml
|
@ -94,7 +94,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-all</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -478,6 +478,7 @@
|
||||||
<scmPubCheckoutDirectory>${user.home}/sites/scm/hapi-fhir</scmPubCheckoutDirectory>
|
<scmPubCheckoutDirectory>${user.home}/sites/scm/hapi-fhir</scmPubCheckoutDirectory>
|
||||||
|
|
||||||
<!-- Dependency Versions -->
|
<!-- Dependency Versions -->
|
||||||
|
<activation_api_version>1.2.0</activation_api_version>
|
||||||
<apache_karaf_version>4.1.4</apache_karaf_version>
|
<apache_karaf_version>4.1.4</apache_karaf_version>
|
||||||
<aries_spifly_version>1.0.10</aries_spifly_version>
|
<aries_spifly_version>1.0.10</aries_spifly_version>
|
||||||
<caffeine_version>2.6.2</caffeine_version>
|
<caffeine_version>2.6.2</caffeine_version>
|
||||||
|
@ -486,29 +487,32 @@
|
||||||
<commons_lang3_version>3.7</commons_lang3_version>
|
<commons_lang3_version>3.7</commons_lang3_version>
|
||||||
<derby_version>10.14.2.0</derby_version>
|
<derby_version>10.14.2.0</derby_version>
|
||||||
<error_prone_annotations_version>2.0.18</error_prone_annotations_version>
|
<error_prone_annotations_version>2.0.18</error_prone_annotations_version>
|
||||||
<guava_version>23.0</guava_version>
|
<guava_version>25.0-jre</guava_version>
|
||||||
<gson_version>2.8.1</gson_version>
|
<gson_version>2.8.1</gson_version>
|
||||||
|
<jaxb_bundle_version>2.2.11_1</jaxb_bundle_version>
|
||||||
<jaxb_api_version>2.3.0</jaxb_api_version>
|
<jaxb_api_version>2.3.0</jaxb_api_version>
|
||||||
<jaxb_runtime_version>2.3.0</jaxb_runtime_version>
|
<jaxb_core_version>2.3.0</jaxb_core_version>
|
||||||
<jersey_version>2.25.1</jersey_version>
|
<jersey_version>2.25.1</jersey_version>
|
||||||
<jetty_version>9.4.8.v20171121</jetty_version>
|
<jetty_version>9.4.10.v20180503</jetty_version>
|
||||||
<jsr305_version>3.0.2</jsr305_version>
|
<jsr305_version>3.0.2</jsr305_version>
|
||||||
<!--<hibernate_version>5.2.10.Final</hibernate_version>-->
|
<!--<hibernate_version>5.2.10.Final</hibernate_version>-->
|
||||||
<hibernate_version>5.2.16.Final</hibernate_version>
|
<hibernate_version>5.3.1.Final</hibernate_version>
|
||||||
<hibernate_validator_version>5.4.1.Final</hibernate_validator_version>
|
<hibernate_validator_version>5.4.1.Final</hibernate_validator_version>
|
||||||
<!-- Update lucene version when you update hibernate-search version -->
|
<!-- Update lucene version when you update hibernate-search version -->
|
||||||
<hibernate_search_version>5.7.1.Final</hibernate_search_version>
|
<hibernate_search_version>5.10.1.Final</hibernate_search_version>
|
||||||
<httpcore_version>4.4.6</httpcore_version>
|
<httpcore_version>4.4.6</httpcore_version>
|
||||||
<httpclient_version>4.5.3</httpclient_version>
|
<httpclient_version>4.5.3</httpclient_version>
|
||||||
<jaxb_bundle_version>2.2.11_1</jaxb_bundle_version>
|
|
||||||
<lucene_version>5.5.4</lucene_version>
|
<lucene_version>5.5.4</lucene_version>
|
||||||
<maven_assembly_plugin_version>2.5.3</maven_assembly_plugin_version>
|
<maven_assembly_plugin_version>2.5.3</maven_assembly_plugin_version>
|
||||||
|
<maven_license_plugin_version>1.8</maven_license_plugin_version>
|
||||||
|
<resteasy_version>4.0.0.Beta3</resteasy_version>
|
||||||
<ph_schematron_version>5.0.4</ph_schematron_version>
|
<ph_schematron_version>5.0.4</ph_schematron_version>
|
||||||
<ph_commons_version>9.1.1</ph_commons_version>
|
<ph_commons_version>9.1.1</ph_commons_version>
|
||||||
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
|
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
|
||||||
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
|
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
|
||||||
<spring_version>5.0.3.RELEASE</spring_version>
|
<spring_version>5.0.6.RELEASE</spring_version>
|
||||||
<spring_data_version>2.0.7.RELEASE</spring_data_version>
|
<spring_data_version>2.0.7.RELEASE</spring_data_version>
|
||||||
|
|
||||||
<spring-boot.version>1.5.6.RELEASE</spring-boot.version>
|
<spring-boot.version>1.5.6.RELEASE</spring-boot.version>
|
||||||
<stax2_api_version>3.1.4</stax2_api_version>
|
<stax2_api_version>3.1.4</stax2_api_version>
|
||||||
<thymeleaf-version>3.0.9.RELEASE</thymeleaf-version>
|
<thymeleaf-version>3.0.9.RELEASE</thymeleaf-version>
|
||||||
|
@ -596,7 +600,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.errorprone</groupId>
|
<groupId>com.google.errorprone</groupId>
|
||||||
<artifactId>error_prone_core</artifactId>
|
<artifactId>error_prone_core</artifactId>
|
||||||
<version>2.0.19</version>
|
<version>2.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
|
@ -623,10 +627,15 @@
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>okhttp</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.activation</groupId>
|
||||||
|
<artifactId>javax.activation</artifactId>
|
||||||
|
<version>1.2.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.mail</groupId>
|
<groupId>com.sun.mail</groupId>
|
||||||
<artifactId>javax.mail</artifactId>
|
<artifactId>javax.mail</artifactId>
|
||||||
<version>1.6.0</version>
|
<version>1.6.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-cli</groupId>
|
<groupId>commons-cli</groupId>
|
||||||
|
@ -670,6 +679,16 @@
|
||||||
<artifactId>txtmark</artifactId>
|
<artifactId>txtmark</artifactId>
|
||||||
<version>0.16</version>
|
<version>0.16</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>javax.activation-api</artifactId>
|
||||||
|
<version>${activation_api_version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
<version>1.3.2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.ejb</groupId>
|
<groupId>javax.ejb</groupId>
|
||||||
<artifactId>ejb-api</artifactId>
|
<artifactId>ejb-api</artifactId>
|
||||||
|
@ -700,6 +719,16 @@
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>${gson_version}</version>
|
<version>${gson_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<version>${jaxb_core_version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<version>${jaxb_core_version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.mail</groupId>
|
<groupId>javax.mail</groupId>
|
||||||
<artifactId>javax.mail-api</artifactId>
|
<artifactId>javax.mail-api</artifactId>
|
||||||
|
@ -887,7 +916,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>2.8.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
@ -984,11 +1013,13 @@
|
||||||
<artifactId>javax.json</artifactId>
|
<artifactId>javax.json</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jaxb</groupId>
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
<artifactId>jaxb-runtime</artifactId>
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
<version>${jaxb_runtime_version}</version>
|
<version>${jaxb_runtime_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>org.glassfish.jersey.core</groupId>
|
||||||
<artifactId>jersey-server</artifactId>
|
<artifactId>jersey-server</artifactId>
|
||||||
|
@ -1009,6 +1040,16 @@
|
||||||
<artifactId>jersey-media-moxy</artifactId>
|
<artifactId>jersey-media-moxy</artifactId>
|
||||||
<version>${jersey_version}</version>
|
<version>${jersey_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-jaxrs</artifactId>
|
||||||
|
<version>${resteasy_version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
|
<artifactId>resteasy-client</artifactId>
|
||||||
|
<version>${resteasy_version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jscience</groupId>
|
<groupId>org.jscience</groupId>
|
||||||
<artifactId>jscience</artifactId>
|
<artifactId>jscience</artifactId>
|
||||||
|
@ -1056,8 +1097,8 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-all</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>1.10.19</version>
|
<version>2.18.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
@ -1246,22 +1287,22 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.errorprone</groupId>
|
<groupId>com.google.errorprone</groupId>
|
||||||
<artifactId>error_prone_core</artifactId>
|
<artifactId>error_prone_core</artifactId>
|
||||||
<version>2.0.19</version>
|
<version>2.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-api</artifactId>
|
<artifactId>plexus-compiler-api</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>2.8.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-javac</artifactId>
|
<artifactId>plexus-compiler-javac</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>2.8.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>2.8.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
@ -1298,7 +1339,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
<version>2.20</version>
|
<version>2.21.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -1387,10 +1428,8 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
jacoco-maven-plugin
|
<version>0.8.1</version>
|
||||||
</artifactId>
|
|
||||||
<version>0.7.9</version>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -2141,7 +2180,7 @@
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>ERRORPRONE_JDK8</id>
|
<id>ERRORPRONE</id>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -2154,27 +2193,6 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
|
||||||
<id>ERRORPRONE_JDK9</id>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<compilerId>javac-with-errorprone</compilerId>
|
|
||||||
</configuration>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.errorprone</groupId>
|
|
||||||
<artifactId>error_prone_core</artifactId>
|
|
||||||
<version>2.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>OWASP</id>
|
<id>OWASP</id>
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -6,6 +6,30 @@
|
||||||
<title>HAPI FHIR Changelog</title>
|
<title>HAPI FHIR Changelog</title>
|
||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
|
<release version="3.5.0" date="TBD">
|
||||||
|
<action type="add">
|
||||||
|
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.
|
||||||
|
</action>
|
||||||
|
<action type="add">
|
||||||
|
The version of a few dependencies have been bumped to the
|
||||||
|
latest versions (dependent HAPI modules listed in brackets):
|
||||||
|
<![CDATA[
|
||||||
|
<ul>
|
||||||
|
<li>Spring Framework (JPA): 5.0.3.RELEASE -> 5.0.6.RELEASE</li>
|
||||||
|
<li>Hibernate OR (JPA): 5.2.16.Final -> 5.3.1.Final</li>
|
||||||
|
<li>Hibernate Search (JPA): 5.7.1.Final -> 5.10.1.Final</li>
|
||||||
|
<li>Jetty (CLI): 9.4.8.v20171121 -> 9.4.10.v20180503</li>
|
||||||
|
</ul>
|
||||||
|
]]>
|
||||||
|
</action>
|
||||||
|
<action type="add">
|
||||||
|
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.
|
||||||
|
</action>
|
||||||
|
</release>
|
||||||
<release version="3.4.0" date="2018-05-28">
|
<release version="3.4.0" date="2018-05-28">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
The version of a few dependencies have been bumped to the
|
The version of a few dependencies have been bumped to the
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Using HAPI FHIR with JDK9 / JDK10+
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg"><img src="https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg" alt="Maven Central"/></a>
|
<a href="https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg"><img src="https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg" alt="Maven Central"/></a>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://www.versioneye.com/user/projects/55e1d0d9c6d8f2001c00043e"><img src="https://www.versioneye.com/user/projects/55e1d0d9c6d8f2001c00043e/badge.svg?style=flat" alt="VersionEye"/></a>
|
|
||||||
<br/>
|
|
||||||
<a href="http://jamesagnew.github.io/hapi-fhir/license.html"><img src="https://img.shields.io/badge/license-apache%202.0-60C060.svg" alt="Apache 2.0 Licensed"/></a>
|
<a href="http://jamesagnew.github.io/hapi-fhir/license.html"><img src="https://img.shields.io/badge/license-apache%202.0-60C060.svg" alt="Apache 2.0 Licensed"/></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue