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);
}
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);
}
}
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());
}
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);
}
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);
}
Aggregations