Search in sources :

Example 6 with RunConfiguration

use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.

the class RunConfigurationManager method changeOwner.

@Override
public AbstractSecuredEntity changeOwner(Long id, String owner) {
    RunConfiguration runConfiguration = load(id);
    runConfiguration.setOwner(owner);
    return runConfigurationDao.update(runConfiguration);
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration)

Example 7 with RunConfiguration

use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.

the class RunConfigurationManager method delete.

@Transactional(propagation = Propagation.REQUIRED)
public RunConfiguration delete(Long id) {
    RunConfiguration configuration = load(id);
    runConfigurationDao.delete(id);
    return configuration;
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with RunConfiguration

use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.

the class ConfigurationMapperTest method shouldMapFireCloudConfiguration.

@Test
void shouldMapFireCloudConfiguration() throws IOException {
    ConfigurationEntryMapper mapper = new ConfigurationEntryMapper();
    RunConfiguration runConfiguration = buildRunConfiguration();
    FirecloudRunConfigurationEntry entry = new FirecloudRunConfigurationEntry();
    entry.setName(TEST_NAME);
    entry.setMethodName(TEST_NAME);
    entry.setMethodSnapshot(TEST_SNAPSHOT);
    entry.setMethodConfigurationName(TEST_NAME);
    entry.setMethodConfigurationSnapshot(TEST_SNAPSHOT);
    ConfigurationEntryDoc configuration = buildDoc(null, runConfiguration, entry);
    XContentBuilder contentBuilder = mapper.map(buildContainer(configuration));
    verifyFirecloudConfigurationEntry(entry, contentBuilder);
    verifyRunConfiguration(runConfiguration, TEST_NAME + " ", contentBuilder);
    verifyPipelineUser(USER, contentBuilder);
    verifyPermissions(PERMISSIONS_CONTAINER, contentBuilder);
    verifyMetadata(EXPECTED_METADATA, contentBuilder);
}
Also used : FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry) MapperVerificationUtils.verifyRunConfiguration(com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyRunConfiguration) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) ConfigurationEntryDoc(com.epam.pipeline.elasticsearchagent.model.ConfigurationEntryDoc) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Test(org.junit.jupiter.api.Test)

Example 9 with RunConfiguration

use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.

the class RunConfigurationLoaderTest method shouldLoadRunConfigurationTest.

@Test
void shouldLoadRunConfigurationTest() throws EntityNotFoundException {
    Pipeline pipeline = new Pipeline();
    pipeline.setId(1L);
    pipeline.setName(TEST_NAME);
    PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
    pipelineConfiguration.setDockerImage(TEST_PATH);
    RunConfigurationEntry entry = new RunConfigurationEntry();
    entry.setPipelineId(pipeline.getId());
    entry.setPipelineVersion(TEST_VERSION);
    entry.setName(TEST_NAME);
    entry.setConfiguration(pipelineConfiguration);
    RunConfiguration runConfiguration = new RunConfiguration();
    runConfiguration.setId(1L);
    runConfiguration.setName(TEST_NAME);
    runConfiguration.setDescription(TEST_VALUE);
    runConfiguration.setOwner(TEST_NAME);
    runConfiguration.setEntries(Collections.singletonList(entry));
    RunConfigurationDoc expectedConfiguration = RunConfigurationDoc.builder().configuration(runConfiguration).pipelines(Collections.singletonList(pipeline)).build();
    RunConfigurationLoader runConfigurationLoader = new RunConfigurationLoader(apiClient);
    when(apiClient.loadRunConfiguration(anyLong())).thenReturn(runConfiguration);
    when(apiClient.loadPipeline(anyString())).thenReturn(pipeline);
    Optional<EntityContainer<RunConfigurationDoc>> container = runConfigurationLoader.loadEntity(1L);
    EntityContainer<RunConfigurationDoc> configurationDocContainer = container.orElseThrow(AssertionError::new);
    RunConfigurationDoc actualConfiguration = configurationDocContainer.getEntity();
    assertNotNull(actualConfiguration);
    verifyConfiguration(expectedConfiguration.getConfiguration(), actualConfiguration.getConfiguration());
    verifyPipeline(expectedConfiguration.getPipelines(), actualConfiguration.getPipelines());
    verifyPipelineUser(configurationDocContainer.getOwner());
    verifyPermissions(PERMISSIONS_CONTAINER_WITH_OWNER, configurationDocContainer.getPermissions());
    verifyMetadata(EXPECTED_METADATA, new ArrayList<>(configurationDocContainer.getMetadata().values()));
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) RunConfigurationDoc(com.epam.pipeline.elasticsearchagent.model.RunConfigurationDoc) EntityContainer(com.epam.pipeline.elasticsearchagent.model.EntityContainer) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) LoaderVerificationUtils.verifyPipeline(com.epam.pipeline.elasticsearchagent.LoaderVerificationUtils.verifyPipeline) Test(org.junit.jupiter.api.Test)

Example 10 with RunConfiguration

use of com.epam.pipeline.entity.configuration.RunConfiguration in project cloud-pipeline by epam.

the class RunConfigurationVO method toEntity.

public RunConfiguration toEntity() {
    RunConfiguration configuration = new RunConfiguration();
    configuration.setId(getId());
    configuration.setName(getName());
    configuration.setDescription(getDescription());
    if (parentId != null) {
        configuration.setParent(new Folder(getParentId()));
    }
    if (CollectionUtils.isNotEmpty(entries)) {
        configuration.setEntries(entries);
    } else {
        configuration.setEntries(Collections.emptyList());
    }
    return configuration;
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) Folder(com.epam.pipeline.entity.pipeline.Folder)

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