本文整理汇总了Java中org.jenkinsci.plugins.workflow.job.WorkflowJob.addProperty方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowJob.addProperty方法的具体用法?Java WorkflowJob.addProperty怎么用?Java WorkflowJob.addProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jenkinsci.plugins.workflow.job.WorkflowJob
的用法示例。
在下文中一共展示了WorkflowJob.addProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWorkflow
import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
/**
* Also applicable for workflow jobs.
*/
@Issue("JENKINS-30357")
@Test
public void testWorkflow() throws Exception {
FreeStyleProject jobToSelect = j.createFreeStyleProject();
Run runToSelect = j.assertBuildStatusSuccess(jobToSelect.scheduleBuild2(0));
WorkflowJob selecter = createWorkflowJob();
ParameterDefinition paramDef = new StringParameterDefinition(
"SELECTOR", "<StatusRunSelector><buildStatus>STABLE</buildStatus></StatusRunSelector>"
);
selecter.addProperty(new ParametersDefinitionProperty(paramDef));
selecter.setDefinition(new CpsFlowDefinition(String.format("" +
"def runWrapper = selectRun job: '%s', " +
" selector: [$class: 'ParameterizedRunSelector', parameterName: '${SELECTOR}'] \n" +
"assert(runWrapper.id == '%s')", jobToSelect.getFullName(), runToSelect.getId())));
j.assertBuildStatusSuccess(selecter.scheduleBuild2(0));
}
示例2: testConfigureBuildFilterParameter
import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
@Test
public void testConfigureBuildFilterParameter() throws Exception {
RunFilterParameter param = new RunFilterParameter(
"PARAM",
"description",
new AndRunFilter(
new ParametersRunFilter("PARAM1=VALUE1"),
new SavedRunFilter()
)
);
WorkflowJob job = j.jenkins.createProject(
WorkflowJob.class,
RandomStringUtils.randomAlphanumeric(7)
);
job.addProperty(new ParametersDefinitionProperty(param));
j.configRoundtrip((Item)job);
j.assertEqualDataBoundBeans(
param,
job.getProperty(ParametersDefinitionProperty.class)
.getParameterDefinition("PARAM")
);
}
示例3: testIsSelectableWithDefault
import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
@Test
public void testIsSelectableWithDefault() throws Exception {
WorkflowJob selecter = j.jenkins.createProject(
WorkflowJob.class,
RandomStringUtils.randomAlphanumeric(7)
);
selecter.addProperty(new ParametersDefinitionProperty(
new RunFilterParameter(
"FILTER",
"description",
new SavedRunFilter()
)
));
selecter.setDefinition(new CpsFlowDefinition(String.format(
"def runWrapper = selectRun"
+ " job: '%s',"
+ " filter: [$class: 'ParameterizedRunFilter', parameter: '${FILTER}'],"
+ " verbose: true;"
+ "assert(runWrapper.id == '%s')",
jobToSelect.getFullName(),
runToSelect1.getId()
)));
j.assertBuildStatusSuccess(selecter.scheduleBuild2(0));
}
示例4: testIsSelectableEmptyParameter
import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
@Test
public void testIsSelectableEmptyParameter() throws Exception {
WorkflowJob selecter = j.jenkins.createProject(
WorkflowJob.class,
RandomStringUtils.randomAlphanumeric(7)
);
selecter.addProperty(new ParametersDefinitionProperty(
new StringParameterDefinition(
"FILTER",
"",
"description"
)
));
selecter.setDefinition(new CpsFlowDefinition(String.format(
"def runWrapper = selectRun"
+ " job: '%s',"
+ " filter: [$class: 'ParameterizedRunFilter', parameter: '${FILTER}'],"
+ " verbose: true;"
+ "assert(runWrapper.id == '%s')",
jobToSelect.getFullName(),
runToSelect2.getId()
)));
j.assertBuildStatusSuccess(selecter.scheduleBuild2(0));
}
示例5: testIsSelectableWithParameter
import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
@Test
public void testIsSelectableWithParameter() throws Exception {
WorkflowJob selecter = j.jenkins.createProject(
WorkflowJob.class,
RandomStringUtils.randomAlphanumeric(7)
);
selecter.addProperty(new ParametersDefinitionProperty(
new RunFilterParameter(
"FILTER",
"description",
new NoRunFilter()
)
));
selecter.setDefinition(new CpsFlowDefinition(String.format(
"def runWrapper = selectRun"
+ " job: '%s',"
+ " filter: [$class: 'ParameterizedRunFilter', parameter: '${FILTER}'],"
+ " verbose: true;"
+ "assert(runWrapper.id == '%s')",
jobToSelect.getFullName(),
runToSelect1.getId()
)));
j.assertBuildStatusSuccess(selecter.scheduleBuild2(
0,
new ParametersAction(
new StringParameterValue("FILTER", "<SavedRunFilter />")
)
));
}
示例6: testIsSelectableWithUI
import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
@Test
public void testIsSelectableWithUI() throws Exception {
WorkflowJob selecter = j.jenkins.createProject(
WorkflowJob.class,
RandomStringUtils.randomAlphanumeric(7)
);
selecter.addProperty(new ParametersDefinitionProperty(
new RunFilterParameter(
"FILTER",
"description",
new SavedRunFilter()
)
));
selecter.setDefinition(new CpsFlowDefinition(String.format(
"def runWrapper = selectRun"
+ " job: '%s',"
+ " filter: [$class: 'ParameterizedRunFilter', parameter: '${FILTER}'],"
+ " verbose: true;"
+ "assert(runWrapper.id == '%s')",
jobToSelect.getFullName(),
runToSelect1.getId()
)));
WebClient wc = j.createWebClient();
// Jenkins sends 405 response for GET of build page.. deal with that:
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
wc.getOptions().setPrintContentOnFailingStatusCode(false);
j.submit(wc.getPage(selecter, "build").getFormByName("parameters"));
j.waitUntilNoActivity();
j.assertBuildStatusSuccess(selecter.getLastBuild());
}
示例7: testIsSelectableBadParameter
import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
@Test
public void testIsSelectableBadParameter() throws Exception {
WorkflowJob selecter = j.jenkins.createProject(
WorkflowJob.class,
RandomStringUtils.randomAlphanumeric(7)
);
selecter.addProperty(new ParametersDefinitionProperty(
new RunFilterParameter(
"FILTER",
"description",
new NoRunFilter()
)
));
selecter.setDefinition(new CpsFlowDefinition(String.format(
"def runWrapper = selectRun"
+ " job: '%s',"
+ " filter: [$class: 'ParameterizedRunFilter', parameter: '${FILTER}'],"
+ " verbose: true;",
jobToSelect.getFullName()
)));
j.assertBuildStatus(
Result.FAILURE,
selecter.scheduleBuild2(
0,
new ParametersAction(
new StringParameterValue("FILTER", "Bad Parameter")
)
).get()
);
}