1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.openehealth.ipf.platform.camel.ihe.fhir.iti67;
18
19 import ca.uhn.fhir.context.FhirVersionEnum;
20 import ca.uhn.fhir.rest.gclient.ICriterion;
21 import ca.uhn.fhir.rest.gclient.ReferenceClientParam;
22 import ca.uhn.fhir.rest.gclient.TokenClientParam;
23 import org.hl7.fhir.dstu3.model.Bundle;
24 import org.hl7.fhir.dstu3.model.DocumentReference;
25 import org.openehealth.ipf.commons.ihe.fhir.IpfFhirServlet;
26 import org.openehealth.ipf.platform.camel.ihe.fhir.test.FhirTestContainer;
27
28
29
30
31 abstract class AbstractTestIti67 extends FhirTestContainer {
32
33
34 public static void startServer(String contextDescriptor) {
35 IpfFhirServlet servlet = new IpfFhirServlet(FhirVersionEnum.DSTU3);
36 startServer(servlet, contextDescriptor, false, DEMO_APP_PORT, "FhirServlet");
37 startClient(String.format("http://localhost:%d/", DEMO_APP_PORT));
38 }
39
40 protected ICriterion<?> referencePatientIdentifierParameter() {
41 return new TokenClientParam("patient.identifier").exactly()
42 .systemAndIdentifier("urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1", "1");
43 }
44
45 protected ICriterion<?> referencePatientReferenceParameter() {
46 return new ReferenceClientParam("patient").hasId("http://fhirserver.org/Patient/1");
47 }
48
49 protected Bundle sendManually(ICriterion<?> requestData) {
50 return client.search()
51 .forResource(DocumentReference.class)
52 .where(requestData)
53 .returnBundle(Bundle.class)
54 .execute();
55 }
56
57 protected Bundle nextPage(Bundle bundle) {
58 return client.loadPage()
59 .next(bundle)
60 .execute();
61 }
62
63 protected Bundle previousPage(Bundle bundle) {
64 return client.loadPage()
65 .previous(bundle)
66 .execute();
67 }
68
69
70 }