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