mirror of https://github.com/apache/nifi.git
NIFI-12858 Corrected Order of Previous Property Values
- Reversed default order of previous values to return oldest entries before newest entries Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #8673.
This commit is contained in:
parent
d9e48f8645
commit
259a734a4b
|
@ -135,7 +135,8 @@ public class EntityStoreAuditService implements AuditService, Closeable {
|
|||
final Map<String, List<PreviousValue>> previousValuesFound = new LinkedHashMap<>();
|
||||
|
||||
final EntityIterable actionEntities = storeTransaction.find(EntityType.ACTION.getEntityType(), ActionEntity.SOURCE_ID.getProperty(), componentId);
|
||||
for (Entity actionEntity : actionEntities) {
|
||||
// Reverse default ordering to return oldest entries before newest entries
|
||||
for (Entity actionEntity : actionEntities.reverse()) {
|
||||
final Entity configureDetails = actionEntity.getLink(ActionLink.CONFIGURE_DETAILS.getProperty());
|
||||
if (configureDetails != null) {
|
||||
final String name = getProperty(configureDetails, ConfigureDetailsEntity.NAME);
|
||||
|
|
|
@ -95,6 +95,8 @@ class EntityStoreAuditServiceTest {
|
|||
|
||||
private static final String SECOND_VALUE = "SecondValue";
|
||||
|
||||
private static final String THIRD_VALUE = "ThirdValue";
|
||||
|
||||
private static final String DATABASE_FILE_EXTENSION = ".xd";
|
||||
|
||||
@TempDir
|
||||
|
@ -331,7 +333,14 @@ class EntityStoreAuditServiceTest {
|
|||
secondConfigureDetails.setValue(SECOND_VALUE);
|
||||
secondAction.setActionDetails(secondConfigureDetails);
|
||||
|
||||
final Collection<Action> actions = Arrays.asList(firstAction, secondAction);
|
||||
final FlowChangeAction thirdAction = newAction();
|
||||
thirdAction.setOperation(Operation.Configure);
|
||||
final FlowChangeConfigureDetails thirdConfigureDetails = new FlowChangeConfigureDetails();
|
||||
thirdConfigureDetails.setName(SECOND_PROPERTY_NAME);
|
||||
thirdConfigureDetails.setValue(THIRD_VALUE);
|
||||
thirdAction.setActionDetails(thirdConfigureDetails);
|
||||
|
||||
final Collection<Action> actions = Arrays.asList(firstAction, secondAction, thirdAction);
|
||||
service.addActions(actions);
|
||||
|
||||
final Map<String, List<PreviousValue>> previousValues = service.getPreviousValues(SOURCE_ID);
|
||||
|
@ -348,7 +357,14 @@ class EntityStoreAuditServiceTest {
|
|||
|
||||
final List<PreviousValue> secondPreviousValues = previousValues.get(SECOND_PROPERTY_NAME);
|
||||
assertNotNull(secondPreviousValues);
|
||||
final PreviousValue secondPreviousValue = secondPreviousValues.get(0);
|
||||
|
||||
final PreviousValue thirdPreviousValue = secondPreviousValues.get(0);
|
||||
assertNotNull(thirdPreviousValue);
|
||||
assertEquals(THIRD_VALUE, thirdPreviousValue.getPreviousValue());
|
||||
assertNotNull(thirdPreviousValue.getTimestamp());
|
||||
assertEquals(USER_IDENTITY, thirdPreviousValue.getUserIdentity());
|
||||
|
||||
final PreviousValue secondPreviousValue = secondPreviousValues.get(1);
|
||||
assertNotNull(secondPreviousValue);
|
||||
assertEquals(SECOND_VALUE, secondPreviousValue.getPreviousValue());
|
||||
assertNotNull(secondPreviousValue.getTimestamp());
|
||||
|
|
Loading…
Reference in New Issue