use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class PipelineDaoTest method getFolder.
private Folder getFolder() {
Folder folder = new Folder();
folder.setName(TEST_NAME);
folder.setOwner(TEST_USER);
return folder;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class DataStorageManagerTest method updateDataStorageTest.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void updateDataStorageTest() throws Exception {
Folder folder = new Folder();
folder.setName("testfolder");
folderManager.create(folder);
DataStorageVO storageVO = ObjectCreatorUtils.constructDataStorageVO(NAME, DESCRIPTION, DataStorageType.S3, PATH, STS_DURATION, LTS_DURATION, folder.getId(), TEST_MOUNT_POINT, TEST_MOUNT_OPTIONS);
AbstractDataStorage saved = storageManager.create(storageVO, false, false, false);
Folder newFolder = new Folder();
newFolder.setName("newtestfolder");
folderManager.create(newFolder);
// test that we can change parent folder for storage
storageVO.setId(saved.getId());
storageVO.setParentFolderId(newFolder.getId());
storageManager.update(storageVO);
AbstractDataStorage loaded = storageManager.load(saved.getId());
assertDataStorageAccordingToUpdateStorageVO(storageVO, loaded);
// test that we can change description for storage
storageVO.setDescription(CHANGED);
storageManager.update(storageVO);
loaded = storageManager.load(saved.getId());
assertDataStorageAccordingToUpdateStorageVO(storageVO, loaded);
}
use of com.epam.pipeline.entity.pipeline.Folder 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);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class MetadataUploadManagerTest method prepareRequiredEntities.
private Folder prepareRequiredEntities() {
when(authManager.getAuthorizedUser()).thenReturn("user");
Folder folder = createFolder();
MetadataClass participantClass = entityManager.createMetadataClass(MetadataFileBuilder.PARTICIPANT_CLASS_NAME);
MetadataClass pairClass = entityManager.createMetadataClass(MetadataFileBuilder.PAIR_CLASS_NAME);
entityManager.updateMetadataEntity(createEntityVO(folder.getId(), participantClass.getId(), MetadataFileBuilder.PARTICIPANT1_ID));
entityManager.updateMetadataEntity(createEntityVO(folder.getId(), participantClass.getId(), MetadataFileBuilder.PARTICIPANT2_ID));
entityManager.updateMetadataEntity(createEntityVO(folder.getId(), pairClass.getId(), MetadataFileBuilder.PAIR1_ID));
entityManager.updateMetadataEntity(createEntityVO(folder.getId(), pairClass.getId(), MetadataFileBuilder.PAIR2_ID));
return folder;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class MetadataUploadManagerTest method uploadingMetadataWithWrongFieldTypeThrowsException.
@Test(expected = MetadataReadingException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void uploadingMetadataWithWrongFieldTypeThrowsException() throws IOException {
Folder folder = prepareRequiredEntities();
entityManager.createMetadataClass(MetadataFileBuilder.SAMPLE_CLASS_NAME);
uploadMetadata(folder, Arrays.asList(HEADER1, LINE1));
uploadMetadata(folder, Arrays.asList(HEADER2, LINE2));
String headerWithWrongFieldType = "Sample:ID${d}SampleName${d}participant${d}fast_dir:Path\n";
uploadMetadata(folder, Arrays.asList(headerWithWrongFieldType, LINE3));
}
Aggregations