Search in sources :

Example 76 with ClouderaManagerProduct

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

the class CmTemplateValidatorTest method testValidationIfNifi727PresentedAndUpScaleThenValidationShouldThrowBecauseTheBPVersionIsLower.

@Test
public void testValidationIfNifi727PresentedAndUpScaleThenValidationShouldThrowBecauseTheBPVersionIsLower() {
    Blueprint blueprint = readBlueprint("input/nifi_7_2_7.bp");
    String hostGroup = "master";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.2.7");
    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 77 with ClouderaManagerProduct

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

the class CmTemplateValidatorTest method testValidationIfKafkaUpgradedTo7212PresentedAndUpScaleThenValidationShouldNOTThrowError.

@Test
public void testValidationIfKafkaUpgradedTo7212PresentedAndUpScaleThenValidationShouldNOTThrowError() {
    Blueprint blueprint = readBlueprint("input/kafka.bp");
    String hostGroup = "broker";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.2.12");
    when(entitlementService.isEntitledFor(anyString(), any())).thenReturn(false);
    assertDoesNotThrow(() -> 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 78 with ClouderaManagerProduct

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

the class CmTemplateValidatorTest method testValidationIfNifiPresentedAndUpScaleAndEntitledForScalingThenValidationShouldReturnTrue.

@Test
public void testValidationIfNifiPresentedAndUpScaleAndEntitledForScalingThenValidationShouldReturnTrue() {
    Blueprint blueprint = readBlueprint("input/nifi.bp");
    String hostGroup = "master";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.0.0");
    when(entitlementService.isEntitledFor(anyString(), any())).thenReturn(true);
    assertDoesNotThrow(() -> 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 79 with ClouderaManagerProduct

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

the class CmTemplateValidatorTest method testValidationIfNodeManagerCountWillBeHigherThanZeroInTheSameGroup.

@Test
public void testValidationIfNodeManagerCountWillBeHigherThanZeroInTheSameGroup() {
    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());
    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)

Example 80 with ClouderaManagerProduct

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

the class CmTemplateValidatorTest method testValidationIfNifi726PresentedAndUpScaleThenValidationShouldNotThrowBecauseTheBPVersionIsHigher.

@Test
public void testValidationIfNifi726PresentedAndUpScaleThenValidationShouldNotThrowBecauseTheBPVersionIsHigher() {
    Blueprint blueprint = readBlueprint("input/nifi_7_2_6.bp");
    String hostGroup = "master";
    ClouderaManagerProduct clouderaManagerRepo = new ClouderaManagerProduct();
    clouderaManagerRepo.setVersion("7.2.6");
    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)

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