davsclaus commented on code in PR #27902:
URL: https://github.com/apache/camel/pull/27902#discussion_r4291675932
##########
components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/integration/ConsumeChildrenIT.java:
##########
@@ -52,19 +56,38 @@ public void shouldAwaitCreationAndGetDataNotification()
throws Exception {
MockEndpoint mock = getMockEndpoint("mock:zookeeper-data");
mock.expectedMessageCount(5);
- client.createPersistent("/grimm", "parent");
- client.create("/grimm/hansel", "child");
- client.create("/grimm/gretel", "child");
- client.delete("/grimm/hansel");
- client.delete("/grimm/gretel");
+ client.createPersistent(ZK_NODE, "parent");
+ awaitMockReceivedCount(mock, 1);
+ client.create(ZK_NODE + "/hansel", "child");
+ awaitMockReceivedCount(mock, 2);
+ client.create(ZK_NODE + "/gretel", "child");
+ awaitMockReceivedCount(mock, 3);
+ client.delete(ZK_NODE + "/hansel");
+ awaitMockReceivedCount(mock, 4);
+ client.delete(ZK_NODE + "/gretel");
- MockEndpoint.assertIsSatisfied(context);
+ MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS);
validateExchangesContainListings(mock, createChildListing(),
createChildListing("hansel"),
createChildListing("hansel", "gretel"),
createChildListing("gretel"),
createChildListing());
}
+ /**
+ * Waits until the mock has received at least {@code count} messages
before the next ZooKeeper mutation is fired.
+ * <p>
+ * This ensures the previous ChildrenChangedOperation copy has been taken
off the queue and its
Review Comment:
Nit (optional): this sentence says the await ensures `installWatch()` has
been called, but in `OperationsExecutor.run()` the copy is put back on the
queue, and its watch installed, only *after* the mock has the exchange (which
the next sentence says too). Maybe: "Once the mock has the exchange, the next
ChildrenChangedOperation copy is put back on the queue and calls
`installWatch()` shortly after."
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]