Search in sources :

Example 1 with S3bucketDataStorage

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());
}
Also used : S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage)

Example 2 with S3bucketDataStorage

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));
}
Also used : S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 3 with S3bucketDataStorage

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;
}
Also used : S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage)

Example 4 with 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());
}
Also used : S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 5 with S3bucketDataStorage

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);
}
Also used : PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) SecuredEntityManager(com.epam.pipeline.manager.security.SecuredEntityManager) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage) Folder(com.epam.pipeline.entity.pipeline.Folder) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

S3bucketDataStorage (com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage)14 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)7 Test (org.junit.Test)7 Folder (com.epam.pipeline.entity.pipeline.Folder)3 SecuredEntityManager (com.epam.pipeline.manager.security.SecuredEntityManager)3 Transactional (org.springframework.transaction.annotation.Transactional)3 StoragePolicy (com.epam.pipeline.entity.datastorage.StoragePolicy)2 NFSDataStorage (com.epam.pipeline.entity.datastorage.nfs.NFSDataStorage)2 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)2 AclClass (com.epam.pipeline.entity.security.acl.AclClass)2 MessageConstants (com.epam.pipeline.common.MessageConstants)1 MessageHelper (com.epam.pipeline.common.MessageHelper)1 DataStorageVO (com.epam.pipeline.controller.vo.DataStorageVO)1 EntityVO (com.epam.pipeline.controller.vo.EntityVO)1 UpdateDataStorageItemVO (com.epam.pipeline.controller.vo.data.storage.UpdateDataStorageItemVO)1 DataStorageDao (com.epam.pipeline.dao.datastorage.DataStorageDao)1 AbstractSecuredEntity (com.epam.pipeline.entity.AbstractSecuredEntity)1 BaseEntity (com.epam.pipeline.entity.BaseEntity)1 RunConfiguration (com.epam.pipeline.entity.configuration.RunConfiguration)1 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)1