- final Optional<NormalizedNode<?, ?>> optional = txChain.newReadOnlyTransaction()
- .read(CarsModel.CAR_LIST_PATH).get(5, TimeUnit.SECONDS);
- assertTrue("isPresent", optional.isPresent());
- assertEquals("# cars", numCars, ((Collection<?>) optional.get().getValue()).size());
+ try (var tx = txChain.newReadOnlyTransaction()) {
+ final var body = tx.read(CarsModel.CAR_LIST_PATH).get(5, TimeUnit.SECONDS).orElseThrow().body();
+ assertThat(body, instanceOf(Collection.class));
+ assertEquals(numCars, ((Collection<?>) body).size());
+ }
+ }
+
+ private static void assertAskClientMetadata(final FrontendClientMetadata clientMeta) {
+ // ask based should track no metadata
+ assertEquals(List.of(), clientMeta.getCurrentHistories());
+ }
+
+ private static void assertTellClientMetadata(final FrontendClientMetadata clientMeta, final long lastPurged) {
+ final var iterator = clientMeta.getCurrentHistories().iterator();
+ var metadata = iterator.next();
+ while (iterator.hasNext() && metadata.getHistoryId() != 1) {
+ metadata = iterator.next();
+ }
+
+ assertEquals(UnsignedLongBitmap.of(), metadata.getClosedTransactions());
+ assertEquals("[[0.." + lastPurged + "]]", metadata.getPurgedTransactions().ranges().toString());