Search in sources :

Example 1 with DBStack

use of com.sequenceiq.redbeams.domain.stack.DBStack in project cloudbreak by hortonworks.

the class NetworkParameterAdderTest method testAddParametersWhenAws.

@Test
public void testAddParametersWhenAws() {
    Map<String, Object> parameters = new HashMap<>();
    DBStack dbStack = new DBStack();
    DetailedEnvironmentResponse environment = getAwsDetailedEnvironmentResponse();
    parameters = underTest.addParameters(parameters, environment, CloudPlatform.AWS, dbStack);
    assertThat(parameters, IsMapContaining.hasEntry(VPC_ID, TEST_VPC_ID));
    assertThat(parameters, IsMapContaining.hasEntry(VPC_CIDR, TEST_VPC_CIDR));
    assertThat(parameters, IsMapContaining.hasEntry(VPC_CIDRS, Set.of(TEST_VPC_CIDR)));
}
Also used : HashMap(java.util.HashMap) DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 2 with DBStack

use of com.sequenceiq.redbeams.domain.stack.DBStack in project cloudbreak by hortonworks.

the class NetworkParameterAdderTest method testAddParametersWhenGcp.

@Test
public void testAddParametersWhenGcp() {
    Map<String, Object> parameters = new HashMap<>();
    DBStack dbStack = new DBStack();
    DetailedEnvironmentResponse environment = getGcpDetailedEnvironmentResponse();
    parameters = underTest.addParameters(parameters, environment, CloudPlatform.GCP, dbStack);
    assertThat(parameters, IsMapContaining.hasEntry(SHARED_PROJECT_ID, "sharedProjectId"));
}
Also used : HashMap(java.util.HashMap) DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 3 with DBStack

use of com.sequenceiq.redbeams.domain.stack.DBStack in project cloudbreak by hortonworks.

the class SubnetChooserServiceTest method testChooseSubnetsThenCloudPlatformConnectorGetIsCalled.

@Test
public void testChooseSubnetsThenCloudPlatformConnectorGetIsCalled() {
    List<CloudSubnet> subnets = List.of();
    setupConnector();
    DBStack dbStack = new DBStack();
    dbStack.setCloudPlatform("MyCloudPlatform");
    dbStack.setPlatformVariant("MyPlatformVariant");
    underTest.chooseSubnets(subnets, CloudPlatform.AWS, dbStack);
    ArgumentCaptor<CloudPlatformVariant> cloudPlatformVariantArgumentCaptor = ArgumentCaptor.forClass(CloudPlatformVariant.class);
    verify(cloudPlatformConnectors).get(cloudPlatformVariantArgumentCaptor.capture());
    assertEquals("MyCloudPlatform", cloudPlatformVariantArgumentCaptor.getValue().getPlatform().value());
    assertEquals("MyPlatformVariant", cloudPlatformVariantArgumentCaptor.getValue().getVariant().value());
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant) CloudSubnet(com.sequenceiq.cloudbreak.cloud.model.CloudSubnet) Test(org.junit.Test)

Example 4 with DBStack

use of com.sequenceiq.redbeams.domain.stack.DBStack in project cloudbreak by hortonworks.

the class DatabaseServerSslCertificatePrescriptionServiceTest method setUp.

@BeforeEach
void setUp() {
    dbStack = new DBStack();
    databaseServer = DatabaseServer.builder().build();
    databaseStack = new DatabaseStack(null, databaseServer, Map.of(), "");
    region = Region.region("myregion");
    location = Location.location(region);
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) DatabaseStack(com.sequenceiq.cloudbreak.cloud.model.DatabaseStack) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with DBStack

use of com.sequenceiq.redbeams.domain.stack.DBStack in project cloudbreak by hortonworks.

the class AllocateDatabaseServerHandlerTest method setUp.

@BeforeEach
void setUp() {
    dbStack = new DBStack();
    dbStack.setCloudPlatform(CloudPlatform.AWS.name());
    lenient().when(dbStackService.getById(anyLong())).thenReturn(dbStack);
    databaseStack = new DatabaseStack(null, null, Map.of(), "");
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) DatabaseStack(com.sequenceiq.cloudbreak.cloud.model.DatabaseStack) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DBStack (com.sequenceiq.redbeams.domain.stack.DBStack)83 Test (org.junit.jupiter.api.Test)28 DatabaseServerConfig (com.sequenceiq.redbeams.domain.DatabaseServerConfig)17 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)17 Test (org.junit.Test)13 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)8 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)7 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)7 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)7 DatabaseStack (com.sequenceiq.cloudbreak.cloud.model.DatabaseStack)7 DatabaseServerV4Response (com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.DatabaseServerV4Response)7 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)6 SslConfig (com.sequenceiq.redbeams.domain.stack.SslConfig)6 Credential (com.sequenceiq.redbeams.dto.Credential)6 RedbeamsFailureEvent (com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsFailureEvent)6 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)5 CloudDatabaseServerSslCertificate (com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate)5 RedbeamsEvent (com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsEvent)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 Location (com.sequenceiq.cloudbreak.cloud.model.Location)4