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);
}
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;
}
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);
}
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()));
}
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;
}
Aggregations