Add some tests

This commit is contained in:
James Agnew 2014-10-29 09:04:44 -04:00
parent 5abdb5680a
commit 8f610d2c3a
19 changed files with 254 additions and 102 deletions

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -6,6 +6,12 @@
<title>HAPI FHIR Changelog</title> <title>HAPI FHIR Changelog</title>
</properties> </properties>
<body> <body>
<release version="0.8" date="TBD">
<action type="add" issue="38">
Profile generation on the server was not working due to IdDt being
incorrectly used. Thanks to Bill de Beaubien for the pull request!
</action>
</release>
<release version="0.7" date="2014-Oct-23"> <release version="0.7" date="2014-Oct-23">
<action type="add" issue="30"> <action type="add" issue="30">
<![CDATA[<b>API CHANGE:</b>]]> The TagList class previously implemented ArrayList semantics, <![CDATA[<b>API CHANGE:</b>]]> The TagList class previously implemented ArrayList semantics,

View File

@ -20,24 +20,29 @@ package ca.uhn.fhir.rest.server.interceptor;
* #L% * #L%
*/ */
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.rest.annotation.Read;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.method.RequestDetails; import ca.uhn.fhir.rest.method.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.AuthenticationException; import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
/** /**
* Provides methods to intercept requests and responses. Note that implementations of this interface may wish * Provides methods to intercept requests and responses. Note that implementations of this interface may wish to use {@link InterceptorAdapter} in order to not need to implement every method.
* to use {@link InterceptorAdapter} in order to not need to implement every method.
*/ */
public interface IServerInterceptor { public interface IServerInterceptor {
/** /**
* This method is called before any other processing takes place for each incoming request. It may be used to * This method is called before any other processing takes place for each incoming request. It may be used to provide alternate handling for some requests, or to screen requests before they are
* provide alternate handling for some requests, or to screen requests before they are handled, etc. * handled, etc.
* <p> * <p>
* Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server) * Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server)
* </p> * </p>
@ -45,19 +50,17 @@ public interface IServerInterceptor {
* @param theRequest * @param theRequest
* The incoming request * The incoming request
* @param theResponse * @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling * The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code> * <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. * @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you * response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
*/ */
public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse); public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse);
/** /**
* This method is called just before the actual implementing server method is invoked. * This method is called just before the actual implementing server method is invoked.
* <p> * <p>
* Note about exceptions: * Note about exceptions:
* </p> * </p>
* *
* @param theRequestDetails * @param theRequestDetails
@ -65,21 +68,18 @@ public interface IServerInterceptor {
* @param theRequest * @param theRequest
* The incoming request * The incoming request
* @param theResponse * @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling * The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code> * <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. * @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you * response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* @throws AuthenticationException * @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access * This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client. * client.
*/ */
public boolean incomingRequestPostProcessed(RequestDetails theRequestDetails, HttpServletRequest theRequest, HttpServletResponse theResponse) throws AuthenticationException; public boolean incomingRequestPostProcessed(RequestDetails theRequestDetails, HttpServletRequest theRequest, HttpServletResponse theResponse) throws AuthenticationException;
/** /**
* This method is called after the server implementation method has been called, but before any attempt to stream * This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
* the response back to the client
* *
* @param theRequestDetails * @param theRequestDetails
* A bean containing details about the request that is about to be processed, including * A bean containing details about the request that is about to be processed, including
@ -88,22 +88,19 @@ public interface IServerInterceptor {
* @param theRequest * @param theRequest
* The incoming request * The incoming request
* @param theResponse * @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling * The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code> * <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. * @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you * response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* @throws AuthenticationException * @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access * This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client. * client.
*/ */
public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException; public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws AuthenticationException;
/** /**
* This method is called after the server implementation method has been called, but before any attempt to stream * This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
* the response back to the client
* *
* @param theRequestDetails * @param theRequestDetails
* A bean containing details about the request that is about to be processed, including * A bean containing details about the request that is about to be processed, including
@ -112,21 +109,19 @@ public interface IServerInterceptor {
* @param theRequest * @param theRequest
* The incoming request * The incoming request
* @param theResponse * @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling * The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code> * <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. * @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you * response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* @throws AuthenticationException * @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access * This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client. * client.
*/ */
public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException; public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws AuthenticationException;
/** /**
* This method is called after the server implementation method has been called, but before any attempt to stream * This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
* the response back to the client
* *
* @param theRequestDetails * @param theRequestDetails
* A bean containing details about the request that is about to be processed, including * A bean containing details about the request that is about to be processed, including
@ -135,21 +130,19 @@ public interface IServerInterceptor {
* @param theRequest * @param theRequest
* The incoming request * The incoming request
* @param theResponse * @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling * The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code> * <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. * @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you * response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* @throws AuthenticationException * @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access * This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client. * client.
*/ */
public boolean outgoingResponse(RequestDetails theRequestDetails, IResource theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException; public boolean outgoingResponse(RequestDetails theRequestDetails, IResource theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws AuthenticationException;
/** /**
* This method is called after the server implementation method has been called, but before any attempt to stream * This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
* the response back to the client
* *
* @param theRequestDetails * @param theRequestDetails
* A bean containing details about the request that is about to be processed, including * A bean containing details about the request that is about to be processed, including
@ -158,16 +151,42 @@ public interface IServerInterceptor {
* @param theRequest * @param theRequest
* The incoming request * The incoming request
* @param theResponse * @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling * The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code> * <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. * @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you * response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* @throws AuthenticationException * @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access * This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client. * client.
*/ */
public boolean outgoingResponse(RequestDetails theRequestDetails, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException; public boolean outgoingResponse(RequestDetails theRequestDetails, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException;
/**
* This method is called upon any exception being thrown within the server's request processing code. This includes any exceptions thrown within resource provider methods (e.g. {@link Search} and
* {@link Read} methods) as well as any runtime exceptions thrown by the server itself. This also includes any {@link AuthenticationException}s thrown.
* <p>
* Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>true</code>. In this case, processing will continue, and the server will automatically generate an
* {@link OperationOutcome OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they should return <code>false</code>, to indicate that
* they have handled the request and processing should stop.
* </p>
*
* @param theRequestDetails
* A bean containing details about the request that is about to be processed, including
* @param theResponseObject
* The actual object which is being streamed to the client as a response
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* @throws ServletException
* If this exception is thrown, it will be re-thrown up to the container for handling.
* @throws IOException
* If this exception is thrown, it will be re-thrown up to the container for handling.
*/
public boolean handleException(RequestDetails theRequestDetails, Throwable theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws ServletException,
IOException;
} }

View File

@ -20,6 +20,9 @@ package ca.uhn.fhir.rest.server.interceptor;
* #L% * #L%
*/ */
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -65,4 +68,10 @@ public class InterceptorAdapter implements IServerInterceptor {
return true; return true;
} }
@Override
public boolean handleException(RequestDetails theRequestDetails, Throwable theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws ServletException,
IOException {
return true;
}
} }

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -24,8 +24,13 @@ import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry; import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.Tag;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.resource.Profile;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.OptionalParam;
import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.rest.annotation.Search;
@ -67,6 +72,26 @@ public class CustomTypeTest {
} }
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeTest.class);
@Test
public void testFindProfileItself() throws Exception {
ourServlet.setAddProfileTag(AddProfileTagEnum.ONLY_FOR_CUSTOM);
ourReturnExtended=true;
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Profile/prof2?_pretty=true");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
ourLog.info(responseContent);
Profile bundle = ourCtx.newXmlParser().parseResource(Profile.class, responseContent);
}
@Test @Test
public void testSearchReturnsNoProfileForNormalType() throws Exception { public void testSearchReturnsNoProfileForNormalType() throws Exception {
ourServlet.setAddProfileTag(AddProfileTagEnum.ONLY_FOR_CUSTOM); ourServlet.setAddProfileTag(AddProfileTagEnum.ONLY_FOR_CUSTOM);
@ -154,13 +179,36 @@ public class CustomTypeTest {
builder.setConnectionManager(connectionManager); builder.setConnectionManager(connectionManager);
ourClient = builder.build(); ourClient = builder.build();
FhirContext fhirContext = ourServlet.getFhirContext();
fhirContext.getResourceDefinition(ExtendedPatient.class);
} }
@ResourceDef(name="Patient", profile="http://foo/profiles/Profile") @ResourceDef(name="Patient", profile="http://foo/profiles/Profile", id="prof2")
public static class ExtendedPatient extends Patient { public static class ExtendedPatient extends Patient {
/**
* Each extension is defined in a field. Any valid HAPI Data Type
* can be used for the field type. Note that the [name=""] attribute
* in the @Child annotation needs to match the name for the bean accessor
* and mutator methods.
*/
@Child(name="petName")
@Extension(url="http://example.com/dontuse#petname", definedLocally=false, isModifier=false)
@Description(shortDefinition="The name of the patient's favourite pet")
private StringDt myPetName;
public StringDt getPetName() {
if (myPetName == null) {
myPetName = new StringDt();
}
return myPetName;
}
public void setPetName(StringDt thePetName) {
myPetName = thePetName;
}
} }

View File

@ -5,6 +5,7 @@ import static org.junit.Assert.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -31,8 +32,11 @@ import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Extension; import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.DiagnosticReport;
import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.resource.Organization; import ca.uhn.fhir.model.dstu.resource.Organization;
import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.resource.Practitioner;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.annotation.IncludeParam; import ca.uhn.fhir.rest.annotation.IncludeParam;
@ -84,6 +88,22 @@ public class IncludeTest {
assertEquals("Hello", p.getId().getIdPart()); assertEquals("Hello", p.getId().getIdPart());
assertEquals("foo", p.getName().get(0).getFamilyFirstRep().getValue()); assertEquals("foo", p.getName().get(0).getFamilyFirstRep().getValue());
} }
@Test
public void testMixedContainedAndNonContained() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/DiagnosticReport?_query=stitchedInclude&_pretty=true");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseBundle(responseContent);
assertEquals(4, bundle.size());
}
@Test @Test
public void testIIncludedResourcesNonContained() throws Exception { public void testIIncludedResourcesNonContained() throws Exception {
@ -239,7 +259,7 @@ public class IncludeTest {
ServletHandler proxyHandler = new ServletHandler(); ServletHandler proxyHandler = new ServletHandler();
RestfulServer servlet = new RestfulServer(); RestfulServer servlet = new RestfulServer();
servlet.setFhirContext(ourCtx); servlet.setFhirContext(ourCtx);
servlet.setResourceProviders(patientProvider); servlet.setResourceProviders(patientProvider, new DummyDiagnosticReportResourceProvider());
ServletHolder servletHolder = new ServletHolder(servlet); ServletHolder servletHolder = new ServletHolder(servlet);
proxyHandler.addServletWithMapping(servletHolder, "/*"); proxyHandler.addServletWithMapping(servletHolder, "/*");
ourServer.setHandler(proxyHandler); ourServer.setHandler(proxyHandler);
@ -275,6 +295,56 @@ public class IncludeTest {
mySecondOrg = theSecondOrg; mySecondOrg = theSecondOrg;
} }
}
/**
* Created by dsotnikov on 2/25/2014.
*/
public static class DummyDiagnosticReportResourceProvider implements IResourceProvider {
@Override
public Class<? extends IResource> getResourceType() {
return DiagnosticReport.class;
}
@Search(queryName = "stitchedInclude")
public List<DiagnosticReport> stitchedInclude() {
Practitioner pr1 = new Practitioner();
pr1.setId("Practitioner/001");
pr1.getName().addFamily("Pract1");
Practitioner pr2 = new Practitioner();
pr2.setId("Practitioner/002");
pr2.getName().addFamily("Pract2");
Practitioner pr3 = new Practitioner();
pr3.setId("Practitioner/003");
pr3.getName().addFamily("Pract3");
Observation o1 = new Observation();
o1.getName().setText("Obs1");
o1.addPerformer().setResource(pr1);
Observation o2 = new Observation();
o2.getName().setText("Obs2");
o2.addPerformer().setResource(pr2);
Observation o3 = new Observation();
o3.getName().setText("Obs3");
o3.addPerformer().setResource(pr3);
DiagnosticReport rep = new DiagnosticReport();
rep.setId("DiagnosticReport/999");
rep.getName().setText("Rep");
rep.addResult().setResource(o1);
rep.addResult().setResource(o2);
rep.addResult().setResource(o3);
return Collections.singletonList(rep);
}
} }
@ -301,7 +371,7 @@ public class IncludeTest {
return Arrays.asList(p1, p2); return Arrays.asList(p1, p2);
} }
@Search(queryName = "extInclude") @Search(queryName = "extInclude")
public List<Patient> extInclude() { public List<Patient> extInclude() {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
@ -40,7 +40,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -44,7 +44,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId> <artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>
@ -127,7 +127,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<id>buildclient</id> <id>buildclient</id>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -16,12 +16,12 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId> <artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId> <artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<type>war</type> <type>war</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -29,7 +29,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test</artifactId> <artifactId>hapi-fhir-jpaserver-test</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@ -185,7 +185,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<id>buildclient</id> <id>buildclient</id>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<!-- Only required for OpenID Connect Support --> <!-- Only required for OpenID Connect Support -->

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
@ -27,7 +27,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -27,7 +27,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>
@ -50,7 +50,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test</artifactId> <artifactId>hapi-fhir-jpaserver-test</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -19,7 +19,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@ -40,7 +40,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<id>custom-structs</id> <id>custom-structs</id>

View File

@ -12,7 +12,7 @@
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<name>HAPI-FHIR</name> <name>HAPI-FHIR</name>
<url>http://hl7api.sourceforge.net/hapi-fhir/</url> <url>http://hl7api.sourceforge.net/hapi-fhir/</url>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>

View File

@ -10,7 +10,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -37,14 +37,14 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<!-- This dependency is used for the "FHIR Tester" web app overlay --> <!-- This dependency is used for the "FHIR Tester" web app overlay -->
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId> <artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>0.7</version> <version>0.8-SNAPSHOT</version>
<type>war</type> <type>war</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>