Feature mgmt simulator semi aware (#377)

* Mgmt simulator is Semic automatic rollout aware

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-12-06 19:33:53 +01:00
committed by GitHub
parent 173f782af8
commit d15084974a
4 changed files with 135 additions and 18 deletions

View File

@@ -8,9 +8,12 @@
*/
package org.eclipse.hawkbit.mgmt.client.resource.builder;
import java.util.List;
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutCondition;
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutCondition.Condition;
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutRestRequestBody;
import org.eclipse.hawkbit.mgmt.json.model.rolloutgroup.MgmtRolloutGroup;
/**
*
@@ -28,6 +31,7 @@ public class RolloutBuilder {
private String successThreshold;
private String errorThreshold;
private String description;
private List<MgmtRolloutGroup> semiAutomaticGroups;
/**
* @param name
@@ -39,6 +43,16 @@ public class RolloutBuilder {
return this;
}
/**
* @param semiAutomaticGroups
* as alternative to full automatic, i.e. {@link #groupSize(int)}
* @return the builder itself
*/
public RolloutBuilder semiAutomaticGroups(final List<MgmtRolloutGroup> semiAutomaticGroups) {
this.semiAutomaticGroups = semiAutomaticGroups;
return this;
}
/**
* @param groupSize
* the amount of groups the rollout should be split into
@@ -121,6 +135,7 @@ public class RolloutBuilder {
body.setDescription(description);
body.setSuccessCondition(new MgmtRolloutCondition(Condition.THRESHOLD, successThreshold));
body.setErrorCondition(new MgmtRolloutCondition(Condition.THRESHOLD, errorThreshold));
body.setGroups(semiAutomaticGroups);
return body;
}

View File

@@ -110,7 +110,7 @@ public class TargetBuilder {
public List<MgmtTargetRequestBody> buildAsList(final int offset, final int count) {
final List<MgmtTargetRequestBody> bodyList = Lists.newArrayList();
for (int index = offset; index < count + offset; index++) {
bodyList.add(doBuild(String.valueOf(index)));
bodyList.add(doBuild(String.format("%06d", index)));
}
return bodyList;
}