Search in sources :

Example 1 with AmbariV2Request

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

the class MockStackCreationV2Test method testStackCreation.

@Test
public void testStackCreation() throws Exception {
    // GIVEN
    // WHEN
    super.testStackCreation();
    // THEN
    StackCreationMock stackCreationMock = getItContext().getContextParam(CloudbreakV2Constants.MOCK_SERVER, StackCreationMock.class);
    String stackName = getItContext().getContextParam(CloudbreakV2Constants.STACK_NAME);
    stackCreationMock.verifyCalls(stackName);
    StackV2Request stackV2Request = getItContext().getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class);
    AmbariV2Request ambariV2Request = stackV2Request.getCluster().getAmbari();
    if (ambariV2Request.getEnableSecurity()) {
        KerberosRequest kerberosRequest = ambariV2Request.getKerberos();
        stackCreationMock.verifyKerberosCalls(stackName, kerberosRequest.getAdmin(), kerberosRequest.getPassword());
    }
}
Also used : StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) Test(org.testng.annotations.Test) AbstractStackCreationV2Test(com.sequenceiq.it.cloudbreak.v2.AbstractStackCreationV2Test)

Example 2 with AmbariV2Request

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

the class CloudProviderHelper method ambariRequestWithBlueprintId.

@Override
public AmbariV2Request ambariRequestWithBlueprintId(Long id) {
    AmbariV2Request req = new AmbariV2Request();
    req.setUserName(testParameter.get(DEFAULT_AMBARI_USER));
    req.setPassword(testParameter.get(DEFAULT_AMBARI_PASSWORD));
    req.setBlueprintId(id);
    return req;
}
Also used : AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request)

Example 3 with AmbariV2Request

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

the class ClusterToAmbariV2RequestRequestConverter method convert.

@Override
public AmbariV2Request convert(Cluster source) {
    AmbariV2Request ambariV2Request = new AmbariV2Request();
    ambariV2Request.setBlueprintName(source.getBlueprint().getName());
    prepareAmbariRepo(source, ambariV2Request);
    prepareStackRepoDetails(source, ambariV2Request);
    prepareBlueprintInputs(source, ambariV2Request);
    ambariV2Request.setConfigStrategy(null);
    ambariV2Request.setConnectedCluster(null);
    ambariV2Request.setEnableSecurity(source.isSecure());
    ambariV2Request.setGateway(null);
    ambariV2Request.setPassword("");
    ambariV2Request.setUserName(source.getUserName());
    ambariV2Request.setValidateBlueprint(null);
    if (source.isSecure() && source.getKerberosConfig() != null) {
        ambariV2Request.setKerberos(getConversionService().convert(source.getKerberosConfig(), KerberosRequest.class));
    }
    return ambariV2Request;
}
Also used : AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest)

Example 4 with AmbariV2Request

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

the class ClusterV2RequestToClusterRequestConverter method convert.

@Override
public ClusterRequest convert(ClusterV2Request source) {
    ClusterRequest cluster = new ClusterRequest();
    cluster.setExecutorType(source.getExecutorType());
    cluster.setEmailNeeded(source.getEmailNeeded());
    cluster.setEmailTo(source.getEmailTo());
    cluster.setFileSystem(source.getFileSystem());
    cluster.setName(source.getName());
    if (source.getRdsConfigNames() != null && !source.getRdsConfigNames().isEmpty()) {
        cluster.setRdsConfigNames(source.getRdsConfigNames());
    }
    cluster.setProxyName(source.getProxyName());
    cluster.setLdapConfigName(source.getLdapConfigName());
    AmbariV2Request ambariRequest = source.getAmbari();
    if (ambariRequest != null) {
        cluster.setAmbariDatabaseDetails(ambariRequest.getAmbariDatabaseDetails());
        cluster.setAmbariRepoDetailsJson(ambariRequest.getAmbariRepoDetailsJson());
        cluster.setAmbariStackDetails(ambariRequest.getAmbariStackDetails());
        cluster.setBlueprintCustomPropertiesAsString(ambariRequest.getBlueprintCustomProperties());
        cluster.setBlueprintId(ambariRequest.getBlueprintId());
        cluster.setBlueprintName(ambariRequest.getBlueprintName());
        cluster.setBlueprintInputs(ambariRequest.getBlueprintInputs());
        cluster.setConfigStrategy(ambariRequest.getConfigStrategy());
        cluster.setConnectedCluster(ambariRequest.getConnectedCluster());
        cluster.setEnableSecurity(ambariRequest.getEnableSecurity());
        cluster.setGateway(ambariRequest.getGateway());
        cluster.setKerberos(ambariRequest.getKerberos());
        cluster.setPassword(ambariRequest.getPassword());
        cluster.setUserName(ambariRequest.getUserName());
        cluster.setValidateBlueprint(ambariRequest.getValidateBlueprint());
        cluster.setAmbariSecurityMasterKey(ambariRequest.getAmbariSecurityMasterKey());
    }
    cluster.setHostGroups(new HashSet<>());
    return cluster;
}
Also used : AmbariV2Request(com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request) ClusterRequest(com.sequenceiq.cloudbreak.api.model.ClusterRequest)

Example 5 with AmbariV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request 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)

Aggregations

AmbariV2Request (com.sequenceiq.cloudbreak.api.model.v2.AmbariV2Request)6 KerberosRequest (com.sequenceiq.cloudbreak.api.model.KerberosRequest)3 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)2 ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)1 GatewayJson (com.sequenceiq.cloudbreak.api.model.GatewayJson)1 ClusterV2Request (com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 AbstractStackCreationV2Test (com.sequenceiq.it.cloudbreak.v2.AbstractStackCreationV2Test)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Parameters (org.testng.annotations.Parameters)1 Test (org.testng.annotations.Test)1