use of com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsResult in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method setUp.
@BeforeEach
public void setUp() {
AvailabilityZone availabilityZone = new AvailabilityZone();
availabilityZone.setZoneName(AZ_NAME);
Region awsRegion = new Region();
awsRegion.setRegionName(REGION_NAME);
InstanceTypeOffering instanceTypeOffering = new InstanceTypeOffering();
instanceTypeOffering.setInstanceType("m5.2xlarge");
instanceTypeInfos = new ArrayList<>();
instanceTypeInfos.add(getInstanceTypeInfo("m5.2xlarge"));
describeInstanceTypesResult.setInstanceTypes(instanceTypeInfos);
when(awsDefaultZoneProvider.getDefaultZone(any(CloudCredential.class))).thenReturn(REGION_NAME);
when(awsClient.createEc2Client(any(AwsCredentialView.class))).thenReturn(amazonEC2Client);
when(awsClient.createEc2Client(any(AwsCredentialView.class), any())).thenReturn(amazonEC2Client);
when(amazonEC2Client.describeRegions(any(DescribeRegionsRequest.class))).thenReturn(describeRegionsResult);
when(describeRegionsResult.getRegions()).thenReturn(Collections.singletonList(awsRegion));
when(awsAvailabilityZoneProvider.describeAvailabilityZones(any(), any(), any())).thenReturn(List.of(availabilityZone));
when(amazonEC2Client.describeInstanceTypeOfferings(any(DescribeInstanceTypeOfferingsRequest.class))).thenReturn(describeInstanceTypeOfferingsResult);
when(amazonEC2Client.describeInstanceTypes(any(DescribeInstanceTypesRequest.class))).thenReturn(describeInstanceTypesResult);
when(describeInstanceTypesResult.getInstanceTypes()).thenReturn(instanceTypeInfos);
when(describeInstanceTypeOfferingsResult.getInstanceTypeOfferings()).thenReturn(Collections.singletonList(instanceTypeOffering));
ReflectionTestUtils.setField(underTest, "fetchMaxItems", 500);
region = region(REGION_NAME);
ReflectionTestUtils.setField(underTest, "enabledRegions", Set.of(region));
ReflectionTestUtils.setField(underTest, "enabledAvailabilityZones", Set.of(availabilityZone(AZ_NAME)));
cloudCredential = new ExtendedCloudCredential(new CloudCredential("crn", "aws-credential", "account"), "AWS", null, "crn", "id", new ArrayList<>());
}
Aggregations