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

AAE-28895 Fix Query application GraphQL not paging results properly #1625

Merged
merged 2 commits into from
Nov 29, 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
2 changes: 1 addition & 1 deletion activiti-cloud-notifications-graphql-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<name>Activiti Cloud Notifications GraphQL Service :: Parent</name>
<packaging>pom</packaging>
<properties>
<graphql-jpa-query.version>1.2.10</graphql-jpa-query.version>
<graphql-jpa-query.version>1.2.11</graphql-jpa-query.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,46 @@ public void testGraphqlAggregateTasksQuery() {
assertThat(result.getData().toString()).isEqualTo(expected);
}

@Test
public void testGraphqlPagedQueryWithAliasedResults() {
GraphQLQueryRequest query = new GraphQLQueryRequest(
"""
query {
page1: Tasks(page: {start: 1, limit: 2}) {
select {
id
name
}
}
page2: Tasks(page: {start: 3, limit: 2}) {
select {
id
name
}
}
}
"""
);

ResponseEntity<GraphQLQueryResult> entity = rest.postForEntity(
GRAPHQL_URL,
new HttpEntity<>(query, authHeaders),
GraphQLQueryResult.class
);

assertThat(entity.getStatusCode()).describedAs(entity.toString()).isEqualTo(HttpStatus.OK);

GraphQLQueryResult result = entity.getBody();

assertThat(result).isNotNull();
assertThat(result.getErrors()).isNull();

var expected =
"{page1={select=[{id=1, name=task1}, {id=2, name=task2}]}, page2={select=[{id=5, name=task5}, {id=6, name=task6}]}}";

assertThat(result.getData().toString()).isEqualTo(expected);
}

public static StringObjectMapBuilder mapBuilder() {
return new StringObjectMapBuilder();
}
Expand Down
Loading