Search in sources :

Example 1 with ExperimentalFeatures

use of com.sequenceiq.environment.environment.domain.ExperimentalFeatures in project cloudbreak by hortonworks.

the class EnvironmentServiceTest method updateTunnelByEnvironmentId.

@Test
void updateTunnelByEnvironmentId() {
    ExperimentalFeatures expFeat = environment.getExperimentalFeaturesJson();
    expFeat.setTunnel(Tunnel.CCM);
    environment.setExperimentalFeaturesJson(expFeat);
    Optional<Environment> optEnv = Optional.of(environment);
    when(environmentRepository.findById(123L)).thenReturn(optEnv);
    environmentServiceUnderTest.updateTunnelByEnvironmentId(123L, Tunnel.CCMV2_JUMPGATE);
    ArgumentCaptor<Environment> envCaptor = ArgumentCaptor.forClass(Environment.class);
    verify(environmentRepository).save(envCaptor.capture());
    Environment captured = envCaptor.getValue();
    assertThat(captured.getExperimentalFeaturesJson().getTunnel()).isEqualTo(Tunnel.CCMV2_JUMPGATE);
}
Also used : ExperimentalFeatures(com.sequenceiq.environment.environment.domain.ExperimentalFeatures) Environment(com.sequenceiq.environment.environment.domain.Environment) Test(org.junit.jupiter.api.Test)

Example 2 with ExperimentalFeatures

use of com.sequenceiq.environment.environment.domain.ExperimentalFeatures in project cloudbreak by hortonworks.

the class EnvironmentUpgradeCcmServiceTest method upgradeCcmTestWhenNotEntitledFromCCMv2.

@Test
void upgradeCcmTestWhenNotEntitledFromCCMv2() {
    EnvironmentDto env = prepareEnvByName(EnvironmentStatus.AVAILABLE);
    ExperimentalFeatures exp = env.getExperimentalFeatures();
    exp.setTunnel(Tunnel.CCMV2);
    when(entitlementService.ccmV2ToV2JumpgateUpgradeEnabled(any())).thenReturn(false);
    assertThatThrownBy(() -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.upgradeCcmByName("name123"))).hasMessageContaining("not entitled for Cluster Connectivity Manager upgrade").isInstanceOf(BadRequestException.class);
}
Also used : ExperimentalFeatures(com.sequenceiq.environment.environment.domain.ExperimentalFeatures) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with ExperimentalFeatures

use of com.sequenceiq.environment.environment.domain.ExperimentalFeatures in project cloudbreak by hortonworks.

the class EnvironmentUpgradeCcmServiceTest method upgradeCcmTestWhenNotEntitledFromCCMv1.

@Test
void upgradeCcmTestWhenNotEntitledFromCCMv1() {
    EnvironmentDto env = prepareEnvByName(EnvironmentStatus.AVAILABLE);
    ExperimentalFeatures exp = env.getExperimentalFeatures();
    exp.setTunnel(Tunnel.CCM);
    when(entitlementService.ccmV1ToV2JumpgateUpgradeEnabled(any())).thenReturn(false);
    assertThatThrownBy(() -> ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.upgradeCcmByName("name123"))).hasMessageContaining("not entitled for Cluster Connectivity Manager upgrade").isInstanceOf(BadRequestException.class);
}
Also used : ExperimentalFeatures(com.sequenceiq.environment.environment.domain.ExperimentalFeatures) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with ExperimentalFeatures

use of com.sequenceiq.environment.environment.domain.ExperimentalFeatures in project cloudbreak by hortonworks.

the class EnvironmentModificationService method editTunnelIfChanged.

private void editTunnelIfChanged(EnvironmentEditDto editDto, Environment environment) {
    if (editDto.getTunnel() != null) {
        ExperimentalFeatures experimentalFeaturesJson = environment.getExperimentalFeaturesJson();
        experimentalFeaturesJson.setTunnel(editDto.getTunnel());
        environment.setExperimentalFeaturesJson(experimentalFeaturesJson);
    }
}
Also used : ExperimentalFeatures(com.sequenceiq.environment.environment.domain.ExperimentalFeatures)

Example 5 with ExperimentalFeatures

use of com.sequenceiq.environment.environment.domain.ExperimentalFeatures in project cloudbreak by hortonworks.

the class EnvironmentUpgradeCcmServiceTest method createEnv.

private EnvironmentDto createEnv(EnvironmentStatus status) {
    EnvironmentDto env = new EnvironmentDto();
    env.setName("TestEnv");
    env.setStatus(status);
    ExperimentalFeatures exp = env.getExperimentalFeatures();
    exp.setTunnel(Tunnel.DIRECT);
    return env;
}
Also used : ExperimentalFeatures(com.sequenceiq.environment.environment.domain.ExperimentalFeatures) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto)

Aggregations

ExperimentalFeatures (com.sequenceiq.environment.environment.domain.ExperimentalFeatures)10 Environment (com.sequenceiq.environment.environment.domain.Environment)3 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)3 Test (org.junit.jupiter.api.Test)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 Tunnel (com.sequenceiq.common.api.type.Tunnel)1 CloudStorageValidation (com.sequenceiq.environment.api.v1.environment.model.base.CloudStorageValidation)1 IdBrokerMappingSource (com.sequenceiq.environment.api.v1.environment.model.base.IdBrokerMappingSource)1