Skip to content

Commit a38ec5f

Browse files
committed
rework example starters
1 parent a2e7cc5 commit a38ec5f

File tree

6 files changed

+59
-39
lines changed

6 files changed

+59
-39
lines changed

dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestSimpleFeasibilityFromMedicsViaMedic1ExampleStarter.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,25 @@
3939
import org.hl7.fhir.r4.model.Reference;
4040
import org.hl7.fhir.r4.model.ResearchStudy;
4141
import org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus;
42-
import org.hl7.fhir.r4.model.Resource;
4342
import org.hl7.fhir.r4.model.ResourceType;
4443
import org.hl7.fhir.r4.model.StringType;
4544
import org.hl7.fhir.r4.model.Task;
4645
import org.hl7.fhir.r4.model.Task.TaskIntent;
4746
import org.hl7.fhir.r4.model.Task.TaskStatus;
4847

49-
public class RequestSimpleFeasibilityFromMedicsViaMedic1ExampleStarter extends AbstractExampleStarter
48+
public class RequestSimpleFeasibilityFromMedicsViaMedic1ExampleStarter
5049
{
50+
// args[0] the path to the client-certificate
51+
// highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
52+
// args[1] the password of the client-certificate
53+
// password
5154
public static void main(String[] args) throws Exception
5255
{
53-
new RequestSimpleFeasibilityFromMedicsViaMedic1ExampleStarter().startAt(MEDIC_1_FHIR_BASE_URL);
56+
Bundle bundle = createStartResource();
57+
ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL).startWith(bundle);
5458
}
5559

56-
@Override
57-
protected Resource createStartResource()
60+
private static Bundle createStartResource()
5861
{
5962
Group group1 = createGroup("Group 1");
6063
Group group2 = createGroup("Group 2");
@@ -75,7 +78,7 @@ protected Resource createStartResource()
7578
return bundle;
7679
}
7780

78-
private Group createGroup(String name)
81+
private static Group createGroup(String name)
7982
{
8083
Group group = new Group();
8184
group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
@@ -93,7 +96,7 @@ private Group createGroup(String name)
9396
return group;
9497
}
9598

96-
private ResearchStudy createResearchStudy(Group group1, Group group2)
99+
private static ResearchStudy createResearchStudy(Group group1, Group group2)
97100
{
98101
ResearchStudy researchStudy = new ResearchStudy();
99102
researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
@@ -125,7 +128,7 @@ private ResearchStudy createResearchStudy(Group group1, Group group2)
125128
return researchStudy;
126129
}
127130

128-
private Task createTask(ResearchStudy researchStudy)
131+
private static Task createTask(ResearchStudy researchStudy)
129132
{
130133
Task task = new Task();
131134
task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));

dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,26 @@
2424
import org.highmed.dsf.bpe.variables.BloomFilterConfig;
2525
import org.hl7.fhir.r4.model.Base64BinaryType;
2626
import org.hl7.fhir.r4.model.BooleanType;
27-
import org.hl7.fhir.r4.model.Resource;
2827
import org.hl7.fhir.r4.model.ResourceType;
2928
import org.hl7.fhir.r4.model.StringType;
3029
import org.hl7.fhir.r4.model.Task;
3130

32-
public class LocalServicesMedic1ExampleStarter extends AbstractExampleStarter
31+
public class LocalServicesMedic1ExampleStarter
3332
{
3433
private static boolean NEEDS_CONSENT_CHECK = true;
3534
private static boolean NEEDS_RECORD_LINKAGE = true;
3635

36+
// args[0] the path to the client-certificate
37+
// highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
38+
// args[1] the password of the client-certificate
39+
// password
3740
public static void main(String[] args) throws Exception
3841
{
39-
new LocalServicesMedic1ExampleStarter().startAt(MEDIC_1_FHIR_BASE_URL);
42+
Task task = createStartResource();
43+
ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL).startWith(task);
4044
}
4145

42-
@Override
43-
protected Resource createStartResource()
46+
private static Task createStartResource()
4447
{
4548
Task task = new Task();
4649

dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,25 @@
1111

1212
import java.util.Date;
1313

14-
import org.hl7.fhir.r4.model.Resource;
1514
import org.hl7.fhir.r4.model.ResourceType;
1615
import org.hl7.fhir.r4.model.StringType;
1716
import org.hl7.fhir.r4.model.Task;
1817
import org.hl7.fhir.r4.model.Task.TaskIntent;
1918
import org.hl7.fhir.r4.model.Task.TaskStatus;
2019

21-
public class Ping3MedicFromTtpExampleStarter extends AbstractExampleStarter
20+
public class Ping3MedicFromTtpExampleStarter
2221
{
22+
// args[0] the path to the client-certificate
23+
// highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
24+
// args[1] the password of the client-certificate
25+
// password
2326
public static void main(String[] args) throws Exception
2427
{
25-
new Ping3MedicFromTtpExampleStarter().startAt(TTP_FHIR_BASE_URL);
28+
Task task = createStartResource();
29+
ExampleStarter.forServer(args, TTP_FHIR_BASE_URL).startWith(task);
2630
}
2731

28-
@Override
29-
protected Resource createStartResource()
32+
private static Task createStartResource()
3033
{
3134
Task task = new Task();
3235
task.getMeta().addProfile(START_PING_TASK_PROFILE);

dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,28 @@
2020
import org.hl7.fhir.r4.model.Bundle;
2121
import org.hl7.fhir.r4.model.IdType;
2222
import org.hl7.fhir.r4.model.Reference;
23-
import org.hl7.fhir.r4.model.Resource;
2423
import org.hl7.fhir.r4.model.ResourceType;
2524
import org.hl7.fhir.r4.model.StringType;
2625
import org.hl7.fhir.r4.model.Task;
2726
import org.hl7.fhir.r4.model.Task.TaskIntent;
2827
import org.hl7.fhir.r4.model.Task.TaskStatus;
2928

30-
public class DownloadAllowListFromTtpViaMedic1ExampleStarter extends AbstractExampleStarter
29+
public class DownloadAllowListFromTtpViaMedic1ExampleStarter
3130
{
31+
// args[0] the path to the client-certificate
32+
// highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
33+
// args[1] the password of the client-certificate
34+
// password
3235
public static void main(String[] args) throws Exception
3336
{
34-
new DownloadAllowListFromTtpViaMedic1ExampleStarter().startAt(MEDIC_1_FHIR_BASE_URL);
37+
ExampleStarter starter = ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL);
38+
Task task = createStartResource(starter);
39+
starter.startWith(task);
3540
}
3641

37-
@Override
38-
protected Resource createStartResource() throws Exception
42+
private static Task createStartResource(ExampleStarter starter) throws Exception
3943
{
40-
Bundle allowList = getAllowList();
44+
Bundle allowList = getAllowList(starter);
4145

4246
Task task = new Task();
4347
task.getMeta().addProfile(DOWNLOAD_ALLOW_LIST_TASK_PROFILE);
@@ -61,9 +65,9 @@ protected Resource createStartResource() throws Exception
6165
return task;
6266
}
6367

64-
private Bundle getAllowList() throws Exception
68+
private static Bundle getAllowList(ExampleStarter starter) throws Exception
6569
{
66-
FhirWebserviceClient client = createClient(TTP_FHIR_BASE_URL);
70+
FhirWebserviceClient client = starter.createClient(TTP_FHIR_BASE_URL);
6771
Bundle searchResult = client.searchWithStrictHandling(Bundle.class, Map.of("identifier",
6872
Collections.singletonList("http://highmed.org/fhir/CodeSystem/update-allow-list|highmed_allow_list")));
6973

dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,25 @@
1111

1212
import java.util.Date;
1313

14-
import org.hl7.fhir.r4.model.Resource;
1514
import org.hl7.fhir.r4.model.ResourceType;
1615
import org.hl7.fhir.r4.model.StringType;
1716
import org.hl7.fhir.r4.model.Task;
1817
import org.hl7.fhir.r4.model.Task.TaskIntent;
1918
import org.hl7.fhir.r4.model.Task.TaskStatus;
2019

21-
public class UpdateAllowList3MedicTtpExampleStarter extends AbstractExampleStarter
20+
public class UpdateAllowList3MedicTtpExampleStarter
2221
{
22+
// args[0] the path to the client-certificate
23+
// highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
24+
// args[1] the password of the client-certificate
25+
// password
2326
public static void main(String[] args) throws Exception
2427
{
25-
new UpdateAllowList3MedicTtpExampleStarter().startAt(TTP_FHIR_BASE_URL);
28+
Task task = createStartResource();
29+
ExampleStarter.forServer(args, TTP_FHIR_BASE_URL).startWith(task);
2630
}
2731

28-
@Override
29-
protected Resource createStartResource()
32+
private static Task createStartResource()
3033
{
3134
Task task = new Task();
3235
task.getMeta().addProfile(UPDATE_ALLOW_LIST_TASK_PROFILE);

dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,28 @@
2020
import org.hl7.fhir.r4.model.Bundle;
2121
import org.hl7.fhir.r4.model.IdType;
2222
import org.hl7.fhir.r4.model.Reference;
23-
import org.hl7.fhir.r4.model.Resource;
2423
import org.hl7.fhir.r4.model.ResourceType;
2524
import org.hl7.fhir.r4.model.StringType;
2625
import org.hl7.fhir.r4.model.Task;
2726
import org.hl7.fhir.r4.model.Task.TaskIntent;
2827
import org.hl7.fhir.r4.model.Task.TaskStatus;
2928

30-
public class UpdateResource3MedicTtpExampleStarter extends AbstractExampleStarter
29+
public class UpdateResource3MedicTtpExampleStarter
3130
{
31+
// args[0] the path to the client-certificate
32+
// highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
33+
// args[1] the password of the client-certificate
34+
// password
3235
public static void main(String[] args) throws Exception
3336
{
34-
new UpdateResource3MedicTtpExampleStarter().startAt(TTP_FHIR_BASE_URL);
37+
ExampleStarter starter = ExampleStarter.forServer(args, TTP_FHIR_BASE_URL);
38+
Task task = createStartResource(starter);
39+
starter.startWith(task);
3540
}
3641

37-
@Override
38-
protected Resource createStartResource() throws Exception
42+
private static Task createStartResource(ExampleStarter starter) throws Exception
3943
{
40-
Bundle allowList = getAllowList();
44+
Bundle allowList = getAllowList(starter);
4145

4246
Task task = new Task();
4347
task.getMeta().addProfile(REQUEST_UPDATE_RESOURCES_TASK_PROFILE);
@@ -66,9 +70,9 @@ protected Resource createStartResource() throws Exception
6670
return task;
6771
}
6872

69-
private Bundle getAllowList() throws Exception
73+
private static Bundle getAllowList(ExampleStarter starter) throws Exception
7074
{
71-
FhirWebserviceClient client = createClient(TTP_FHIR_BASE_URL);
75+
FhirWebserviceClient client = starter.createClient(TTP_FHIR_BASE_URL);
7276
Bundle searchResult = client.searchWithStrictHandling(Bundle.class, Map.of("identifier",
7377
Collections.singletonList("http://highmed.org/fhir/CodeSystem/update-allow-list|highmed_allow_list")));
7478

0 commit comments

Comments
 (0)