Search in sources :

Example 6 with CloudDatabaseServerSslCertificate

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

the class AwsPlatformResourcesTest method verifySslRootCertificate.

private void verifySslRootCertificate(Set<CloudDatabaseServerSslCertificate> sslCertificates, String certificateIdentifier) {
    Optional<CloudDatabaseServerSslCertificate> match = sslCertificates.stream().filter(c -> certificateIdentifier.equals(c.getCertificateIdentifier())).findFirst();
    assertThat(match).overridingErrorMessage("No cert found for certificateIdentifier %s", certificateIdentifier).isNotEmpty();
    CloudDatabaseServerSslCertificate sslCertificate = match.get();
    assertThat(sslCertificate.getCertificateType()).isEqualTo(CloudDatabaseServerSslCertificateType.ROOT);
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) CloudVmTypes(com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) EbsInfo(com.amazonaws.services.ec2.model.EbsInfo) AvailabilityZone.availabilityZone(com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone.availabilityZone) ExtendedCloudCredential(com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential) CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Date(java.util.Date) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) MemoryInfo(com.amazonaws.services.ec2.model.MemoryInfo) ListKeysRequest(com.amazonaws.services.kms.model.ListKeysRequest) VCpuInfo(com.amazonaws.services.ec2.model.VCpuInfo) InstanceProfile(com.amazonaws.services.identitymanagement.model.InstanceProfile) DescribeSubnetsResult(com.amazonaws.services.ec2.model.DescribeSubnetsResult) ListAliasesRequest(com.amazonaws.services.kms.model.ListAliasesRequest) AwsCredentialView(com.sequenceiq.cloudbreak.cloud.aws.common.view.AwsCredentialView) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) EbsEncryptionSupport(com.amazonaws.services.ec2.model.EbsEncryptionSupport) ListTablesRequest(com.amazonaws.services.dynamodbv2.model.ListTablesRequest) Map(java.util.Map) Location(com.sequenceiq.cloudbreak.cloud.model.Location) AmazonIdentityManagementClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonIdentityManagementClient) BadRequestException(javax.ws.rs.BadRequestException) Region(com.amazonaws.services.ec2.model.Region) DescribeKeyResult(com.amazonaws.services.kms.model.DescribeKeyResult) InstanceStoreMetadata(com.sequenceiq.cloudbreak.cloud.model.InstanceStoreMetadata) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) DescribeRegionsRequest(com.amazonaws.services.ec2.model.DescribeRegionsRequest) AmazonServiceException(com.amazonaws.AmazonServiceException) CloudEncryptionKeys(com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys) Set(java.util.Set) InstanceStorageInfo(com.amazonaws.services.ec2.model.InstanceStorageInfo) CloudNoSqlTables(com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables) Test(org.junit.jupiter.api.Test) InstanceTypeOffering(com.amazonaws.services.ec2.model.InstanceTypeOffering) List(java.util.List) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) DescribeInstanceTypeOfferingsResult(com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsResult) Optional(java.util.Optional) DescribeCertificatesRequest(com.amazonaws.services.rds.model.DescribeCertificatesRequest) CloudDatabaseServerSslCertificates(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificates) DescribeKeyRequest(com.amazonaws.services.kms.model.DescribeKeyRequest) DescribeRouteTablesResult(com.amazonaws.services.ec2.model.DescribeRouteTablesResult) ListInstanceProfilesRequest(com.amazonaws.services.identitymanagement.model.ListInstanceProfilesRequest) Mockito.mock(org.mockito.Mockito.mock) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Strictness(org.mockito.quality.Strictness) DescribeRegionsResult(com.amazonaws.services.ec2.model.DescribeRegionsResult) MockitoSettings(org.mockito.junit.jupiter.MockitoSettings) Mock(org.mockito.Mock) DescribeAvailabilityZonesResult(com.amazonaws.services.ec2.model.DescribeAvailabilityZonesResult) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ListTablesResult(com.amazonaws.services.dynamodbv2.model.ListTablesResult) HashMap(java.util.HashMap) ListKeysResult(com.amazonaws.services.kms.model.ListKeysResult) CloudNetworks(com.sequenceiq.cloudbreak.cloud.model.CloudNetworks) CloudRegions(com.sequenceiq.cloudbreak.cloud.model.CloudRegions) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) DescribeInstanceTypesResult(com.amazonaws.services.ec2.model.DescribeInstanceTypesResult) DescribeVpcsResult(com.amazonaws.services.ec2.model.DescribeVpcsResult) AmazonEc2Client(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonEc2Client) AliasListEntry(com.amazonaws.services.kms.model.AliasListEntry) AmazonRdsClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonRdsClient) DescribeInstanceTypesRequest(com.amazonaws.services.ec2.model.DescribeInstanceTypesRequest) AmazonDynamoDBClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonDynamoDBClient) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Subnet(com.amazonaws.services.ec2.model.Subnet) CloudDatabaseServerSslCertificateType(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificateType) VmType.vmType(com.sequenceiq.cloudbreak.cloud.model.VmType.vmType) InjectMocks(org.mockito.InjectMocks) ListInstanceProfilesResult(com.amazonaws.services.identitymanagement.model.ListInstanceProfilesResult) Certificate(com.amazonaws.services.rds.model.Certificate) CloudNoSqlTable(com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTable) Vpc(com.amazonaws.services.ec2.model.Vpc) DiskInfo(com.amazonaws.services.ec2.model.DiskInfo) Region.region(com.sequenceiq.cloudbreak.cloud.model.Region.region) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) KeyListEntry(com.amazonaws.services.kms.model.KeyListEntry) CloudAccessConfigs(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs) Mockito.when(org.mockito.Mockito.when) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) AmazonKmsClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonKmsClient) AvailabilityZone(com.amazonaws.services.ec2.model.AvailabilityZone) InstanceTypeInfo(com.amazonaws.services.ec2.model.InstanceTypeInfo) Builder(com.sequenceiq.cloudbreak.cloud.context.CloudContext.Builder) KeyMetadata(com.amazonaws.services.kms.model.KeyMetadata) ListAliasesResult(com.amazonaws.services.kms.model.ListAliasesResult) DescribeInstanceTypeOfferingsRequest(com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsRequest) Collections(java.util.Collections) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate)

Example 7 with CloudDatabaseServerSslCertificate

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

the class AwsPlatformResources method databaseServerGeneralSslRootCertificates.

@Override
public CloudDatabaseServerSslCertificates databaseServerGeneralSslRootCertificates(CloudCredential cloudCredential, Region region) {
    requireNonNull(cloudCredential);
    requireNonNull(region);
    AmazonRdsClient rdsClient = getAmazonRdsClient(cloudCredential, region);
    List<Certificate> certificates = rdsClient.describeCertificates(new DescribeCertificatesRequest());
    Set<CloudDatabaseServerSslCertificate> sslCertificates = certificates.stream().map(Certificate::getCertificateIdentifier).map(id -> new CloudDatabaseServerSslCertificate(CloudDatabaseServerSslCertificateType.ROOT, id)).collect(Collectors.toSet());
    return new CloudDatabaseServerSslCertificates(sslCertificates);
}
Also used : DescribeCertificatesRequest(com.amazonaws.services.rds.model.DescribeCertificatesRequest) CloudVmTypes(com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes) DescribeSubnetsRequest(com.amazonaws.services.ec2.model.DescribeSubnetsRequest) AvailabilityZone.availabilityZone(com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone.availabilityZone) ExtendedCloudCredential(com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential) MinimalHardwareFilter(com.sequenceiq.cloudbreak.filter.MinimalHardwareFilter) Cacheable(org.springframework.cache.annotation.Cacheable) ListKeysRequest(com.amazonaws.services.kms.model.ListKeysRequest) InstanceProfile(com.amazonaws.services.identitymanagement.model.InstanceProfile) Collections.singletonList(java.util.Collections.singletonList) DescribeSubnetsResult(com.amazonaws.services.ec2.model.DescribeSubnetsResult) VmType.vmTypeWithMeta(com.sequenceiq.cloudbreak.cloud.model.VmType.vmTypeWithMeta) AwsCredentialView(com.sequenceiq.cloudbreak.cloud.aws.common.view.AwsCredentialView) CloudAccessConfig(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfig) ListTablesRequest(com.amazonaws.services.dynamodbv2.model.ListTablesRequest) Map(java.util.Map) Location(com.sequenceiq.cloudbreak.cloud.model.Location) AmazonIdentityManagementClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonIdentityManagementClient) CloudEncryptionKey(com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKey) CloudUnauthorizedException(com.sequenceiq.cloudbreak.cloud.exception.CloudUnauthorizedException) AmazonServiceException(com.amazonaws.AmazonServiceException) DescribeInternetGatewaysResult(com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult) CloudEncryptionKeys(com.sequenceiq.cloudbreak.cloud.model.CloudEncryptionKeys) Set(java.util.Set) RegionSpecification(com.sequenceiq.cloudbreak.cloud.model.RegionSpecification) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) RegionCoordinateSpecifications(com.sequenceiq.cloudbreak.cloud.model.RegionCoordinateSpecifications) PlatformResourceVpcFilterView(com.sequenceiq.cloudbreak.cloud.model.view.PlatformResourceVpcFilterView) CloudSshKey(com.sequenceiq.cloudbreak.cloud.model.CloudSshKey) DescribeRouteTablesRequest(com.amazonaws.services.ec2.model.DescribeRouteTablesRequest) CloudPrivateDnsZones(com.sequenceiq.cloudbreak.cloud.model.dns.CloudPrivateDnsZones) Coordinate.coordinate(com.sequenceiq.cloudbreak.cloud.model.Coordinate.coordinate) Tag(com.amazonaws.services.ec2.model.Tag) MAGNETIC(com.sequenceiq.cloudbreak.cloud.model.VolumeParameterType.MAGNETIC) ListInstanceProfilesRequest(com.amazonaws.services.identitymanagement.model.ListInstanceProfilesRequest) RegionsSpecification(com.sequenceiq.cloudbreak.cloud.model.RegionsSpecification) DescribeRegionsResult(com.amazonaws.services.ec2.model.DescribeRegionsResult) CloudbreakResourceReaderService(com.sequenceiq.cloudbreak.service.CloudbreakResourceReaderService) Region(com.sequenceiq.cloudbreak.cloud.model.Region) ListTablesResult(com.amazonaws.services.dynamodbv2.model.ListTablesResult) DescribeKeyPairsRequest(com.amazonaws.services.ec2.model.DescribeKeyPairsRequest) CloudGateWays(com.sequenceiq.cloudbreak.cloud.model.CloudGateWays) CloudNetworks(com.sequenceiq.cloudbreak.cloud.model.CloudNetworks) CloudRegions(com.sequenceiq.cloudbreak.cloud.model.CloudRegions) StringUtils.isNotEmpty(org.apache.commons.lang3.StringUtils.isNotEmpty) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) CloudParameterConst(com.sequenceiq.cloudbreak.cloud.CloudParameterConst) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) Strings(com.google.common.base.Strings) AmazonEc2Client(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonEc2Client) AliasListEntry(com.amazonaws.services.kms.model.AliasListEntry) AmazonRdsClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonRdsClient) DescribeInstanceTypesRequest(com.amazonaws.services.ec2.model.DescribeInstanceTypesRequest) AmazonDynamoDBClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonDynamoDBClient) Service(org.springframework.stereotype.Service) ConfigSpecification(com.sequenceiq.cloudbreak.cloud.model.ConfigSpecification) PlatformResourceSecurityGroupFilterView(com.sequenceiq.cloudbreak.cloud.model.view.PlatformResourceSecurityGroupFilterView) DescribeSecurityGroupsRequest(com.amazonaws.services.ec2.model.DescribeSecurityGroupsRequest) Filter(com.amazonaws.services.ec2.model.Filter) RouteTable(com.amazonaws.services.ec2.model.RouteTable) PRIVATE(com.sequenceiq.cloudbreak.cloud.model.network.SubnetType.PRIVATE) CloudConstants(com.sequenceiq.cloudbreak.common.type.CloudConstants) LinkedHashSet(java.util.LinkedHashSet) ST1(com.sequenceiq.cloudbreak.cloud.model.VolumeParameterType.ST1) RegionCoordinateSpecification(com.sequenceiq.cloudbreak.cloud.model.RegionCoordinateSpecification) CloudSubnet(com.sequenceiq.cloudbreak.cloud.model.CloudSubnet) ListInstanceProfilesResult(com.amazonaws.services.identitymanagement.model.ListInstanceProfilesResult) Certificate(com.amazonaws.services.rds.model.Certificate) CloudNoSqlTable(com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTable) AwsPageCollector(com.sequenceiq.cloudbreak.cloud.aws.common.util.AwsPageCollector) IOException(java.io.IOException) CloudAccessConfigs(com.sequenceiq.cloudbreak.cloud.model.CloudAccessConfigs) SSD(com.sequenceiq.cloudbreak.cloud.model.VolumeParameterType.SSD) InternetGateway(com.amazonaws.services.ec2.model.InternetGateway) AmazonKmsClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonKmsClient) HttpStatus(org.springframework.http.HttpStatus) SdkClientException(com.amazonaws.SdkClientException) AmazonEC2Exception(com.amazonaws.services.ec2.model.AmazonEC2Exception) StringUtils.isNullOrEmpty(com.amazonaws.util.StringUtils.isNullOrEmpty) DescribeInternetGatewaysRequest(com.amazonaws.services.ec2.model.DescribeInternetGatewaysRequest) PermanentlyFailedException(com.sequenceiq.cloudbreak.util.PermanentlyFailedException) DisplayName.displayName(com.sequenceiq.cloudbreak.cloud.model.DisplayName.displayName) CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate) DescribeVpcsRequest(com.amazonaws.services.ec2.model.DescribeVpcsRequest) ListRolesResult(com.amazonaws.services.identitymanagement.model.ListRolesResult) Role(com.amazonaws.services.identitymanagement.model.Role) LoggerFactory(org.slf4j.LoggerFactory) JsonUtil(com.sequenceiq.cloudbreak.common.json.JsonUtil) ListAliasesRequest(com.amazonaws.services.kms.model.ListAliasesRequest) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) CloudSshKeys(com.sequenceiq.cloudbreak.cloud.model.CloudSshKeys) InternetGatewayAttachment(com.amazonaws.services.ec2.model.InternetGatewayAttachment) DescribeKeyResult(com.amazonaws.services.kms.model.DescribeKeyResult) EPHEMERAL(com.sequenceiq.cloudbreak.cloud.model.VolumeParameterType.EPHEMERAL) DescribeAvailabilityZonesRequest(com.amazonaws.services.ec2.model.DescribeAvailabilityZonesRequest) InstanceStoreMetadata(com.sequenceiq.cloudbreak.cloud.model.InstanceStoreMetadata) DescribeRegionsRequest(com.amazonaws.services.ec2.model.DescribeRegionsRequest) Predicate(java.util.function.Predicate) Collection(java.util.Collection) CloudResourceGroups(com.sequenceiq.cloudbreak.cloud.model.resourcegroup.CloudResourceGroups) InstanceStorageInfo(com.amazonaws.services.ec2.model.InstanceStorageInfo) Collectors(java.util.stream.Collectors) VmType(com.sequenceiq.cloudbreak.cloud.model.VmType) CloudGateWay(com.sequenceiq.cloudbreak.cloud.model.CloudGateWay) CloudNoSqlTables(com.sequenceiq.cloudbreak.cloud.model.nosql.CloudNoSqlTables) Objects(java.util.Objects) List(java.util.List) VolumeParameterType(com.sequenceiq.cloudbreak.cloud.model.VolumeParameterType) Entry(java.util.Map.Entry) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) DescribeCertificatesRequest(com.amazonaws.services.rds.model.DescribeCertificatesRequest) Coordinate(com.sequenceiq.cloudbreak.cloud.model.Coordinate) CloudDatabaseServerSslCertificates(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificates) DescribeKeyRequest(com.amazonaws.services.kms.model.DescribeKeyRequest) KeyPairInfo(com.amazonaws.services.ec2.model.KeyPairInfo) CloudSecurityGroup(com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroup) CloudIpPools(com.sequenceiq.cloudbreak.cloud.model.CloudIpPools) HashMap(java.util.HashMap) ListKeysResult(com.amazonaws.services.kms.model.ListKeysResult) PlatformResourceSshKeyFilterView(com.sequenceiq.cloudbreak.cloud.model.view.PlatformResourceSshKeyFilterView) HashSet(java.util.HashSet) Inject(javax.inject.Inject) AvailabilityZone(com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone) PUBLIC(com.sequenceiq.cloudbreak.cloud.model.network.SubnetType.PUBLIC) DescribeInstanceTypesResult(com.amazonaws.services.ec2.model.DescribeInstanceTypesResult) DescribeVpcsResult(com.amazonaws.services.ec2.model.DescribeVpcsResult) Objects.requireNonNull(java.util.Objects.requireNonNull) ListRolesRequest(com.amazonaws.services.identitymanagement.model.ListRolesRequest) Subnet(com.amazonaws.services.ec2.model.Subnet) CloudDatabaseServerSslCertificateType(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificateType) LinkedList(java.util.LinkedList) DisplayName(com.sequenceiq.cloudbreak.cloud.model.DisplayName) Logger(org.slf4j.Logger) Vpc(com.amazonaws.services.ec2.model.Vpc) PlatformResources(com.sequenceiq.cloudbreak.cloud.PlatformResources) DiskInfo(com.amazonaws.services.ec2.model.DiskInfo) VmTypeMetaBuilder(com.sequenceiq.cloudbreak.cloud.model.VmTypeMeta.VmTypeMetaBuilder) Region.region(com.sequenceiq.cloudbreak.cloud.model.Region.region) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) InstanceTypeInfo(com.amazonaws.services.ec2.model.InstanceTypeInfo) CloudSecurityGroups(com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroups) ListAliasesResult(com.amazonaws.services.kms.model.ListAliasesResult) DescribeInstanceTypeOfferingsRequest(com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsRequest) VisibleForTesting(com.google.common.annotations.VisibleForTesting) VolumeParameterConfig(com.sequenceiq.cloudbreak.cloud.model.VolumeParameterConfig) CloudNetwork(com.sequenceiq.cloudbreak.cloud.model.CloudNetwork) CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate) AmazonRdsClient(com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonRdsClient) CloudDatabaseServerSslCertificates(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificates) Certificate(com.amazonaws.services.rds.model.Certificate) CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate)

Example 8 with CloudDatabaseServerSslCertificate

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

the class AwsRdsStatusLookupServiceTest method getActiveSslRootCertificateTestWhenSuccess.

@Test
void getActiveSslRootCertificateTestWhenSuccess() {
    when(amazonRDS.describeDBInstances(any(DescribeDBInstancesRequest.class))).thenReturn(describeDBInstancesResult);
    when(describeDBInstancesResult.getDBInstances()).thenReturn(List.of(dbInstance));
    when(dbInstance.getCACertificateIdentifier()).thenReturn(CA_CERTIFICATE_IDENTIFIER);
    CloudDatabaseServerSslCertificate result = victim.getActiveSslRootCertificate(authenticatedContext, dbStack);
    assertThat(result).isNotNull();
    assertThat(result.getCertificateType()).isEqualTo(CloudDatabaseServerSslCertificateType.ROOT);
    assertThat(result.getCertificateIdentifier()).isEqualTo(CA_CERTIFICATE_IDENTIFIER);
}
Also used : CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate) DescribeDBInstancesRequest(com.amazonaws.services.rds.model.DescribeDBInstancesRequest) Test(org.junit.jupiter.api.Test)

Example 9 with CloudDatabaseServerSslCertificate

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

the class AwsRdsStatusLookupServiceTest method getActiveSslRootCertificateTestWhenDBInstanceNotFoundException.

@Test
void getActiveSslRootCertificateTestWhenDBInstanceNotFoundException() {
    when(amazonRDS.describeDBInstances(any(DescribeDBInstancesRequest.class))).thenThrow(DBInstanceNotFoundException.class);
    CloudDatabaseServerSslCertificate result = victim.getActiveSslRootCertificate(authenticatedContext, dbStack);
    assertThat(result).isNull();
}
Also used : CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate) DescribeDBInstancesRequest(com.amazonaws.services.rds.model.DescribeDBInstancesRequest) Test(org.junit.jupiter.api.Test)

Example 10 with CloudDatabaseServerSslCertificate

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

the class AwsResourceConnectorTest method getDatabaseServerActiveSslRootCertificateTest.

@Test
void getDatabaseServerActiveSslRootCertificateTest() {
    CloudDatabaseServerSslCertificate sslCertificate = mock(CloudDatabaseServerSslCertificate.class);
    when(awsRdsStatusLookupService.getActiveSslRootCertificate(authenticatedContext, dbStack)).thenReturn(sslCertificate);
    CloudDatabaseServerSslCertificate result = underTest.getDatabaseServerActiveSslRootCertificate(authenticatedContext, dbStack);
    assertThat(result).isSameAs(sslCertificate);
}
Also used : CloudDatabaseServerSslCertificate(com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate) Test(org.junit.jupiter.api.Test)

Aggregations

CloudDatabaseServerSslCertificate (com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate)14 Test (org.junit.jupiter.api.Test)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 DBStack (com.sequenceiq.redbeams.domain.stack.DBStack)5 Certificate (com.amazonaws.services.rds.model.Certificate)3 DescribeCertificatesRequest (com.amazonaws.services.rds.model.DescribeCertificatesRequest)3 AmazonRdsClient (com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonRdsClient)3 AwsCredentialView (com.sequenceiq.cloudbreak.cloud.aws.common.view.AwsCredentialView)3 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)3 CloudDatabaseServerSslCertificates (com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificates)3 AmazonServiceException (com.amazonaws.AmazonServiceException)2 ListTablesRequest (com.amazonaws.services.dynamodbv2.model.ListTablesRequest)2 ListTablesResult (com.amazonaws.services.dynamodbv2.model.ListTablesResult)2 DescribeInstanceTypeOfferingsRequest (com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsRequest)2 DescribeInstanceTypesRequest (com.amazonaws.services.ec2.model.DescribeInstanceTypesRequest)2 DescribeInstanceTypesResult (com.amazonaws.services.ec2.model.DescribeInstanceTypesResult)2 DescribeRegionsRequest (com.amazonaws.services.ec2.model.DescribeRegionsRequest)2 DescribeRegionsResult (com.amazonaws.services.ec2.model.DescribeRegionsResult)2 DescribeSubnetsResult (com.amazonaws.services.ec2.model.DescribeSubnetsResult)2 DescribeVpcsResult (com.amazonaws.services.ec2.model.DescribeVpcsResult)2