Search in sources :

Example 1 with StorageConsumptionRequest

use of com.sequenceiq.consumption.api.v1.consumption.model.request.StorageConsumptionRequest in project cloudbreak by hortonworks.

the class ConsumptionApiConverterTest method testInitCreationDtoForStorage.

@Test
void testInitCreationDtoForStorage() {
    StorageConsumptionRequest request = new StorageConsumptionRequest();
    request.setEnvironmentCrn("env-crn");
    request.setMonitoredResourceType(ResourceType.DATALAKE);
    request.setMonitoredResourceName("name");
    request.setMonitoredResourceCrn("dl-crn");
    request.setStorageLocation("location");
    ConsumptionCreationDto result = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.initCreationDtoForStorage(request));
    Assertions.assertEquals("name_STORAGE", result.getName());
    Assertions.assertNull(result.getDescription());
    Assertions.assertEquals("test-aws", result.getAccountId());
    Assertions.assertTrue(result.getResourceCrn().startsWith("crn:cdp:consumption:us-west-1:test-aws:consumption:"));
    Assertions.assertEquals("env-crn", result.getEnvironmentCrn());
    Assertions.assertEquals(ResourceType.DATALAKE, result.getMonitoredResourceType());
    Assertions.assertEquals("dl-crn", result.getMonitoredResourceCrn());
    Assertions.assertEquals(ConsumptionType.STORAGE, result.getConsumptionType());
    Assertions.assertEquals("location", result.getStorageLocation());
}
Also used : StorageConsumptionRequest(com.sequenceiq.consumption.api.v1.consumption.model.request.StorageConsumptionRequest) ConsumptionCreationDto(com.sequenceiq.consumption.dto.ConsumptionCreationDto) Test(org.junit.jupiter.api.Test)

Aggregations

StorageConsumptionRequest (com.sequenceiq.consumption.api.v1.consumption.model.request.StorageConsumptionRequest)1 ConsumptionCreationDto (com.sequenceiq.consumption.dto.ConsumptionCreationDto)1 Test (org.junit.jupiter.api.Test)1