ServerProfileProvider now uses IdDt.getIdPart() rather than getValue() so that it can find the profiles in in FhirContext's myIdToResourceDefinition.
This commit is contained in:
parent
69ee8a4777
commit
7f965c447f
|
@ -1,5 +1,9 @@
|
||||||
/bin
|
/bin
|
||||||
/target
|
/target
|
||||||
|
.idea/
|
||||||
|
.project/
|
||||||
|
.settings/
|
||||||
|
*.iml
|
||||||
*.log
|
*.log
|
||||||
*.log*
|
*.log*
|
||||||
nohup.out
|
nohup.out
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ServerProfileProvider implements IResourceProvider {
|
||||||
|
|
||||||
@Read()
|
@Read()
|
||||||
public Profile getProfileById(@IdParam IdDt theId) {
|
public Profile getProfileById(@IdParam IdDt theId) {
|
||||||
RuntimeResourceDefinition retVal = myContext.getResourceDefinitionById(theId.getValue());
|
RuntimeResourceDefinition retVal = myContext.getResourceDefinitionById(theId.getIdPart());
|
||||||
if (retVal==null) {
|
if (retVal==null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,4 +64,6 @@ public class ModelScannerTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.*;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
@ -44,11 +45,6 @@ import ca.uhn.fhir.model.dstu.composite.CodingDt;
|
||||||
import ca.uhn.fhir.model.dstu.composite.HumanNameDt;
|
import ca.uhn.fhir.model.dstu.composite.HumanNameDt;
|
||||||
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
||||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||||
import ca.uhn.fhir.model.dstu.resource.AdverseReaction;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Conformance;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.DiagnosticReport;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
|
@ -86,6 +82,7 @@ public class ResfulServerMethodTest {
|
||||||
private static int ourPort;
|
private static int ourPort;
|
||||||
private static DummyDiagnosticReportResourceProvider ourReportProvider;
|
private static DummyDiagnosticReportResourceProvider ourReportProvider;
|
||||||
private static Server ourServer;
|
private static Server ourServer;
|
||||||
|
private static RestfulServer ourRestfulServer;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test404IsPropagatedCorrectly() throws Exception {
|
public void test404IsPropagatedCorrectly() throws Exception {
|
||||||
|
@ -995,6 +992,14 @@ public class ResfulServerMethodTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testServerProfileProviderFindsProfiles() {
|
||||||
|
ServerProfileProvider profileProvider = (ServerProfileProvider)ourRestfulServer.getServerProfilesProvider();
|
||||||
|
IdDt id = new IdDt("Profile", "observation");
|
||||||
|
Profile profile = profileProvider.getProfileById(id);
|
||||||
|
assertNotNull(profile);
|
||||||
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws Exception {
|
public static void afterClass() throws Exception {
|
||||||
ourServer.stop();
|
ourServer.stop();
|
||||||
|
@ -1012,8 +1017,8 @@ public class ResfulServerMethodTest {
|
||||||
DummyAdverseReactionResourceProvider adv = new DummyAdverseReactionResourceProvider();
|
DummyAdverseReactionResourceProvider adv = new DummyAdverseReactionResourceProvider();
|
||||||
|
|
||||||
ServletHandler proxyHandler = new ServletHandler();
|
ServletHandler proxyHandler = new ServletHandler();
|
||||||
DummyRestfulServer servlet = new DummyRestfulServer(patientProvider, profProvider, ourReportProvider, adv);
|
ourRestfulServer =new DummyRestfulServer(patientProvider, profProvider, ourReportProvider, adv);
|
||||||
ServletHolder servletHolder = new ServletHolder(servlet);
|
ServletHolder servletHolder = new ServletHolder(ourRestfulServer);
|
||||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||||
ourServer.setHandler(proxyHandler);
|
ourServer.setHandler(proxyHandler);
|
||||||
ourServer.start();
|
ourServer.start();
|
||||||
|
|
Loading…
Reference in New Issue