use of com.sequenceiq.cloudbreak.client.CloudbreakClient.CloudbreakClientBuilder in project cloudbreak by hortonworks.
the class CloudbreakTestSuiteInitializer method initCloudbreakSuite.
@BeforeSuite(dependsOnMethods = "initContext")
@Parameters({ "cloudbreakServer", "cloudProvider", "credentialName", "instanceGroups", "hostGroups", "blueprintName", "stackName", "networkName", "securityGroupName" })
public void initCloudbreakSuite(@Optional("") String cloudbreakServer, @Optional("") String cloudProvider, @Optional("") String credentialName, @Optional("") String instanceGroups, @Optional("") String hostGroups, @Optional("") String blueprintName, @Optional("") String stackName, @Optional("") String networkName, @Optional("") String securityGroupName) {
cloudbreakServer = StringUtils.hasLength(cloudbreakServer) ? cloudbreakServer : defaultCloudbreakServer;
String cbServerRoot = cloudbreakServer + cbRootContextPath;
itContext.putContextParam(CloudbreakITContextConstants.SKIP_REMAINING_SUITETEST_AFTER_ONE_FAILED, skipRemainingSuiteTestsAfterOneFailed);
itContext.putContextParam(CloudbreakITContextConstants.CLOUDBREAK_SERVER, cloudbreakServer);
itContext.putContextParam(CloudbreakITContextConstants.CLOUDBREAK_SERVER_ROOT, cbServerRoot);
itContext.putContextParam(CloudbreakITContextConstants.CLOUDPROVIDER, cloudProvider);
String identity = itContext.getContextParam(IntegrationTestContext.IDENTITY_URL);
String user = itContext.getContextParam(IntegrationTestContext.AUTH_USER);
String password = itContext.getContextParam(IntegrationTestContext.AUTH_PASSWORD);
CloudbreakClient cloudbreakClient = new CloudbreakClientBuilder(cbServerRoot, identity, "cloudbreak_shell").withCertificateValidation(false).withIgnorePreValidation(true).withDebug(true).withCredential(user, password).build();
itContext.putContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, cloudbreakClient);
if (cleanUpBeforeStart) {
cleanUpService.deleteTestStacksAndResources(cloudbreakClient);
}
putBlueprintToContextIfExist(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).blueprintEndpoint(), blueprintName);
putNetworkToContext(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).networkEndpoint(), cloudProvider, networkName);
putSecurityGroupToContext(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).securityGroupEndpoint(), cloudProvider, securityGroupName);
putCredentialToContext(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).credentialEndpoint(), cloudProvider, credentialName);
putStackToContextIfExist(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).stackV1Endpoint(), stackName);
if (StringUtils.hasLength(instanceGroups)) {
List<String[]> instanceGroupStrings = templateAdditionHelper.parseCommaSeparatedRows(instanceGroups);
itContext.putContextParam(CloudbreakITContextConstants.TEMPLATE_ID, createInstanceGroups(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).templateEndpoint(), instanceGroupStrings));
}
if (StringUtils.hasLength(hostGroups)) {
List<String[]> hostGroupStrings = templateAdditionHelper.parseCommaSeparatedRows(hostGroups);
itContext.putContextParam(CloudbreakITContextConstants.HOSTGROUP_ID, createHostGroups(hostGroupStrings));
}
}
Aggregations