当前位置: 首页>>代码示例>>Java>>正文


Java WorkflowJob.addProperty方法代码示例

本文整理汇总了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));
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:24,代码来源:ParameterizedRunSelectorTest.java

示例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")
    );
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:23,代码来源:ParameterizedRunFilterTest.java

示例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));
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:26,代码来源:ParameterizedRunFilterTest.java

示例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));
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:26,代码来源:ParameterizedRunFilterTest.java

示例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 />")
        )
    ));
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:31,代码来源:ParameterizedRunFilterTest.java

示例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());
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:32,代码来源:ParameterizedRunFilterTest.java

示例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()
    );
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:32,代码来源:ParameterizedRunFilterTest.java


注:本文中的org.jenkinsci.plugins.workflow.job.WorkflowJob.addProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。