Search in sources :

Example 6 with AwsRegion

use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.

the class AwsRegionDaoTest method getCommonRegion.

private AwsRegion getCommonRegion() {
    final AwsRegion awsRegion = new AwsRegion();
    awsRegion.setName("name-" + RandomUtils.nextInt());
    awsRegion.setAwsRegionName("regionId-" + RandomUtils.nextInt());
    awsRegion.setOwner("test-admin");
    awsRegion.setCreatedDate(new Date());
    return awsRegion;
}
Also used : AwsRegion(com.epam.pipeline.entity.region.AwsRegion) Date(java.util.Date)

Example 7 with AwsRegion

use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.

the class AwsRegionDaoTest method createShouldReturnEntityWithGeneratedId.

@Test
public void createShouldReturnEntityWithGeneratedId() {
    final AwsRegion region = getCommonRegion();
    assertNull(region.getId());
    final AwsRegion createdRegion = awsRegionDao.create(region);
    assertNotNull(createdRegion.getId());
}
Also used : AwsRegion(com.epam.pipeline.entity.region.AwsRegion) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 8 with AwsRegion

use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.

the class AwsRegionDaoTest method createShouldSaveEntityWithAllSpecifiedParameters.

@Test
public void createShouldSaveEntityWithAllSpecifiedParameters() {
    final AwsRegion expectedRegion = getCommonRegion();
    expectedRegion.setCorsRules("corsRules");
    expectedRegion.setPolicy("policy");
    expectedRegion.setKmsKeyId("kmsKeyId");
    expectedRegion.setKmsKeyArn("kmsKeyArn");
    final AwsRegion createdRegion = awsRegionDao.create(expectedRegion);
    final Optional<AwsRegion> retrievedRegionWrapper = awsRegionDao.loadById(createdRegion.getId());
    assertTrue(retrievedRegionWrapper.isPresent());
    final AwsRegion actualRegion = retrievedRegionWrapper.get();
    assertRegionEquals(expectedRegion, actualRegion);
}
Also used : AwsRegion(com.epam.pipeline.entity.region.AwsRegion) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 9 with AwsRegion

use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.

the class AwsRegionDaoTest method loadByNameShouldReturnEntityWithTheGivenName.

@Test
public void loadByNameShouldReturnEntityWithTheGivenName() {
    final AwsRegion expectedRegion = awsRegionDao.create(getCommonRegion());
    final Optional<AwsRegion> actualRegionWrapper = awsRegionDao.loadByName(expectedRegion.getName());
    assertTrue(actualRegionWrapper.isPresent());
    final AwsRegion actualRegion = actualRegionWrapper.get();
    assertThat(actualRegion.getName(), is(expectedRegion.getName()));
    assertRegionEquals(expectedRegion, actualRegion);
}
Also used : AwsRegion(com.epam.pipeline.entity.region.AwsRegion) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 10 with AwsRegion

use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.

the class ObjectCreatorUtils method createAwsRegion.

public static AwsRegion createAwsRegion(long id, String regionId) {
    AwsRegion region = new AwsRegion();
    region.setId(id);
    region.setAwsRegionName(regionId);
    return region;
}
Also used : AwsRegion(com.epam.pipeline.entity.region.AwsRegion)

Aggregations

AwsRegion (com.epam.pipeline.entity.region.AwsRegion)42 Test (org.junit.Test)24 AwsRegionVO (com.epam.pipeline.controller.vo.AwsRegionVO)13 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)9 Matchers.isEmptyOrNullString (org.hamcrest.Matchers.isEmptyOrNullString)6 Transactional (org.springframework.transaction.annotation.Transactional)5 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)4 Before (org.junit.Before)4 Date (java.util.Date)3 List (java.util.List)3 MessageConstants (com.epam.pipeline.common.MessageConstants)2 MessageHelper (com.epam.pipeline.common.MessageHelper)2 InstancePrice (com.epam.pipeline.entity.cluster.InstancePrice)2 PipelineRunPrice (com.epam.pipeline.entity.cluster.PipelineRunPrice)2 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)2 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)2 DataStorageException (com.epam.pipeline.entity.datastorage.DataStorageException)2 StoragePolicy (com.epam.pipeline.entity.datastorage.StoragePolicy)2 S3bucketDataStorage (com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage)2 Folder (com.epam.pipeline.entity.pipeline.Folder)2