Search in sources :

Example 6 with KerberosRequest

use of com.sequenceiq.cloudbreak.api.model.KerberosRequest in project cloudbreak by hortonworks.

the class ClusterCreationTest method testClusterCreation.

@Test
@Parameters({ "clusterName", "emailNeeded", "enableSecurity", "kerberosMasterKey", "kerberosAdmin", "kerberosPassword", "runRecipesOnHosts", "checkAmbari", "withRDSConfig", "autoRecoveryMode", "withFs" })
public void testClusterCreation(@Optional("it-cluster") String clusterName, @Optional("false") boolean emailNeeded, @Optional("false") boolean enableSecurity, @Optional String kerberosMasterKey, @Optional String kerberosAdmin, @Optional String kerberosPassword, @Optional("") String runRecipesOnHosts, @Optional("true") boolean checkAmbari, @Optional("false") boolean withRDSConfig, @Optional("false") boolean autoRecoveryMode, @Optional("false") boolean withFs) throws Exception {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    String stackIdStr = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
    Integer stackId = Integer.valueOf(stackIdStr);
    Integer blueprintId = Integer.valueOf(itContext.getContextParam(CloudbreakITContextConstants.BLUEPRINT_ID));
    List<HostGroup> hostgroups = itContext.getContextParam(CloudbreakITContextConstants.HOSTGROUP_ID, List.class);
    Set<HostGroupRequest> hostGroupJsons1 = convertHostGroups(hostgroups, runRecipesOnHosts, autoRecoveryMode);
    String ambariUser = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID);
    String ambariPassword = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID);
    String ambariPort = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID);
    // WHEN
    ClusterRequest clusterRequest = new ClusterRequest();
    clusterRequest.setName(clusterName);
    clusterRequest.setDescription("Cluster for integration test");
    clusterRequest.setEnableSecurity(enableSecurity);
    clusterRequest.setPassword(ambariPassword);
    clusterRequest.setUserName(ambariUser);
    clusterRequest.setBlueprintId(Long.valueOf(blueprintId));
    clusterRequest.setHostGroups(hostGroupJsons1);
    if (withRDSConfig) {
        clusterRequest = setRDSConfiguration(itContext, clusterRequest);
    }
    if (withFs) {
        clusterRequest = setFileSystem(itContext, clusterRequest);
    }
    if (enableSecurity) {
        KerberosRequest kerberosRequest = new KerberosRequest();
        kerberosRequest.setAdmin(kerberosAdmin);
        kerberosRequest.setPassword(kerberosPassword);
        kerberosRequest.setMasterKey(kerberosMasterKey);
        clusterRequest.setKerberos(kerberosRequest);
    }
    ClusterV1Endpoint clusterV1Endpoint = getCloudbreakClient().clusterEndpoint();
    Long clusterId = clusterV1Endpoint.post(Long.valueOf(stackId), clusterRequest).getId();
    // THEN
    Assert.assertNotNull(clusterId);
    CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(), stackIdStr, "AVAILABLE");
    CloudbreakUtil.checkClusterAvailability(getCloudbreakClient().stackV1Endpoint(), ambariPort, stackIdStr, ambariUser, ambariPassword, checkAmbari);
    if (Boolean.TRUE.equals(withRDSConfig)) {
        checkRDSConfigWithCluster(itContext, clusterName);
    }
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) ClusterV1Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v1.ClusterV1Endpoint) ClusterRequest(com.sequenceiq.cloudbreak.api.model.ClusterRequest) HostGroupRequest(com.sequenceiq.cloudbreak.api.model.HostGroupRequest) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 7 with KerberosRequest

use of com.sequenceiq.cloudbreak.api.model.KerberosRequest in project cloudbreak by hortonworks.

the class KerberosConfigToKerberosRequestConverterTest method testCustom.

@Test
public void testCustom() {
    KerberosConfig config = new KerberosConfig();
    config.setType(KerberosType.CUSTOM);
    config.setPassword("");
    config.setPrincipal("");
    config.setDescriptor("");
    config.setKrb5Conf("");
    config.setTcpAllowed(true);
    KerberosRequest request = underTest.convert(config);
    assertAllFieldsNotNull(request, Lists.newArrayList("admin", "url", "adminUrl", "realm", "ldapUrl", "containerDn", "masterKey", "principal"));
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) AbstractConverterTest(com.sequenceiq.cloudbreak.converter.AbstractConverterTest) Test(org.junit.Test)

Example 8 with KerberosRequest

use of com.sequenceiq.cloudbreak.api.model.KerberosRequest in project cloudbreak by hortonworks.

the class KerberosConfigToKerberosRequestConverterTest method testCbManaged.

@Test
public void testCbManaged() {
    KerberosConfig config = TestUtil.kerberosConfig();
    KerberosRequest request = underTest.convert(config);
    assertAllFieldsNotNull(request, Lists.newArrayList("url", "adminUrl", "realm", "ldapUrl", "containerDn", "descriptor", "krb5Conf", "principal"));
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) AbstractConverterTest(com.sequenceiq.cloudbreak.converter.AbstractConverterTest) Test(org.junit.Test)

Example 9 with KerberosRequest

use of com.sequenceiq.cloudbreak.api.model.KerberosRequest in project cloudbreak by hortonworks.

the class KerberosConfigToKerberosRequestConverterTest method testExistingAd.

@Test
public void testExistingAd() {
    KerberosConfig config = new KerberosConfig();
    config.setType(KerberosType.EXISTING_AD);
    config.setPassword("");
    config.setPrincipal("");
    config.setUrl("");
    config.setAdminUrl("");
    config.setRealm("");
    config.setLdapUrl("");
    config.setContainerDn("");
    config.setTcpAllowed(true);
    KerberosRequest request = underTest.convert(config);
    assertAllFieldsNotNull(request, Lists.newArrayList("admin", "descriptor", "krb5Conf", "masterKey"));
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) AbstractConverterTest(com.sequenceiq.cloudbreak.converter.AbstractConverterTest) Test(org.junit.Test)

Example 10 with KerberosRequest

use of com.sequenceiq.cloudbreak.api.model.KerberosRequest in project cloudbreak by hortonworks.

the class KerberosConfigToKerberosRequestConverterTest method testExistingMit.

@Test
public void testExistingMit() {
    KerberosConfig config = new KerberosConfig();
    config.setType(KerberosType.EXISTING_MIT);
    config.setPassword("");
    config.setPrincipal("");
    config.setUrl("");
    config.setAdminUrl("");
    config.setRealm("");
    config.setTcpAllowed(true);
    KerberosRequest request = underTest.convert(config);
    assertAllFieldsNotNull(request, Lists.newArrayList("admin", "ldapUrl", "containerDn", "descriptor", "krb5Conf", "masterKey"));
}
Also used : KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) AbstractConverterTest(com.sequenceiq.cloudbreak.converter.AbstractConverterTest) Test(org.junit.Test)

Aggregations

KerberosRequest (com.sequenceiq.cloudbreak.api.model.KerberosRequest)17 Test (org.junit.Test)11 AbstractConverterTest (com.sequenceiq.cloudbreak.converter.AbstractConverterTest)4 KerberosConfig (com.sequenceiq.cloudbreak.domain.KerberosConfig)4 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)4 Parameters (org.testng.annotations.Parameters)4 Test (org.testng.annotations.Test)4 ClusterV1Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.ClusterV1Endpoint)3 ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)3 HostGroupRequest (com.sequenceiq.cloudbreak.api.model.HostGroupRequest)3 GatewayJson (com.sequenceiq.cloudbreak.api.model.GatewayJson)2 AmbariV2Request (com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request)2 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)2 HostGroup (com.sequenceiq.it.cloudbreak.HostGroup)2 ClusterV2Request (com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request)1 CloudVmMetaDataStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)1 AbstractCloudbreakIntegrationTest (com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest)1 AbstractMockIntegrationTest (com.sequenceiq.it.cloudbreak.AbstractMockIntegrationTest)1 AbstractStackCreationV2Test (com.sequenceiq.it.cloudbreak.v2.AbstractStackCreationV2Test)1 StackCreationMock (com.sequenceiq.it.cloudbreak.v2.mock.StackCreationMock)1