Search in sources :

Example 1 with NetworkV4StackRequest

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.NetworkV4StackRequest in project cloudbreak by hortonworks.

the class AllocateDatabaseServerV4RequestToDBStackConverterTest method setUp.

@BeforeEach
public void setUp() {
    ReflectionTestUtils.setField(underTest, FIELD_DB_SERVICE_SUPPORTED_PLATFORMS, Set.of("AWS", "AZURE"));
    ReflectionTestUtils.setField(underTest, FIELD_REDBEAMS_DB_MAJOR_VERSION, REDBEAMS_DB_MAJOR_VERSION);
    ReflectionTestUtils.setField(underTest, FIELD_SSL_ENABLED, true);
    allocateRequest = new AllocateDatabaseServerV4Request();
    networkRequest = new NetworkV4StackRequest();
    allocateRequest.setNetwork(networkRequest);
    databaseServerRequest = new DatabaseServerV4StackRequest();
    allocateRequest.setDatabaseServer(databaseServerRequest);
    securityGroupRequest = new SecurityGroupV4StackRequest();
    databaseServerRequest.setSecurityGroup(securityGroupRequest);
    when(crnUserDetailsService.loadUserByUsername(OWNER_CRN)).thenReturn(getCrnUser());
    when(uuidGeneratorService.randomUuid()).thenReturn("uuid");
    when(accountTagService.list()).thenReturn(new HashMap<>());
    when(uuidGeneratorService.uuidVariableParts(anyInt())).thenReturn("parts");
    when(entitlementService.internalTenant(anyString())).thenReturn(true);
    sslCertificateEntryV2 = new SslCertificateEntry(VERSION_2, CLOUD_PROVIDER_IDENTIFIER_V2, CERT_PEM_V2, x509Certificate);
    sslCertificateEntryV3 = new SslCertificateEntry(VERSION_3, CLOUD_PROVIDER_IDENTIFIER_V3, CERT_PEM_V3, x509Certificate);
    when(databaseServerSslCertificateConfig.getMaxVersionByCloudPlatformAndRegion(anyString(), eq(REGION))).thenReturn(MAX_VERSION);
    when(clock.getCurrentInstant()).thenReturn(NOW);
    when(crnService.createCrn(any(DBStack.class))).thenReturn(CrnTestUtil.getDatabaseServerCrnBuilder().setAccountId("accountid").setResource("1").build());
}
Also used : NetworkV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.NetworkV4StackRequest) DatabaseServerV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest) DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) SslCertificateEntry(com.sequenceiq.redbeams.configuration.SslCertificateEntry) AllocateDatabaseServerV4Request(com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.requests.AllocateDatabaseServerV4Request) SecurityGroupV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.SecurityGroupV4StackRequest) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with NetworkV4StackRequest

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.NetworkV4StackRequest in project cloudbreak by hortonworks.

the class AllocateDatabaseServerV4RequestTest method testGettersAndSetters.

@Test
public void testGettersAndSetters() {
    request.setName("myallocation");
    assertEquals("myallocation", request.getName());
    request.setEnvironmentCrn("myenv");
    request.setTags(new HashMap<>());
    assertEquals("myenv", request.getEnvironmentCrn());
    NetworkV4StackRequest network = new NetworkV4StackRequest();
    request.setNetwork(network);
    assertEquals(network, request.getNetwork());
    DatabaseServerV4StackRequest server = new DatabaseServerV4StackRequest();
    request.setDatabaseServer(server);
    assertEquals(server, request.getDatabaseServer());
}
Also used : NetworkV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.NetworkV4StackRequest) DatabaseServerV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest) Test(org.junit.Test)

Aggregations

DatabaseServerV4StackRequest (com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest)2 NetworkV4StackRequest (com.sequenceiq.redbeams.api.endpoint.v4.stacks.NetworkV4StackRequest)2 AllocateDatabaseServerV4Request (com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.requests.AllocateDatabaseServerV4Request)1 SecurityGroupV4StackRequest (com.sequenceiq.redbeams.api.endpoint.v4.stacks.SecurityGroupV4StackRequest)1 SslCertificateEntry (com.sequenceiq.redbeams.configuration.SslCertificateEntry)1 DBStack (com.sequenceiq.redbeams.domain.stack.DBStack)1 Test (org.junit.Test)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1