Using a configurable properties file for settings that might change between environments

This commit is contained in:
Sean McIlvenna
2019-02-06 16:00:38 -08:00
parent 18c85900e5
commit 7a96e96996
6 changed files with 338 additions and 62 deletions

View File

@@ -20,15 +20,29 @@ public class ExampleServerIT {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExampleServerIT.class);
private static IGenericClient ourClient;
private static FhirContext ourCtx = FhirContext.forDstu3();
private static FhirContext ourCtx;
private static int ourPort;
private static Server ourServer;
private static String ourServerBase;
static {
switch (HapiProperties.getFhirVersion()) {
case DSTU2:
ourCtx = FhirContext.forDstu2();
case R4:
ourCtx = FhirContext.forR4();
case DSTU3:
default:
ourCtx = FhirContext.forDstu3();
}
ourPort = HapiProperties.getTestPort();
}
@Test
public void testCreateAndRead() throws IOException {
ourLog.info("Base URL is: http://localhost:" + ourPort + "/baseDstu3");
ourLog.info("Base URL is: http://localhost:" + ourPort + HapiProperties.getServerBase());
String methodName = "testCreateResourceConditional";
Patient pt = new Patient();
@@ -72,16 +86,13 @@ public class ExampleServerIT {
ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
ourServerBase = "http://localhost:" + ourPort + "/baseDstu3";
ourServerBase = "http://localhost:" + ourPort + HapiProperties.getServerBase();
ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
ourClient.registerInterceptor(new LoggingInterceptor(true));
}
public static void main(String[] theArgs) throws Exception {
ourPort = 8080;
beforeClass();
}
}