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.pcc44;
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 org.hl7.fhir.dstu3.model.Bundle;
23 import org.hl7.fhir.dstu3.model.Observation;
24 import org.openehealth.ipf.commons.ihe.fhir.IpfFhirServlet;
25 import org.openehealth.ipf.platform.camel.ihe.fhir.test.FhirTestContainer;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29
30
31
32 abstract class AbstractTestPcc44 extends FhirTestContainer {
33
34 private static final Logger LOG = LoggerFactory.getLogger(AbstractTestPcc44.class);
35
36 public static void startServer(String contextDescriptor) {
37 IpfFhirServlet servlet = new IpfFhirServlet(FhirVersionEnum.DSTU3);
38 startServer(servlet, contextDescriptor, false, DEMO_APP_PORT, "FhirServlet");
39 startClient(String.format("http://localhost:%d/", DEMO_APP_PORT));
40 }
41
42 protected ICriterion<?> observationPatientReferenceParameter() {
43 return new ReferenceClientParam("patient").hasId("http://fhirserver.org/Patient/1");
44 }
45
46 protected Bundle sendManually(ICriterion<?> requestData) {
47 return client.search()
48 .forResource(Observation.class)
49 .where(requestData)
50 .returnBundle(Bundle.class)
51 .execute();
52 }
53
54 protected Bundle nextPage(Bundle bundle) {
55 return client.loadPage()
56 .next(bundle)
57 .execute();
58 }
59
60 protected Bundle previousPage(Bundle bundle) {
61 return client.loadPage()
62 .previous(bundle)
63 .execute();
64 }
65
66
67 }