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


Java RemovedJobAction类代码示例

本文整理汇总了Java中javaposse.jobdsl.plugin.RemovedJobAction的典型用法代码示例。如果您正苦于以下问题:Java RemovedJobAction类的具体用法?Java RemovedJobAction怎么用?Java RemovedJobAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RemovedJobAction类属于javaposse.jobdsl.plugin包,在下文中一共展示了RemovedJobAction类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: before

import javaposse.jobdsl.plugin.RemovedJobAction; //导入依赖的package包/类
private void before(Description description) throws Exception {
    FreeStyleProject job = jRule.createFreeStyleProject();
    String script = description.getAnnotation(WithJobDsl.class).value();
    String scriptText = Resources.toString(Resources.getResource(script), Charsets.UTF_8);

    job.getBuildersList().add(
            new ExecuteDslScripts(
                    new ExecuteDslScripts.ScriptLocation(
                            null, null,
                            scriptText
                    ),
                    false,
                    RemovedJobAction.DELETE,
                    RemovedViewAction.DELETE,
                    LookupStrategy.JENKINS_ROOT
            )
    );

    jRule.buildAndAssertSuccess(job);

    assertThat(jRule.getInstance().getJobNames(), hasItem(is(JOB_NAME_IN_DSL_SCRIPT)));

    generated = jRule.getInstance().getItemByFullName(JOB_NAME_IN_DSL_SCRIPT, FreeStyleProject.class);
}
 
开发者ID:jcsirot,项目名称:ansible-plugin,代码行数:25,代码来源:DslJobRule.java

示例2: shouldCreateJobWithExtendedDsl

import javaposse.jobdsl.plugin.RemovedJobAction; //导入依赖的package包/类
@Test
public void shouldCreateJobWithExtendedDsl() throws Exception {
    FreeStyleProject job = jenkins.createFreeStyleProject();
    job.getBuildersList().add(
            new ExecuteDslScripts(
                    new ExecuteDslScripts.ScriptLocation(
                            null, null,
                            IOUtils.toString(this
                                    .getClass().getClassLoader().getResourceAsStream(JOB_DSL_GROOVY))
                    ),
                    false,
                    RemovedJobAction.DELETE,
                    RemovedViewAction.DELETE,
                    LookupStrategy.JENKINS_ROOT
            )
    );

    jenkins.buildAndAssertSuccess(job);

    assertThat(jenkins.getInstance().getJobNames(), hasItem(is(JOB_NAME_IN_DSL_SCRIPT)));

    FreeStyleProject generated = jenkins.getInstance()
            .getItemByFullName(JOB_NAME_IN_DSL_SCRIPT, FreeStyleProject.class);


    Collection<Trigger<?>> triggers = generated.getTriggers().values();
    assertThat("Should add trigger", triggers, hasSize(1));
    GitHubBranchTrigger trigger = (GitHubBranchTrigger) triggers.toArray()[0];
    assertThat("Should add trigger of GHPR class", trigger, instanceOf(GitHubBranchTrigger.class));
    assertThat("Should have pre status", trigger.isPreStatus(), equalTo(true));
    assertThat("Should have cancel queued", trigger.isCancelQueued(), equalTo(true));
    assertThat("Should add events", trigger.getEvents(), hasSize(5));
    assertThat("Should set mode", trigger.getTriggerMode(), equalTo(HEAVY_HOOKS_CRON));

    /*
     * note: this are explicity placed in the first and second positions so it's easier to
     * pluck them back out for explicit testing
     */
    verifyBranchFilter(trigger.getEvents().get(0));
    verifyCommitChecks(trigger.getEvents().get(1));

    final List<GitHubRepoProvider> repoProviders = trigger.getRepoProviders();
    assertThat("Should contain repoProvider", repoProviders, notNullValue());
    assertThat("Should contain 1 repoProvider", repoProviders, hasSize(1));

    final GitHubRepoProvider repoProvider = repoProviders.get(0);
    assertThat(repoProvider, instanceOf(GitHubPluginRepoProvider.class));
    final GitHubPluginRepoProvider provider = (GitHubPluginRepoProvider) repoProvider;
    assertThat(provider.isCacheConnection(), is(false));
    assertThat(provider.isManageHooks(), is(false));
    assertThat(provider.getRepoPermission(), is(PULL));

}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:54,代码来源:GitHubPRJobDslExtensionTest.java

示例3: shouldCreateJobWithExtendedDsl

import javaposse.jobdsl.plugin.RemovedJobAction; //导入依赖的package包/类
@Test
public void shouldCreateJobWithExtendedDsl() throws Exception {
    FreeStyleProject job = jenkins.createFreeStyleProject();
    job.getBuildersList().add(
            new ExecuteDslScripts(
                    new ExecuteDslScripts.ScriptLocation(
                            null, null,
                            IOUtils.toString(this
                                    .getClass().getClassLoader().getResourceAsStream(JOB_DSL_GROOVY))
                    ),
                    false,
                    RemovedJobAction.DELETE,
                    RemovedViewAction.DELETE,
                    LookupStrategy.JENKINS_ROOT
            )
    );

    jenkins.buildAndAssertSuccess(job);

    assertThat(jenkins.getInstance().getJobNames(), hasItem(is(JOB_NAME_IN_DSL_SCRIPT)));

    FreeStyleProject generated = jenkins.getInstance()
            .getItemByFullName(JOB_NAME_IN_DSL_SCRIPT, FreeStyleProject.class);

    final DescribableList<Builder, Descriptor<Builder>> builders = generated.getBuildersList();

    assertThat("Should have builder", builders, hasSize(1));
    assertThat("Should add status builder", builders.get(0), instanceOf(GitHubPRStatusBuilder.class));
    assertThat("Should add message",
            ((GitHubPRStatusBuilder) builders.get(0)).getStatusMessage().getContent(),
            equalTo(JOB_DSL_BUILDER_TEXT_CONTENT));

    verifyPublishers(generated.getPublishersList());

    Collection<Trigger<?>> triggers = generated.getTriggers().values();
    assertThat("Should add trigger", triggers, hasSize(1));
    GitHubPRTrigger trigger = (GitHubPRTrigger) triggers.toArray()[0];
    assertThat("Should add trigger of GHPR class", trigger, instanceOf(GitHubPRTrigger.class));
    assertThat("Should have pre status", trigger.isPreStatus(), equalTo(true));
    assertThat("Should have cancel queued", trigger.isCancelQueued(), equalTo(true));
    assertThat("Should set mode", trigger.getTriggerMode(), equalTo(HEAVY_HOOKS_CRON));

    final List<GitHubRepoProvider> repoProviders = trigger.getRepoProviders();
    assertThat("Should contain repoProvider", repoProviders, notNullValue());
    assertThat("Should contain 1 repoProvider", repoProviders, hasSize(1));

    final GitHubRepoProvider repoProvider = repoProviders.get(0);
    assertThat(repoProvider, instanceOf(GitHubPluginRepoProvider.class));
    final GitHubPluginRepoProvider provider = (GitHubPluginRepoProvider) repoProvider;
    assertThat(provider.isCacheConnection(), is(false));
    assertThat(provider.isManageHooks(), is(false));
    assertThat(provider.getRepoPermission(), is(PUSH));

    final List<GitHubPREvent> events = trigger.getEvents();
    assertThat("Should add events", events, hasSize(17));


    GitHubPREvent event = events.get(15);
    assertThat(event, instanceOf(GitHubPRNumber.class));
    assertThat(((GitHubPRNumber) event).isSkip(), is(false));
    assertThat(((GitHubPRNumber) event).isMatch(), is(true));


    event = events.get(16);
    assertThat(event, instanceOf(GitHubPRNumber.class));
    assertThat(((GitHubPRNumber) event).isSkip(), is(true));
    assertThat(((GitHubPRNumber) event).isMatch(), is(true));
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:69,代码来源:DslIntegrationTest.java


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