use of com.sequenceiq.environment.environment.domain.EnvironmentView in project cloudbreak by hortonworks.
the class EnvironmentDeletionService method deleteByCrnAndAccountId.
public EnvironmentViewDto deleteByCrnAndAccountId(String crn, String accountId, String actualUserCrn, boolean cascading, boolean forced) {
EnvironmentView environment = environmentViewService.getByCrnAndAccountId(crn, accountId);
MDCBuilder.buildMdcContext(environment);
LOGGER.debug(String.format("Deleting environment [name: %s]", environment.getName()));
delete(environment, actualUserCrn, cascading, forced);
return environmentDtoConverter.environmentViewToViewDto(environment);
}
use of com.sequenceiq.environment.environment.domain.EnvironmentView in project cloudbreak by hortonworks.
the class GcpEnvironmentParametersConverterTest method convertToDtoTest.
@Test
void convertToDtoTest() {
EnvironmentView environmentView = ENVIRONMENT_VIEW;
GcpParameters parameters = new GcpParameters();
parameters.setAccountId(ACCOUNT_ID);
parameters.setEnvironment(environmentView);
parameters.setId(ID);
parameters.setName(ENV_NAME);
parameters.setEncryptionKey(ENCRYPTION_KEY);
ParametersDto result = underTest.convertToDto(parameters);
assertEquals(ACCOUNT_ID, result.getAccountId());
assertEquals(ID, result.getId());
assertEquals(ENV_NAME, result.getName());
assertEquals(ENCRYPTION_KEY, result.getGcpParametersDto().getGcpResourceEncryptionParametersDto().getEncryptionKey());
}
use of com.sequenceiq.environment.environment.domain.EnvironmentView in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkConverterTest method testConvertToNetwork.
@Test
void testConvertToNetwork() {
EnvironmentView environment = new EnvironmentView();
environment.setLocation(LOCATION);
AwsNetwork awsNetwork = new AwsNetwork();
awsNetwork.setVpcId(VPC_ID);
awsNetwork.setEnvironments(Set.of(environment));
Network network = underTest.convertToNetwork(awsNetwork);
assertEquals(VPC_ID, network.getStringParameter(NetworkConstants.VPC_ID));
}
use of com.sequenceiq.environment.environment.domain.EnvironmentView in project cloudbreak by hortonworks.
the class EnvironmentViewConverterTest method convertTest.
@Test
void convertTest() {
Environment environment = newTestEnvironment();
EnvironmentView result = underTest.convert(environment);
assertEquals(ACCOUNT_ID, result.getAccountId());
assertEquals(false, result.isArchived());
assertEquals(CLOUD_PLATFORM, result.getCloudPlatform());
assertEquals(DESCRIPTION, result.getDescription());
assertEquals(1L, result.getId());
assertEquals(LATITUDE, result.getLatitude());
assertEquals(LOCATION, result.getLocation());
assertEquals(LOCATION_DISPLAY_NAME, result.getLocationDisplayName());
assertEquals(LONGITUDE, result.getLongitude());
assertEquals(ENVIRONMENT_NAME, result.getName());
assertEquals(NETWORK_ID, result.getNetwork().getNetworkId());
assertEquals(REGIONS, result.getRegions());
assertEquals(CRN, result.getResourceCrn());
assertEquals(EnvironmentStatus.AVAILABLE, result.getStatus());
}
use of com.sequenceiq.environment.environment.domain.EnvironmentView in project cloudbreak by hortonworks.
the class EnvironmentDeletionServiceTest method deleteMultipleByCrns.
@Test
public void deleteMultipleByCrns() {
environmentDeletionService.deleteMultipleByCrns(Set.of("crn1", "crn2"), ACCOUNT_ID, USER, false, false);
Set<String> names = Set.of("crn1", "crn2");
EnvironmentView e1 = new EnvironmentView();
e1.setId(0L);
EnvironmentView e2 = new EnvironmentView();
e2.setId(1L);
Set<EnvironmentView> envs = Set.of(e1, e2);
int expected = envs.size();
EnvironmentDeletionService environmentDeletionServiceWired = spy(environmentDeletionService);
when(environmentService.findByResourceCrnsInAccount(eq(names), eq(ACCOUNT_ID))).thenReturn(envs);
assertEquals(expected, environmentDeletionServiceWired.deleteMultipleByCrns(names, ACCOUNT_ID, USER, false, false).size());
verify(environmentDeletionServiceWired, times(expected)).delete(any(), eq(USER), anyBoolean(), anyBoolean());
}
Aggregations