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

KOGITO-9721 - Use JSON scalar for process instance variables in Data … #1830

Merged
merged 1 commit into from
Aug 28, 2023
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 @@ -339,19 +339,19 @@ public void testProcessGatewayAPI() throws IOException {
testProcessGatewayAPIComments(taskId, pId2);
testProcessGatewayAPIAttachments(taskId, pId2);

String vars = given().spec(dataIndexSpec()).contentType(ContentType.JSON)
Map<String, Object> vars = given().spec(dataIndexSpec()).contentType(ContentType.JSON)
.body("{ \"query\" : \"{ ProcessInstances (where: { id: {equal: \\\"" + pId2 + "\\\"}}) { variables} }\"}")
.when().post("/graphql")
.then()
.statusCode(200).extract().path("data.ProcessInstances[0].variables");

if (vars != null) {
((Map<String, String>) vars.get("traveller")).put("firstName", "Anakin");
await()
.atMost(TIMEOUT)
.untilAsserted(() -> given().spec(dataIndexSpec()).contentType(ContentType.JSON)
.body("{ \"query\" : \"mutation{ ProcessInstanceUpdateVariables(id:\\\"" + pId2 + "\\\", variables:\\\"" +
vars.replace("Darth", "Anakin")
.replace("\"", "\\\\\\\"")
mapper.writeValueAsString(vars).replace("\"", "\\\\\\\"")
+ "\\\")}\"}")
.when().post("/graphql")
.then()
Expand All @@ -364,7 +364,7 @@ public void testProcessGatewayAPI() throws IOException {
.when().post("/graphql")
.then()
.statusCode(200)
.body("data.ProcessInstances[0].variables", containsString("Anakin")));
.body("data.ProcessInstances[0].variables.traveller.firstName", containsString("Anakin")));
}
given().spec(dataIndexSpec()).contentType(ContentType.JSON)
.body("{ \"query\" : \"mutation{ NodeInstanceTrigger(id:\\\"" + pId2 + "\\\", nodeId:\\\"_8B62D3CA-5D03-4B2B-832B-126469288BB4\\\")}\"}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
scalar DateTime
scalar BigDecimal
scalar Long
scalar JSON

schema {
query: Query
Expand All @@ -25,7 +26,7 @@ type ProcessInstance {
serviceUrl: String
nodes: [NodeInstance!]!
milestones: [Milestone!]
variables: String
variables: JSON
start: DateTime!
end: DateTime
parentProcessInstance: ProcessInstance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public GraphQLSchema createSchema() {
.scalar(getDateTimeScalarType())
.scalar(ExtendedScalars.GraphQLBigDecimal)
.scalar(ExtendedScalars.GraphQLLong)
.scalar(ExtendedScalars.Json)
.build();

SchemaGenerator schemaGenerator = new SchemaGenerator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public GraphQLSchema createSchema() {
.scalar(getDateTimeScalarType())
.scalar(ExtendedScalars.GraphQLBigDecimal)
.scalar(ExtendedScalars.GraphQLLong)
.scalar(ExtendedScalars.Json)
.build();

SchemaGenerator schemaGenerator = new SchemaGenerator();
Expand Down
Loading