Removed unused target parameter in method forceQuitAction and change assertEquals to assertThat

Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
Jonathan Philip Knoblauch
2016-03-07 14:44:34 +01:00
parent f730c9cee4
commit 8f35b75857
4 changed files with 15 additions and 14 deletions

View File

@@ -572,7 +572,7 @@ public class DeploymentManagement {
@Modifying
@Transactional
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
public Action forceQuitAction(@NotNull final Action action, @NotNull final Target target) {
public Action forceQuitAction(@NotNull final Action action) {
final Action mergedAction = entityManager.merge(action);
if (!mergedAction.isCancelingOrCanceled()) {

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.repository;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import java.util.ArrayList;
@@ -312,7 +311,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
deploymentManagement.cancelAction(assigningAction, target);
assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId());
deploymentManagement.forceQuitAction(assigningAction, target);
deploymentManagement.forceQuitAction(assigningAction);
assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId());
@@ -350,8 +349,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
// force quit assignment
try {
deploymentManagement.forceQuitAction(assigningAction,
targetManagement.findTargetByControllerID(target.getControllerId()));
deploymentManagement.forceQuitAction(assigningAction);
fail("expected ForceQuitActionNotAllowedException");
} catch (final ForceQuitActionNotAllowedException ex) {
}
@@ -764,13 +762,16 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
// verifying that the assignment is correct
assertEquals("Active target actions are wrong", 1, deploymentManagement.findActiveActionsByTarget(targ).size());
assertEquals("Target actions are wrong", 1, deploymentManagement.findActionsByTarget(targ).size());
assertEquals("Target status is wrong", TargetUpdateStatus.PENDING, targ.getTargetInfo().getUpdateStatus());
assertEquals("Assigned ds is wrong", dsA, targ.getAssignedDistributionSet());
assertEquals("Active ds is wrong", dsA,
deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet());
assertNull("Installed ds should be null", targ.getTargetInfo().getInstalledDistributionSet());
assertThat(deploymentManagement.findActiveActionsByTarget(targ).size()).as("Active target actions are wrong")
.isEqualTo(1);
assertThat(deploymentManagement.findActionsByTarget(targ).size()).as("Target actions are wrong").isEqualTo(1);
assertThat(targ.getTargetInfo().getUpdateStatus()).as("UpdateStatus of target is wrong")
.isEqualTo(TargetUpdateStatus.PENDING);
assertThat(targ.getAssignedDistributionSet()).as("Assigned distribution set of target is wrong").isEqualTo(dsA);
assertThat(deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet())
.as("Distribution set of actionn is wrong").isEqualTo(dsA);
assertThat(deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet())
.as("Installed distribution set of action should be null").isNotNull();
final Page<Action> updAct = actionRepository.findByDistributionSet(pageReq, dsA);
final Action action = updAct.getContent().get(0);

View File

@@ -209,7 +209,7 @@ public class TargetResource implements TargetRestApi {
final Action action = findActionWithExceptionIfNotFound(actionId);
if (force) {
this.deploymentManagement.forceQuitAction(action, target);
this.deploymentManagement.forceQuitAction(action);
} else {
this.deploymentManagement.cancelAction(action, target);
}

View File

@@ -844,7 +844,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
if (actionId != null) {
final Action activeAction = deploymentManagement.findAction(actionId);
try {
deploymentManagement.forceQuitAction(activeAction, target);
deploymentManagement.forceQuitAction(activeAction);
return true;
} catch (final CancelActionNotAllowedException e) {
LOG.info("Force Cancel action not allowed exception :{}", e);