Skip to content

Commit

Permalink
Merge branch 'java9'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesagnew committed Jun 1, 2018
2 parents 674005b + f016656 commit 44c6292
Show file tree
Hide file tree
Showing 87 changed files with 1,214 additions and 1,484 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

# Use VM based build environment
sudo: required
dist: trusty

language: java
jdk:
- oraclejdk8
- oraclejdk9
env:
global:
- MAVEN_OPTS="-Xmx1024m"
Expand All @@ -25,5 +26,4 @@ before_script:
script:
# - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report
# - mvn -Dci=true -e -B -P ALLMODULES,NOPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
- mvn -Dci=true -e -B -P ALLMODULES,REDUCED_JPA_TESTS,ERRORPRONE_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
4 changes: 3 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ cache:
- C:\maven\
- C:\Users\appveyor\.m2\repository
build_script:
- cmd: mvn -P MINPARALLEL,ALLMODULES clean install
- SET JAVA_HOME=C:\Program Files\Java\jdk10
- SET PATH=C:\Program Files\Java\jdk10\bin;%PATH%
- cmd: mvn -P MINPARALLEL,ALLMODULES,REDUCED_JPA_TESTS clean install
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Ignore;

import java.io.*;
import java.net.HttpURLConnection;
Expand Down Expand Up @@ -188,7 +189,8 @@ public void ActivityDefinitionApplyTest() {
Assert.assertTrue(procedureRequest.getDoNotPerform());
}

//@Test
@Test
@Ignore
public void CdsHooksPatientViewTest() throws IOException {
putResource("cds-bcs-library.json", "patient-view");
putResource("cds-bcs-patient.json", "Patient-6532");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void testParserJson() {
* android uses) and see if this passes
*/
@SuppressWarnings("deprecation")
@Test
public void testClient() {
FhirContext ctx = FhirContext.forDstu2();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void testBinaryCreateWithNoContentType() throws Exception {
@Test
public void testClientFailures() throws Exception {
ResponseBody body = mock(ResponseBody.class);
when(body.source()).thenThrow(IllegalStateException.class, RuntimeException.class, Exception.class);
when(body.source()).thenThrow(IllegalStateException.class, RuntimeException.class);

myHttpResponse = new Response.Builder()
.request(myRequest)
Expand All @@ -216,12 +216,6 @@ public void testClientFailures() throws Exception {
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());
}
}


Expand Down
4 changes: 2 additions & 2 deletions hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1757,8 +1757,8 @@ static void setThrowExceptionForUnitTest(Throwable theException) {

private static void throwUnitTestExceptionIfConfiguredToDoSo() throws FactoryConfigurationError, XMLStreamException {
if (ourNextException != null) {
if (ourNextException instanceof FactoryConfigurationError) {
throw ((FactoryConfigurationError)ourNextException);
if (ourNextException instanceof javax.xml.stream.FactoryConfigurationError) {
throw ((javax.xml.stream.FactoryConfigurationError)ourNextException);
}
throw (XMLStreamException)ourNextException;
}
Expand Down
26 changes: 17 additions & 9 deletions hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,32 +166,40 @@
<artifactId>thymeleaf-spring4</artifactId>
</dependency>

<!-- Dependencies for Schematron -->
<dependency>
<groupId>com.helger</groupId>
<artifactId>ph-schematron</artifactId>
<exclusions>
<exclusion>
<artifactId>Saxon-HE</artifactId>
<groupId>net.sf.saxon</groupId>
<groupId>org.glassfish.jaxb</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>
</exclusions>
</dependency>
<dependency>
<groupId>com.helger</groupId>
<artifactId>ph-commons</artifactId>
</dependency>

<!--
These have been added as explicit dependencies
as JDK9 no longer includes them by default
-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</dependency>


Expand Down
18 changes: 4 additions & 14 deletions hapi-fhir-client-okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</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>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<scope>test</scope>
</dependency>

Expand Down
22 changes: 22 additions & 0 deletions hapi-fhir-jacoco/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@
<version>${project.version}</version>
</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>
<groupId>com.helger</groupId>
<artifactId>ph-schematron</artifactId>
Expand Down Expand Up @@ -330,6 +345,13 @@
<sourceDirectory>../hapi-fhir-client-okhttp/src/main/java</sourceDirectory>
</sourceDirectories>
</configuration>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
21 changes: 21 additions & 0 deletions hapi-fhir-jaxrsserver-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>

<!-- Unit test dependencies -->
<dependency>
<groupId>org.codehaus.woodstox</groupId>
Expand All @@ -109,6 +114,20 @@
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</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>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
Expand All @@ -129,6 +148,8 @@
<artifactId>jersey-media-moxy</artifactId>
<scope>test</scope>
</dependency>
-->

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
private org.hl7.fhir.dstu2016may.model.Conformance myDstu2_1Conformance;
private org.hl7.fhir.instance.model.Conformance myDstu2Hl7OrgConformance;
private ca.uhn.fhir.model.dstu2.resource.Conformance myDstu2Conformance;
private boolean myInitialized;

/**
* Constructor allowing the description, servername and server to be set
Expand Down Expand Up @@ -112,7 +113,11 @@ protected AbstractJaxRsConformanceProvider(FhirContext ctx, String implementatio
* conformance
*/
@PostConstruct
protected void setUpPostConstruct() {
protected synchronized void setUpPostConstruct() {
if (myInitialized) {
return;
}

for (Entry<Class<? extends IResourceProvider>, IResourceProvider> provider : getProviders().entrySet()) {
addProvider(provider.getValue(), provider.getKey());
}
Expand Down Expand Up @@ -155,6 +160,8 @@ protected void setUpPostConstruct() {
default:
throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion);
}

myInitialized = true;
}

/**
Expand Down Expand Up @@ -184,6 +191,8 @@ public Response conformanceUsingOptions() throws IOException {
@GET
@Path("/metadata")
public Response conformance() throws IOException {
setUpPostConstruct();

Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA);
IRestfulResponse response = request.build().getResponse();
response.addHeader(Constants.HEADER_CORS_ALLOW_ORIGIN, "*");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
* a large amount of the fhir api functionality using JAXRS
* @author Peter Van Houte | [email protected] | Agfa Healthcare
*/
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML, Constants.CT_FHIR_JSON_NEW, Constants.CT_FHIR_XML_NEW })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML })
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML, Constants.CT_FHIR_JSON_NEW, Constants.CT_FHIR_XML_NEW, "application/octet-stream" })
@Interceptors(JaxRsExceptionInterceptor.class)
public abstract class AbstractJaxRsResourceProvider<R extends IBaseResource> extends AbstractJaxRsProvider

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private ConcurrentHashMap<String, BaseMethodBinding<?>> getMapForOperation(RestO
*/
public BaseMethodBinding<?> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
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)) {
throw new NotImplementedOperationException("Operation not implemented");
} else {
Expand Down
Loading

0 comments on commit 44c6292

Please sign in to comment.