Search in sources :

Example 16 with RedbeamsEvent

use of com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsEvent in project cloudbreak by hortonworks.

the class StopDatabaseServerFinishedActionTest method shouldIncrementMetricOnCreateRequest.

@Test
public void shouldIncrementMetricOnCreateRequest() {
    RedbeamsStopContext context = new RedbeamsStopContext(flowParameters, cloudContext, cloudCredential, databaseStack);
    RedbeamsEvent redbeamsEvent = (RedbeamsEvent) victim.createRequest(context);
    assertEquals(RedbeamsStopEvent.REDBEAMS_STOP_FINISHED_EVENT.name(), redbeamsEvent.selector());
}
Also used : RedbeamsStopContext(com.sequenceiq.redbeams.flow.redbeams.stop.RedbeamsStopContext) RedbeamsEvent(com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsEvent) Test(org.junit.jupiter.api.Test)

Example 17 with RedbeamsEvent

use of com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsEvent in project cloudbreak by hortonworks.

the class AbstractRedbeamsTerminationActionTest method testCreateFlowContext.

@Test
public void testCreateFlowContext() {
    when(dbStackService.findById(Long.valueOf(1L))).thenReturn(Optional.of(dbStack));
    when(credentialService.getCredentialByEnvCrn("myenv")).thenReturn(credential);
    when(credentialConverter.convert(credential)).thenReturn(cloudCredential);
    when(databaseStackConverter.convert(dbStack)).thenReturn(databaseStack);
    RedbeamsContext ctx = underTest.createFlowContext(flowParameters, stateContext, new RedbeamsEvent(1L));
    assertEquals(dbStack.getId(), ctx.getCloudContext().getId());
    assertEquals(dbStack.getName(), ctx.getCloudContext().getName());
    assertEquals(Platform.platform(dbStack.getCloudPlatform()), ctx.getCloudContext().getPlatform());
    assertEquals(Variant.variant(dbStack.getPlatformVariant()), ctx.getCloudContext().getVariant());
    assertEquals(Location.location(Region.region(dbStack.getRegion()), AvailabilityZone.availabilityZone(dbStack.getAvailabilityZone())), ctx.getCloudContext().getLocation());
    assertEquals(dbStack.getOwnerCrn().getAccountId(), ctx.getCloudContext().getAccountId());
    assertEquals(cloudCredential, ctx.getCloudCredential());
    assertEquals(databaseStack, ctx.getDatabaseStack());
}
Also used : RedbeamsEvent(com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsEvent) RedbeamsContext(com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsContext) Test(org.junit.Test)

Aggregations

RedbeamsEvent (com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsEvent)17 Test (org.junit.jupiter.api.Test)8 DBStack (com.sequenceiq.redbeams.domain.stack.DBStack)6 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)2 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)2 ExternalDatabaseStatus (com.sequenceiq.cloudbreak.cloud.model.ExternalDatabaseStatus)2 DatabaseServerConfig (com.sequenceiq.redbeams.domain.DatabaseServerConfig)2 RedbeamsContext (com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsContext)2 Event (reactor.bus.Event)2 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)1 CloudPlatformVariant (com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)1 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 Flow (com.sequenceiq.flow.core.Flow)1 FlowParameters (com.sequenceiq.flow.core.FlowParameters)1 RedbeamsFailureEvent (com.sequenceiq.redbeams.flow.redbeams.common.RedbeamsFailureEvent)1 AbstractRedbeamsProvisionAction (com.sequenceiq.redbeams.flow.redbeams.provision.AbstractRedbeamsProvisionAction)1 RedbeamsStartContext (com.sequenceiq.redbeams.flow.redbeams.start.RedbeamsStartContext)1 StartDatabaseServerFailed (com.sequenceiq.redbeams.flow.redbeams.start.event.StartDatabaseServerFailed)1 StartDatabaseServerRequest (com.sequenceiq.redbeams.flow.redbeams.start.event.StartDatabaseServerRequest)1