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.iti66;
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.DocumentManifest;
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 AbstractTestIti66 extends FhirTestContainer {
32
33 public static void startServer(String contextDescriptor) {
34 IpfFhirServlet servlet = new IpfFhirServlet(FhirVersionEnum.DSTU3);
35 startServer(servlet, contextDescriptor, false, DEMO_APP_PORT, "FhirServlet");
36 startClient(String.format("http://localhost:%d/", DEMO_APP_PORT));
37 }
38
39 protected ICriterion<?> manifestPatientIdentifierParameter() {
40 return new TokenClientParam("patient.identifier").exactly()
41 .systemAndIdentifier("urn:oid:2.16.840.1.113883.3.37.4.1.1.2.1.1", "1");
42 }
43
44 protected ICriterion<?> manifestPatientReferenceParameter() {
45 return new ReferenceClientParam("patient").hasId("http://fhirserver.org/Patient/1");
46 }
47
48 protected Bundle sendManually(ICriterion<?> requestData) {
49 return client.search()
50 .forResource(DocumentManifest.class)
51 .where(requestData)
52 .returnBundle(Bundle.class)
53 .execute();
54 }
55
56 protected Bundle nextPage(Bundle bundle) {
57 return client.loadPage()
58 .next(bundle)
59 .execute();
60 }
61
62 protected Bundle previousPage(Bundle bundle) {
63 return client.loadPage()
64 .previous(bundle)
65 .execute();
66 }
67
68
69 }