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