Search in sources :

Example 1 with UpscaleStackResult

use of com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult in project cloudbreak by hortonworks.

the class StackUpscaleActionsTest method verifyEventForUpscaleStackResult.

private void verifyEventForUpscaleStackResult(List<CloudResourceStatus> resourceStatuses) {
    verify(reactorEventFactory).createEvent(anyMap(), payloadArgumentCaptor.capture());
    verify(eventBus).notify("UPSCALESTACKRESULT", event);
    Object responsePayload = payloadArgumentCaptor.getValue();
    assertThat(responsePayload).isInstanceOf(UpscaleStackResult.class);
    UpscaleStackResult upscaleStackResult = (UpscaleStackResult) responsePayload;
    assertThat(upscaleStackResult.getResourceId()).isEqualTo(STACK_ID);
    assertThat(upscaleStackResult.getResourceStatus()).isEqualTo(ResourceStatus.CREATED);
    assertThat(upscaleStackResult.getResults()).isEqualTo(resourceStatuses);
    assertThat(upscaleStackResult.getStatus()).isEqualTo(EventStatus.OK);
    assertThat(upscaleStackResult.getStatusReason()).isNull();
    assertThat(upscaleStackResult.getErrorDetails()).isNull();
}
Also used : UpscaleStackResult(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult)

Example 2 with UpscaleStackResult

use of com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult in project cloudbreak by hortonworks.

the class StackUpscaleActions method addInstances.

@Bean(name = "ADD_INSTANCES_STATE")
public Action<?, ?> addInstances() {
    return new AbstractStackUpscaleAction<>(UpscaleStackValidationResult.class) {

        @Override
        protected void doExecute(StackScalingFlowContext context, UpscaleStackValidationResult payload, Map<Object, Object> variables) {
            sendEvent(context);
        }

        @Override
        protected Selectable createRequest(StackScalingFlowContext context) {
            Map<String, Integer> hostGroupWithInstanceCountToCreate = getHostGroupsWithInstanceCountToCreate(context);
            Stack updatedStack = instanceMetaDataService.saveInstanceAndGetUpdatedStack(context.getStack(), hostGroupWithInstanceCountToCreate, context.getHostgroupWithHostnames(), true, context.isRepair(), context.getStackNetworkScaleDetails());
            List<CloudResource> resources = context.getStack().getResources().stream().map(r -> cloudResourceConverter.convert(r)).collect(Collectors.toList());
            CloudStack updatedCloudStack = cloudStackConverter.convert(updatedStack);
            AdjustmentTypeWithThreshold adjustmentTypeWithThreshold = context.getAdjustmentTypeWithThreshold();
            if (adjustmentTypeWithThreshold == null) {
                Integer exactNumber = hostGroupWithInstanceCountToCreate.values().stream().reduce(0, Integer::sum);
                adjustmentTypeWithThreshold = new AdjustmentTypeWithThreshold(AdjustmentType.EXACT, exactNumber.longValue());
            }
            LOGGER.info("Adjustment type with threshold for upscale request: {}", adjustmentTypeWithThreshold);
            return new UpscaleStackRequest<UpscaleStackResult>(context.getCloudContext(), context.getCloudCredential(), updatedCloudStack, resources, adjustmentTypeWithThreshold);
        }
    };
}
Also used : Action(org.springframework.statemachine.action.Action) StackScaleTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.StackScaleTriggerEvent) LoggerFactory(org.slf4j.LoggerFactory) StackToCloudStackConverter(com.sequenceiq.cloudbreak.converter.spi.StackToCloudStackConverter) EventSelectorUtil(com.sequenceiq.flow.event.EventSelectorUtil) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) InstanceGroupService(com.sequenceiq.cloudbreak.service.stack.InstanceGroupService) InstanceMetaDataToCloudInstanceConverter(com.sequenceiq.cloudbreak.converter.spi.InstanceMetaDataToCloudInstanceConverter) Map(java.util.Map) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) StackScalingFlowContext(com.sequenceiq.cloudbreak.core.flow2.stack.downscale.StackScalingFlowContext) BootstrapNewNodesResult(com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesResult) UpscaleStackRequest(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackRequest) AbstractStackFailureAction(com.sequenceiq.cloudbreak.core.flow2.stack.AbstractStackFailureAction) UpscaleStackValidationRequest(com.sequenceiq.cloudbreak.cloud.event.resource.UpscaleStackValidationRequest) Collection(java.util.Collection) StackFailureContext(com.sequenceiq.cloudbreak.core.flow2.stack.StackFailureContext) Set(java.util.Set) HOST_GROUP_WITH_HOSTNAMES(com.sequenceiq.cloudbreak.core.flow2.stack.upscale.AbstractStackUpscaleAction.HOST_GROUP_WITH_HOSTNAMES) Collectors(java.util.stream.Collectors) UpscaleStackValidationResult(com.sequenceiq.cloudbreak.cloud.event.resource.UpscaleStackValidationResult) Configuration(org.springframework.context.annotation.Configuration) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) AdjustmentType(com.sequenceiq.common.api.type.AdjustmentType) List(java.util.List) UpdateDomainDnsResolverResult(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpdateDomainDnsResolverResult) TransactionExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException) ExtendHostMetadataRequest(com.sequenceiq.cloudbreak.reactor.api.event.resource.ExtendHostMetadataRequest) Optional(java.util.Optional) StackCreationEvent(com.sequenceiq.cloudbreak.core.flow2.stack.provision.StackCreationEvent) BootstrapNewNodesRequest(com.sequenceiq.cloudbreak.reactor.api.event.resource.BootstrapNewNodesRequest) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) StackService(com.sequenceiq.cloudbreak.service.stack.StackService) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) HashMap(java.util.HashMap) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) StackFailureEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent) ClusterPublicEndpointManagementService(com.sequenceiq.cloudbreak.service.publicendpoint.ClusterPublicEndpointManagementService) HOST_GROUP_WITH_ADJUSTMENT(com.sequenceiq.cloudbreak.core.flow2.stack.upscale.AbstractStackUpscaleAction.HOST_GROUP_WITH_ADJUSTMENT) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) CleanupFreeIpaEvent(com.sequenceiq.cloudbreak.reactor.api.event.stack.CleanupFreeIpaEvent) HashSet(java.util.HashSet) Inject(javax.inject.Inject) ResourceToCloudResourceConverter(com.sequenceiq.cloudbreak.converter.spi.ResourceToCloudResourceConverter) ExtendHostMetadataResult(com.sequenceiq.cloudbreak.reactor.api.event.resource.ExtendHostMetadataResult) UpscaleStackResult(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult) InstanceMetaDataService(com.sequenceiq.cloudbreak.service.stack.InstanceMetaDataService) GetSSHFingerprintsResult(com.sequenceiq.cloudbreak.cloud.event.instance.GetSSHFingerprintsResult) UpdateDomainDnsResolverRequest(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpdateDomainDnsResolverRequest) Logger(org.slf4j.Logger) GetSSHFingerprintsRequest(com.sequenceiq.cloudbreak.cloud.event.instance.GetSSHFingerprintsRequest) CollectMetadataResult(com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataResult) CollectMetadataRequest(com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataRequest) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) AdjustmentTypeWithThreshold(com.sequenceiq.common.api.adjustment.AdjustmentTypeWithThreshold) EnvironmentClientService(com.sequenceiq.cloudbreak.service.environment.EnvironmentClientService) ClusterProxyEnablementService(com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyEnablementService) ClusterProxyReRegistrationRequest(com.sequenceiq.cloudbreak.reactor.api.event.orchestration.ClusterProxyReRegistrationRequest) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) InstanceStatus(com.sequenceiq.cloudbreak.cloud.model.InstanceStatus) MetricType(com.sequenceiq.cloudbreak.service.metrics.MetricType) InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) Bean(org.springframework.context.annotation.Bean) AdjustmentTypeWithThreshold(com.sequenceiq.common.api.adjustment.AdjustmentTypeWithThreshold) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) StackScalingFlowContext(com.sequenceiq.cloudbreak.core.flow2.stack.downscale.StackScalingFlowContext) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) UpscaleStackRequest(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackRequest) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) UpscaleStackValidationResult(com.sequenceiq.cloudbreak.cloud.event.resource.UpscaleStackValidationResult) Map(java.util.Map) HashMap(java.util.HashMap) Bean(org.springframework.context.annotation.Bean)

Example 3 with UpscaleStackResult

use of com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult in project cloudbreak by hortonworks.

the class UpscaleStackHandler method accept.

@Override
public void accept(Event<UpscaleStackRequest> upscaleStackRequestEvent) {
    LOGGER.debug("Received event: {}", upscaleStackRequestEvent);
    UpscaleStackRequest<UpscaleStackResult> request = upscaleStackRequestEvent.getData();
    CloudContext cloudContext = request.getCloudContext();
    try {
        CloudConnector<?> connector = cloudPlatformConnectors.get(cloudContext.getPlatformVariant());
        AuthenticatedContext ac = getAuthenticatedContext(request, cloudContext, connector);
        List<CloudResourceStatus> resourceStatus = stackUpscaleService.upscale(ac, request, connector);
        LOGGER.info("Upscaled resource statuses: {}", resourceStatus);
        UpscaleStackResult result = new UpscaleStackResult(request.getResourceId(), ResourceStatus.UPDATED, resourceStatus);
        request.getResult().onNext(result);
        eventBus.notify(result.selector(), new Event<>(upscaleStackRequestEvent.getHeaders(), result));
        LOGGER.debug("Upscale successfully finished for {}, and the result is: {}", cloudContext, result);
    } catch (Exception e) {
        LOGGER.error("Upscaling stack failed", e);
        UpscaleStackResult result = new UpscaleStackResult(e.getMessage(), e, request.getResourceId());
        request.getResult().onNext(result);
        eventBus.notify(CloudPlatformResult.failureSelector(UpscaleStackResult.class), new Event<>(upscaleStackRequestEvent.getHeaders(), result));
    }
}
Also used : UpscaleStackResult(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult) CloudResourceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudResourceStatus) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) Event(reactor.bus.Event) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)

Example 4 with UpscaleStackResult

use of com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult in project cloudbreak by hortonworks.

the class StackUpscaleServiceTest method testBestEffortButFail.

@Test
public void testBestEffortButFail() throws QuotaExceededException {
    CloudConnector connector = mock(CloudConnector.class);
    ResourceConnector resourceConnector = mock(ResourceConnector.class);
    when(connector.resources()).thenReturn(resourceConnector);
    when(resourceConnector.upscale(any(), any(), any(), any())).thenThrow(new QuotaExceededException(40, 36, 40, "quota error", new Exception()));
    AdjustmentTypeWithThreshold adjustmentTypeWithThreshold = new AdjustmentTypeWithThreshold(AdjustmentType.BEST_EFFORT, 0L);
    List<Group> groups = new ArrayList<>();
    List<CloudInstance> workerInstances = new ArrayList<>();
    workerInstances.add(new CloudInstance("W1", getInstanceTemplate(1L, "worker"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "worker1.example.com")));
    workerInstances.add(new CloudInstance(null, getInstanceTemplate(2L, "worker"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "worker2.example.com")));
    workerInstances.add(new CloudInstance(null, getInstanceTemplate(3L, "worker"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "worker3.example.com")));
    groups.add(new Group("worker", InstanceGroupType.CORE, workerInstances, mock(Security.class), mock(CloudInstance.class), mock(InstanceAuthentication.class), "admin", "ssh", 100, Optional.empty(), null, emptyMap()));
    List<CloudInstance> computeInstances = new ArrayList<>();
    computeInstances.add(new CloudInstance("C1", getInstanceTemplate(4L, "compute"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "compute1.example.com")));
    computeInstances.add(new CloudInstance(null, getInstanceTemplate(5L, "compute"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "compute2.example.com")));
    computeInstances.add(new CloudInstance(null, getInstanceTemplate(6L, "compute"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "compute3.example.com")));
    groups.add(new Group("compute", InstanceGroupType.CORE, computeInstances, mock(Security.class), mock(CloudInstance.class), mock(InstanceAuthentication.class), "admin", "ssh", 100, Optional.empty(), null, emptyMap()));
    CloudStack cloudStack = new CloudStack(groups, mock(Network.class), mock(Image.class), Collections.emptyMap(), Collections.emptyMap(), "template", mock(InstanceAuthentication.class), "username", "publickey", mock(SpiFileSystem.class));
    UpscaleStackRequest<UpscaleStackResult> upscaleStackRequest = new UpscaleStackRequest<>(mock(CloudContext.class), mock(CloudCredential.class), cloudStack, new ArrayList<>(), adjustmentTypeWithThreshold);
    Assertions.assertThrows(CloudConnectorException.class, () -> stackUpscaleService.upscale(mock(AuthenticatedContext.class), upscaleStackRequest, connector));
    verify(flowMessageService, times(1)).fireEventAndLog(upscaleStackRequest.getResourceId(), UPDATE_IN_PROGRESS.name(), STACK_UPSCALE_QUOTA_ISSUE, "quota error");
    ArgumentCaptor<CloudStack> cloudStackArgumentCaptor = ArgumentCaptor.forClass(CloudStack.class);
    verify(resourceConnector, times(1)).upscale(any(), cloudStackArgumentCaptor.capture(), any(), eq(adjustmentTypeWithThreshold));
}
Also used : QuotaExceededException(com.sequenceiq.cloudbreak.cloud.exception.QuotaExceededException) Group(com.sequenceiq.cloudbreak.cloud.model.Group) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) CloudConnector(com.sequenceiq.cloudbreak.cloud.CloudConnector) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) ArrayList(java.util.ArrayList) AdjustmentTypeWithThreshold(com.sequenceiq.common.api.adjustment.AdjustmentTypeWithThreshold) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) SpiFileSystem(com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Image(com.sequenceiq.cloudbreak.cloud.model.Image) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) QuotaExceededException(com.sequenceiq.cloudbreak.cloud.exception.QuotaExceededException) UpscaleStackResult(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult) Network(com.sequenceiq.cloudbreak.cloud.model.Network) ResourceConnector(com.sequenceiq.cloudbreak.cloud.ResourceConnector) UpscaleStackRequest(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackRequest) Test(org.junit.jupiter.api.Test)

Example 5 with UpscaleStackResult

use of com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult in project cloudbreak by hortonworks.

the class StackUpscaleServiceTest method testBestEffort.

@Test
public void testBestEffort() throws QuotaExceededException {
    CloudConnector connector = mock(CloudConnector.class);
    ResourceConnector resourceConnector = mock(ResourceConnector.class);
    when(connector.resources()).thenReturn(resourceConnector);
    when(resourceConnector.upscale(any(), any(), any(), any())).thenThrow(new QuotaExceededException(40, 20, 40, "quota error", new Exception())).thenReturn(Collections.emptyList());
    AdjustmentTypeWithThreshold adjustmentTypeWithThreshold = new AdjustmentTypeWithThreshold(AdjustmentType.BEST_EFFORT, 0L);
    List<Group> groups = new ArrayList<>();
    List<CloudInstance> workerInstances = new ArrayList<>();
    workerInstances.add(new CloudInstance("W1", getInstanceTemplate(1L, "worker"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "worker1.example.com")));
    workerInstances.add(new CloudInstance(null, getInstanceTemplate(2L, "worker"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "worker2.example.com")));
    workerInstances.add(new CloudInstance(null, getInstanceTemplate(3L, "worker"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "worker3.example.com")));
    groups.add(new Group("worker", InstanceGroupType.CORE, workerInstances, mock(Security.class), mock(CloudInstance.class), mock(InstanceAuthentication.class), "admin", "ssh", 100, Optional.empty(), null, emptyMap()));
    List<CloudInstance> computeInstances = new ArrayList<>();
    computeInstances.add(new CloudInstance("C1", getInstanceTemplate(4L, "compute"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "compute1.example.com")));
    computeInstances.add(new CloudInstance(null, getInstanceTemplate(5L, "compute"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "compute2.example.com")));
    computeInstances.add(new CloudInstance(null, getInstanceTemplate(6L, "compute"), mock(InstanceAuthentication.class), "subnet-1", "az1", Map.of(CloudInstance.FQDN, "compute3.example.com")));
    groups.add(new Group("compute", InstanceGroupType.CORE, computeInstances, mock(Security.class), mock(CloudInstance.class), mock(InstanceAuthentication.class), "admin", "ssh", 100, Optional.empty(), null, emptyMap()));
    CloudStack cloudStack = new CloudStack(groups, mock(Network.class), mock(Image.class), Collections.emptyMap(), Collections.emptyMap(), "template", mock(InstanceAuthentication.class), "username", "publickey", mock(SpiFileSystem.class));
    UpscaleStackRequest<UpscaleStackResult> upscaleStackRequest = new UpscaleStackRequest<>(mock(CloudContext.class), mock(CloudCredential.class), cloudStack, new ArrayList<>(), adjustmentTypeWithThreshold);
    stackUpscaleService.upscale(mock(AuthenticatedContext.class), upscaleStackRequest, connector);
    verify(flowMessageService, times(1)).fireEventAndLog(upscaleStackRequest.getResourceId(), UPDATE_IN_PROGRESS.name(), STACK_UPSCALE_QUOTA_ISSUE, "quota error");
    ArgumentCaptor<CloudStack> cloudStackArgumentCaptor = ArgumentCaptor.forClass(CloudStack.class);
    verify(resourceConnector, times(2)).upscale(any(), cloudStackArgumentCaptor.capture(), any(), eq(adjustmentTypeWithThreshold));
    List<CloudStack> cloudStacks = cloudStackArgumentCaptor.getAllValues();
    List<CloudInstance> cloudInstances = cloudStacks.get(1).getGroups().stream().flatMap(group -> group.getInstances().stream()).collect(Collectors.toList());
    List<CloudInstance> cloudInstancesWithoutInstanceId = cloudInstances.stream().filter(cloudInstance -> cloudInstance.getInstanceId() == null).collect(Collectors.toList());
    assertEquals(4, cloudInstances.size());
    assertEquals(2, cloudInstancesWithoutInstanceId.size());
}
Also used : CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) TestUtil(com.sequenceiq.cloudbreak.TestUtil) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) CloudbreakFlowMessageService(com.sequenceiq.cloudbreak.core.flow2.stack.CloudbreakFlowMessageService) Map(java.util.Map) UpscaleStackRequest(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackRequest) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) InstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus) Set(java.util.Set) TestUtil.instanceMetaData(com.sequenceiq.cloudbreak.TestUtil.instanceMetaData) Collectors(java.util.stream.Collectors) TemporaryStorage(com.sequenceiq.cloudbreak.common.type.TemporaryStorage) Test(org.junit.jupiter.api.Test) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) AdjustmentType(com.sequenceiq.common.api.type.AdjustmentType) List(java.util.List) Group(com.sequenceiq.cloudbreak.cloud.model.Group) Optional(java.util.Optional) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Mock(org.mockito.Mock) SpiFileSystem(com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem) Image(com.sequenceiq.cloudbreak.cloud.model.Image) ArrayList(java.util.ArrayList) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) ArgumentCaptor(org.mockito.ArgumentCaptor) UPDATE_IN_PROGRESS(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.UPDATE_IN_PROGRESS) UpscaleStackResult(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult) InstanceMetaDataService(com.sequenceiq.cloudbreak.service.stack.InstanceMetaDataService) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Network(com.sequenceiq.cloudbreak.cloud.model.Network) InjectMocks(org.mockito.InjectMocks) Security(com.sequenceiq.cloudbreak.cloud.model.Security) Collections.emptyMap(java.util.Collections.emptyMap) ResourceConnector(com.sequenceiq.cloudbreak.cloud.ResourceConnector) AdjustmentTypeWithThreshold(com.sequenceiq.common.api.adjustment.AdjustmentTypeWithThreshold) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) QuotaExceededException(com.sequenceiq.cloudbreak.cloud.exception.QuotaExceededException) CloudConnector(com.sequenceiq.cloudbreak.cloud.CloudConnector) Mockito.verify(org.mockito.Mockito.verify) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) STACK_UPSCALE_QUOTA_ISSUE(com.sequenceiq.cloudbreak.event.ResourceEvent.STACK_UPSCALE_QUOTA_ISSUE) CloudPlatformConnectors(com.sequenceiq.cloudbreak.cloud.init.CloudPlatformConnectors) Assertions(org.junit.jupiter.api.Assertions) InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) Collections(java.util.Collections) Group(com.sequenceiq.cloudbreak.cloud.model.Group) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) CloudConnector(com.sequenceiq.cloudbreak.cloud.CloudConnector) ArrayList(java.util.ArrayList) SpiFileSystem(com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Network(com.sequenceiq.cloudbreak.cloud.model.Network) UpscaleStackRequest(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackRequest) QuotaExceededException(com.sequenceiq.cloudbreak.cloud.exception.QuotaExceededException) InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) AdjustmentTypeWithThreshold(com.sequenceiq.common.api.adjustment.AdjustmentTypeWithThreshold) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) QuotaExceededException(com.sequenceiq.cloudbreak.cloud.exception.QuotaExceededException) UpscaleStackResult(com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult) ResourceConnector(com.sequenceiq.cloudbreak.cloud.ResourceConnector) Test(org.junit.jupiter.api.Test)

Aggregations

UpscaleStackResult (com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackResult)10 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)7 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)7 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)7 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)7 UpscaleStackRequest (com.sequenceiq.cloudbreak.reactor.api.event.stack.UpscaleStackRequest)7 AdjustmentTypeWithThreshold (com.sequenceiq.common.api.adjustment.AdjustmentTypeWithThreshold)7 CloudConnector (com.sequenceiq.cloudbreak.cloud.CloudConnector)6 ResourceConnector (com.sequenceiq.cloudbreak.cloud.ResourceConnector)6 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)6 QuotaExceededException (com.sequenceiq.cloudbreak.cloud.exception.QuotaExceededException)6 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)6 Group (com.sequenceiq.cloudbreak.cloud.model.Group)6 Image (com.sequenceiq.cloudbreak.cloud.model.Image)6 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)6 Network (com.sequenceiq.cloudbreak.cloud.model.Network)6 SpiFileSystem (com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem)6 ArrayList (java.util.ArrayList)6 Test (org.junit.jupiter.api.Test)6 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)4