Search in sources :

Example 81 with Cluster

use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.

the class BlueprintValidatorTest method testKnoxWithKerberosAndEachGwHasKnox.

@Test
public void testKnoxWithKerberosAndEachGwHasKnox() 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", KNOX, 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);
    // WHEN
    underTest.validateBlueprintForStack(cluster, blueprint, hostGroups, instanceGroups);
// THEN no exception thrown
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Gateway(com.sequenceiq.cloudbreak.domain.Gateway) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) InstanceGroup(com.sequenceiq.cloudbreak.domain.InstanceGroup) HashSet(java.util.HashSet) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) Test(org.junit.Test)

Example 82 with Cluster

use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.

the class BlueprintValidatorTest method testKnoxWithKerberosButNoKnoxInTheBlueprintForAllNodes.

@Test
public void testKnoxWithKerberosButNoKnoxInTheBlueprintForAllNodes() 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, MA_MIN1_MAX1);
    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: gateway1,gateway2");
    // WHEN
    underTest.validateBlueprintForStack(cluster, blueprint, hostGroups, instanceGroups);
// THEN exception thrown
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Gateway(com.sequenceiq.cloudbreak.domain.Gateway) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) InstanceGroup(com.sequenceiq.cloudbreak.domain.InstanceGroup) HashSet(java.util.HashSet) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) Test(org.junit.Test)

Example 83 with Cluster

use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.

the class ClusterV1Controller method post.

@Override
public ClusterResponse post(Long stackId, ClusterRequest request) throws Exception {
    IdentityUser user = authenticatedUserService.getCbUser();
    Stack stack = stackService.getByIdWithLists(stackId);
    clusterCreationSetupService.validate(request, stack, user);
    Cluster cluster = clusterCreationSetupService.prepare(request, stack, user);
    return conversionService.convert(cluster, ClusterResponse.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Example 84 with Cluster

use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.

the class ClusterCredentialChangeService method finishCredentialReplace.

public void finishCredentialReplace(Long stackId, Long clusterId, String user, String password) {
    Cluster cluster = clusterService.getById(clusterId);
    cluster.setUserName(user);
    cluster.setPassword(password);
    finishCredentialChange(stackId, cluster);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster)

Example 85 with Cluster

use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.

the class StackPreTerminationAction method putClusterToDeleteInProgressState.

private void putClusterToDeleteInProgressState(Stack stack) {
    Cluster cluster = stack.getCluster();
    if (cluster != null) {
        cluster.setStatus(DELETE_IN_PROGRESS);
        clusterService.updateCluster(cluster);
    }
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster)

Aggregations

Cluster (com.sequenceiq.cloudbreak.domain.Cluster)144 Stack (com.sequenceiq.cloudbreak.domain.Stack)68 Test (org.junit.Test)64 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)31 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)26 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)22 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)22 HashMap (java.util.HashMap)22 HashSet (java.util.HashSet)15 List (java.util.List)15 ArrayList (java.util.ArrayList)13 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)12 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)12 BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)11 Matchers.anyString (org.mockito.Matchers.anyString)11 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)10 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)10 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)9 Json (com.sequenceiq.cloudbreak.domain.json.Json)9 PollingResult (com.sequenceiq.cloudbreak.service.PollingResult)9