Search in sources :

Example 61 with Group

use of com.sequenceiq.cloudbreak.cloud.model.Group in project cloudbreak by hortonworks.

the class AzureTemplateBuilderTest method buildTestDataDisksShouldThrowAssertionError.

@Test
@Ignore
public void buildTestDataDisksShouldThrowAssertionError() {
    // GIVEN
    Network network = new Network(new Subnet("testSubnet"));
    Map<String, String> parameters = new HashMap<>();
    parameters.put("persistentStorage", "persistentStorageTest");
    parameters.put("attachedStorageOption", "attachedStorageOptionTest");
    InstanceAuthentication instanceAuthentication = new InstanceAuthentication("sshkey", "", "cloudbreak");
    groups.add(new Group(name, InstanceGroupType.GATEWAY, Collections.singletonList(instance), security, null, instanceAuthentication, instanceAuthentication.getLoginUserName(), instanceAuthentication.getPublicKey()));
    groups.add(new Group(name, InstanceGroupType.CORE, Collections.singletonList(instance), security, null, instanceAuthentication, instanceAuthentication.getLoginUserName(), instanceAuthentication.getPublicKey()));
    cloudStack = new CloudStack(groups, network, image, parameters, tags, azureTemplateBuilder.getTemplateString(), instanceAuthentication, instanceAuthentication.getLoginUserName(), instanceAuthentication.getPublicKey());
    azureStackView = new AzureStackView("mystack", 3, groups, azureStorageView, azureSubnetStrategy);
    // WHEN
    when(defaultCostTaggingService.prepareAllTagsForTemplate()).thenReturn(defaultTags);
    when(azureStorage.getImageStorageName(any(AzureCredentialView.class), any(CloudContext.class), any(CloudStack.class))).thenReturn("test");
    when(azureStorage.getDiskContainerName(any(CloudContext.class))).thenReturn("testStorageContainer");
    String templateString = azureTemplateBuilder.build(stackName, CUSTOM_IMAGE_NAME, azureCredentialView, azureStackView, cloudContext, cloudStack);
    // THEN
    gson.fromJson(templateString, Map.class);
    assertThat(templateString, containsString("[concat('datadisk', 'm0', '0')]"));
    assertThat(templateString, containsString("[concat('datadisk', 'm0', '1')]"));
    assertThat(templateString, containsString("[concat('datadisk', 'm0', '2')]"));
}
Also used : Group(com.sequenceiq.cloudbreak.cloud.model.Group) AzureCredentialView(com.sequenceiq.cloudbreak.cloud.azure.view.AzureCredentialView) InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) HashMap(java.util.HashMap) Network(com.sequenceiq.cloudbreak.cloud.model.Network) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) AzureStackView(com.sequenceiq.cloudbreak.cloud.azure.view.AzureStackView) Matchers.containsString(org.hamcrest.Matchers.containsString) Subnet(com.sequenceiq.cloudbreak.cloud.model.Subnet) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 62 with Group

use of com.sequenceiq.cloudbreak.cloud.model.Group in project cloudbreak by hortonworks.

the class StackUpscaleService method updateNodeCount.

private void updateNodeCount(Long stackId, Iterable<Group> originalGroups, Iterable<CloudResourceStatus> statuses) {
    for (Group group : originalGroups) {
        int nodeCount = group.getInstancesSize();
        removeFailedMetadata(stackId, statuses, group);
    }
}
Also used : InstanceGroup(com.sequenceiq.cloudbreak.domain.InstanceGroup) Group(com.sequenceiq.cloudbreak.cloud.model.Group)

Aggregations

Group (com.sequenceiq.cloudbreak.cloud.model.Group)62 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)37 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)36 Test (org.junit.Test)36 Network (com.sequenceiq.cloudbreak.cloud.model.Network)35 HashMap (java.util.HashMap)35 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)33 Subnet (com.sequenceiq.cloudbreak.cloud.model.Subnet)33 Matchers.containsString (org.hamcrest.Matchers.containsString)20 AzureCredentialView (com.sequenceiq.cloudbreak.cloud.azure.view.AzureCredentialView)17 AzureStackView (com.sequenceiq.cloudbreak.cloud.azure.view.AzureStackView)17 AmazonEC2Client (com.amazonaws.services.ec2.AmazonEC2Client)15 DescribeSubnetsResult (com.amazonaws.services.ec2.model.DescribeSubnetsResult)15 Vpc (com.amazonaws.services.ec2.model.Vpc)15 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)15 DescribeVpcsResult (com.amazonaws.services.ec2.model.DescribeVpcsResult)14 Location (com.sequenceiq.cloudbreak.cloud.model.Location)14 ArrayList (java.util.ArrayList)14 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)11 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)9