Search in sources :

Example 1 with RunConfiguration

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);
}
Also used : FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) InputsOutputs(com.epam.pipeline.entity.configuration.InputsOutputs) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with RunConfiguration

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);
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration)

Example 3 with RunConfiguration

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);
}
Also used : PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) MetadataEntity(com.epam.pipeline.entity.metadata.MetadataEntity) SecuredEntityManager(com.epam.pipeline.manager.security.SecuredEntityManager) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) S3bucketDataStorage(com.epam.pipeline.entity.datastorage.aws.S3bucketDataStorage) Folder(com.epam.pipeline.entity.pipeline.Folder) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with RunConfiguration

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;
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration)

Example 5 with RunConfiguration

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);
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) Folder(com.epam.pipeline.entity.pipeline.Folder) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

RunConfiguration (com.epam.pipeline.entity.configuration.RunConfiguration)23 Folder (com.epam.pipeline.entity.pipeline.Folder)10 Transactional (org.springframework.transaction.annotation.Transactional)9 Test (org.junit.Test)8 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)7 RunConfigurationEntry (com.epam.pipeline.entity.configuration.RunConfigurationEntry)6 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)6 FirecloudRunConfigurationEntry (com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry)5 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)4 MapperVerificationUtils.verifyRunConfiguration (com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyRunConfiguration)3 AbstractRunConfigurationEntry (com.epam.pipeline.entity.configuration.AbstractRunConfigurationEntry)3 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)3 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)3 ConfigurationEntryDoc (com.epam.pipeline.elasticsearchagent.model.ConfigurationEntryDoc)2 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)2 MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)2 AclClass (com.epam.pipeline.entity.security.acl.AclClass)2 PasswordGenerator.generateRandomString (com.epam.pipeline.utils.PasswordGenerator.generateRandomString)2 Test (org.junit.jupiter.api.Test)2 AwsRegionVO (com.epam.pipeline.controller.vo.AwsRegionVO)1