use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class CommandBuilderTest method constructConfiguration.
private PipelineConfiguration constructConfiguration() {
PipelineConfiguration configuration = new PipelineConfiguration();
configuration.setCmdTemplate(template);
configuration.setMainFile(MAIN_FILE);
configuration.setMainClass(MAIN_CLASS);
configuration.setEnvironmentParams(new LinkedHashMap<String, String>() {
{
put("main_class", MAIN_CLASS);
put("main_file", MAIN_FILE);
put("cmd_template", template);
}
});
configuration.setParameters(new LinkedHashMap<String, PipeConfValueVO>() {
{
put("sample", new PipeConfValueVO(SAMPLE));
put("input-fastq", new PipeConfValueVO(INPUT_FASTQ));
}
});
return configuration;
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class EnvVarsBuilderTest method matchPipeConfig.
public static PipelineConfiguration matchPipeConfig() {
PipelineConfiguration configuration = new PipelineConfiguration();
configuration.setCmdTemplate(CMD_TEMPLATE);
configuration.setMainClass(MAIN_CLASS_VALUE);
configuration.setMainFile(MAIN_FILE_VALUE);
configuration.buildEnvVariables();
configuration.setParameters(new HashMap<String, PipeConfValueVO>() {
{
put(P1, new PipeConfValueVO(P1_VALUE, NUMBER_TYPE));
put(P2, new PipeConfValueVO(P2_VALUE, STRING_TYPE));
}
});
return configuration;
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration 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.PipelineConfiguration in project cloud-pipeline by epam.
the class PipelineConfigurationForRunnerTest method shouldGetConfigurationForPipelineRun.
@Test
public void shouldGetConfigurationForPipelineRun() {
PipelineStart vo = getPipelineStartVO();
vo.setPipelineId(1L);
vo.setVersion("draft");
PipelineConfiguration config = pipelineConfigurationManager.getPipelineConfiguration(vo);
commonPipelineConfigurationAssertions(config);
assertThat(config).hasFieldOrPropertyWithValue(INSTANCE_DISK_FIELD, TEST_HDD_SIZE).hasFieldOrPropertyWithValue(WORKED_CMD_FIELD, // from default configuration
TEST_WORKED_CMD);
assertThat(config.getParameters()).isNotEmpty().hasSize(2).containsKeys(TEST_PARAM_1, // from default configuration
TEST_PARAM_2);
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class PipelineVersionManagerTest method testDockerImageSetFromProperties.
@Test
public void testDockerImageSetFromProperties() throws GitClientException, IOException {
Mockito.when(preferenceManager.getPreference(SystemPreferences.LAUNCH_DOCKER_IMAGE)).thenReturn(IMAGE_FROM_PROPERTIES);
Tool mockTool = getMockTool(TEST_REPOSITORY, IMAGE_FROM_PROPERTIES);
Mockito.when(gitManager.getConfigFileContent(Mockito.any(Pipeline.class), Mockito.anyString())).thenReturn(getFileContent(WITHOUT_IMAGE_CONFIG));
Mockito.when(toolManager.loadByNameOrId(IMAGE_FROM_PROPERTIES)).thenReturn(mockTool);
PipelineConfiguration configuration = pipelineVersionManager.loadParametersFromScript(1L, "");
Assert.assertEquals(TEST_REPOSITORY + "/" + IMAGE_FROM_PROPERTIES, configuration.getDockerImage());
}
Aggregations