Wait until the action update event is processed
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -9,8 +9,10 @@
|
|||||||
package org.eclipse.hawkbit.integration;
|
package org.eclipse.hawkbit.integration;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.fail;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -595,10 +597,23 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertAction(final Long actionId, final Status... expectedActionStates) {
|
private void assertAction(final Long actionId, final Status... expectedActionStates) {
|
||||||
final Action action = waitUntilIsPresent(() -> controllerManagement.findActionWithDetails(actionId));
|
createConditionFactory().await().until(() -> {
|
||||||
final List<Status> status = action.getActionStatus().stream().map(actionStatus -> actionStatus.getStatus())
|
try {
|
||||||
|
securityRule.runAsPrivileged(() -> {
|
||||||
|
final Optional<Action> findActionWithDetails = controllerManagement.findActionWithDetails(actionId);
|
||||||
|
assertThat(findActionWithDetails).isPresent();
|
||||||
|
assertThat(convertStatusList(findActionWithDetails.get())).containsOnly(expectedActionStates);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
} catch (final Exception e) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Status> convertStatusList(Action action) {
|
||||||
|
return action.getActionStatus().stream().map(actionStatus -> actionStatus.getStatus())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
assertThat(status).containsOnly(expectedActionStates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Message createEventMessage(final String tenant, final EventTopic eventTopic, final Object payload) {
|
private Message createEventMessage(final String tenant, final EventTopic eventTopic, final Object payload) {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return callable.call().get();
|
return securityRule.runAsPrivileged(() -> callable.call().get());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user