Search in sources :

Example 1 with DatabaseBackupTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.DatabaseBackupTriggerEvent in project cloudbreak by hortonworks.

the class BackupDatalakeDatabaseFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(DatabaseBackupTriggerEvent event) {
    Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
    flowEventChain.add(new StackEvent(SaltUpdateEvent.SALT_UPDATE_EVENT.event(), event.getResourceId(), event.accepted()));
    flowEventChain.add(new DatabaseBackupTriggerEvent(DATABASE_BACKUP_EVENT.event(), event.getResourceId(), event.getBackupLocation(), event.getBackupId(), event.getCloseConnections()));
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) DatabaseBackupTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.DatabaseBackupTriggerEvent) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 2 with DatabaseBackupTriggerEvent

use of com.sequenceiq.cloudbreak.core.flow2.event.DatabaseBackupTriggerEvent in project cloudbreak by hortonworks.

the class ReactorFlowManagerTest method testTriggerDatabaseBackupFlowchain.

@Test
public void testTriggerDatabaseBackupFlowchain() {
    long stackId = 1L;
    String backupId = UUID.randomUUID().toString();
    underTest.triggerDatalakeDatabaseBackup(stackId, BACKUP_LOCATION, backupId, true);
    ArgumentCaptor<Acceptable> captor = ArgumentCaptor.forClass(Acceptable.class);
    verify(reactorNotifier).notify(eq(stackId), eq(FlowChainTriggers.DATALAKE_DATABASE_BACKUP_CHAIN_TRIGGER_EVENT), captor.capture());
    DatabaseBackupTriggerEvent event = (DatabaseBackupTriggerEvent) captor.getValue();
    assertEquals(stack.getId(), event.getResourceId());
    assertEquals(backupId, event.getBackupId());
    assertEquals(BACKUP_LOCATION, event.getBackupLocation());
    assertEquals(FlowChainTriggers.DATALAKE_DATABASE_BACKUP_CHAIN_TRIGGER_EVENT, event.selector());
}
Also used : Acceptable(com.sequenceiq.cloudbreak.common.event.Acceptable) DatabaseBackupTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.DatabaseBackupTriggerEvent) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Aggregations

DatabaseBackupTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.DatabaseBackupTriggerEvent)2 Acceptable (com.sequenceiq.cloudbreak.common.event.Acceptable)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1