Skip to content

Commit

Permalink
Fix test failure of ELKAnalyticsWithRespondMediatorTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
tharikaGitHub committed Aug 6, 2024
1 parent be75e47 commit bd0ccc1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,35 @@ public Map<String, String> getAllCommonOperationPolicies() throws ApiException {
return null;
}

/**
* Method to get all common operation policies passing limit, offset and query as parameters
*
* @param limit limit
* @param offset offset
* @param query query
* @return A map of policy name and policy UUID
* @throws ApiException - Throws if policy information cannot be retrieved.
*/
public Map<String, String> getAllCommonOperationPolicies(Integer limit, Integer offset, String query)
throws ApiException {

setActivityID();
if (limit == null) {
limit = 50;
}
if (offset == null) {
offset = 0;
}
ApiResponse<OperationPolicyDataListDTO> apiResponse = operationPoliciesApi.getAllCommonOperationPoliciesWithHttpInfo(
limit, offset, query);
Assert.assertEquals(apiResponse.getStatusCode(), HttpStatus.SC_OK,
"Unable to retrieve common policies " + apiResponse.getData());
if (apiResponse != null && apiResponse.getData().getCount() >= 0) {
return mapPolicyNameToId(apiResponse.getData());
}
return null;
}

public Map<String, String> getAllCommonOperationPolicies(int limit) throws ApiException {

setActivityID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void testELKAnalyticsWithRespondMediator() throws Exception {

// Add common operation policy with respond mediator
addNewOperationPolicy();
Map<String, String> updatedCommonPolicyMap = restAPIPublisher.getAllCommonOperationPolicies();
Map<String, String> updatedCommonPolicyMap = restAPIPublisher.getAllCommonOperationPolicies(60, 0, null);
Assert.assertNotNull(updatedCommonPolicyMap.get("respondMediatorPolicy"),
"Unable to find the newly added common policy");

Expand Down

0 comments on commit bd0ccc1

Please sign in to comment.