Skip to content

Commit a4028d1

Browse files
committed
use contstant in all test starters
1 parent a479914 commit a4028d1

File tree

20 files changed

+277
-131
lines changed

20 files changed

+277
-131
lines changed

dsf-bpe-process-feasibility/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
<artifactId>dsf-fhir-validation</artifactId>
2929
<scope>test</scope>
3030
</dependency>
31+
<dependency>
32+
<groupId>org.highmed.dsf</groupId>
33+
<artifactId>dsf-bpe-process-base</artifactId>
34+
<scope>test</scope>
35+
<type>test-jar</type>
36+
</dependency>
3137
</dependencies>
3238

3339
<build>

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private String getSecurityIdentifier(DelegateExecution execution)
9999
{
100100
Task task = getCurrentTaskFromExecutionVariables();
101101

102-
if (task.getInstantiatesUri().startsWith(ConstantsFeasibility.LOCAL_SERVICES_INTEGRATION_PROCESS_URI))
102+
if (task.getInstantiatesUri().startsWith(ConstantsFeasibility.LOCAL_SERVICES_PROCESS_URI))
103103
return task.getRequester().getIdentifier().getValue();
104104
else
105105
return (String) execution.getVariable(ConstantsBase.VARIABLE_TTP_IDENTIFIER);

dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/ConstantsFeasibility.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,16 @@ public interface ConstantsFeasibility
3636
String EXTENSION_PARTICIPATING_TTP_URI = "http://highmed.org/fhir/StructureDefinition/participating-ttp";
3737
String EXTENSION_GROUP_ID_URI = "http://highmed.org/fhir/StructureDefinition/group-id";
3838

39-
String LOCAL_SERVICES_INTEGRATION_PROCESS_URI = "http://highmed.org/bpe/Process/localServicesIntegration";
39+
String FEASIBILITY_RESEARCH_STUDY_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-research-study-feasibility";
40+
String GROUP_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-group";
41+
String RESEARCH_STUDY_IDENTIFIER_SYSTEM = "http://highmed.org/fhir/NamingSystem/research-study-identifier";
42+
43+
String REQUEST_FEASIBILITY_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-request-simple-feasibility";
44+
String LOCAL_SERVICES_PROCESS_URI = "http://highmed.org/bpe/Process/localServicesIntegration";
45+
String REQUEST_FEASIBILITY_PROCESS_URI = "http://highmed.org/bpe/Process/requestSimpleFeasibility";
46+
String REQUEST_FEASIBILITY_PROCESS_LATEST_VERSION = "0.4.0";
47+
String REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION =
48+
REQUEST_FEASIBILITY_PROCESS_URI + "/" + REQUEST_FEASIBILITY_PROCESS_LATEST_VERSION;
49+
50+
String REQUEST_FEASIBILITY_MESSAGE_NAME = "requestSimpleFeasibilityMessage";
4051
}

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

Lines changed: 69 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
package org.highmed.dsf.bpe.start;
22

3+
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
4+
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
5+
import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_QUERY_URI;
6+
import static org.highmed.dsf.bpe.ConstantsBase.ORGANIZATION_IDENTIFIER_SYSTEM;
7+
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.CERTIFICATE_PASSWORD;
8+
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.CERTIFICATE_PATH;
9+
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL;
10+
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1;
11+
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2;
12+
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3;
13+
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.ORGANIZATION_IDENTIFIER_VALUE_TTP;
14+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY;
15+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK;
16+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE;
17+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE;
18+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.EXTENSION_PARTICIPATING_MEDIC_URI;
19+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.EXTENSION_PARTICIPATING_TTP_URI;
20+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.FEASIBILITY_RESEARCH_STUDY_PROFILE;
21+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.GROUP_PROFILE;
22+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.REQUEST_FEASIBILITY_MESSAGE_NAME;
23+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION;
24+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.REQUEST_FEASIBILITY_TASK_PROFILE;
25+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.RESEARCH_STUDY_IDENTIFIER_SYSTEM;
26+
327
import java.io.IOException;
428
import java.nio.file.Paths;
529
import java.security.KeyStore;
@@ -31,6 +55,7 @@
3155
import org.hl7.fhir.r4.model.Reference;
3256
import org.hl7.fhir.r4.model.ResearchStudy;
3357
import org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus;
58+
import org.hl7.fhir.r4.model.ResourceType;
3459
import org.hl7.fhir.r4.model.StringType;
3560
import org.hl7.fhir.r4.model.Task;
3661
import org.hl7.fhir.r4.model.Task.TaskIntent;
@@ -46,16 +71,13 @@ public class RequestSimpleFeasibilityFromMedicsViaMedic1ExampleStarter
4671
public static void main(String[] args)
4772
throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException
4873
{
49-
char[] keyStorePassword = "password".toCharArray();
50-
KeyStore keyStore = CertificateReader.fromPkcs12(Paths.get(
51-
"../../dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12"),
52-
keyStorePassword);
74+
KeyStore keyStore = CertificateReader.fromPkcs12(Paths.get(CERTIFICATE_PATH), CERTIFICATE_PASSWORD);
5375
KeyStore trustStore = CertificateHelper.extractTrust(keyStore);
5476

5577
FhirContext context = FhirContext.forR4();
5678
ReferenceCleaner referenceCleaner = new ReferenceCleanerImpl(new ReferenceExtractorImpl());
57-
FhirWebserviceClient client = new FhirWebserviceClientJersey("https://medic1/fhir/", trustStore, keyStore,
58-
keyStorePassword, null, null, null, 0, 0, null, context, referenceCleaner);
79+
FhirWebserviceClient client = new FhirWebserviceClientJersey(MEDIC_1_FHIR_BASE_URL, trustStore, keyStore,
80+
CERTIFICATE_PASSWORD, null, null, null, 0, 0, null, context, referenceCleaner);
5981

6082
try
6183
{
@@ -67,13 +89,13 @@ public static void main(String[] args)
6789
Bundle bundle = new Bundle();
6890
bundle.setType(BundleType.TRANSACTION);
6991
bundle.addEntry().setResource(group1).setFullUrl(group1.getIdElement().getIdPart()).getRequest()
70-
.setMethod(HTTPVerb.POST).setUrl("Group");
92+
.setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name());
7193
bundle.addEntry().setResource(group2).setFullUrl(group2.getIdElement().getIdPart()).getRequest()
72-
.setMethod(HTTPVerb.POST).setUrl("Group");
94+
.setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name());
7395
bundle.addEntry().setResource(researchStudy).setFullUrl(researchStudy.getIdElement().getIdPart())
74-
.getRequest().setMethod(HTTPVerb.POST).setUrl("ResearchStudy");
96+
.getRequest().setMethod(HTTPVerb.POST).setUrl(ResourceType.ResearchStudy.name());
7597
bundle.addEntry().setResource(task).setFullUrl(task.getIdElement().getIdPart()).getRequest()
76-
.setMethod(HTTPVerb.POST).setUrl("Task");
98+
.setMethod(HTTPVerb.POST).setUrl(ResourceType.Task.name());
7799

78100
client.withMinimalReturn().postBundle(bundle);
79101
}
@@ -95,13 +117,13 @@ private static Group createGroup(String name)
95117
Group group = new Group();
96118
group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
97119

98-
group.getMeta().addProfile("http://highmed.org/fhir/StructureDefinition/highmed-group");
120+
group.getMeta().addProfile(GROUP_PROFILE);
99121
group.getText().getDiv().addText("This is the description");
100122
group.getText().setStatus(Narrative.NarrativeStatus.ADDITIONAL);
101123
group.setType(GroupType.PERSON);
102124
group.setActual(false);
103125
group.setActive(true);
104-
group.addExtension().setUrl("http://highmed.org/fhir/StructureDefinition/query").setValue(
126+
group.addExtension().setUrl(EXTENSION_QUERY_URI).setValue(
105127
new Expression().setLanguageElement(ConstantsBase.AQL_QUERY_TYPE)
106128
.setExpression("SELECT COUNT(e) FROM EHR e"));
107129
group.setName(name);
@@ -114,30 +136,29 @@ private static ResearchStudy createResearchStudy(Group group1, Group group2)
114136
ResearchStudy researchStudy = new ResearchStudy();
115137
researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
116138

117-
researchStudy.getMeta()
118-
.addProfile("http://highmed.org/fhir/StructureDefinition/highmed-research-study-feasibility");
119-
researchStudy.addIdentifier().setSystem("http://highmed.org/fhir/NamingSystem/research-study-identifier")
139+
researchStudy.getMeta().addProfile(FEASIBILITY_RESEARCH_STUDY_PROFILE);
140+
researchStudy.addIdentifier().setSystem(RESEARCH_STUDY_IDENTIFIER_SYSTEM)
120141
.setValue(UUID.randomUUID().toString());
121142
researchStudy.setStatus(ResearchStudyStatus.ACTIVE);
122143
researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart());
123144
researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart());
124145

125-
researchStudy.addExtension().setUrl("http://highmed.org/fhir/StructureDefinition/participating-medic").setValue(
126-
new Reference().setType("Organization").setIdentifier(
127-
new Identifier().setSystem("http://highmed.org/fhir/NamingSystem/organization-identifier")
128-
.setValue("Test_MeDIC_1")));
129-
researchStudy.addExtension().setUrl("http://highmed.org/fhir/StructureDefinition/participating-medic").setValue(
130-
new Reference().setType("Organization").setIdentifier(
131-
new Identifier().setSystem("http://highmed.org/fhir/NamingSystem/organization-identifier")
132-
.setValue("Test_MeDIC_2")));
133-
researchStudy.addExtension().setUrl("http://highmed.org/fhir/StructureDefinition/participating-medic").setValue(
134-
new Reference().setType("Organization").setIdentifier(
135-
new Identifier().setSystem("http://highmed.org/fhir/NamingSystem/organization-identifier")
136-
.setValue("Test_MeDIC_3")));
137-
researchStudy.addExtension().setUrl("http://highmed.org/fhir/StructureDefinition/participating-ttp").setValue(
138-
new Reference().setType("Organization").setIdentifier(
139-
new Identifier().setSystem("http://highmed.org/fhir/NamingSystem/organization-identifier")
140-
.setValue("Test_TTP")));
146+
researchStudy.addExtension().setUrl(EXTENSION_PARTICIPATING_MEDIC_URI).setValue(
147+
new Reference().setType(ResourceType.Organization.name()).setIdentifier(
148+
new Identifier().setSystem(ORGANIZATION_IDENTIFIER_SYSTEM)
149+
.setValue(ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1)));
150+
researchStudy.addExtension().setUrl(EXTENSION_PARTICIPATING_MEDIC_URI).setValue(
151+
new Reference().setType(ResourceType.Organization.name()).setIdentifier(
152+
new Identifier().setSystem(ORGANIZATION_IDENTIFIER_SYSTEM)
153+
.setValue(ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2)));
154+
researchStudy.addExtension().setUrl(EXTENSION_PARTICIPATING_MEDIC_URI).setValue(
155+
new Reference().setType(ResourceType.Organization.name()).setIdentifier(
156+
new Identifier().setSystem(ORGANIZATION_IDENTIFIER_SYSTEM)
157+
.setValue(ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3)));
158+
researchStudy.addExtension().setUrl(EXTENSION_PARTICIPATING_TTP_URI).setValue(
159+
new Reference().setType(ResourceType.Organization.name()).setIdentifier(
160+
new Identifier().setSystem(ORGANIZATION_IDENTIFIER_SYSTEM)
161+
.setValue(ORGANIZATION_IDENTIFIER_VALUE_TTP)));
141162

142163
return researchStudy;
143164
}
@@ -147,27 +168,26 @@ private static Task createTask(ResearchStudy researchStudy)
147168
Task task = new Task();
148169
task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
149170

150-
task.getMeta()
151-
.addProfile("http://highmed.org/fhir/StructureDefinition/highmed-task-request-simple-feasibility");
152-
task.setInstantiatesUri("http://highmed.org/bpe/Process/requestSimpleFeasibility/0.4.0");
171+
task.getMeta().addProfile(REQUEST_FEASIBILITY_TASK_PROFILE);
172+
task.setInstantiatesUri(REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION);
153173
task.setStatus(TaskStatus.REQUESTED);
154174
task.setIntent(TaskIntent.ORDER);
155175
task.setAuthoredOn(new Date());
156-
task.getRequester().setType("Organization").getIdentifier()
157-
.setSystem("http://highmed.org/fhir/NamingSystem/organization-identifier").setValue("Test_MeDIC_1");
158-
task.getRestriction().addRecipient().setType("Organization").getIdentifier()
159-
.setSystem("http://highmed.org/fhir/NamingSystem/organization-identifier").setValue("Test_MeDIC_1");
160-
161-
task.addInput().setValue(new StringType("requestSimpleFeasibilityMessage")).getType().addCoding()
162-
.setSystem("http://highmed.org/fhir/CodeSystem/bpmn-message").setCode("message-name");
163-
task.addInput().setValue(
164-
new Reference().setReference(researchStudy.getIdElement().getIdPart()).setType("ResearchStudy"))
165-
.getType().addCoding().setSystem("http://highmed.org/fhir/CodeSystem/feasibility")
166-
.setCode("research-study-reference");
167-
task.addInput().setValue(new BooleanType(true)).getType().addCoding()
168-
.setSystem("http://highmed.org/fhir/CodeSystem/feasibility").setCode("needs-record-linkage");
169-
task.addInput().setValue(new BooleanType(true)).getType().addCoding()
170-
.setSystem("http://highmed.org/fhir/CodeSystem/feasibility").setCode("needs-consent-check");
176+
task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
177+
.setSystem(ORGANIZATION_IDENTIFIER_SYSTEM).setValue(ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
178+
task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
179+
.setSystem(ORGANIZATION_IDENTIFIER_SYSTEM).setValue(ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
180+
181+
task.addInput().setValue(new StringType(REQUEST_FEASIBILITY_MESSAGE_NAME)).getType().addCoding()
182+
.setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
183+
task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart())
184+
.setType(ResourceType.ResearchStudy.name())).getType().addCoding()
185+
.setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
186+
.setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE);
187+
task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
188+
.setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE);
189+
task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
190+
.setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK);
171191

172192
return task;
173193
}

dsf-bpe-process-local-services/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
<artifactId>dsf-fhir-validation</artifactId>
3535
<scope>test</scope>
3636
</dependency>
37+
<dependency>
38+
<groupId>org.highmed.dsf</groupId>
39+
<artifactId>dsf-bpe-process-base</artifactId>
40+
<scope>test</scope>
41+
<type>test-jar</type>
42+
</dependency>
3743
</dependencies>
3844

3945
<build>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.highmed.dsf.bpe.variables;
2+
3+
import static org.highmed.dsf.bpe.variables.ConstantsFeasibility.LOCAL_SERVICES_PROCESS_URI;
4+
5+
public interface ConstantsLocalServices
6+
{
7+
String LOCAL_SERVICES_TASK_PROFILE = "http://highmed.org/fhir/StructureDefinition/highmed-task-local-services-integration";
8+
String LOCAL_SERVICES_PROCESS_LATEST_VERSION = "0.4.0";
9+
String LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION =
10+
LOCAL_SERVICES_PROCESS_URI + "/" + LOCAL_SERVICES_PROCESS_LATEST_VERSION;
11+
12+
String LOCAL_SERVICES_MESSAGE_NAME = "localServicesIntegrationMessage";
13+
}

0 commit comments

Comments
 (0)