Skip to content

Commit

Permalink
Merge pull request #21893 from madurangasiriwardena/stackoverflow
Browse files Browse the repository at this point in the history
Fix stackoverflow error
  • Loading branch information
Thisara-Welmilla authored Dec 4, 2024
2 parents d81e83d + aa5654e commit 67d62e8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -540,32 +540,6 @@ public void testGetPaginatedOrganizationsDiscoveryWithInvalidLimitAndOffset(Stri
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, ERROR_CODE_BAD_REQUEST);
}

/*
* TODO: After the issue https://github.com/wso2/product-is/issues/21025 is fixed,
* remove the method testGetPaginatedOrganizationsDiscoveryWithInvalidOffsetAndLimitZero
* along with its data provider organizationDiscoveryInvalidOffsetAtLimitAndLimitZeroDataProvider.
*/
@DataProvider(name = "organizationDiscoveryInvalidOffsetAtLimitAndLimitZeroDataProvider")
public Object[][] organizationDiscoveryInvalidOffsetAtLimitAndLimitZeroDataProvider() {

return new Object[][]{
{"20", "0"},
{"25", "0"}
};
}

@Test(dependsOnMethods = "testGetPaginatedOrganizationsDiscoveryWithInvalidLimitAndOffset",
dataProvider = "organizationDiscoveryInvalidOffsetAtLimitAndLimitZeroDataProvider")
public void testGetPaginatedOrganizationsDiscoveryWithInvalidOffsetAndLimitZero(String offset,
String limit) {

String url = ORGANIZATION_MANAGEMENT_API_BASE_PATH + ORGANIZATION_DISCOVERY_API_PATH + QUESTION_MARK +
OFFSET_QUERY_PARAM + EQUAL + offset + AMPERSAND + LIMIT_QUERY_PARAM + EQUAL + limit;

Response response = getResponseOfGetWithOAuth2(url, m2mToken);
validateErrorResponse(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, ERROR_CODE_SERVER_ERROR);
}

@Test(dependsOnMethods = "testGetPaginatedOrganizationsDiscoveryWithInvalidLimitAndOffset")
public void testGetPaginatedMetaAttributesWithInvalidLimit() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,32 @@ public void testGetPaginatedOrganizations(int limit) {
validateOrganizationsOnPage(previousPageResponse, 1, NUM_OF_ORGANIZATIONS_FOR_PAGINATION_TESTS, limit);
}

@DataProvider(name = "organizationDiscoveryInvalidOffsetAtLimitAndLimitZeroDataProvider")
public Object[][] organizationDiscoveryInvalidOffsetAtLimitAndLimitZeroDataProvider() {

return new Object[][]{
{"20", "0"},
{"25", "0"}
};
}

@Test(groups = "organizationPaginationTests",
dependsOnMethods = "createOrganizationsForPaginationTests",
dataProvider = "organizationDiscoveryInvalidOffsetAtLimitAndLimitZeroDataProvider")
public void testGetPaginatedOrganizationsDiscoveryWithInvalidOffsetAndLimitZero(String offset,
String limit) {

String url = ORGANIZATION_MANAGEMENT_API_BASE_PATH + ORGANIZATION_DISCOVERY_API_PATH + QUESTION_MARK +
OFFSET_QUERY_PARAM + EQUAL + offset + AMPERSAND + LIMIT_QUERY_PARAM + EQUAL + limit;

Response response = getResponseOfGetWithOAuth2(url, m2mToken);
validateHttpStatusCode(response, HttpStatus.SC_OK);
List<Map<String, String>> returnedOrganizations = response.jsonPath().getList(ORGANIZATIONS_PATH_PARAM);
Assert.assertNull(returnedOrganizations);
int totalResults = response.jsonPath().getInt("totalResults");
Assert.assertEquals(totalResults, 0, "Total results should be 0 when the limit is 0.");
}

@DataProvider(name = "organizationPaginationNumericEdgeCasesOfLimitDataProvider")
public Object[][] organizationPaginationNumericEdgeCasesOfLimitDataProvider() {

Expand All @@ -806,7 +832,8 @@ public Object[][] organizationPaginationNumericEdgeCasesOfLimitDataProvider() {
};
}

@Test(groups = "organizationPaginationTests", dependsOnMethods = "createOrganizationsForPaginationTests",
@Test(groups = "organizationPaginationTests",
dependsOnMethods = "testGetPaginatedOrganizationsDiscoveryWithInvalidOffsetAndLimitZero",
dataProvider = "organizationPaginationNumericEdgeCasesOfLimitDataProvider")
public void testGetPaginatedOrganizationsForNumericEdgeCasesOfLimit(int limit) {

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@

<!-- Identity REST API feature -->
<identity.api.dispatcher.version>2.0.17</identity.api.dispatcher.version>
<identity.server.api.version>1.3.2</identity.server.api.version>
<identity.server.api.version>1.3.4</identity.server.api.version>
<identity.user.api.version>1.3.45</identity.user.api.version>

<identity.agent.sso.version>5.5.9</identity.agent.sso.version>
Expand Down

0 comments on commit 67d62e8

Please sign in to comment.