Adapt cancel flow (#1274)

* Adapt assignment events to communicate mass cancel operations within one event.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Fix edge cases identified by test failures. Adapt tests and reduce amount of published cancel events.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Fix license header

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Refactor visibility of methods in assignment strategy classes. Avoid having empty action status messages.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Fix api docs

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>
Co-authored-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>
This commit is contained in:
Michael Herdt
2022-09-21 17:04:08 +02:00
committed by GitHub
parent 5e963f8308
commit ea5a3b3d30
20 changed files with 329 additions and 180 deletions

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.repository.jpa;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -17,7 +18,7 @@ import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.QuotaManagement;
import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
@@ -30,11 +31,15 @@ import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* {@link DistributionSet} to {@link Target} assignment strategy as utility for
@@ -144,19 +149,22 @@ public abstract class AbstractDsAssignmentStrategy {
.findByActiveAndTargetIdInAndActionStatusNotEqualToAndDistributionSetNotRequiredMigrationStep(
targetsIds, Action.Status.CANCELING);
return activeActions.stream().map(action -> {
final List<Long> targetIds = activeActions.stream().map(action -> {
action.setStatus(Status.CANCELING);
// document that the status has been retrieved
actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELING, System.currentTimeMillis(),
RepositoryConstants.SERVER_MESSAGE_PREFIX + "cancel obsolete action due to new update"));
RepositoryConstants.SERVER_MESSAGE_PREFIX + "cancel obsolete action due to new update"));
actionRepository.save(action);
cancelAssignDistributionSetEvent(action.getTarget(), action.getId());
return action.getTarget().getId();
}).collect(Collectors.toList());
if (!activeActions.isEmpty()) {
cancelAssignDistributionSetEvent(Collections.unmodifiableList(activeActions));
}
return targetIds;
}
/**
@@ -188,20 +196,28 @@ public abstract class AbstractDsAssignmentStrategy {
}
/**
* Sends the {@link CancelTargetAssignmentEvent} for a specific target to
* Sends the {@link CancelTargetAssignmentEvent} for a specific action to
* the eventPublisher.
*
* @param target
* the Target which has been assigned to a distribution set
* @param actionId
* the action id of the assignment
* @param action
* the action of the assignment
*/
void cancelAssignDistributionSetEvent(final Target target, final Long actionId) {
protected void cancelAssignDistributionSetEvent(final Action action) {
afterCommit.afterCommit(() -> eventPublisherHolder.getEventPublisher().publishEvent(
new CancelTargetAssignmentEvent(target, actionId, eventPublisherHolder.getApplicationId())));
new CancelTargetAssignmentEvent(action, eventPublisherHolder.getApplicationId())));
}
JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
private void cancelAssignDistributionSetEvent(final List<Action> actions) {
if (CollectionUtils.isEmpty(actions)) {
return;
}
final String tenant = actions.get(0).getTenant();
afterCommit.afterCommit(() -> eventPublisherHolder.getEventPublisher()
.publishEvent(new CancelTargetAssignmentEvent(tenant,
actions, eventPublisherHolder.getApplicationId())));
}
public JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
final List<JpaTarget> targets, final JpaDistributionSet set) {
final Optional<JpaTarget> optTarget = targets.stream()
.filter(t -> t.getControllerId().equals(targetWithActionType.getControllerId())).findFirst();
@@ -227,18 +243,30 @@ public abstract class AbstractDsAssignmentStrategy {
});
}
JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
final JpaActionStatus actionStatus = new JpaActionStatus();
actionStatus.setAction(action);
actionStatus.setOccurredAt(action.getCreatedAt());
if (actionMessage != null) {
if (StringUtils.hasText(actionMessage)) {
actionStatus.addMessage(actionMessage);
} else {
actionStatus.addMessage(getActionMessage(action));
}
return actionStatus;
}
private static String getActionMessage(final Action action) {
final RolloutGroup rolloutGroup = action.getRolloutGroup();
if (rolloutGroup != null) {
final Rollout rollout = rolloutGroup.getRollout();
return String.format("Initiated by Rollout Group '%s' [Rollout %s:%s]", rolloutGroup.getName(),
rollout.getName(), rollout.getId());
}
return String.format("Assignment initiated by user '%s'", action.getInitiatedBy());
}
private void assertActionsPerTargetQuota(final Target target, final int requested) {
final int quota = quotaManagement.getMaxActionsPerTarget();
QuotaHelper.assertAssignmentQuota(target.getId(), requested, quota, Action.class, Target.class,

View File

@@ -50,7 +50,7 @@ import org.eclipse.hawkbit.repository.UpdateMode;
import org.eclipse.hawkbit.repository.builder.ActionStatusCreate;
import org.eclipse.hawkbit.repository.event.remote.TargetAttributesRequestedEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
@@ -1041,7 +1041,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELING, System.currentTimeMillis(),
"manual cancelation requested"));
final Action saveAction = actionRepository.save(action);
cancelAssignDistributionSetEvent((JpaTarget) action.getTarget(), action.getId());
cancelAssignDistributionSetEvent(action);
return saveAction;
} else {
@@ -1074,9 +1074,9 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
}
}
private void cancelAssignDistributionSetEvent(final JpaTarget target, final Long actionId) {
private void cancelAssignDistributionSetEvent(final Action action) {
afterCommit.afterCommit(() -> eventPublisherHolder.getEventPublisher().publishEvent(
new CancelTargetAssignmentEvent(target, actionId, eventPublisherHolder.getApplicationId())));
new CancelTargetAssignmentEvent(action, eventPublisherHolder.getApplicationId())));
}
// for testing

View File

@@ -72,6 +72,8 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSetInvalidation.CancelationType;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetType;
@@ -580,19 +582,28 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
if (rolloutGroupActions.getContent().isEmpty()) {
return 0L;
}
final List<Action> newTargetAssignments = handleTargetAssignments(rolloutGroupActions);
final List<Action> targetAssignments = rolloutGroupActions.getContent().stream().map(JpaAction.class::cast)
.map(this::closeActionIfSetWasAlreadyAssigned).filter(Objects::nonNull)
.map(this::startScheduledActionIfNoCancelationHasToBeHandledFirst).filter(Objects::nonNull)
.collect(Collectors.toList());
if (!targetAssignments.isEmpty()) {
onlineDsAssignmentStrategy.sendDeploymentEvents(distributionSetId, targetAssignments);
if (!newTargetAssignments.isEmpty()) {
onlineDsAssignmentStrategy.sendDeploymentEvents(distributionSetId, newTargetAssignments);
}
return rolloutGroupActions.getTotalElements();
});
}
private List<Action> handleTargetAssignments(final Page<Action> rolloutGroupActions) {
// Close actions already assigned and collect pending assignments
final List<JpaAction> pendingTargetAssignments = rolloutGroupActions.getContent().stream()
.map(JpaAction.class::cast).map(this::closeActionIfSetWasAlreadyAssigned).filter(Objects::nonNull)
.collect(Collectors.toList());
if (pendingTargetAssignments.isEmpty()) {
return new ArrayList<>(pendingTargetAssignments);
}
// check if old actions needs to be canceled first
return startScheduledActionsAndHandleOpenCancellationFirst(pendingTargetAssignments);
}
private Page<Action> findActionsByRolloutAndRolloutGroupParent(final Long rolloutId,
final Long rolloutGroupParentId, final int limit) {
@@ -630,41 +641,51 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
return action;
}
private JpaAction startScheduledActionIfNoCancelationHasToBeHandledFirst(final JpaAction action) {
// check if we need to override running update actions
final List<Long> overrideObsoleteUpdateActions;
private List<Action> startScheduledActionsAndHandleOpenCancellationFirst(final List<JpaAction> actions) {
if (!isMultiAssignmentsEnabled()) {
closeOrCancelOpenDeviceActions(actions);
}
final List<JpaAction> savedActions = activateActions(actions);
setInitialActionStatus(savedActions);
setAssignmentOnTargets(savedActions);
return Collections.unmodifiableList(savedActions);
}
if (isMultiAssignmentsEnabled()) {
overrideObsoleteUpdateActions = Collections.emptyList();
private void closeOrCancelOpenDeviceActions(final List<JpaAction> actions){
final List<Long> targetIds = actions.stream().map(JpaAction::getTarget).map(Target::getId)
.collect(Collectors.toList());
if (isActionsAutocloseEnabled()) {
onlineDsAssignmentStrategy.closeObsoleteUpdateActions(targetIds);
} else {
final List<Long> targetId = Collections.singletonList(action.getTarget().getId());
if (isActionsAutocloseEnabled()) {
overrideObsoleteUpdateActions = Collections.emptyList();
onlineDsAssignmentStrategy.closeObsoleteUpdateActions(targetId);
} else {
overrideObsoleteUpdateActions = onlineDsAssignmentStrategy.overrideObsoleteUpdateActions(targetId);
}
onlineDsAssignmentStrategy.overrideObsoleteUpdateActions(targetIds);
}
}
action.setActive(true);
action.setStatus(Status.RUNNING);
final JpaAction savedAction = actionRepository.save(action);
private List<JpaAction> activateActions(final List<JpaAction> actions){
actions.forEach(action -> {
action.setActive(true);
action.setStatus(Status.RUNNING);
});
return actionRepository.saveAll(actions);
}
actionStatusRepository.save(onlineDsAssignmentStrategy.createActionStatus(savedAction, null));
private void setAssignmentOnTargets(final List<JpaAction> actions) {
final List<JpaTarget> assignedDsTargets = actions.stream().map(savedAction -> {
final JpaTarget mergedTarget = (JpaTarget) entityManager.merge(savedAction.getTarget());
mergedTarget.setAssignedDistributionSet(savedAction.getDistributionSet());
mergedTarget.setUpdateStatus(TargetUpdateStatus.PENDING);
return mergedTarget;
}).collect(Collectors.toList());
final JpaTarget target = (JpaTarget) entityManager.merge(savedAction.getTarget());
targetRepository.saveAll(assignedDsTargets);
}
target.setAssignedDistributionSet(savedAction.getDistributionSet());
target.setUpdateStatus(TargetUpdateStatus.PENDING);
targetRepository.save(target);
// in case we canceled an action before for this target, then don't fire
// assignment event
if (overrideObsoleteUpdateActions.contains(savedAction.getId())) {
return null;
private void setInitialActionStatus(final List<JpaAction> actions) {
final List<JpaActionStatus> statusList = new ArrayList<>();
for (final JpaAction action : actions) {
statusList.add(onlineDsAssignmentStrategy.createActionStatus(action, null));
}
return savedAction;
actionStatusRepository.saveAll(statusList);
}
private void setSkipActionStatus(final JpaAction action) {

View File

@@ -51,7 +51,7 @@ public class OfflineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
void sendTargetUpdatedEvents(final DistributionSet set, final List<JpaTarget> targets) {
public void sendTargetUpdatedEvents(final DistributionSet set, final List<JpaTarget> targets) {
targets.forEach(target -> {
target.setUpdateStatus(TargetUpdateStatus.IN_SYNC);
sendTargetUpdatedEvent(target);
@@ -78,19 +78,19 @@ public class OfflineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
void closeActiveActions(final List<List<Long>> targetIds) {
public void closeActiveActions(final List<List<Long>> targetIds) {
// Not supported by offline case
}
@Override
void setAssignedDistributionSetAndTargetStatus(final JpaDistributionSet set, final List<List<Long>> targetIds,
public void setAssignedDistributionSetAndTargetStatus(final JpaDistributionSet set, final List<List<Long>> targetIds,
final String currentUser) {
targetIds.forEach(tIds -> targetRepository.setAssignedAndInstalledDistributionSetAndUpdateStatus(
TargetUpdateStatus.IN_SYNC, set, System.currentTimeMillis(), currentUser, tIds));
}
@Override
protected JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
public JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
final List<JpaTarget> targets, final JpaDistributionSet set) {
final JpaAction result = super.createTargetAction(initiatedBy, targetWithActionType, targets, set);
if (result != null) {
@@ -101,7 +101,7 @@ public class OfflineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
protected JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
final JpaActionStatus result = super.createActionStatus(action, actionMessage);
result.setStatus(Status.FINISHED);
result.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Action reported as offline deployment");

View File

@@ -54,7 +54,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
void sendTargetUpdatedEvents(final DistributionSet set, final List<JpaTarget> targets) {
public void sendTargetUpdatedEvents(final DistributionSet set, final List<JpaTarget> targets) {
targets.forEach(target -> {
target.setUpdateStatus(TargetUpdateStatus.PENDING);
sendTargetUpdatedEvent(target);
@@ -62,7 +62,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
void sendDeploymentEvents(final DistributionSetAssignmentResult assignmentResult) {
public void sendDeploymentEvents(final DistributionSetAssignmentResult assignmentResult) {
if (isMultiAssignmentsEnabled()) {
sendDeploymentEvents(Collections.singletonList(assignmentResult));
} else {
@@ -71,7 +71,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
void sendDeploymentEvents(final List<DistributionSetAssignmentResult> assignmentResults) {
public void sendDeploymentEvents(final List<DistributionSetAssignmentResult> assignmentResults) {
if (isMultiAssignmentsEnabled()) {
sendDeploymentEvent(assignmentResults.stream().flatMap(result -> result.getAssignedEntity().stream())
.collect(Collectors.toList()));
@@ -80,7 +80,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
}
void sendDeploymentEvents(final long distributionSetId, final List<Action> actions) {
public void sendDeploymentEvents(final long distributionSetId, final List<Action> actions) {
if (isMultiAssignmentsEnabled()) {
sendDeploymentEvent(actions);
return;
@@ -94,7 +94,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
List<JpaTarget> findTargetsForAssignment(final List<String> controllerIDs, final long setId) {
public List<JpaTarget> findTargetsForAssignment(final List<String> controllerIDs, final long setId) {
final Function<List<String>, List<JpaTarget>> mapper;
if (isMultiAssignmentsEnabled()) {
mapper = ids -> targetRepository.findAll(TargetSpecifications.hasControllerIdIn(ids));
@@ -107,18 +107,18 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
Set<Long> cancelActiveActions(final List<List<Long>> targetIds) {
public Set<Long> cancelActiveActions(final List<List<Long>> targetIds) {
return targetIds.stream().map(this::overrideObsoleteUpdateActions).flatMap(Collection::stream)
.collect(Collectors.toSet());
}
@Override
void closeActiveActions(final List<List<Long>> targetIds) {
public void closeActiveActions(final List<List<Long>> targetIds) {
targetIds.forEach(this::closeObsoleteUpdateActions);
}
@Override
void setAssignedDistributionSetAndTargetStatus(final JpaDistributionSet set, final List<List<Long>> targetIds,
public void setAssignedDistributionSetAndTargetStatus(final JpaDistributionSet set, final List<List<Long>> targetIds,
final String currentUser) {
targetIds.forEach(tIds -> targetRepository.setAssignedDistributionSetAndUpdateStatus(TargetUpdateStatus.PENDING,
set, System.currentTimeMillis(), currentUser, tIds));
@@ -126,7 +126,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
public JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
final List<JpaTarget> targets, final JpaDistributionSet set) {
final JpaAction result = super.createTargetAction(initiatedBy, targetWithActionType, targets, set);
if (result != null) {
@@ -136,7 +136,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
}
@Override
JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
final JpaActionStatus result = super.createActionStatus(action, actionMessage);
result.setStatus(Status.RUNNING);
return result;
@@ -146,7 +146,7 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
if (isMultiAssignmentsEnabled()) {
sendMultiActionCancelEvent(action);
} else {
cancelAssignDistributionSetEvent(action.getTarget(), action.getId());
cancelAssignDistributionSetEvent(action);
}
}

View File

@@ -119,6 +119,31 @@ public class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
assertTargetAssignDistributionSetEvent(action, remoteEventJackson);
}
@Test
@Description("Verifies that a TargetAssignDistributionSetEvent can be properly serialized and deserialized")
public void testCancelTargetAssignmentEvent() {
final DistributionSet dsA = testdataFactory.createDistributionSet("");
final JpaAction generateAction = new JpaAction();
generateAction.setActionType(ActionType.FORCED);
generateAction.setTarget(testdataFactory.createTarget("Test"));
generateAction.setDistributionSet(dsA);
generateAction.setStatus(Status.RUNNING);
generateAction.setInitiatedBy(tenantAware.getCurrentUsername());
final Action action = actionRepository.save(generateAction);
final CancelTargetAssignmentEvent cancelEvent = new CancelTargetAssignmentEvent(action,
serviceMatcher.getServiceId());
final CancelTargetAssignmentEvent remoteEventProtoStuff = createProtoStuffEvent(cancelEvent);
assertCancelTargetAssignmentEvent(action, remoteEventProtoStuff);
final CancelTargetAssignmentEvent remoteEventJackson = createJacksonEvent(cancelEvent);
assertCancelTargetAssignmentEvent(action, remoteEventJackson);
}
private void assertTargetAssignDistributionSetEvent(final Action action,
final TargetAssignDistributionSetEvent underTest) {
@@ -128,4 +153,12 @@ public class RemoteTenantAwareEventTest extends AbstractRemoteEventTest {
assertThat(actionProperties).isEqualToComparingFieldByField(new ActionProperties(action));
assertThat(underTest.getDistributionSetId()).isEqualTo(action.getDistributionSet().getId());
}
private void assertCancelTargetAssignmentEvent(final Action action, final CancelTargetAssignmentEvent underTest) {
assertThat(underTest.getActions().size()).isEqualTo(1);
final ActionProperties actionProperties = underTest.getActions().get(action.getTarget().getControllerId());
assertThat(actionProperties).isNotNull();
assertThat(actionProperties).isEqualToComparingFieldByField(new ActionProperties(action));
assertThat(underTest.getActionPropertiesForController(action.getTarget().getControllerId())).isPresent();
}
}

View File

@@ -36,17 +36,6 @@ public class TargetEventTest extends AbstractRemoteEntityEventTest<Target> {
assertAndCreateRemoteEvent(TargetUpdatedEvent.class);
}
@Test
@Description("Verifies that cancel target assignment event works")
public void testCancelTargetAssignmentEvent() {
final Target target = createEntity();
final CancelTargetAssignmentEvent assignmentEvent = new CancelTargetAssignmentEvent(target, 1L, "node");
final CancelTargetAssignmentEvent underTest = (CancelTargetAssignmentEvent) assertEntity(target,
assignmentEvent);
assertThat(underTest.getActionId()).isNotNull();
}
@Override
protected Target createEntity() {
return testdataFactory.createTarget("12345");

View File

@@ -44,7 +44,7 @@ import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionUpdatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleUpdatedEvent;

View File

@@ -32,7 +32,7 @@ import org.eclipse.hawkbit.repository.event.remote.MultiActionCancelEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionUpdatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedEvent;
@@ -265,7 +265,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
@Expect(type = TargetUpdatedEvent.class, count = 40),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
@Expect(type = ActionCreatedEvent.class, count = 40),
@Expect(type = CancelTargetAssignmentEvent.class, count = 20),
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
@Expect(type = ActionUpdatedEvent.class, count = 20),
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6) })
@@ -945,11 +945,11 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
@Expect(type = TargetUpdatedEvent.class, count = 3 * 4),
@Expect(type = ActionCreatedEvent.class, count = 3 * 4),
@Expect(type = ActionUpdatedEvent.class, count = 4 * 2),
@Expect(type = CancelTargetAssignmentEvent.class, count = 4 * 2),
@Expect(type = CancelTargetAssignmentEvent.class, count = 2),
@Expect(type = DistributionSetCreatedEvent.class, count = 3),
@Expect(type = SoftwareModuleCreatedEvent.class, count = 9),
@Expect(type = TargetAssignDistributionSetEvent.class, count = 3) })
void multipleDeployments() throws InterruptedException {
void multipleDeployments() {
final String undeployedTargetPrefix = "undep-T";
final int noOfUndeployedTargets = 5;