Fix for endless loop when an exception of type EntityAlreadyExistsException is thrown in the context of the retryable findOrRegisterTargetIfItDoesNotExist method (#828)
* fixed typo in method name Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * Added recover method to handle EntityAlreadyExistsException Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * Added tests Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * Apply suggestions from code review Use thenThrow(Exception.class) instead of (new Exception()) Co-Authored-By: a-sayyed <ahmed.sayed@bosch-si.com> * Apply suggestions from code review use final modifier Co-Authored-By: a-sayyed <ahmed.sayed@bosch-si.com> * Adapted review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * Adapted review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * added logs for EntityAlreadyExistsException case Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>
This commit is contained in:
committed by
Dominic Schabel
parent
ed95ae6398
commit
9884452ad4
@@ -1640,7 +1640,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
private Target createSingleTarget(final String controllerId, final String name) {
|
||||
targetManagement.create(entityFactory.target().create().controllerId(controllerId).name(name)
|
||||
.description(TARGET_DESCRIPTION_TEST));
|
||||
return controllerManagement.findOrRegisterTargetIfItDoesNotexist(controllerId, LOCALHOST);
|
||||
return controllerManagement.findOrRegisterTargetIfItDoesNotExist(controllerId, LOCALHOST);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1656,7 +1656,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
for (int index = 0; index < amount; index++) {
|
||||
final String str = String.valueOf(character);
|
||||
targetManagement.create(entityFactory.target().create().controllerId(str).name(str).description(str));
|
||||
controllerManagement.findOrRegisterTargetIfItDoesNotexist(str, LOCALHOST);
|
||||
controllerManagement.findOrRegisterTargetIfItDoesNotExist(str, LOCALHOST);
|
||||
character++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user