apache / incubator-kie-kogito-runtimes

Kogito Runtimes - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
Apache License 2.0
543 stars 210 forks source link

process-svg-quarkus-addon does not send proper json #1139

Closed mingfang closed 3 years ago

mingfang commented 3 years ago

https://github.com/kiegroup/kogito-runtimes/blob/741a14640fa11f2ee1d21104ab3e47df8bec4831/addons/process-svg/process-svg-quarkus-addon/src/main/java/org/kie/kogito/svg/dataindex/QuarkusDataIndexClient.java#L82

here is the fix

    public List<NodeInstance> getNodeInstancesFromProcessInstance(String processInstanceId) {
        String query = getNodeInstancesQuery(processInstanceId);
        CompletableFuture<List<NodeInstance>> cf = new CompletableFuture<>();
        HttpRequest<Buffer> request = client.post("/graphql").putHeader("Authorization", getToken());
        request.sendJsonObject(JsonObject.mapFrom(singletonMap("query", query)), result -> {
            if (result.succeeded() && result.result().statusCode() == 200) {
                cf.complete(getNodeInstancesFromResponse(result.result().bodyAsJsonObject()));
            } else {
                cf.completeExceptionally(result.cause());
            }
        });
        try {
            return cf.get();
        } catch (Exception e) {
            throw new ProcessSVGException("Exception while trying to get data from Data Index service", e);
        }
    }
mingfang commented 3 years ago

It turns out sendJson() and sendJsonObject() do exactly the same thing.