static RolloutCreate fromRequest(final EntityFactory entityFactory, final MgmtRolloutRestRequestBody restRequest, final DistributionSet distributionSet) { return entityFactory.rollout().create().name(restRequest.getName()).description(restRequest.getDescription()) .set(distributionSet).targetFilterQuery(restRequest.getTargetFilterQuery()) .actionType(MgmtRestModelMapper.convertActionType(restRequest.getType())) .forcedTime(restRequest.getForcetime()).startAt(restRequest.getStartAt()); }
.errorAction(RolloutGroupErrorAction.PAUSE, null).build(); final Rollout rollout = rolloutManagement.create(entityFactory.rollout().create().name(rolloutName) .description(rolloutDescription).targetFilterQuery(filterQuery).set(distributionSet), groupSize, conditions);
.errorAction(RolloutGroupErrorAction.PAUSE, null).build(); final Rollout rollout = rolloutManagement.create(entityFactory.rollout().create().name(rolloutName) .description(rolloutDescription).targetFilterQuery(filterQuery).set(distributionSet), groupSize, conditions);
private Rollout saveRollout() { final Long distributionId = (Long) distributionSet.getValue(); final int amountGroup = Integer.parseInt(noOfGroups.getValue()); final int errorThresholdPercent = getErrorThresholdPercentage(amountGroup); final RolloutGroupConditions conditions = new RolloutGroupConditionBuilder() .successAction(RolloutGroupSuccessAction.NEXTGROUP, null) .successCondition(RolloutGroupSuccessCondition.THRESHOLD, triggerThreshold.getValue()) .errorCondition(RolloutGroupErrorCondition.THRESHOLD, String.valueOf(errorThresholdPercent)) .errorAction(RolloutGroupErrorAction.PAUSE, null).build(); final RolloutCreate rolloutCreate = entityFactory.rollout().create().name(rolloutName.getValue()) .description(description.getValue()).set(distributionId).targetFilterQuery(getTargetFilterQuery()) .actionType(getActionType()).forcedTime(getForcedTimeStamp()); if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) { rolloutCreate.startAt(System.currentTimeMillis()); } if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) { rolloutCreate.startAt(getScheduledStartTime()); } if (isNumberOfGroups()) { return rolloutManagement.create(rolloutCreate, amountGroup, conditions); } else if (isGroupsDefinition()) { final List<RolloutGroupCreate> groups = defineGroupsLayout.getSavedRolloutGroups(); return rolloutManagement.create(rolloutCreate, groups, conditions); } throw new IllegalStateException("Either of the Tabs must be selected"); }
private Rollout saveRollout() { final Long distributionId = (Long) distributionSet.getValue(); final int amountGroup = Integer.parseInt(noOfGroups.getValue()); final int errorThresholdPercent = getErrorThresholdPercentage(amountGroup); final RolloutGroupConditions conditions = new RolloutGroupConditionBuilder() .successAction(RolloutGroupSuccessAction.NEXTGROUP, null) .successCondition(RolloutGroupSuccessCondition.THRESHOLD, triggerThreshold.getValue()) .errorCondition(RolloutGroupErrorCondition.THRESHOLD, String.valueOf(errorThresholdPercent)) .errorAction(RolloutGroupErrorAction.PAUSE, null).build(); final RolloutCreate rolloutCreate = entityFactory.rollout().create().name(rolloutName.getValue()) .description(description.getValue()).set(distributionId).targetFilterQuery(getTargetFilterQuery()) .actionType(getActionType()).forcedTime(getForcedTimeStamp()); if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) { rolloutCreate.startAt(System.currentTimeMillis()); } if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) { rolloutCreate.startAt(getScheduledStartTime()); } if (isNumberOfGroups()) { return rolloutManagement.create(rolloutCreate, amountGroup, conditions); } else if (isGroupsDefinition()) { final List<RolloutGroupCreate> groups = defineGroupsLayout.getSavedRolloutGroups(); return rolloutManagement.create(rolloutCreate, groups, conditions); } throw new IllegalStateException("Either of the Tabs must be selected"); }
private Rollout createRolloutEntity() { testdataFactory.createTargets(20, "exampleTarget"); final Rollout rollout = rolloutManagement.create( entityFactory.rollout().create().name("exampleRollout") .targetFilterQuery("controllerId==exampleTarget*").set(testdataFactory.createDistributionSet()), 10, new RolloutGroupConditionBuilder().withDefaults() .successCondition(RolloutGroupSuccessCondition.THRESHOLD, "10").build()); // Run here, because Scheduler is disabled during tests rolloutManagement.handleRollouts(); return rolloutManagement .update(entityFactory.rollout().update(rollout.getId()).description("exampleDescription")); }
private void editRollout() { if (rollout == null) { return; } final Long distributionSetId = (Long) distributionSet.getValue(); final RolloutUpdate rolloutUpdate = entityFactory.rollout().update(rollout.getId()) .name(rolloutName.getValue()).description(description.getValue()).set(distributionSetId) .actionType(getActionType()).forcedTime(getForcedTimeStamp()); if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) { rolloutUpdate.startAt(System.currentTimeMillis()); } if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) { rolloutUpdate.startAt(getScheduledStartTime()); } Rollout updatedRollout; try { updatedRollout = rolloutManagement.update(rolloutUpdate); } catch (final EntityNotFoundException | EntityReadOnlyException e) { LOGGER.warn("Rollout was deleted. Redirect to Rollouts overview.", e); uiNotification.displayWarning( "Rollout with name " + rolloutName.getValue() + " was deleted. Update is not possible"); eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS); return; } uiNotification.displaySuccess(i18n.getMessage("message.update.success", updatedRollout.getName())); eventBus.publish(this, RolloutEvent.UPDATE_ROLLOUT); }
private void editRollout() { if (rollout == null) { return; } final Long distributionSetId = (Long) distributionSet.getValue(); final RolloutUpdate rolloutUpdate = entityFactory.rollout().update(rollout.getId()) .name(rolloutName.getValue()).description(description.getValue()).set(distributionSetId) .actionType(getActionType()).forcedTime(getForcedTimeStamp()); if (AutoStartOptionGroupLayout.AutoStartOption.AUTO_START.equals(getAutoStartOption())) { rolloutUpdate.startAt(System.currentTimeMillis()); } if (AutoStartOptionGroupLayout.AutoStartOption.SCHEDULED.equals(getAutoStartOption())) { rolloutUpdate.startAt(getScheduledStartTime()); } Rollout updatedRollout; try { updatedRollout = rolloutManagement.update(rolloutUpdate); } catch (final EntityNotFoundException | EntityReadOnlyException e) { LOGGER.warn("Rollout was deleted. Redirect to Rollouts overview.", e); uiNotification.displayWarning( "Rollout with name " + rolloutName.getValue() + " was deleted. Update is not possible"); eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS); return; } uiNotification.displaySuccess(i18n.getMessage("message.update.success", updatedRollout.getName())); eventBus.publish(this, RolloutEvent.UPDATE_ROLLOUT); }