use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class BlueprintValidatorTest method testKnoxValidationWithNoGateway.
@Test
public void testKnoxValidationWithNoGateway() throws IOException {
// GIVEN
Blueprint blueprint = createBlueprint();
Set<InstanceGroup> instanceGroups = createInstanceGroups();
Set<HostGroup> hostGroups = createHostGroups(instanceGroups);
instanceGroups.add(createInstanceGroup("gateway", 1));
JsonNode blueprintJsonTree = createJsonTree();
BDDMockito.given(objectMapper.readTree(BLUEPRINT_STRING)).willReturn(blueprintJsonTree);
Cluster cluster = new Cluster();
cluster.setSecure(true);
// WHEN
underTest.validateBlueprintForStack(cluster, blueprint, hostGroups, instanceGroups);
// THEN no exception thrown
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class BlueprintValidatorTest method testValidateBlueprintForStackShouldThrowBadRequestExceptionWhenComponentIsInMoreGroupsAndNodeCountIsMoreThanMax.
@Test
public void testValidateBlueprintForStackShouldThrowBadRequestExceptionWhenComponentIsInMoreGroupsAndNodeCountIsMoreThanMax() throws IOException {
// GIVEN
Blueprint blueprint = createBlueprint();
Set<InstanceGroup> instanceGroups = createInstanceGroups();
Set<HostGroup> hostGroups = createHostGroups(instanceGroups);
instanceGroups.add(createInstanceGroup("gateway", 1));
JsonNode blueprintJsonTree = createJsonTreeWithComponentInMoreGroups();
BDDMockito.given(objectMapper.readTree(BLUEPRINT_STRING)).willReturn(blueprintJsonTree);
thrown.expect(BlueprintValidationException.class);
thrown.expectMessage("Incorrect number of 'mastercomp3' components are in '[group1, group3]' hostgroups: count: 4, min: 1 max: 3");
// WHEN
underTest.validateBlueprintForStack(blueprint, hostGroups, instanceGroups);
// THEN throw exception
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class BlueprintValidatorTest method testKnoxWithKerberosButOneNodeMissingKnox.
@Test
public void testKnoxWithKerberosButOneNodeMissingKnox() throws IOException {
// GIVEN
Blueprint blueprint = createBlueprint();
Set<InstanceGroup> instanceGroups = new HashSet<>();
instanceGroups.add(createInstanceGroup("gateway1", 1, InstanceGroupType.GATEWAY));
instanceGroups.add(createInstanceGroup("gateway2", 1, InstanceGroupType.GATEWAY));
instanceGroups.add(createInstanceGroup("master", 1, InstanceGroupType.CORE));
Set<HostGroup> hostGroups = createHostGroups(instanceGroups);
JsonNodeFactory jsonNodeFactory = JsonNodeFactory.instance;
ObjectNode rootNode = jsonNodeFactory.objectNode();
ArrayNode hostGroupsNode = rootNode.putArray("host_groups");
addHostGroup(hostGroupsNode, "gateway1", SL_MIN0_MAX3, KNOX);
addHostGroup(hostGroupsNode, "gateway2", SL_MIN0_MAX3, MA_MIN1_MAX3);
addHostGroup(hostGroupsNode, "master", SL_MIN0_MAX3, MA_MIN1_MAX5);
BDDMockito.given(objectMapper.readTree(BLUEPRINT_STRING)).willReturn(rootNode);
Cluster cluster = new Cluster();
cluster.setSecure(true);
Gateway gateway = new Gateway();
gateway.setEnableGateway(true);
cluster.setGateway(gateway);
thrown.expect(BlueprintValidationException.class);
thrown.expectMessage("In case of Knox and Kerberos each 'Ambari Server' node must include the 'KNOX_GATEWAY' service. " + "The following host groups are missing the service: gateway2");
// WHEN
underTest.validateBlueprintForStack(cluster, blueprint, hostGroups, instanceGroups);
// THEN exception thrown
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class BlueprintValidatorTest method testKnoxWithNoCluster.
@Test
public void testKnoxWithNoCluster() throws IOException {
// GIVEN
Blueprint blueprint = createBlueprint();
Set<InstanceGroup> instanceGroups = createInstanceGroups();
Set<HostGroup> hostGroups = createHostGroups(instanceGroups);
instanceGroups.add(createInstanceGroup("gateway", 1));
JsonNode blueprintJsonTree = createJsonTree();
BDDMockito.given(objectMapper.readTree(BLUEPRINT_STRING)).willReturn(blueprintJsonTree);
// WHEN
underTest.validateBlueprintForStack(null, blueprint, hostGroups, instanceGroups);
// THEN no exception thrown
}
use of com.sequenceiq.cloudbreak.domain.HostGroup in project cloudbreak by hortonworks.
the class BlueprintValidatorTest method testValidateBlueprintForStackShouldThrowBadRequestExceptionWhenGroupCountsAreDifferent.
@Test
public void testValidateBlueprintForStackShouldThrowBadRequestExceptionWhenGroupCountsAreDifferent() throws IOException {
// GIVEN
Blueprint blueprint = createBlueprint();
Set<InstanceGroup> instanceGroups = createInstanceGroups();
Set<HostGroup> hostGroups = createHostGroups(instanceGroups);
instanceGroups.add(createInstanceGroup("gateway", 1));
JsonNode blueprintJsonTree = createJsonTreeWithTooMuchGroup();
BDDMockito.given(objectMapper.readTree(BLUEPRINT_STRING)).willReturn(blueprintJsonTree);
thrown.expect(BlueprintValidationException.class);
thrown.expectMessage(Matchers.startsWith("The host groups in the validation"));
// WHEN
underTest.validateBlueprintForStack(blueprint, hostGroups, instanceGroups);
// THEN throw exception
}
Aggregations