Skip to content

Commit

Permalink
AAE-28895 Fix Query application GraphQL not paging results properly (#…
Browse files Browse the repository at this point in the history
…1625)

* Update graphql-jpa-query dependency version to 1.2.11

* Add test coverage
  • Loading branch information
igdianov authored Nov 29, 2024
1 parent 5288ee8 commit 893701e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
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

0 comments on commit 893701e

Please sign in to comment.