use of org.talend.core.runtime.repository.build.IBuildExportHandler in project tdi-studio-se by Talend.
the class BuildJobFactory method createBuildJobHandler.
public static IBuildJobHandler createBuildJobHandler(ProcessItem processItem, String contextName, String version, Map<ExportChoice, Object> exportChoiceMap, String buildType) {
// if null, will try to find the type from item for build type.
if (StringUtils.isEmpty(buildType)) {
final Object type = processItem.getProperty().getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
if (type != null) {
buildType = type.toString();
}
// else{ // if didn't set, should use default provider to create it.
}
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(IBuildParametes.ITEM, processItem);
parameters.put(IBuildParametes.VERSION, version);
parameters.put(IBuildJobParameters.CONTEXT_GROUP, contextName);
parameters.put(IBuildJobParameters.CHOICE_OPTION, exportChoiceMap);
final AbstractBuildProvider buildProvider = BuildExportManager.getInstance().getBuildProvider(buildType, parameters);
if (buildProvider != null) {
IBuildExportHandler buildExportHandler = buildProvider.createBuildExportHandler(parameters);
if (buildExportHandler instanceof IBuildJobHandler) {
// if buildType is null, will get first one. so use exact provider one.
buildExportHandler.getArguments().put(TalendProcessArgumentConstant.ARG_BUILD_TYPE, buildProvider.getBuildType().getName());
return (IBuildJobHandler) buildExportHandler;
}
}
return null;
}
use of org.talend.core.runtime.repository.build.IBuildExportHandler in project tdi-studio-se by Talend.
the class StandardJobStandaloneBuildProviderTest method test_createBuildExportHandler_nullChoiceMap.
@Test
public void test_createBuildExportHandler_nullChoiceMap() {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(IBuildParametes.ITEM, PropertiesFactory.eINSTANCE.createProcessItem());
parameters.put(IBuildParametes.VERSION, "0.1");
parameters.put(IBuildJobParameters.CONTEXT_GROUP, "Dev");
// parameters.put(IBuildJobParameters.CHOICE_OPTION, null);
RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
final IBuildExportHandler buildExportHandler = provider.createBuildExportHandler(parameters);
Assert.assertNotNull(buildExportHandler);
Assert.assertEquals(BuildJobHandler.class, buildExportHandler.getClass());
}
use of org.talend.core.runtime.repository.build.IBuildExportHandler in project tdi-studio-se by Talend.
the class StandardJobStandaloneBuildProviderTest method test_createBuildExportHandler.
@Test
public void test_createBuildExportHandler() {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(IBuildParametes.ITEM, PropertiesFactory.eINSTANCE.createProcessItem());
parameters.put(IBuildParametes.VERSION, "0.1");
parameters.put(IBuildJobParameters.CONTEXT_GROUP, "Dev");
parameters.put(IBuildJobParameters.CHOICE_OPTION, JobScriptsManagerFactory.getDefaultExportChoiceMap());
RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
final IBuildExportHandler buildExportHandler = provider.createBuildExportHandler(parameters);
Assert.assertNotNull(buildExportHandler);
Assert.assertEquals(BuildJobHandler.class, buildExportHandler.getClass());
}
Aggregations