@Test public void validWithZeroComputeNodes() { Blueprint blueprint = new Blueprint(); blueprint.setBlueprintText(FileReaderUtils.readFileFromClasspathQuietly("input/cdp-data-mart.bp")); Set<HostGroup> hostGroups = Set.of( hostGroup("master", 1), hostGroup("worker", 3), hostGroup("compute", 0) ); Collection<InstanceGroup> instanceGroups = hostGroups.stream() .map(HostGroup::getInstanceGroup) .collect(toSet()); subject.validate(blueprint, hostGroups, instanceGroups, true); }
@Override public void validate(Blueprint blueprint, Set<HostGroup> hostGroups, Collection<InstanceGroup> instanceGroups, boolean validateServiceCardinality) { CmTemplateProcessor templateProcessor = processorFactory.get(blueprint.getBlueprintText()); Map<String, InstanceCount> blueprintHostGroupCardinality = templateProcessor.getCardinalityByHostGroup(); BlueprintValidatorUtil.validateHostGroupsMatch(hostGroups, blueprintHostGroupCardinality.keySet()); BlueprintValidatorUtil.validateInstanceGroups(hostGroups, instanceGroups); if (validateServiceCardinality) { BlueprintValidatorUtil.validateHostGroupCardinality(hostGroups, blueprintHostGroupCardinality); } }
CmTemplateValidator implements BlueprintValidator { @Override public void validate(Blueprint blueprint, Set<HostGroup> hostGroups, Collection<InstanceGroup> instanceGroups, boolean validateServiceCardinality) { CmTemplateProcessor templateProcessor = processorFactory.get(blueprint.getBlueprintText()); Map<String, InstanceCount> blueprintHostGroupCardinality = templateProcessor.getCardinalityByHostGroup(); BlueprintValidatorUtil.validateHostGroupsMatch(hostGroups, blueprintHostGroupCardinality.keySet()); BlueprintValidatorUtil.validateInstanceGroups(hostGroups, instanceGroups); if (validateServiceCardinality) { BlueprintValidatorUtil.validateHostGroupCardinality(hostGroups, blueprintHostGroupCardinality); } } }
CmTemplateValidator implements BlueprintValidator { @Override public void validate(Blueprint blueprint, Set<HostGroup> hostGroups, Collection<InstanceGroup> instanceGroups, boolean validateServiceCardinality) { CmTemplateProcessor templateProcessor = processorFactory.get(blueprint.getBlueprintText()); Map<String, InstanceCount> blueprintHostGroupCardinality = templateProcessor.getCardinalityByHostGroup(); BlueprintValidatorUtil.validateHostGroupsMatch(hostGroups, blueprintHostGroupCardinality.keySet()); BlueprintValidatorUtil.validateInstanceGroups(hostGroups, instanceGroups); if (validateServiceCardinality) { BlueprintValidatorUtil.validateHostGroupCardinality(hostGroups, blueprintHostGroupCardinality); } }  }
CmTemplateValidator implements BlueprintValidator { @Override public void validate(Blueprint blueprint, Set<HostGroup> hostGroups, Collection<InstanceGroup> instanceGroups, boolean validateServiceCardinality) { CmTemplateProcessor templateProcessor = processorFactory.get(blueprint.getBlueprintText()); Map<String, InstanceCount> blueprintHostGroupCardinality = templateProcessor.getCardinalityByHostGroup(); BlueprintValidatorUtil.validateHostGroupsMatch(hostGroups, blueprintHostGroupCardinality.keySet()); BlueprintValidatorUtil.validateInstanceGroups(hostGroups, instanceGroups); if (validateServiceCardinality) { BlueprintValidatorUtil.validateHostGroupCardinality(hostGroups, blueprintHostGroupCardinality); } }  @Override void validate(Blueprint blueprint, Set<HostGroup> hostGroups, Collection<InstanceGroup> instanceGroups,
        boolean validateServiceCardinality); @Override void validateHostGroupScalingRequest(String userCrn, String accountId, Blueprint blueprint, HostGroup hostGroup, Integer adjustment); }
CmTemplateValidator implements BlueprintValidator { @Override public void validate(Blueprint blueprint, Set<HostGroup> hostGroups, Collection<InstanceGroup> instanceGroups, boolean validateServiceCardinality) { CmTemplateProcessor templateProcessor = processorFactory.get(blueprint.getBlueprintText()); Map<String, InstanceCount> blueprintHostGroupCardinality = templateProcessor.getCardinalityByHostGroup(); BlueprintValidatorUtil.validateHostGroupsMatch(hostGroups, blueprintHostGroupCardinality.keySet()); BlueprintValidatorUtil.validateInstanceGroups(hostGroups, instanceGroups); if (validateServiceCardinality) { BlueprintValidatorUtil.validateHostGroupCardinality(hostGroups, blueprintHostGroupCardinality); } }  @Override void validate(Blueprint blueprint, Set<HostGroup> hostGroups, Collection<InstanceGroup> instanceGroups,
        boolean validateServiceCardinality); @Override void validateHostGroupScalingRequest(String userCrn, String accountId, Blueprint blueprint, HostGroup hostGroup, Integer adjustment);  }