Fix cancel action status (#429)

* Fixed handling of action cancellation status updates.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix broken DDI test.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Code readibility.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Reduce access to default.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Added test for finished on action that is in cancelling.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Update MariaDb driver

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Wrong branch

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove duplicate status definition.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Use updated picture in docs.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Leverage existing statics.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix picture upload.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Revert change

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-02-07 09:57:57 +01:00
committed by GitHub
parent 21181bc6f8
commit 1ad9b915c4
19 changed files with 513 additions and 273 deletions

View File

@@ -439,7 +439,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
case REJECTED:
LOG.info("Target rejected the cancelation request (actionid: {}, controllerId: {}).", actionid,
target.getControllerId());
status = Status.WARNING;
status = Status.CANCEL_REJECTED;
messages.add(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target rejected the cancelation request.");
break;
case CLOSED:

View File

@@ -276,7 +276,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(5);
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget.getControllerId())).hasSize(1);
// cancelation canceled -> should remove the action from active
// cancellation canceled -> should remove the action from active
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget.getControllerId())).hasSize(1);
current = System.currentTimeMillis();
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
@@ -289,7 +289,8 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(6);
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget.getControllerId())).hasSize(1);
// cancelation rejected -> action still active until controller close it
// cancellation rejected -> action still active until controller close
// it
// with finished or
// error
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget.getControllerId())).hasSize(1);
@@ -304,9 +305,9 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(7);
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget.getControllerId())).hasSize(1);
// cancelaction closed -> should remove the action from active
// update closed -> should remove the action from active
current = System.currentTimeMillis();
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/"
+ cancelAction.getId() + "/feedback", tenantAware.getCurrentTenant())
.content(JsonBuilder.cancelActionFeedback(cancelAction.getId().toString(), "closed"))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))