Search in sources :

Example 1 with StackAuthenticationRequest

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

the class GcpCloudProvider method stackauth.

@Override
StackAuthenticationRequest stackauth() {
    StackAuthenticationRequest stackauth = new StackAuthenticationRequest();
    stackauth.setPublicKey(getTestParameter().get(CloudProviderHelper.INTEGRATIONTEST_PUBLIC_KEY_FILE).substring(BEGIN_INDEX));
    return stackauth;
}
Also used : StackAuthenticationRequest(com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)

Example 2 with StackAuthenticationRequest

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

the class OpenstackCloudProvider method stackauth.

@Override
StackAuthenticationRequest stackauth() {
    StackAuthenticationRequest stackauth = new StackAuthenticationRequest();
    stackauth.setPublicKey(getTestParameter().get(CloudProviderHelper.INTEGRATIONTEST_PUBLIC_KEY_FILE).substring(BEGIN_INDEX));
    return stackauth;
}
Also used : StackAuthenticationRequest(com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)

Example 3 with StackAuthenticationRequest

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

the class AzureCloudProvider method stackauth.

@Override
StackAuthenticationRequest stackauth() {
    StackAuthenticationRequest stackauth = new StackAuthenticationRequest();
    stackauth.setPublicKey(getTestParameter().get(INTEGRATIONTEST_PUBLIC_KEY_FILE).substring(BEGIN_INDEX));
    return stackauth;
}
Also used : StackAuthenticationRequest(com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)

Example 4 with StackAuthenticationRequest

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

the class StackCreationTest method testStackCreation.

@Test
@Parameters({ "stackName", "region", "onFailureAction", "threshold", "adjustmentType", "variant", "availabilityZone", "persistentStorage", "orchestrator", "userDefinedTags", "publicKeyFile" })
public void testStackCreation(@Optional("testing1") String stackName, @Optional("europe-west1") String region, @Optional("DO_NOTHING") String onFailureAction, @Optional("4") Long threshold, @Optional("EXACT") String adjustmentType, @Optional("") String variant, @Optional String availabilityZone, @Optional String persistentStorage, @Optional("SALT") String orchestrator, @Optional("") String userDefinedTags, @Optional("") String publicKeyFile) throws Exception {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    List<InstanceGroup> instanceGroups = itContext.getContextParam(CloudbreakITContextConstants.TEMPLATE_ID, List.class);
    List<InstanceGroupRequest> igMap = new ArrayList<>();
    for (InstanceGroup ig : instanceGroups) {
        InstanceGroupRequest instanceGroupRequest = new InstanceGroupRequest();
        instanceGroupRequest.setGroup(ig.getName());
        instanceGroupRequest.setNodeCount(ig.getNodeCount());
        instanceGroupRequest.setTemplateId(Long.valueOf(ig.getTemplateId()));
        instanceGroupRequest.setType(InstanceGroupType.valueOf(ig.getType()));
        instanceGroupRequest.setSecurityGroupId(Long.valueOf(itContext.getContextParam(CloudbreakITContextConstants.SECURITY_GROUP_ID)));
        igMap.add(instanceGroupRequest);
    }
    String credentialId = itContext.getContextParam(CloudbreakITContextConstants.CREDENTIAL_ID);
    String networkId = itContext.getContextParam(CloudbreakITContextConstants.NETWORK_ID);
    publicKeyFile = StringUtils.hasLength(publicKeyFile) ? publicKeyFile : defaultPublicKeyFile;
    String publicKey = ResourceUtil.readStringFromResource(applicationContext, publicKeyFile).replaceAll("\n", "");
    StackRequest stackRequest = new StackRequest();
    StackAuthenticationRequest stackAuthenticationRequest = new StackAuthenticationRequest();
    stackAuthenticationRequest.setPublicKey(publicKey);
    stackRequest.setStackAuthentication(stackAuthenticationRequest);
    stackRequest.setName(stackName);
    stackRequest.setCredentialId(Long.valueOf(credentialId));
    stackRequest.setRegion(region);
    stackRequest.setOnFailureAction(OnFailureAction.valueOf(onFailureAction));
    FailurePolicyRequest failurePolicyRequest = new FailurePolicyRequest();
    failurePolicyRequest.setAdjustmentType(AdjustmentType.valueOf(adjustmentType));
    failurePolicyRequest.setThreshold(threshold);
    stackRequest.setFailurePolicy(failurePolicyRequest);
    stackRequest.setNetworkId(Long.valueOf(networkId));
    stackRequest.setPlatformVariant(variant);
    stackRequest.setAvailabilityZone(availabilityZone);
    stackRequest.setInstanceGroups(igMap);
    if (!userDefinedTags.isEmpty()) {
        stackRequest.setUserDefinedTags(TagsUtil.getTagsToCheck(userDefinedTags));
    }
    OrchestratorRequest orchestratorRequest = new OrchestratorRequest();
    orchestratorRequest.setType(orchestrator);
    stackRequest.setOrchestrator(orchestratorRequest);
    Map<String, String> map = new HashMap<>();
    if (persistentStorage != null && !persistentStorage.isEmpty()) {
        map.put("persistentStorage", persistentStorage);
    }
    stackRequest.setParameters(map);
    // WHEN
    String stackId = getCloudbreakClient().stackV1Endpoint().postPrivate(stackRequest).getId().toString();
    // THEN
    Assert.assertNotNull(stackId);
    itContext.putCleanUpParam(CloudbreakITContextConstants.STACK_ID, stackId);
    CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(), stackId, "AVAILABLE");
    itContext.putContextParam(CloudbreakITContextConstants.STACK_ID, stackId);
    ScalingUtil.putInstanceCountToContext(itContext, stackId);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) StackAuthenticationRequest(com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest) InstanceGroupRequest(com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StackRequest(com.sequenceiq.cloudbreak.api.model.StackRequest) OrchestratorRequest(com.sequenceiq.cloudbreak.api.model.OrchestratorRequest) FailurePolicyRequest(com.sequenceiq.cloudbreak.api.model.FailurePolicyRequest) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test)

Example 5 with StackAuthenticationRequest

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

the class StackAuthenticationToStackAuthenticationRequestConverter method convert.

@Override
public StackAuthenticationRequest convert(StackAuthentication source) {
    StackAuthenticationRequest stackAuthenticationRequest = new StackAuthenticationRequest();
    stackAuthenticationRequest.setLoginUserName(null);
    stackAuthenticationRequest.setPublicKey(source.getPublicKey());
    stackAuthenticationRequest.setPublicKeyId(source.getPublicKeyId());
    return stackAuthenticationRequest;
}
Also used : StackAuthenticationRequest(com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)

Aggregations

StackAuthenticationRequest (com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)8 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)3 Parameters (org.testng.annotations.Parameters)3 FailurePolicyRequest (com.sequenceiq.cloudbreak.api.model.FailurePolicyRequest)2 InstanceGroupRequest (com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest)2 OrchestratorRequest (com.sequenceiq.cloudbreak.api.model.OrchestratorRequest)2 StackRequest (com.sequenceiq.cloudbreak.api.model.StackRequest)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Test (org.testng.annotations.Test)2 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)1 AbstractCloudbreakIntegrationTest (com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest)1 InstanceGroup (com.sequenceiq.it.cloudbreak.InstanceGroup)1 BeforeMethod (org.testng.annotations.BeforeMethod)1