Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Logout user scenario #67

Closed
wants to merge 1 commit into from
Closed
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
Added Logout user scenario
  • Loading branch information
Lemeri123 committed Feb 25, 2025
commit f92df2141cc1f0f277b09e69c3a04c4ef6f9cfe0
3 changes: 3 additions & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=21.0.6-tem
10 changes: 9 additions & 1 deletion src/test/java/org/openmrs/performance/http/HttpService.java
Original file line number Diff line number Diff line change
@@ -115,4 +115,12 @@ public HttpRequestActionBuilder getActiveOrders(String patientUuid) {
return http("Get Active Orders")
.get("/openmrs/ws/rest/v1/order?patient="+patientUuid+"&careSetting=6f0c9a92-6f24-11e3-af88-005056821db0&status=ACTIVE&orderType=131168f4-15f5-102d-96e4-000c29c2a5d7&v=custom:(uuid,dosingType,orderNumber,accessionNumber,patient:ref,action,careSetting:ref,previousOrder:ref,dateActivated,scheduledDate,dateStopped,autoExpireDate,orderType:ref,encounter:ref,orderer:(uuid,display,person:(display)),orderReason,orderReasonNonCoded,orderType,urgency,instructions,commentToFulfiller,drug:(uuid,display,strength,dosageForm:(display,uuid),concept),dose,doseUnits:ref,frequency:ref,asNeeded,asNeededCondition,quantity,quantityUnits:ref,numRefills,dosingInstructions,duration,durationUnits:ref,route:ref,brandName,dispenseAsWritten)");
}
}
// Add the logoutRequest method
public HttpRequestActionBuilder logoutRequest() {
return http("Logout")
.post("/openmrs/ws/rest/v1/session")
.header("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
.body(StringBody("{\"action\":\"logout\"}"))
.check(jsonPath("$.authenticated").is("false"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.openmrs.performance.scenarios;

import io.gatling.javaapi.core.ScenarioBuilder;
import org.openmrs.performance.registries.Registry;
import org.openmrs.performance.http.HttpService;

import static io.gatling.javaapi.core.CoreDsl.*;

public class UserLogoutScenario extends Scenario<Registry<HttpService>> {

public UserLogoutScenario(float scenarioLoadShare, Registry<HttpService> registry) {
super(scenarioLoadShare, registry);
}

@Override
public ScenarioBuilder getScenarioBuilder() {
return scenario("User Logout Scenario")
.exec(registry.httpService.logoutRequest())
.pause(1);
}
}