Search in sources :

Example 1 with RunConfigurationVO

use of com.epam.pipeline.controller.vo.configuration.RunConfigurationVO in project cloud-pipeline by epam.

the class ObjectCreatorUtils method createRunConfigurationVO.

public static RunConfigurationVO createRunConfigurationVO(String name, String description, Long parentFolderId, List<AbstractRunConfigurationEntry> entries) {
    RunConfigurationVO runConfigurationVO = new RunConfigurationVO();
    runConfigurationVO.setName(name);
    runConfigurationVO.setDescription(description);
    runConfigurationVO.setParentId(parentFolderId);
    runConfigurationVO.setEntries(entries);
    return runConfigurationVO;
}
Also used : RunConfigurationVO(com.epam.pipeline.controller.vo.configuration.RunConfigurationVO)

Example 2 with RunConfigurationVO

use of com.epam.pipeline.controller.vo.configuration.RunConfigurationVO 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);
}
Also used : AwsRegionVO(com.epam.pipeline.controller.vo.AwsRegionVO) MetadataVO(com.epam.pipeline.controller.vo.MetadataVO) Autowired(org.springframework.beans.factory.annotation.Autowired) ObjectCreatorUtils.constructPipelineVO(com.epam.pipeline.manager.ObjectCreatorUtils.constructPipelineVO) StoragePolicy(com.epam.pipeline.entity.datastorage.StoragePolicy) DataStorageVO(com.epam.pipeline.controller.vo.DataStorageVO) Assert.assertThat(org.junit.Assert.assertThat) MockitoAnnotations(org.mockito.MockitoAnnotations) Folder(com.epam.pipeline.entity.pipeline.Folder) PipeConfValue(com.epam.pipeline.entity.metadata.PipeConfValue) Pair(org.apache.commons.lang3.tuple.Pair) MockS3Helper(com.epam.pipeline.manager.MockS3Helper) FolderWithMetadata(com.epam.pipeline.entity.metadata.FolderWithMetadata) Map(java.util.Map) Is.is(org.hamcrest.core.Is.is) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) Mockito.doReturn(org.mockito.Mockito.doReturn) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) MetadataEntityVO(com.epam.pipeline.controller.vo.metadata.MetadataEntityVO) S3StorageProvider(com.epam.pipeline.manager.datastorage.providers.aws.s3.S3StorageProvider) GitManager(com.epam.pipeline.manager.git.GitManager) SpyBean(org.springframework.boot.test.mock.mockito.SpyBean) Set(java.util.Set) Collectors(java.util.stream.Collectors) PasswordGenerator.generateRandomString(com.epam.pipeline.utils.PasswordGenerator.generateRandomString) Objects(java.util.Objects) Matchers.any(org.mockito.Matchers.any) List(java.util.List) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) ObjectCreatorUtils.constructDataStorageVO(com.epam.pipeline.manager.ObjectCreatorUtils.constructDataStorageVO) DataStorageManager(com.epam.pipeline.manager.datastorage.DataStorageManager) ObjectCreatorUtils.createConfigEntry(com.epam.pipeline.manager.ObjectCreatorUtils.createConfigEntry) EntityVO(com.epam.pipeline.controller.vo.EntityVO) MetadataEntry(com.epam.pipeline.entity.metadata.MetadataEntry) Mock(org.mockito.Mock) HashMap(java.util.HashMap) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) RunConfigurationVO(com.epam.pipeline.controller.vo.configuration.RunConfigurationVO) MetadataManager(com.epam.pipeline.manager.metadata.MetadataManager) Value(org.springframework.beans.factory.annotation.Value) HashSet(java.util.HashSet) CollectionUtils(org.apache.commons.collections.CollectionUtils) Propagation(org.springframework.transaction.annotation.Propagation) PipelineVO(com.epam.pipeline.controller.vo.PipelineVO) Before(org.junit.Before) ObjectCreatorUtils.createRunConfigurationVO(com.epam.pipeline.manager.ObjectCreatorUtils.createRunConfigurationVO) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) Test(org.junit.Test) DataStorageType(com.epam.pipeline.entity.datastorage.DataStorageType) Mockito.when(org.mockito.Mockito.when) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) Assert.assertNull(org.junit.Assert.assertNull) MetadataEntityManager(com.epam.pipeline.manager.metadata.MetadataEntityManager) AclClass(com.epam.pipeline.entity.security.acl.AclClass) RunConfigurationManager(com.epam.pipeline.manager.configuration.RunConfigurationManager) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) AwsRegionManager(com.epam.pipeline.manager.region.AwsRegionManager) Transactional(org.springframework.transaction.annotation.Transactional) RunConfigurationVO(com.epam.pipeline.controller.vo.configuration.RunConfigurationVO) ObjectCreatorUtils.createRunConfigurationVO(com.epam.pipeline.manager.ObjectCreatorUtils.createRunConfigurationVO) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) Folder(com.epam.pipeline.entity.pipeline.Folder) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

RunConfigurationVO (com.epam.pipeline.controller.vo.configuration.RunConfigurationVO)2 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)1 AwsRegionVO (com.epam.pipeline.controller.vo.AwsRegionVO)1 DataStorageVO (com.epam.pipeline.controller.vo.DataStorageVO)1 EntityVO (com.epam.pipeline.controller.vo.EntityVO)1 MetadataVO (com.epam.pipeline.controller.vo.MetadataVO)1 PipelineVO (com.epam.pipeline.controller.vo.PipelineVO)1 MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)1 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)1 RunConfiguration (com.epam.pipeline.entity.configuration.RunConfiguration)1 RunConfigurationEntry (com.epam.pipeline.entity.configuration.RunConfigurationEntry)1 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)1 DataStorageType (com.epam.pipeline.entity.datastorage.DataStorageType)1 StoragePolicy (com.epam.pipeline.entity.datastorage.StoragePolicy)1 FolderWithMetadata (com.epam.pipeline.entity.metadata.FolderWithMetadata)1 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)1 MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)1 MetadataEntry (com.epam.pipeline.entity.metadata.MetadataEntry)1 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)1 Folder (com.epam.pipeline.entity.pipeline.Folder)1