use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class ConfigurationRunner method getIdsToProcess.
private List<Long> getIdsToProcess(RunConfigurationWithEntitiesVO runConfiguration) {
if (CollectionUtils.isNotEmpty(runConfiguration.getEntitiesIds())) {
return runConfiguration.getEntitiesIds();
}
if (StringUtils.hasText(runConfiguration.getMetadataClass())) {
Folder folder = folderManager.load(runConfiguration.getFolderId());
Assert.notNull(folder, "Project is required to launch whole class processing.");
MetadataClass metadataClass = metadataEntityManager.loadClass(runConfiguration.getMetadataClass());
return metadataEntityManager.loadMetadataEntityByClassNameAndFolderId(folder.getId(), metadataClass.getName()).stream().map(BaseEntity::getId).collect(Collectors.toList());
}
return Collections.emptyList();
}
use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class MetadataClassDaoTest method testCRUDMetadataClass.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testCRUDMetadataClass() {
MetadataClass metadataClass = new MetadataClass();
metadataClass.setId(CLASS_ID_1);
metadataClass.setName(CLASS_NAME_1);
metadataClassDao.createMetadataClass(metadataClass);
List<MetadataClass> expectedResult = Collections.singletonList(metadataClass);
Assert.assertEquals(expectedResult, metadataClassDao.loadAllMetadataClasses());
metadataClass.setFireCloudClassName(FireCloudClass.SAMPLE);
metadataClassDao.updateMetadataClass(metadataClass);
expectedResult = Collections.singletonList(metadataClass);
Assert.assertEquals(expectedResult, metadataClassDao.loadAllMetadataClasses());
metadataClassDao.deleteMetadataClass(metadataClass.getId());
Assert.assertEquals(Collections.emptyList(), metadataClassDao.loadAllMetadataClasses());
}
use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class FolderDaoTest method createMetadataClass.
private MetadataClass createMetadataClass() {
MetadataClass metadataClass = new MetadataClass();
metadataClass.setName(CLASS_NAME_1);
metadataClassDao.createMetadataClass(metadataClass);
return metadataClass;
}
use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.
the class ObjectCreatorUtils method createMetadataClass.
public static MetadataClass createMetadataClass(String name) {
MetadataClass metadataClass = new MetadataClass();
metadataClass.setName(name);
return metadataClass;
}
use of com.epam.pipeline.entity.metadata.MetadataClass 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