Skip to content

Commit

Permalink
extend selectable fields with "__lifecycle";
Browse files Browse the repository at this point in the history
fixed test cases in ThingPersistenceActorTest;

Signed-off-by: Stefan Maute <stefan.maute@bosch.io>
  • Loading branch information
Stefan Maute committed Jan 17, 2022
1 parent 57fcf5c commit bdb3168
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public final class ThingFieldSelector implements JsonFieldSelector {
.withoutUrlDecoding()
.build();
static final List<String> SELECTABLE_FIELDS = Arrays.asList("thingId", "policyId", "definition",
"_namespace", "_revision", "_created", "_modified", "_metadata", "_policy", "features(/[^,]+)?",
"attributes(/[^,]+)?");
"_namespace", "_revision", "_created", "_modified", "_metadata", "_policy", "__lifecycle",
"features(/[^,]+)?", "attributes(/[^,]+)?");
private static final String KNOWN_FIELDS_REGEX = "/?(" + String.join("|", SELECTABLE_FIELDS) + ")";
private static final String FIELD_SELECTION_REGEX = "^" + KNOWN_FIELDS_REGEX + "(," + KNOWN_FIELDS_REGEX + ")*$";
private static final Pattern FIELD_SELECTION_PATTERN = Pattern.compile(FIELD_SELECTION_REGEX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ public void ensureSequenceNumberCorrectness() {

// retrieve the thing's sequence number
final JsonFieldSelector versionFieldSelector =
JsonFactory.newFieldSelector(Thing.JsonFields.REVISION.toString(), JSON_PARSE_OPTIONS);
JsonFactory.newFieldSelector(Thing.JsonFields.REVISION.getPointer().toString(), JSON_PARSE_OPTIONS);
final long versionExpected = 2;
final Thing thingExpected = ThingsModelFactory.newThingBuilder(thingToModify)
.setRevision(versionExpected)
Expand All @@ -902,9 +902,7 @@ public void ensureSequenceNumberCorrectness() {
.withSelectedFields(versionFieldSelector)
.build();
underTest.tell(retrieveThing, getRef());
expectMsgEquals(
ETagTestUtils.retrieveThingResponse(thingExpected, versionFieldSelector,
dittoHeadersV2));
expectMsgEquals(ETagTestUtils.retrieveThingResponse(thingExpected, versionFieldSelector, dittoHeadersV2));
}
};
}
Expand Down Expand Up @@ -932,7 +930,7 @@ public void ensureSequenceNumberCorrectnessAfterRecovery() {

// retrieve the thing's sequence number from recovered actor
final JsonFieldSelector versionFieldSelector =
JsonFactory.newFieldSelector(Thing.JsonFields.REVISION.toString(), JSON_PARSE_OPTIONS);
JsonFactory.newFieldSelector(Thing.JsonFields.REVISION.getPointer().toString(), JSON_PARSE_OPTIONS);
final long versionExpected = 2;
final Thing thingExpected = ThingsModelFactory.newThingBuilder(thingToModify)
.setRevision(versionExpected)
Expand Down

0 comments on commit bdb3168

Please sign in to comment.