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

Fix stackoverflow error #21893

Merged
merged 2 commits into from
Dec 4, 2024
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
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