Search in sources :

Example 1 with Builder

use of com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder in project cloudbreak by hortonworks.

the class AwsPlatformResourcesTest method collectInstanceStorageCountWhenInstanceTypeIsNotFoundTest.

@Test
void collectInstanceStorageCountWhenInstanceTypeIsNotFoundTest() {
    ReflectionTestUtils.setField(underTest, "disabledInstanceTypes", Collections.emptyList());
    CloudContext cloudContext = new Builder().withLocation(Location.location(region, availabilityZone(AZ_NAME))).build();
    AuthenticatedContext ac = new AuthenticatedContext(cloudContext, cloudCredential);
    InstanceStoreMetadata instanceStoreMetadata = underTest.collectInstanceStorageCount(ac, Collections.singletonList("unsupported"), List.of());
    assertNull(instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("unsupported"));
    assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("unsupported"));
    assertNull(instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("m5.2xlarge"));
    assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("m5.2xlarge"));
    instanceStoreMetadata = underTest.collectInstanceStorageCount(ac, new ArrayList<>(), List.of());
    assertNull(instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("m5.2xlarge"));
    assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("m5.2xlarge"));
}
Also used : CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) Builder(com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder) ArrayList(java.util.ArrayList) InstanceStoreMetadata(com.sequenceiq.cloudbreak.cloud.model.InstanceStoreMetadata) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) Test(org.junit.jupiter.api.Test)

Example 2 with Builder

use of com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder in project cloudbreak by hortonworks.

the class AwsPlatformResourcesTest method collectInstanceStorageCountTest.

@Test
void collectInstanceStorageCountTest() {
    ReflectionTestUtils.setField(underTest, "disabledInstanceTypes", Collections.emptyList());
    CloudContext cloudContext = new Builder().withLocation(Location.location(region, availabilityZone(AZ_NAME))).build();
    AuthenticatedContext ac = new AuthenticatedContext(cloudContext, cloudCredential);
    InstanceStoreMetadata instanceStoreMetadata = underTest.collectInstanceStorageCount(ac, Collections.singletonList("m5.2xlarge"), List.of());
    assertEquals(2, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCount("m5.2xlarge"));
    assertEquals(0, instanceStoreMetadata.mapInstanceTypeToInstanceStoreCountNullHandled("unsupported"));
}
Also used : CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) Builder(com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder) InstanceStoreMetadata(com.sequenceiq.cloudbreak.cloud.model.InstanceStoreMetadata) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) Test(org.junit.jupiter.api.Test)

Aggregations

AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)2 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)2 Builder (com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder)2 InstanceStoreMetadata (com.sequenceiq.cloudbreak.cloud.model.InstanceStoreMetadata)2 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1