Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/test/java/org/openmrs/performance/http/DoctorHttpService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import static io.gatling.javaapi.core.CoreDsl.StringBody;
import static io.gatling.javaapi.core.CoreDsl.bodyString;
import static io.gatling.javaapi.core.CoreDsl.jsonPath;
import static io.gatling.javaapi.http.HttpDsl.RawFileBodyPart;
import static io.gatling.javaapi.http.HttpDsl.StringBodyPart;
import static io.gatling.javaapi.http.HttpDsl.http;
import static org.openmrs.performance.Constants.ALLERGY_REACTION_UUID;
import static org.openmrs.performance.Constants.ARTERIAL_BLOOD_OXYGEN_SATURATION;
Expand Down Expand Up @@ -230,6 +232,19 @@ public HttpRequestActionBuilder getAllowedFileExtensions() {
.get("/openmrs/ws/rest/v1/systemsetting?&v=custom:(value)&q=attachments.allowedFileExtensions");
}

public HttpRequestActionBuilder uploadAttachment(String patientUuid) {
return http("Upload Attachment Request")
.post("/openmrs/ws/rest/v1/attachment")
.bodyPart(StringBodyPart("fileCaption", "Test Image"))
.bodyPart(StringBodyPart("patient", patientUuid))
.bodyPart(
RawFileBodyPart("file", "Sample_1MB_image.jpg")
.contentType("image/jpg")
.fileName("Sample_1MB_image.jpg")
)
.asMultipartForm();
}

public HttpRequestActionBuilder getLabResults(String patientUuid) {
return http("Get Lab Results of Patient")
.get("/openmrs/ws/fhir2/R4/Observation?category=laboratory&patient=" + patientUuid + "&_count=100&_summary=data")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ public ChainBuilder openAttachmentsTab(String patientUuid) {
.exec(httpService.getAllowedFileExtensions());
}

public ChainBuilder addAttachment(String patientUuid){
return exec(httpService.uploadAttachment(patientUuid))
.exec(httpService.getAttachments(patientUuid));
}

public ChainBuilder openVisitsTab(String patientUuid) {
return exec(httpService.getVisitsOfPatient(patientUuid));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public ScenarioBuilder getScenarioBuilder() {
.pause(5)
.exec(registry.openAttachmentsTab("#{patient_uuid}"))
.pause(5)
.exec(registry.addAttachment("#{patient_uuid}"))
.pause(5)
.exec(registry.addDrugOrder("#{patient_uuid}", "#{visitUuid}", "#{currentUserUuid}"))
.pause(5)
.exec(registry.addVisitNote("#{patient_uuid}", "#{currentUserUuid}"))
Expand Down
Binary file added src/test/resources/Sample_1MB_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.