Get R5 support working

This commit is contained in:
jamesagnew
2019-08-11 18:35:43 -04:00
parent ef49c11e8e
commit 7831250d92
10 changed files with 332 additions and 53 deletions

View File

@@ -5,7 +5,7 @@ import ca.uhn.fhir.model.dstu2.resource.Patient;
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.util.PortUtil;
import ca.uhn.fhir.test.utilities.JettyUtil;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.hl7.fhir.instance.model.api.IIdType;
@@ -23,16 +23,13 @@ public class ExampleServerDstu2IT {
private static IGenericClient ourClient;
private static FhirContext ourCtx;
private static int ourPort;
private static Server ourServer;
private static String ourServerBase;
static {
HapiProperties.forceReload();
HapiProperties.setProperty(HapiProperties.FHIR_VERSION, "DSTU2");
HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:derby:memory:dbr2;create=true");
HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:h2:mem:dbr2");
ourCtx = FhirContext.forDstu2();
ourPort = PortUtil.findFreePort();
}
@Test
@@ -59,7 +56,7 @@ public class ExampleServerDstu2IT {
ourLog.info("Project base path is: {}", path);
ourServer = new Server(ourPort);
ourServer = new Server(0);
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath("/hapi-fhir-jpaserver");
@@ -70,9 +67,11 @@ public class ExampleServerDstu2IT {
ourServer.setHandler(webAppContext);
ourServer.start();
ourPort = JettyUtil.getPortForStartedServer(ourServer);
ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/";
String ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/";
ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
ourClient.registerInterceptor(new LoggingInterceptor(true));
}