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.iti78;
18
19 import ca.uhn.fhir.context.FhirVersionEnum;
20 import ca.uhn.fhir.rest.gclient.ICriterion;
21 import org.hl7.fhir.dstu3.model.Bundle;
22 import org.openehealth.ipf.commons.ihe.fhir.IpfFhirServlet;
23 import org.openehealth.ipf.commons.ihe.fhir.iti78.PdqPatient;
24 import org.openehealth.ipf.platform.camel.ihe.fhir.test.FhirTestContainer;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28
29
30
31 abstract class AbstractTestIti78 extends FhirTestContainer {
32
33 private static final Logger LOG = LoggerFactory.getLogger(AbstractTestIti78.class);
34
35 public static void startServer(String contextDescriptor, boolean secure) {
36 IpfFhirServlet servlet = new IpfFhirServlet(FhirVersionEnum.DSTU3);
37 startServer(servlet, contextDescriptor, secure, FhirTestContainer.DEMO_APP_PORT, "FhirServlet");
38
39 }
40
41 public static void startClient() {
42 startClient(String.format("http://localhost:%d/", FhirTestContainer.DEMO_APP_PORT));
43 }
44
45 protected ICriterion<?> familyParameters() {
46 return PdqPatient.FAMILY.matches().value("Test");
47 }
48
49 protected Bundle sendManually(ICriterion<?> requestData) {
50 return client.search()
51 .forResource(PdqPatient.class)
52 .where(requestData)
53 .returnBundle(Bundle.class)
54 .execute();
55 }
56
57 protected Bundle sendManuallyWithCount(ICriterion<?> requestData, int count) {
58 return client.search()
59 .forResource(PdqPatient.class)
60 .where(requestData)
61 .count(count)
62 .returnBundle(Bundle.class)
63 .execute();
64 }
65
66 protected Bundle nextPage(Bundle bundle) {
67 return client.loadPage()
68 .next(bundle)
69 .execute();
70 }
71
72 protected Bundle previousPage(Bundle bundle) {
73 return client.loadPage()
74 .previous(bundle)
75 .execute();
76 }
77
78
79 }