use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class RunConfigurationDaoTest method testFirecloudConfigCreation.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testFirecloudConfigCreation() {
List<InputsOutputs> inputs = Stream.of(InputsOutputs.builder().name(TEST_INPUT_NAME).type(TEST_INPUT_TYPE).value(TEST_INPUT_VALUE).build()).collect(Collectors.toList());
List<InputsOutputs> outputs = Stream.of(InputsOutputs.builder().name(TEST_OUTPUT_NAME).value(TEST_OUTPUT_VALUE).build()).collect(Collectors.toList());
// create
FirecloudRunConfigurationEntry entry = ObjectCreatorUtils.createFirecloudConfigEntry(TEST_CONFIG_NAME, inputs, outputs, TEST_FIRECLOUD_METHOD, TEST_FIRECLOUD_METHOD_SNAPSHOT, TEST_FIRECLOUD_CONFIGURATION);
RunConfiguration configuration = ObjectCreatorUtils.createConfiguration(TEST_NAME, TEST_DESCRIPTION, null, TEST_OWNER, Collections.singletonList(entry));
RunConfiguration created = runConfigurationDao.create(configuration);
verifyFirecloudConfiguration(configuration, created);
// load
RunConfiguration loaded = runConfigurationDao.load(created.getId());
verifyFirecloudConfiguration(configuration, loaded);
}
use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class FolderDaoTest method addConfiguration.
private RunConfiguration addConfiguration(Folder folder) {
RunConfigurationEntry entry = ObjectCreatorUtils.createConfigEntry(TEST_NAME, true, new PipelineConfiguration());
RunConfiguration configuration = ObjectCreatorUtils.createConfiguration(TEST_NAME, TEST_NAME, folder.getId(), TEST_USER, Collections.singletonList(entry));
return configurationDao.create(configuration);
}
use of com.epam.pipeline.entity.configuration.RunConfiguration 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.configuration.RunConfiguration in project cloud-pipeline by epam.
the class RunConfigurationManager method load.
@Override
public RunConfiguration load(Long id) {
RunConfiguration configuration = runConfigurationDao.load(id);
Assert.notNull(configuration, messageHelper.getMessage(MessageConstants.ERROR_RUN_CONFIG_NOT_FOUND, id));
return configuration;
}
use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class RunConfigurationManager method update.
@Transactional(propagation = Propagation.REQUIRED)
public RunConfiguration update(RunConfigurationVO configuration) {
validateConfiguration(runConfigurationMapper.toRunConfiguration(configuration));
RunConfiguration dbConfiguration = load(configuration.getId());
dbConfiguration.setName(configuration.getName());
dbConfiguration.setDescription(configuration.getDescription());
dbConfiguration.setEntries(configuration.getEntries());
if (configuration.getParentId() != null) {
dbConfiguration.setParent(new Folder(configuration.getParentId()));
} else {
dbConfiguration.setParent(null);
}
return runConfigurationDao.update(dbConfiguration);
}
Aggregations