From 7acacda758d850740ed3c507f77467ee3af4fe10 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sun, 21 Jun 2015 00:07:48 -0400 Subject: [PATCH] Travis --- .../ca/uhn/fhir/jpa/dao/BaseFhirDaoTest.java | 2 +- .../java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java | 20 +++++++++++++++++++ .../jpa/dao/FhirResourceDaoDstu1Test.java | 2 +- .../jpa/dao/FhirResourceDaoDstu2Test.java | 2 +- .../fhir/jpa/dao/FhirSystemDaoDstu1Test.java | 2 +- .../fhir/jpa/dao/FhirSystemDaoDstu2Test.java | 6 ++++-- .../provider/ResourceProviderDstu1Test.java | 3 ++- .../provider/ResourceProviderDstu2Test.java | 3 ++- .../ResourceProviderMultiVersionTest.java | 3 ++- .../jpa/provider/SystemProviderDstu1Test.java | 3 ++- .../jpa/provider/SystemProviderDstu2Test.java | 3 ++- 11 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseFhirDaoTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseFhirDaoTest.java index 82ef8eac653..ff538892abd 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseFhirDaoTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseFhirDaoTest.java @@ -7,7 +7,7 @@ import org.junit.Test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.dstu2.resource.Condition; -public class BaseFhirDaoTest { +public class BaseFhirDaoTest extends BaseJpaTest { private static FhirContext ourCtx = FhirContext.forDstu2(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java new file mode 100644 index 00000000000..1cb376e895e --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java @@ -0,0 +1,20 @@ +package ca.uhn.fhir.jpa.dao; + +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.SQLNonTransientConnectionException; + +import org.junit.AfterClass; + +public class BaseJpaTest { + + @AfterClass + public static void afterClassShutdownDerby() throws SQLException { + try { + DriverManager.getConnection("jdbc:derby:memory:myUnitTestDB;drop=true"); + } catch (SQLNonTransientConnectionException e) { + // expected.. for some reason.... + } + } + +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu1Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu1Test.java index 82963836453..bb6571cecd4 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu1Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu1Test.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; -public class FhirResourceDaoDstu1Test { +public class FhirResourceDaoDstu1Test extends BaseJpaTest { private static ClassPathXmlApplicationContext ourCtx; private static IFhirResourceDao ourDeviceDao; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java index 1749b67e9da..6c8e0a7b9cf 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoDstu2Test.java @@ -93,7 +93,7 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; @SuppressWarnings("unchecked") -public class FhirResourceDaoDstu2Test { +public class FhirResourceDaoDstu2Test extends BaseJpaTest { private static ClassPathXmlApplicationContext ourCtx; private static IFhirResourceDao ourDeviceDao; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu1Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu1Test.java index cf4971e8a3d..37cfda114ef 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu1Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu1Test.java @@ -45,7 +45,7 @@ import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.IBundleProvider; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -public class FhirSystemDaoDstu1Test { +public class FhirSystemDaoDstu1Test extends BaseJpaTest { private static ClassPathXmlApplicationContext ourCtx; private static FhirContext ourFhirContext; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java index 6afacf45aa1..517992b5afc 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2Test.java @@ -8,6 +8,8 @@ import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.*; import java.io.InputStream; +import java.sql.DriverManager; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; @@ -45,7 +47,7 @@ import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; -public class FhirSystemDaoDstu2Test { +public class FhirSystemDaoDstu2Test extends BaseJpaTest { private static ClassPathXmlApplicationContext ourCtx; private static FhirContext ourFhirContext; @@ -953,7 +955,7 @@ public class FhirSystemDaoDstu2Test { } @AfterClass - public static void afterClass() { + public static void afterClass() throws SQLException { ourCtx.close(); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java index d705d64e0ba..05546effce1 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java @@ -17,6 +17,7 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.BaseJpaTest; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; @@ -49,7 +50,7 @@ import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; -public class ResourceProviderDstu1Test { +public class ResourceProviderDstu1Test extends BaseJpaTest { private static ClassPathXmlApplicationContext ourAppCtx; private static IGenericClient ourClient; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java index dc66f2dafae..aeccb5e1c89 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java @@ -48,6 +48,7 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.BaseJpaTest; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; @@ -96,7 +97,7 @@ import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; -public class ResourceProviderDstu2Test { +public class ResourceProviderDstu2Test extends BaseJpaTest { private static ClassPathXmlApplicationContext ourAppCtx; private static IGenericClient ourClient; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderMultiVersionTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderMultiVersionTest.java index b5bfd1dcbc1..7a5673a01cd 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderMultiVersionTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderMultiVersionTest.java @@ -13,6 +13,7 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.BaseJpaTest; import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.dstu.resource.Patient; @@ -26,7 +27,7 @@ import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.RestfulServer; -public class ResourceProviderMultiVersionTest { +public class ResourceProviderMultiVersionTest extends BaseJpaTest { private static ClassPathXmlApplicationContext ourAppCtx; private static IGenericClient ourClientDstu2; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu1Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu1Test.java index 58b03c85ad0..380079407bd 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu1Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu1Test.java @@ -19,6 +19,7 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.BaseJpaTest; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.rp.dstu.ObservationResourceProvider; import ca.uhn.fhir.jpa.rp.dstu.OrganizationResourceProvider; @@ -34,7 +35,7 @@ import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.client.IGenericClient; import ca.uhn.fhir.rest.server.RestfulServer; -public class SystemProviderDstu1Test { +public class SystemProviderDstu1Test extends BaseJpaTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SystemProviderDstu1Test.class); private static Server ourServer; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java index 1a6ba0c4fdf..8c68a7e3ade 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java @@ -15,6 +15,7 @@ import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.BaseJpaTest; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.rp.dstu.ObservationResourceProvider; import ca.uhn.fhir.jpa.rp.dstu.OrganizationResourceProvider; @@ -29,7 +30,7 @@ import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.client.IGenericClient; import ca.uhn.fhir.rest.server.RestfulServer; -public class SystemProviderDstu2Test { +public class SystemProviderDstu2Test extends BaseJpaTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SystemProviderDstu2Test.class); private static Server ourServer;