Skip to content

Commit 4a86cd6

Browse files
committed
Revert "Trying to avoid flaky test on PojoServiceIt"
This reverts commit 8a6a38a.
1 parent 8a6a38a commit 4a86cd6

File tree

2 files changed

+15
-23
lines changed
  • quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows

2 files changed

+15
-23
lines changed

quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/PojoServiceIT.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,22 +150,21 @@ void testTypesPojo() throws Exception {
150150
}
151151

152152
private void doIt(String flowName) throws Exception {
153+
Map<String, Object> body = new HashMap<>();
154+
body.put("name", "javierito");
155+
body.put("age", 666);
156+
given()
157+
.contentType(ContentType.JSON)
158+
.when()
159+
.body(Collections.singletonMap("workflowdata", body))
160+
.post("/" + flowName)
161+
.then()
162+
.statusCode(201)
163+
.body("id", notNullValue())
164+
.body("workflowdata.name", is("javieritoPerson"))
165+
.body("workflowdata.age", nullValue());
153166
JsonPath processInstanceEventContent = waitForKogitoProcessInstanceEvent(kafkaClient, ProcessInstanceVariableDataEvent.class,
154-
e -> flowName.equals(e.get("kogitoprocid")) && "workflowdata".equals(e.get("data.variableName")), true, () -> {
155-
Map<String, Object> body = new HashMap<>();
156-
body.put("name", "javierito");
157-
body.put("age", 666);
158-
given()
159-
.contentType(ContentType.JSON)
160-
.when()
161-
.body(Collections.singletonMap("workflowdata", body))
162-
.post("/" + flowName)
163-
.then()
164-
.statusCode(201)
165-
.body("id", notNullValue())
166-
.body("workflowdata.name", is("javieritoPerson"))
167-
.body("workflowdata.age", nullValue());
168-
});
167+
e -> flowName.equals(e.get("kogitoprocid")) && "workflowdata".equals(e.get("data.variableName")), true);
169168
Map workflowDataMap = processInstanceEventContent.getMap("data.variableValue");
170169
assertThat(workflowDataMap).hasSize(1);
171170
assertThat(workflowDataMap).containsEntry("name", "javieritoPerson");

quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/WorkflowTestUtils.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ public static JsonPath waitForKogitoProcessInstanceEvent(KafkaTestClient kafkaCl
4747

4848
public static <T extends DataEvent<?>> JsonPath waitForKogitoProcessInstanceEvent(KafkaTestClient kafkaClient, Class<T> eventType, Predicate<JsonPath> predicate, boolean shutdownAfterConsume)
4949
throws Exception {
50-
return waitForKogitoProcessInstanceEvent(kafkaClient, eventType, predicate, shutdownAfterConsume, () -> {
51-
});
52-
}
53-
54-
public static <T extends DataEvent<?>> JsonPath waitForKogitoProcessInstanceEvent(KafkaTestClient kafkaClient, Class<T> eventType, Predicate<JsonPath> predicate, boolean shutdownAfterConsume,
55-
Runnable runnable) throws InterruptedException {
5650
final CountDownLatch countDownLatch = new CountDownLatch(1);
5751
final AtomicReference<JsonPath> cloudEvent = new AtomicReference<>();
5852

@@ -67,13 +61,12 @@ public static <T extends DataEvent<?>> JsonPath waitForKogitoProcessInstanceEven
6761
countDownLatch.countDown();
6862
}
6963
});
70-
71-
runnable.run();
7264
// give some time to consume the event
7365
assertThat(countDownLatch.await(TIME_OUT_SECONDS, TimeUnit.SECONDS)).isTrue();
7466
if (shutdownAfterConsume) {
7567
kafkaClient.shutdown();
7668
}
7769
return cloudEvent.get();
7870
}
71+
7972
}

0 commit comments

Comments
 (0)