4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 16
16
import static io .gatling .javaapi .core .CoreDsl .StringBody ;
17
17
import static io .gatling .javaapi .core .CoreDsl .bodyString ;
18
18
import static io .gatling .javaapi .core .CoreDsl .jsonPath ;
19
+ import static io .gatling .javaapi .http .HttpDsl .RawFileBodyPart ;
20
+ import static io .gatling .javaapi .http .HttpDsl .StringBodyPart ;
19
21
import static io .gatling .javaapi .http .HttpDsl .http ;
20
22
import static org .openmrs .performance .Constants .ALLERGY_REACTION_UUID ;
21
23
import static org .openmrs .performance .Constants .ARTERIAL_BLOOD_OXYGEN_SATURATION ;
@@ -230,6 +232,19 @@ public HttpRequestActionBuilder getAllowedFileExtensions() {
230
232
.get ("/openmrs/ws/rest/v1/systemsetting?&v=custom:(value)&q=attachments.allowedFileExtensions" );
231
233
}
232
234
235
+ public HttpRequestActionBuilder uploadAttachment (String patientUuid ) {
236
+ return http ("Upload Attachment Request" )
237
+ .post ("/openmrs/ws/rest/v1/attachment" )
238
+ .bodyPart (StringBodyPart ("fileCaption" , "Test Image" ))
239
+ .bodyPart (StringBodyPart ("patient" , patientUuid ))
240
+ .bodyPart (
241
+ RawFileBodyPart ("file" , "Sample_1MB_image.jpg" )
242
+ .contentType ("image/jpg" )
243
+ .fileName ("Sample_1MB_image.jpg" )
244
+ )
245
+ .asMultipartForm ();
246
+ }
247
+
233
248
public HttpRequestActionBuilder getLabResults (String patientUuid ) {
234
249
return http ("Get Lab Results of Patient" )
235
250
.get ("/openmrs/ws/fhir2/R4/Observation?category=laboratory&patient=" + patientUuid + "&_count=100&_summary=data" )
Original file line number Diff line number Diff line change @@ -135,6 +135,11 @@ public ChainBuilder openAttachmentsTab(String patientUuid) {
135
135
.exec (httpService .getAllowedFileExtensions ());
136
136
}
137
137
138
+ public ChainBuilder addAttachment (String patientUuid ){
139
+ return exec (httpService .uploadAttachment (patientUuid ))
140
+ .exec (httpService .getAttachments (patientUuid ));
141
+ }
142
+
138
143
public ChainBuilder openVisitsTab (String patientUuid ) {
139
144
return exec (httpService .getVisitsOfPatient (patientUuid ));
140
145
}
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ public ScenarioBuilder getScenarioBuilder() {
50
50
.pause (5 )
51
51
.exec (registry .openAttachmentsTab ("#{patient_uuid}" ))
52
52
.pause (5 )
53
+ .exec (registry .addAttachment ("#{patient_uuid}" ))
54
+ .pause (5 )
53
55
.exec (registry .addDrugOrder ("#{patient_uuid}" , "#{visitUuid}" , "#{currentUserUuid}" ))
54
56
.pause (5 )
55
57
.exec (registry .addVisitNote ("#{patient_uuid}" , "#{currentUserUuid}" ))
0 commit comments