Search in sources :

Example 11 with KerberosRequest

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

the class KerberosConfigToKerberosRequestConverter method convert.

@Override
public KerberosRequest convert(KerberosConfig source) {
    KerberosRequest config = new KerberosRequest();
    config.setTcpAllowed(source.getTcpAllowed());
    config.setPassword("");
    switch(source.getType()) {
        case CB_MANAGED:
            config.setMasterKey("");
            config.setAdmin(source.getAdmin());
            break;
        case EXISTING_AD:
            config.setPrincipal(source.getPrincipal());
            config.setUrl(source.getUrl());
            config.setAdminUrl(source.getAdminUrl());
            config.setRealm(source.getRealm());
            config.setLdapUrl(source.getLdapUrl());
            config.setContainerDn(source.getContainerDn());
            break;
        case EXISTING_MIT:
            config.setPrincipal(source.getPrincipal());
            config.setUrl(source.getUrl());
            config.setAdminUrl(source.getAdminUrl());
            config.setRealm(source.getRealm());
            break;
        case CUSTOM:
            config.setPrincipal(source.getPrincipal());
            config.setDescriptor(source.getDescriptor());
            config.setKrb5Conf(source.getKrb5Conf());
            break;
        default:
    }
    return config;
}
Also used : KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest)

Example 12 with KerberosRequest

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

the class AbstractStackCreationV2Test method ambariParameters.

@BeforeMethod(dependsOnGroups = "V2StackCreationInit")
@Parameters({ "blueprintName", "enableSecurity", "kerberosMasterKey", "kerberosAdmin", "kerberosPassword" })
public void ambariParameters(@Optional("") String blueprintName, @Optional("false") boolean enableSecurity, @Optional String kerberosMasterKey, @Optional String kerberosAdmin, @Optional String kerberosPassword) {
    IntegrationTestContext itContext = getItContext();
    blueprintName = StringUtils.hasText(blueprintName) ? blueprintName : itContext.getContextParam(CloudbreakV2Constants.SSH_PUBLICKEY_ID);
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID), "Ambari user is mandatory.");
    Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID), "Ambari password is mandatory.");
    Assert.assertNotNull(blueprintName, "blueprint name is mandatory.");
    StackV2Request stackV2Request = itContext.getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    ClusterV2Request clusterV2Request = new ClusterV2Request();
    stackV2Request.setCluster(clusterV2Request);
    AmbariV2Request ambariV2Request = new AmbariV2Request();
    clusterV2Request.setAmbari(ambariV2Request);
    ambariV2Request.setBlueprintName(blueprintName);
    ambariV2Request.setUserName(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID));
    ambariV2Request.setPassword(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID));
    GatewayJson gatewayJson = new GatewayJson();
    gatewayJson.setEnableGateway(Boolean.FALSE);
    gatewayJson.setExposedServices(ImmutableList.of("ALL"));
    ambariV2Request.setGateway(gatewayJson);
    if (enableSecurity) {
        ambariV2Request.setEnableSecurity(enableSecurity);
        KerberosRequest kerberosRequest = new KerberosRequest();
        kerberosRequest.setMasterKey(kerberosMasterKey);
        kerberosRequest.setAdmin(kerberosAdmin);
        kerberosRequest.setPassword(kerberosPassword);
        ambariV2Request.setKerberos(kerberosRequest);
    }
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) ClusterV2Request(com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request) GatewayJson(com.sequenceiq.cloudbreak.api.model.GatewayJson) Parameters(org.testng.annotations.Parameters) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 13 with KerberosRequest

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

the class KerberosTypeTest method testCloudbreakManaged.

@Test
public void testCloudbreakManaged() {
    KerberosRequest request = new KerberosRequest();
    request.setMasterKey("mk");
    request.setAdmin("adm");
    request.setPassword("pwd");
    Assert.assertEquals(KerberosType.CB_MANAGED, KerberosType.valueOf(request));
}
Also used : KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) Test(org.junit.Test)

Example 14 with KerberosRequest

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

the class KerberosTypeTest method testExistingMit.

@Test
public void testExistingMit() {
    KerberosRequest request = new KerberosRequest();
    request.setPrincipal("prnc");
    request.setPassword("pwd");
    request.setUrl("url");
    request.setAdminUrl("admurl");
    request.setRealm("rlm");
    Assert.assertEquals(KerberosType.EXISTING_MIT, KerberosType.valueOf(request));
}
Also used : KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) Test(org.junit.Test)

Example 15 with KerberosRequest

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

the class KerberosTypeTest method testCloudbreakManagedMissing.

@Test
public void testCloudbreakManagedMissing() {
    KerberosRequest request = new KerberosRequest();
    request.setMasterKey("mk");
    request.setAdmin("adm");
    Assert.assertNull(KerberosType.valueOf(request));
}
Also used : KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) 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