當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。