Search in sources :

Example 6 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class UpgradeCcmOrchestratorServiceTest method testApplyUpgradeState.

@Test
void testApplyUpgradeState() throws CloudbreakOrchestratorException {
    underTest.applyUpgradeState(STACK_ID);
    verify(hostOrchestrator).runOrchestratorState(paramCaptor.capture());
    OrchestratorStateParams params = paramCaptor.getValue();
    assertThat(params.getState()).isEqualTo("upgradeccm");
    assertOtherStateParams(params);
}
Also used : OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams) Test(org.junit.jupiter.api.Test)

Example 7 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class CreateFullBackupHandler method runBackupForNodesSequentially.

private void runBackupForNodesSequentially(Set<Node> nodes, OrchestratorStateParams stateParameters) throws CloudbreakOrchestratorFailedException, CloneNotSupportedException {
    for (Node node : nodes) {
        OrchestratorStateParams orchestratorStateParams = stateParameters.clone();
        LOGGER.info("Run full backup for {}", node);
        orchestratorStateParams.setTargetHostNames(Set.of(node.getHostname()));
        orchestrator.runOrchestratorState(orchestratorStateParams);
    }
}
Also used : Node(com.sequenceiq.cloudbreak.common.orchestration.Node) OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)

Example 8 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class CreateFullBackupHandlerTest method testBackupSuccessful.

@Test
public void testBackupSuccessful() throws CloudbreakOrchestratorFailedException {
    Stack stack = mock(Stack.class);
    when(stackService.getByIdWithListsInTransaction(2L)).thenReturn(stack);
    Set<InstanceMetaData> metaDataSet = Set.of();
    when(stack.getNotDeletedInstanceMetaDataSet()).thenReturn(metaDataSet);
    Node node1 = createNode("node1");
    Node node2 = createNode("node2");
    Set<Node> nodes = Set.of(node1, node2);
    when(nodeService.mapInstancesToNodes(metaDataSet)).thenReturn(nodes);
    GatewayConfig gatewayConfig = mock(GatewayConfig.class);
    when(gatewayConfigService.getPrimaryGatewayConfig(stack)).thenReturn(gatewayConfig);
    StackEvent result = (StackEvent) underTest.doAccept(new HandlerEvent<>(new Event<>(new CreateFullBackupEvent(2L))));
    ArgumentCaptor<OrchestratorStateParams> captor = ArgumentCaptor.forClass(OrchestratorStateParams.class);
    verify(orchestrator, times(2)).runOrchestratorState(captor.capture());
    List<OrchestratorStateParams> stateParams = captor.getAllValues();
    assertThat(stateParams, everyItem(allOf(hasProperty("primaryGatewayConfig", is(gatewayConfig)), hasProperty("state", is("freeipa.backup-full")), hasProperty("allNodes", is(nodes)))));
    assertThat(stateParams, hasItem(hasProperty("targetHostNames", allOf(hasItem("node1"), iterableWithSize(1)))));
    assertThat(stateParams, hasItem(hasProperty("targetHostNames", allOf(hasItem("node2"), iterableWithSize(1)))));
    assertEquals(2L, result.getResourceId());
    assertEquals(FullBackupEvent.FULL_BACKUP_SUCCESSFUL_EVENT.event(), result.selector());
}
Also used : CreateFullBackupEvent(com.sequenceiq.freeipa.flow.freeipa.backup.full.event.CreateFullBackupEvent) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams) Stack(com.sequenceiq.freeipa.entity.Stack) InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) HandlerEvent(com.sequenceiq.flow.reactor.api.handler.HandlerEvent) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) Test(org.junit.jupiter.api.Test)

Example 9 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class UpgradeCcmOrchestratorService method disableMina.

public void disableMina(Long stackId) throws CloudbreakOrchestratorException {
    OrchestratorStateParams stateParams = createStateParams(stackId, DISABLE_MINA_STATE);
    LOGGER.debug("Calling disableMina with state params '{}'", stateParams);
    hostOrchestrator.runOrchestratorState(stateParams);
}
Also used : OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)

Example 10 with OrchestratorStateParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams in project cloudbreak by hortonworks.

the class UpgradeCcmOrchestratorService method reconfigureNginx.

public void reconfigureNginx(Long stackId) throws CloudbreakOrchestratorException {
    OrchestratorStateParams stateParams = createStateParams(stackId, NGINX_STATE);
    LOGGER.debug("Calling reconfigureNginx with state params '{}'", stateParams);
    hostOrchestrator.runOrchestratorState(stateParams);
}
Also used : OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)

Aggregations

OrchestratorStateParams (com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)21 Test (org.junit.jupiter.api.Test)7 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)6 Stack (com.sequenceiq.freeipa.entity.Stack)3 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)2 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)2 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)2 ClusterDeletionBasedExitCriteriaModel (com.sequenceiq.cloudbreak.core.bootstrap.service.ClusterDeletionBasedExitCriteriaModel)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 OrchestratorStateRetryParams (com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams)1 HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)1 CreateFullBackupEvent (com.sequenceiq.freeipa.flow.freeipa.backup.full.event.CreateFullBackupEvent)1 StackFailureEvent (com.sequenceiq.freeipa.flow.stack.StackFailureEvent)1 StackBasedExitCriteriaModel (com.sequenceiq.freeipa.orchestrator.StackBasedExitCriteriaModel)1