From f79b7adabd98972bbafe18dfd2a2cc72a3c21d63 Mon Sep 17 00:00:00 2001 From: t106uhn Date: Mon, 15 Sep 2014 20:40:40 -0400 Subject: [PATCH 1/6] added jetty-http dependancy to allow test case classes to compile in eclipse --- hapi-fhir-base/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 2d735d6f822..93c91bf3b0f 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -225,6 +225,13 @@ 9.1.1.v20140108 test + + org.eclipse.jetty + jetty-http + 9.1.1.v20140108 + test + + From ef57a5f47e07e996b710637909903e4ea5d863c8 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 16 Sep 2014 12:05:44 -0400 Subject: [PATCH 2/6] Work on #21 - Don't depend on Servlet 3+ APIs --- hapi-fhir-base/src/changes/changes.xml | 4 + .../HardcodedServerAddressStrategy.java | 17 +- .../rest/server/IServerAddressStrategy.java | 3 +- .../IncomingRequestAddressStrategy.java | 7 +- .../uhn/fhir/rest/server/RestfulServer.java | 14 +- .../ca/uhn/fhir/validation/FhirValidator.java | 57 ++-- .../ca/uhn/fhir/i18n/hapi-messages.properties | 5 +- .../validation/ValidatorInstantiatorTest.java | 24 ++ hapi-fhir-base/testmindeps/.classpath | 21 ++ hapi-fhir-base/testmindeps/.gitignore | 1 + hapi-fhir-base/testmindeps/.project | 23 ++ .../org.eclipse.core.resources.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 289 ++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 3 + .../.settings/org.eclipse.m2e.core.prefs | 4 + hapi-fhir-base/testmindeps/pom.xml | 61 ++++ .../testmindeps/pom.xml.versionsBackup | 47 +++ .../ca/uhn/fhir/testmindeps/ReadTest.java | 187 ++++++++++++ .../uhn/fhir/testmindeps/ValidatorTest.java | 30 ++ pom.xml | 1 + .../org.eclipse.wst.common.component | 2 +- 21 files changed, 764 insertions(+), 39 deletions(-) create mode 100644 hapi-fhir-base/src/test/java/ca/uhn/fhir/validation/ValidatorInstantiatorTest.java create mode 100644 hapi-fhir-base/testmindeps/.classpath create mode 100644 hapi-fhir-base/testmindeps/.gitignore create mode 100644 hapi-fhir-base/testmindeps/.project create mode 100644 hapi-fhir-base/testmindeps/.settings/org.eclipse.core.resources.prefs create mode 100644 hapi-fhir-base/testmindeps/.settings/org.eclipse.jdt.core.prefs create mode 100644 hapi-fhir-base/testmindeps/.settings/org.eclipse.jdt.ui.prefs create mode 100644 hapi-fhir-base/testmindeps/.settings/org.eclipse.m2e.core.prefs create mode 100644 hapi-fhir-base/testmindeps/pom.xml create mode 100644 hapi-fhir-base/testmindeps/pom.xml.versionsBackup create mode 100644 hapi-fhir-base/testmindeps/src/test/java/ca/uhn/fhir/testmindeps/ReadTest.java create mode 100644 hapi-fhir-base/testmindeps/src/test/java/ca/uhn/fhir/testmindeps/ValidatorTest.java diff --git a/hapi-fhir-base/src/changes/changes.xml b/hapi-fhir-base/src/changes/changes.xml index 59ca277db76..d9e3a896b0d 100644 --- a/hapi-fhir-base/src/changes/changes.xml +++ b/hapi-fhir-base/src/changes/changes.xml @@ -10,6 +10,10 @@ Documentation update, thanks to Suranga Nath Kasthurirathne of the OpenMRS project. + + HAPI now runs successfully on Servlet 2.5 containers (such as Tomcat 6). Thanks to + Bernard Gitaadji for reporting and diagnosing the issue! + From 774e38eacc15ae72e468731a85e2bee57c1f7e48 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 16 Sep 2014 17:16:03 -0400 Subject: [PATCH 5/6] Just logging in unit test --- .../java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java index 5d1cacb7f9f..c0f7cad7188 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java @@ -69,6 +69,7 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.param.CodingListParam; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.DateRangeParam; +import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.provider.ServerProfileProvider; @@ -1303,6 +1304,10 @@ public class ResfulServerMethodTest { @Read(version=true) public Patient vread(@IdParam IdDt theId) { Patient retVal = getIdToPatient().get(theId.getIdPart()); + if (retVal == null) { + throw new InternalErrorException("Couldn't find ID " + theId.getIdPart() + " - Valid IDs are: " + getIdToPatient().keySet()); + } + List name = retVal.getName(); HumanNameDt nameDt = name.get(0); String value = theId.getVersionIdPart(); From 83f9c1c6a992266de12f9076b733dffdaaf63203 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 16 Sep 2014 17:21:04 -0400 Subject: [PATCH 6/6] Still working on unit tests --- .../java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java index c0f7cad7188..2dd748421d5 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResfulServerMethodTest.java @@ -1305,7 +1305,7 @@ public class ResfulServerMethodTest { public Patient vread(@IdParam IdDt theId) { Patient retVal = getIdToPatient().get(theId.getIdPart()); if (retVal == null) { - throw new InternalErrorException("Couldn't find ID " + theId.getIdPart() + " - Valid IDs are: " + getIdToPatient().keySet()); + throw new ResourceNotFoundException("Couldn't find ID " + theId.getIdPart() + " - Valid IDs are: " + getIdToPatient().keySet()); } List name = retVal.getName();