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

Fix enrichment of ThingCreated events with _policy #1863

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ private CompletableFuture<JsonObject> smartUpdateCachedObject(final SignalEnrich
final var nextExpectedThingEventsParameters =
new CachingParameters(fieldSelector, thingEvents, invalidateCacheOnPolicyChange,
cachingParameters.minAcceptableSeqNr);
result = handleNextExpectedThingEvents(cacheKey, JsonObject.empty(), nextExpectedThingEventsParameters)
.toCompletableFuture();
result = doCacheLookup(cacheKey, dittoHeaders).thenCompose(
cachedJsonObject -> handleNextExpectedThingEvents(cacheKey, cachedJsonObject,
nextExpectedThingEventsParameters));
} else {
// there are twin events; perform smart update
result = doCacheLookup(cacheKey, dittoHeaders).thenCompose(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ public void computeThingCacheValueFromThingEvents() {
sourceProbe.sendNext(inputMap);
sourceProbe.sendComplete();

thingsProbe.expectMsgClass(Duration.apply(30, TimeUnit.SECONDS), SudoRetrieveThing.class);
thingsProbe.reply(SudoRetrieveThingResponse.of(JsonObject.empty(), DittoHeaders.empty()));
// WHEN: policy is retrieved with up-to-date revisions
policiesProbe.expectMsgClass(Duration.apply(30, TimeUnit.SECONDS), SudoRetrievePolicy.class);
final var policy = Policy.newBuilder(policyId).setRevision(1).build();
Expand Down Expand Up @@ -319,6 +321,10 @@ public void computeThingCacheValueFromThingEventsWhenLastEventWasDeleted() {
sourceProbe.sendNext(inputMap);
sourceProbe.sendComplete();

// WHEN
thingsProbe.expectMsgClass(Duration.apply(30, TimeUnit.SECONDS), SudoRetrieveThing.class);
thingsProbe.reply(SudoRetrieveThingResponse.of(JsonObject.empty(), DittoHeaders.empty()));

// THEN: the write model contains up-to-date revisions
final AbstractWriteModel deleteModel = sinkProbe.expectNext().get(0);
sinkProbe.expectComplete();
Expand Down