Search in sources :

Example 41 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class CmTemplateValidatorTest method testValidationIfNifiPresentedAndDownScaleThenValidationShouldThrowException.

@Test
public void testValidationIfNifiPresentedAndDownScaleThenValidationShouldThrowException() {
    Blueprint blueprint = readBlueprint("input/nifi.bp");
    String hostGroup = "master";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.0.0");
    when(entitlementService.isEntitledFor(anyString(), any())).thenReturn(false);
    assertThrows(BadRequestException.class, () -> subject.validateHostGroupScalingRequest(ACCOUNT_ID, blueprint, Optional.of(clouderaManagerRepo), hostGroup, -2, List.of()));
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 42 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class CmTemplateValidatorTest method testValidationIfNodeManagerCountWillBeZero.

@Test
public void testValidationIfNodeManagerCountWillBeZero() {
    Blueprint blueprint = readBlueprint("input/cdp-data-mart.bp");
    String hostGroup = "compute";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.0.0");
    InstanceGroup compute = new InstanceGroup();
    compute.setGroupName("compute");
    compute.setInstanceMetaData(Set.of(new InstanceMetaData(), new InstanceMetaData(), new InstanceMetaData()));
    InstanceGroup worker = new InstanceGroup();
    worker.setGroupName("worker");
    worker.setInstanceMetaData(Set.of());
    BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> subject.validateHostGroupScalingRequest(ACCOUNT_ID, blueprint, Optional.of(clouderaManagerRepo), hostGroup, -3, List.of(compute, worker)));
    assertEquals("Scaling adjustment is not allowed. NODEMANAGER role must be present on 1 host(s) but after the scaling operation 0 host(s) " + "would have this role. Based on the template this role is present on the compute, worker host group(s).", badRequestException.getMessage());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Test(org.junit.Test)

Example 43 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class CmTemplateValidatorTest method testValidationIfNifiPresentedAndUpScaleThenValidationShouldThrowException.

@Test
public void testValidationIfNifiPresentedAndUpScaleThenValidationShouldThrowException() {
    Blueprint blueprint = readBlueprint("input/nifi.bp");
    String hostGroup = "master";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.0.0");
    when(entitlementService.isEntitledFor(anyString(), any())).thenReturn(false);
    assertThrows(BadRequestException.class, () -> subject.validateHostGroupScalingRequest(ACCOUNT_ID, blueprint, Optional.of(clouderaManagerRepo), hostGroup, 2, List.of()));
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 44 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class CmTemplateValidatorTest method testValidationIfKafkaUpgradedTo7211PresentedAndUpScaleThenValidationShouldThrowError.

@Test
public void testValidationIfKafkaUpgradedTo7211PresentedAndUpScaleThenValidationShouldThrowError() {
    Blueprint blueprint = readBlueprint("input/kafka.bp");
    String hostGroup = "broker";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.2.11");
    when(entitlementService.isEntitledFor(anyString(), any())).thenReturn(false);
    assertThrows(BadRequestException.class, () -> subject.validateHostGroupScalingRequest(ACCOUNT_ID, blueprint, Optional.of(clouderaManagerRepo), hostGroup, +1, List.of()));
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 45 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class CmTemplateValidatorTest method testValidationIfNodeManagerCountWillBeHigherThanZeroInOtherGroup.

@Test
public void testValidationIfNodeManagerCountWillBeHigherThanZeroInOtherGroup() {
    Blueprint blueprint = readBlueprint("input/cdp-data-mart.bp");
    String hostGroup = "compute";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.0.0");
    InstanceGroup compute = new InstanceGroup();
    compute.setGroupName("compute");
    compute.setInstanceMetaData(Set.of(new InstanceMetaData(), new InstanceMetaData(), new InstanceMetaData()));
    InstanceGroup worker = new InstanceGroup();
    worker.setGroupName("worker");
    worker.setInstanceMetaData(Set.of(new InstanceMetaData()));
    subject.validateHostGroupScalingRequest(ACCOUNT_ID, blueprint, Optional.of(clouderaManagerRepo), hostGroup, -2, Set.of(compute, worker));
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Test(org.junit.Test)

Aggregations

ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)91 Test (org.junit.Test)34 Test (org.junit.jupiter.api.Test)23 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)23 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)20 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)14 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)10 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)9 ClusterComponent (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent)9 ParcelInfo (com.sequenceiq.cloudbreak.service.upgrade.sync.common.ParcelInfo)9 HashSet (java.util.HashSet)8 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)8 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)7 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)7 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)6 IdBroker (com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker)6 ExtendedPollingResult (com.sequenceiq.cloudbreak.polling.ExtendedPollingResult)6 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)6 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)6 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)5