introduced open actionIds in MgmtTargetAssignmentResponseBody (#864)
* introduced open actionIds in MgmtTargetAssignmentResponseBody Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed SonarQube issues Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * removed unused method parameter Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * updated documentation tests Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * added limit to the alreadyAssignedActions in the AssignmentResult Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * moved alreadyAssignedActions limitation to MgmtDistributionSetMapper Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * removed alreadyAssignedActions Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed sonarQube issues Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed compilation error Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed PR review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed PR review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * Renamed AssignmentResult to AbstractAssignmentResult Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed formatting Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * reverted method visibility Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>
This commit is contained in:
committed by
Dominic Schabel
parent
973f1952c7
commit
d40b11d2ab
@@ -17,6 +17,7 @@ import java.net.URI;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -321,8 +322,8 @@ public abstract class AbstractIntegrationTest {
|
||||
final boolean isRequiredMigrationStep) {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet(distributionSet, isRequiredMigrationStep);
|
||||
Target savedTarget = testdataFactory.createTarget(controllerId);
|
||||
savedTarget = assignDistributionSet(ds.getId(), savedTarget.getControllerId(), ActionType.FORCED)
|
||||
.getAssignedEntity().iterator().next();
|
||||
savedTarget = getFirstAssignedTarget(
|
||||
assignDistributionSet(ds.getId(), savedTarget.getControllerId(), ActionType.FORCED));
|
||||
Action savedAction = deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())
|
||||
.getContent().get(0);
|
||||
|
||||
@@ -434,4 +435,21 @@ public abstract class AbstractIntegrationTest {
|
||||
|
||||
return randomStringBuilder.toString();
|
||||
}
|
||||
|
||||
protected static Action getFirstAssignedAction(final DistributionSetAssignmentResult distributionSetAssignmentResult) {
|
||||
return distributionSetAssignmentResult.getAssignedEntity().stream().findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("expected one assigned action, found none"));
|
||||
}
|
||||
|
||||
protected static Long getFirstAssignedActionId(final DistributionSetAssignmentResult distributionSetAssignmentResult) {
|
||||
return getFirstAssignedAction(distributionSetAssignmentResult).getId();
|
||||
}
|
||||
|
||||
protected static Target getFirstAssignedTarget(final DistributionSetAssignmentResult assignment) {
|
||||
return getFirstAssignedAction(assignment).getTarget();
|
||||
}
|
||||
|
||||
protected static Comparator<Target> controllerIdComparator() {
|
||||
return (o1, o2) -> o1.getControllerId().equals(o2.getControllerId()) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user