use of com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage in project cloud-pipeline by epam.
the class DataStorageDaoTest method validateS3Storage.
private void validateS3Storage(AbstractDataStorage actual, S3bucketDataStorage expected) {
validateCommonStorage(actual, expected);
assertThat(actual).isInstanceOfAny(S3bucketDataStorage.class);
S3bucketDataStorage bucket = (S3bucketDataStorage) actual;
assertThat(bucket).hasRegionId(expected.getRegionId()).hasAllowedCidrs(expected.getAllowedCidrs());
}
use of com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage in project cloud-pipeline by epam.
the class RoleDaoTest method shouldReturnRoleByStorageId.
@Test
public void shouldReturnRoleByStorageId() {
S3bucketDataStorage s3bucketDataStorage = ObjectCreatorUtils.createS3Bucket(null, TEST_STORAGE_PATH, TEST_STORAGE_PATH, TEST_USER1);
dataStorageDao.createDataStorage(s3bucketDataStorage);
roleDao.createRole(TEST_ROLE, false, false, s3bucketDataStorage.getId());
assertThat(roleDao.loadRolesByStorageId(s3bucketDataStorage.getId()), hasSize(1));
}
use of com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage in project cloud-pipeline by epam.
the class ObjectCreatorUtils method createS3Bucket.
public static S3bucketDataStorage createS3Bucket(Long id, String name, String path, String owner) {
S3bucketDataStorage s3bucketDataStorage = new S3bucketDataStorage(id, name, path);
s3bucketDataStorage.setOwner(owner);
return s3bucketDataStorage;
}
use of com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage in project cloud-pipeline by epam.
the class S3StorageProviderTest method createBucketWithSpecifiedCorsPolicy.
@Test
public void createBucketWithSpecifiedCorsPolicy() {
final S3bucketDataStorage storage = new S3bucketDataStorage(1L, bucketName, bucketName);
storage.setRegionId(REGION_ID);
final String createdBucketName = s3StorageProvider.createStorage(storage);
Assert.assertEquals(bucketName, createdBucketName);
verify(amazonClient).setBucketCrossOriginConfiguration(any(), any());
}
use of com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage in project cloud-pipeline by epam.
the class FolderEventServiceTest method shouldAddFolderEvent.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void shouldAddFolderEvent() {
doNothing().when(entityManager).setManagers(anyListOf(SecuredEntityManager.class));
Folder folder2 = new Folder(2L);
Pipeline pipeline = new Pipeline(1L);
S3bucketDataStorage dataStorage = new S3bucketDataStorage(1L, "", "");
RunConfiguration runConfiguration = new RunConfiguration();
runConfiguration.setId(1L);
MetadataEntity metadataEntity = new MetadataEntity();
metadataEntity.setClassEntity(new MetadataClass(1L, METADATA_CLASS_NAME));
metadataEntity.setId(1L);
Folder folder1 = new Folder(1L);
folder1.setChildFolders(Collections.singletonList(folder2));
folder1.setPipelines(Collections.singletonList(pipeline));
folder1.setStorages(Collections.singletonList(dataStorage));
folder1.setConfigurations(Collections.singletonList(runConfiguration));
folder1.setMetadata(Collections.singletonMap(METADATA_CLASS_NAME, 1));
when(issueManager.loadIssuesForEntity(any())).thenReturn(Arrays.asList(Issue.builder().id(1L).build(), Issue.builder().id(2L).build()));
when(pipelineRunManager.loadAllRunsByPipeline(anyLong())).thenReturn(Arrays.asList(new PipelineRun(1L, ""), new PipelineRun(2L, "")));
when(dataStorageManager.load(1L)).thenReturn(dataStorage);
when(folderManager.load(1L)).thenReturn(folder1);
when(folderManager.load(2L)).thenReturn(folder2);
when(metadataEntityManager.loadMetadataEntityByClassNameAndFolderId(anyLong(), anyString())).thenReturn(Collections.singletonList(metadataEntity));
doNothing().when(eventDao).insertUpdateEvent(anyString(), anyLong());
folderEventService.updateEventsWithChildrenAndIssues(1L);
verify(eventDao).insertUpdateEvent("folder", 1L);
verify(eventDao).insertUpdateEvent("folder", 2L);
verify(eventDao).insertUpdateEvent("pipeline", 1L);
verify(eventDao).insertUpdateEvent("run", 1L);
verify(eventDao).insertUpdateEvent("run", 2L);
verify(eventDao).insertUpdateEvent("S3", 1L);
verify(eventDao).insertUpdateEvent("configuration", 1L);
verify(eventDao).insertUpdateEvent("metadata_entity", 1L);
verify(eventDao, times(6)).insertUpdateEvent("issue", 1L);
verify(eventDao, times(6)).insertUpdateEvent("issue", 2L);
verifyNoMoreInteractions(eventDao);
}
Aggregations