Search in sources :

Example 6 with StartExternalDatabaseRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.externaldatabase.StartExternalDatabaseRequest in project cloudbreak by hortonworks.

the class StartExternalDatabaseHandlerTest method acceptNonDatahub.

@Test
void acceptNonDatahub() {
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    environment.setCloudPlatform("AWS");
    when(environmentClientService.getByCrn(anyString())).thenReturn(environment);
    Stack stack = buildStack(DatabaseAvailabilityType.HA);
    stack.setType(StackType.DATALAKE);
    stack.getCluster().setDatabaseServerCrn(DATABASE_CRN);
    when(stackService.getById(anyLong())).thenReturn(stack);
    StartExternalDatabaseRequest request = new StartExternalDatabaseRequest(STACK_ID, "selector", "resourceName", "crn");
    Event<StartExternalDatabaseRequest> event = new Event<>(EVENT_HEADERS, request);
    underTest.accept(event);
    verify(startService, never()).startDatabase(any(), any(), eq(environment));
    verify(stackUpdaterService, never()).updateStatus(any(), any(), any(), any());
    verify(eventBus).notify(eq("StartExternalDatabaseResult"), any(Event.class));
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Event(reactor.bus.Event) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) StartExternalDatabaseRequest(com.sequenceiq.cloudbreak.reactor.api.event.externaldatabase.StartExternalDatabaseRequest) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)6 StartExternalDatabaseRequest (com.sequenceiq.cloudbreak.reactor.api.event.externaldatabase.StartExternalDatabaseRequest)6 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)6 ResourceEvent (com.sequenceiq.cloudbreak.event.ResourceEvent)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 Event (reactor.bus.Event)5 Test (org.junit.jupiter.api.Test)4 DatabaseAvailabilityType (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.database.DatabaseAvailabilityType)2 StartExternalDatabaseResult (com.sequenceiq.cloudbreak.reactor.api.event.externaldatabase.StartExternalDatabaseResult)2 PollerException (com.dyngr.exception.PollerException)1 PollerStoppedException (com.dyngr.exception.PollerStoppedException)1 UserBreakException (com.dyngr.exception.UserBreakException)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 StartExternalDatabaseFailed (com.sequenceiq.cloudbreak.reactor.api.event.externaldatabase.StartExternalDatabaseFailed)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1 MockitoSettings (org.mockito.junit.jupiter.MockitoSettings)1