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


Java Job.getAction方法代码示例

本文整理汇总了Java中hudson.model.Job.getAction方法的典型用法代码示例。如果您正苦于以下问题:Java Job.getAction方法的具体用法?Java Job.getAction怎么用?Java Job.getAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.model.Job的用法示例。


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

示例1: basicTest

import hudson.model.Job; //导入方法依赖的package包/类
public void basicTest(Job job) throws Exception {
    // fails with workflow
    if (job instanceof FreeStyleProject || job instanceof MatrixProject) {
        jRule.configRoundtrip(job); // activate trigger
    }

    // update trigger (maybe useless)
    GitHubPRTrigger trigger = ghPRTriggerFromJob(job);
    if (job instanceof WorkflowJob) {
        trigger.start(job, true); // hack configRountrip that doesn't work with workflow
    }

    await().pollInterval(3, TimeUnit.SECONDS)
            .timeout(100, SECONDS)
            .until(ghTriggerRunAndEnd(trigger));

    jRule.waitUntilNoActivity();

    assertThat(job.getLastBuild(), is(nullValue()));

    GitHubPRRepository ghPRRepository = job.getAction(GitHubPRRepository.class);
    assertThat("Action storage should be available", ghPRRepository, notNullValue());

    Map<Integer, GitHubPRPullRequest> pulls = ghPRRepository.getPulls();
    assertThat("Action storage should be empty", pulls.entrySet(), Matchers.hasSize(0));

    final GHPullRequest pullRequest1 = ghRule.getGhRepo().createPullRequest("title with \"quote\" text",
            "branch-1", "master", "body");

    await().pollInterval(2, SECONDS)
            .timeout(100, SECONDS)
            .until(ghPRAppeared(pullRequest1));

    await().pollInterval(3, TimeUnit.SECONDS)
            .timeout(100, SECONDS)
            .until(ghTriggerRunAndEnd(trigger));

    jRule.waitUntilNoActivity();

    // refresh objects
    ghPRRepository = job.getAction(GitHubPRRepository.class);
    assertThat("Action storage should be available", ghPRRepository, notNullValue());

    pulls = ghPRRepository.getPulls();
    assertThat("Pull request 1 should appear in action storage", pulls.entrySet(), Matchers.hasSize(1));

    jRule.assertBuildStatusSuccess(job.getLastBuild());
    assertThat(job.getBuilds().size(), is(1));

    // now push changes that should trigger again
    ghRule.commitFileToBranch(BRANCH1, BRANCH1 + ".file2", "content", "commit 2 for " + BRANCH1);

    trigger.run();

    await().pollInterval(5, TimeUnit.SECONDS)
            .timeout(100, SECONDS)
            .until(ghTriggerRunAndEnd(trigger));

    jRule.waitUntilNoActivity();

    // refresh objects
    ghPRRepository = job.getAction(GitHubPRRepository.class);
    assertThat("Action storage should be available", ghPRRepository, notNullValue());

    pulls = ghPRRepository.getPulls();
    assertThat("Pull request 1 should appear in action storage", pulls.entrySet(), Matchers.hasSize(1));

    jRule.assertBuildStatusSuccess(job.getLastBuild());
    assertThat(job.getBuilds().size(), is(2));
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:71,代码来源:AbstractPRTest.java

示例2: smokeTest

import hudson.model.Job; //导入方法依赖的package包/类
public void smokeTest(Job<?, ?> job) throws Exception {
    GitHubBranchTrigger trigger;
    // fails with workflow
    if (job instanceof FreeStyleProject || job instanceof MatrixProject) {
        jRule.configRoundtrip(job); // activate trigger
        trigger = ghBranchTriggerFromJob(job);
    } else {
        trigger = ghBranchTriggerFromJob(job);
        trigger.start(job, true);
    }

    await().pollInterval(3, TimeUnit.SECONDS)
            .timeout(100, SECONDS)
            .until(ghTriggerRunAndEnd(trigger));

    jRule.waitUntilNoActivity();

    assertThat(job.getBuilds(), hasSize(3));

    GitHubBranchRepository ghRepository = job.getAction(GitHubBranchRepository.class);
    assertThat("Action storage should be available", ghRepository, notNullValue());

    Map<String, GitHubBranch> branches = ghRepository.getBranches();

    assertThat("Action storage should not to be empty", branches.entrySet(), Matchers.hasSize(3));


    ghRule.commitFileToBranch("branch-4", "someFile", "content", "With this magessage");
    await().pollInterval(3, TimeUnit.SECONDS)
            .timeout(100, SECONDS)
            .until(ghTriggerRunAndEnd(trigger));

    jRule.waitUntilNoActivity();

    // refresh objects
    ghRepository = job.getAction(GitHubBranchRepository.class);
    assertThat("Action storage should be available", ghRepository, notNullValue());

    branches = ghRepository.getBranches();
    assertThat(branches.entrySet(), Matchers.hasSize(4));

    assertThat(job.getBuilds().size(), is(4));

    jRule.assertBuildStatusSuccess(job.getLastBuild());
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:46,代码来源:BranchITest.java


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