Search in sources :

Example 76 with DBStack

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

the class DatabaseServerSslCertificateSyncServiceTest method getDBStack.

private DBStack getDBStack(SslConfig sslConfig) {
    DBStack dbStack = new DBStack();
    dbStack.setRegion(REGION);
    dbStack.setSslConfig(sslConfig);
    return dbStack;
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack)

Example 77 with DBStack

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

the class DBStackServiceTest method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    dbStack = new DBStack();
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) Before(org.junit.Before)

Example 78 with DBStack

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

the class DBStackStatusUpdaterTest method testUpdateStatus.

@Test
public void testUpdateStatus() {
    dbStack.setDBStackStatus(new DBStackStatus(dbStack, DetailedDBStackStatus.CREATING_INFRASTRUCTURE, now));
    DBStack savedStack = underTest.updateStatus(1L, DetailedDBStackStatus.PROVISIONED, "because").get();
    verify(dbStackService).save(dbStack);
    verify(redbeamsInMemoryStateStoreUpdaterService).update(1L, Status.AVAILABLE);
    DBStackStatus dbStackStatus = savedStack.getDbStackStatus();
    assertEquals(dbStack, dbStackStatus.getDBStack());
    assertEquals(DetailedDBStackStatus.PROVISIONED.getStatus(), dbStackStatus.getStatus());
    assertEquals("because", dbStackStatus.getStatusReason());
    assertEquals(DetailedDBStackStatus.PROVISIONED, dbStackStatus.getDetailedDBStackStatus());
    assertEquals(now, dbStackStatus.getCreated().longValue());
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) DetailedDBStackStatus(com.sequenceiq.redbeams.api.model.common.DetailedDBStackStatus) DBStackStatus(com.sequenceiq.redbeams.domain.stack.DBStackStatus) Test(org.junit.Test)

Example 79 with DBStack

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

the class DBStackStatusUpdaterTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    dbStack = new DBStack();
    dbStack.setId(1L);
    dbStackOptional = Optional.of(dbStack);
    when(dbStackService.findById(1L)).thenReturn(dbStackOptional);
    when(dbStackService.save(dbStack)).thenReturn(dbStack);
    now = System.currentTimeMillis();
    when(clock.getCurrentTimeMillis()).thenReturn(now);
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) Before(org.junit.Before)

Example 80 with DBStack

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

the class RedbeamsCreationServiceTest method testShouldNotLaunchDatabaseServerWhenDatabaseServerConfigIsAvailable.

@Test
public void testShouldNotLaunchDatabaseServerWhenDatabaseServerConfigIsAvailable() {
    when(dbStackService.findByNameAndEnvironmentCrn(DB_STACK_NAME, ENVIRONMENT_CRN)).thenReturn(Optional.empty());
    when(databaseServerConfigService.findByEnvironmentCrnAndClusterCrn(ENVIRONMENT_CRN, CLUSTER_CRN)).thenReturn(Optional.of(databaseServerConfig));
    when(databaseServerConfig.getDbStack()).thenReturn(Optional.of(dbStack));
    DBStack launchedStack = underTest.launchDatabaseServer(dbStack, CLUSTER_CRN);
    assertThat(launchedStack).isEqualTo(dbStack);
    verifyNoInteractions(flowManager);
    verifyNoMoreInteractions(databaseServerConfigService);
}
Also used : DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) Test(org.junit.jupiter.api.Test)

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