Introduce new DMF message THING_REMOVED (#891)

* Introduce new DMF message THING_REMOVED

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch-si.com>

* rename test to its original name

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch-si.com>

* API documentation adapted; constant defined for duplicated string

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch-si.com>

* Resolve review comments; Replace try/catch blocks in exceptions testing

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch-si.com>

* Re-add finally block in test cases

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch-si.com>
This commit is contained in:
Natalia Kislicyn
2019-10-10 14:41:47 +02:00
committed by Dominic Schabel
parent 8687510131
commit 193603282a
7 changed files with 316 additions and 220 deletions

View File

@@ -193,7 +193,7 @@ public class JpaControllerManagement implements ControllerManagement {
/**
* Returns the count to be used for reducing polling interval while calling
* {@link ControllerManagement#getPollingTimeForAction()}.
* {@link ControllerManagement#getPollingTimeForAction(long)}.
*
* @return configured value of
* {@link TenantConfigurationKey#MAINTENANCE_WINDOW_POLL_COUNT}.
@@ -243,7 +243,7 @@ public class JpaControllerManagement implements ControllerManagement {
* @param minimumEventInterval
* for loading {@link DistributionSet#getModules()}. This
* puts a lower bound to the timer value
* @param timerUnit
* @param timeUnit
* representing the unit of time to be used for timer.
*/
EventTimer(final String defaultEventInterval, final String minimumEventInterval, final TemporalUnit timeUnit) {
@@ -375,6 +375,13 @@ public class JpaControllerManagement implements ControllerManagement {
return actionRepository.findByExternalRefInAndActive(externalRefs, true);
}
@Override
public void deleteExistingTarget(@NotEmpty String controllerId) {
final Target target = targetRepository.findByControllerId(controllerId)
.orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId));
targetRepository.deleteById(target.getId());
}
@Override
@Transactional(isolation = Isolation.READ_COMMITTED)
@Retryable(include = ConcurrencyFailureException.class, exclude = EntityAlreadyExistsException.class, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
@@ -997,8 +1004,8 @@ public class JpaControllerManagement implements ControllerManagement {
* Cancels given {@link Action} for this {@link Target}. The method will
* immediately add a {@link Status#CANCELED} status to the action. However,
* it might be possible that the controller will continue to work on the
* cancelation. The controller needs to acknowledge or reject the
* cancelation using {@link DdiRootController#postCancelActionFeedback}.
* cancellation. The controller needs to acknowledge or reject the
* cancellation using {@link DdiRootController#postCancelActionFeedback}.
*
* @param actionId
* to be canceled