use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.
the class AwsRegionManager method create.
@Transactional
public AwsRegion create(final AwsRegionVO awsRegionVO) {
validateAwsRegionVO(awsRegionVO);
final AwsRegion region = awsRegionMapper.toAwsRegion(awsRegionVO);
region.setOwner(authManager.getAuthorizedUser());
region.setCreatedDate(DateUtils.now());
fillMissingRegionSettingsWithDefaultValues(region);
switchDefaultRegion(region);
return awsRegionDao.create(region);
}
use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.
the class AwsRegionManager method changeOwner.
@Override
public AwsRegion changeOwner(final Long id, final String owner) {
final AwsRegion awsRegion = load(id);
awsRegion.setOwner(owner);
final AwsRegionVO awsRegionVO = awsRegionMapper.toAwsRegionVO(awsRegion);
return update(id, awsRegionVO);
}
use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.
the class DataStorageDaoTest method setUp.
@Before
public void setUp() {
testFolder = buildFolder(null);
awsRegion = new AwsRegion();
awsRegion.setName("Default");
awsRegion.setDefault(true);
awsRegion.setAwsRegionName("us-east-1");
awsRegionDao.create(awsRegion);
s3Bucket = new S3bucketDataStorage(null, TEST_STORAGE_NAME, TEST_STORAGE_PATH);
s3Bucket.setDescription("testDescription");
s3Bucket.setParentFolderId(testFolder.getId());
s3Bucket.setRegionId(awsRegion.getId());
s3Bucket.setOwner(TEST_OWNER);
s3Bucket.setMountPoint("testMountPoint");
s3Bucket.setMountOptions("testMountOptions");
s3Bucket.setShared(true);
s3Bucket.setAllowedCidrs(Arrays.asList("test1", "test2"));
policy = new StoragePolicy();
policy.setBackupDuration(BACKUP_DURATION);
policy.setLongTermStorageDuration(LTS_DURATION);
policy.setShortTermStorageDuration(STS_DURATION);
policy.setVersioningEnabled(true);
s3Bucket.setStoragePolicy(policy);
nfsStorage = new NFSDataStorage(null, "NFS_STORAGE", "nfs_path");
nfsStorage.setOwner(TEST_OWNER);
nfsStorage.setDescription("NFS");
nfsStorage.setParentFolderId(testFolder.getId());
nfsStorage.setMountOptions("-s");
nfsStorage.setMountPoint("nfs");
}
use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.
the class AwsRegionDaoTest method loadByIdShouldReturnEntityWithTheGivenId.
@Test
public void loadByIdShouldReturnEntityWithTheGivenId() {
final AwsRegion expectedRegion = awsRegionDao.create(getCommonRegion());
final Optional<AwsRegion> actualRegionWrapper = awsRegionDao.loadById(expectedRegion.getId());
assertTrue(actualRegionWrapper.isPresent());
final AwsRegion actualRegion = actualRegionWrapper.get();
assertThat(actualRegion.getId(), is(expectedRegion.getId()));
assertRegionEquals(expectedRegion, actualRegion);
}
use of com.epam.pipeline.entity.region.AwsRegion in project cloud-pipeline by epam.
the class AwsRegionDaoTest method createShouldThrowIfNameIsNotSpecified.
@Test
public void createShouldThrowIfNameIsNotSpecified() {
final AwsRegion regionWithoutName = getCommonRegion();
regionWithoutName.setName(null);
assertThrows(DataIntegrityViolationException.class, () -> awsRegionDao.create(regionWithoutName));
}
Aggregations