use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class FolderDaoTest method testCreateAndLoadFolderWithConfigurations.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testCreateAndLoadFolderWithConfigurations() {
Folder folder = getFolder();
AbstractDataStorage storage = addStorage(folder);
RunConfiguration configuration = addConfiguration(folder);
Folder loaded = folderDao.loadFolder(folder.getId());
assertEquals(folder.getId(), loaded.getId());
assertEquals(folder.getName(), loaded.getName());
assertNull(folder.getParentId());
checkStorageIsPresent(storage, loaded);
checkConfigIsPresent(configuration, loaded);
}
use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class ObjectCreatorUtils method createConfiguration.
public static RunConfiguration createConfiguration(String name, String description, Long parentFolderId, String owner, List<AbstractRunConfigurationEntry> entries) {
RunConfiguration configuration = new RunConfiguration();
configuration.setName(name);
if (parentFolderId != null) {
configuration.setParent(new Folder(parentFolderId));
}
configuration.setDescription(description);
configuration.setOwner(owner);
configuration.setEntries(entries);
return configuration;
}
use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class FolderManagerGetProjectTest method getProjectShouldWorkWithConfigurationAsInputEntity.
@Test
public void getProjectShouldWorkWithConfigurationAsInputEntity() {
RunConfiguration configuration = new RunConfiguration();
configuration.setId(1L);
configuration.setParent(folder3);
Mockito.when(entityManager.load(Matchers.any(AclClass.class), Matchers.any(Long.class))).thenReturn(configuration);
Folder actualFolder = folderManager.getProject(configuration.getId(), AclClass.CONFIGURATION);
assertFolders(folder2, actualFolder);
}
use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class FolderManagerTest method shouldCloneWithRunConfiguration.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void shouldCloneWithRunConfiguration() {
Folder sourceFolder = new Folder();
sourceFolder.setName(FOLDER_TO_CLONE);
folderManager.create(sourceFolder);
PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
pipelineConfiguration.setCmdTemplate(TEST_NAME);
RunConfigurationEntry entry = createConfigEntry(TEST_NAME, true, pipelineConfiguration);
RunConfigurationVO runConfigurationVO = createRunConfigurationVO(TEST_NAME, TEST_DESCRIPTION, sourceFolder.getId(), Collections.singletonList(entry));
RunConfiguration expectedRunConfiguration = runConfigurationManager.create(runConfigurationVO);
Folder childSourceFolder = new Folder();
childSourceFolder.setName(CHILD_FOLDER_TO_CLONE);
childSourceFolder.setParentId(sourceFolder.getId());
folderManager.create(childSourceFolder);
runConfigurationVO.setParentId(childSourceFolder.getId());
runConfigurationManager.create(runConfigurationVO);
Folder destinationFolder = new Folder();
destinationFolder.setName(TEST_NAME);
folderManager.create(destinationFolder);
folderManager.cloneFolder(sourceFolder.getId(), destinationFolder.getId(), TEST_CLONE_PREFIX);
destinationFolder = folderManager.loadByNameOrId(TEST_NAME);
destinationFolder = folderManager.load(destinationFolder.getId());
Folder clonedFolder = destinationFolder.getChildFolders().get(0);
RunConfiguration clonedRunConfiguration = runConfigurationManager.loadAll().stream().filter(conf -> Objects.equals(conf.getParent().getId(), clonedFolder.getId())).collect(Collectors.toList()).get(0);
assertRunConfiguration(expectedRunConfiguration, clonedRunConfiguration);
Folder clonedChildFolder = clonedFolder.getChildFolders().get(0);
clonedRunConfiguration = runConfigurationManager.loadAll().stream().filter(conf -> Objects.equals(conf.getParent().getId(), clonedChildFolder.getId())).collect(Collectors.toList()).get(0);
assertRunConfiguration(expectedRunConfiguration, clonedRunConfiguration);
}
use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.
the class PipelineRunManagerTest method testResolveProjectFiltering.
@Test
@WithMockUser(roles = "ADMIN")
public void testResolveProjectFiltering() {
Folder project = new Folder();
project.setId(1L);
Folder child = new Folder();
project.setId(2L);
project.getChildFolders().add(child);
Pipeline pipeline1 = new Pipeline();
pipeline1.setId(2L);
project.getPipelines().add(pipeline1);
Pipeline pipeline2 = new Pipeline();
pipeline2.setId(3L);
child.getPipelines().add(pipeline2);
RunConfiguration configuration1 = new RunConfiguration();
configuration1.setId(4L);
project.getConfigurations().add(configuration1);
RunConfiguration configuration2 = new RunConfiguration();
configuration2.setId(5L);
child.getConfigurations().add(configuration2);
when(folderManager.load(project.getId())).thenReturn(project);
PagingRunFilterVO filterVO = new PagingRunFilterVO();
filterVO.setProjectIds(Collections.singletonList(project.getId()));
PipelineRunFilterVO.ProjectFilter projectFilter = pipelineRunManager.resolveProjectFiltering(filterVO);
Assert.assertEquals(2, projectFilter.getPipelineIds().size());
Assert.assertEquals(2, projectFilter.getConfigurationIds().size());
}
Aggregations