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


Java SemaphoreStep.success方法代码示例

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


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

示例1: testDefaultJenkinsFile

import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; //导入方法依赖的package包/类
@Test
public void testDefaultJenkinsFile() throws Exception {
    GlobalConfigFiles globalConfigFiles = r.jenkins.getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class);
    ConfigFileStore store = globalConfigFiles.get();

    Config config = new GroovyScript("Jenkinsfile", "Jenkinsfile", "",
        "semaphore 'wait'; node {checkout scm; echo readFile('file')}");
    store.save(config);

    sampleGitRepo.init();
    sampleGitRepo.write("file", "initial content");
    sampleGitRepo.git("commit", "--all", "--message=flow");
    WorkflowMultiBranchProject mp = r.jenkins.createProject(PipelineMultiBranchDefaultsProject.class, "p");
    mp.getSourcesList().add(new BranchSource(new GitSCMSource(null, sampleGitRepo.toString(), "", "*", "", false),
        new DefaultBranchPropertyStrategy(new BranchProperty[0])));
    WorkflowJob p = PipelineMultiBranchDefaultsProjectTest.scheduleAndFindBranchProject(mp, "master");
    SemaphoreStep.waitForStart("wait/1", null);
    WorkflowRun b1 = p.getLastBuild();
    assertNotNull(b1);
    assertEquals(1, b1.getNumber());
    SemaphoreStep.success("wait/1", null);
    r.assertLogContains("initial content", r.waitForCompletion(b1));
}
 
开发者ID:vaimr,项目名称:pipeline-multibranch-defaults-plugin,代码行数:24,代码来源:DefaultsBinderTest.java

示例2: smokes

import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; //导入方法依赖的package包/类
@Issue("JENKINS-26942")
@Test public void smokes() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
        "node {\n" +
        "  writeFile file: 'subdir/fname', text: 'whatever'\n" +
        "  writeFile file: 'subdir/other', text: 'more'\n" +
        "  dir('subdir') {stash 'whatever'}\n" +
        "}\n" +
        "node {\n" +
        "  dir('elsewhere') {\n" +
        "    unstash 'whatever'\n" +
        "    echo \"got fname: ${readFile 'fname'} other: ${readFile 'other'}\"\n" +
        "  }\n" +
        "  writeFile file: 'at-top', text: 'ignored'\n" +
        "  stash name: 'from-top', includes: 'elsewhere/', excludes: '**/other'\n" +
        "  semaphore 'ending'\n" +
        "}", true));
    WorkflowRun b = p.scheduleBuild2(0).waitForStart();
    SemaphoreStep.waitForStart("ending/1", b);
    assertEquals("{from-top={elsewhere/fname=whatever}, whatever={fname=whatever, other=more}}", StashManager.stashesOf(b).toString());
    SemaphoreStep.success("ending/1", null);
    r.assertBuildStatusSuccess(r.waitForCompletion(b));
    r.assertLogContains("got fname: whatever other: more", b);
    assertEquals("{}", StashManager.stashesOf(b).toString()); // TODO flake expected:<{[]}> but was:<{[from-top={elsewhere/fname=whatever}, whatever={fname=whatever, other=more}]}>
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:27,代码来源:StashTest.java

示例3: testAllowEmpty

import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; //导入方法依赖的package包/类
@Issue("JENKINS-37327")
@Test public void testAllowEmpty() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
                    "  stash name: 'whatever', allowEmpty: true\n" +
                    "  semaphore 'ending'\n" +
                    "}\n"
                    , true));
    WorkflowRun b = p.scheduleBuild2(0).waitForStart();
    SemaphoreStep.waitForStart("ending/1", b);
    assertEquals("{whatever={}}", StashManager.stashesOf(b).toString());
    SemaphoreStep.success("ending/1", null);
    r.assertBuildStatusSuccess(r.waitForCompletion(b));
    r.assertLogContains("Stashed 0 file(s)", b);
    assertEquals("{}", StashManager.stashesOf(b).toString());
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("stash"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals("whatever", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:21,代码来源:StashTest.java

示例4: testDefaultJenkinsFileLoadFromWorkspace

import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; //导入方法依赖的package包/类
@Test
public void testDefaultJenkinsFileLoadFromWorkspace() throws Exception {
    GlobalConfigFiles globalConfigFiles = r.jenkins.getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class);
    ConfigFileStore store = globalConfigFiles.get();
    Config config = new GroovyScript("Jenkinsfile", "Jenkinsfile", "",
        "semaphore 'wait'; node {checkout scm; load 'Jenkinsfile'}");
    store.save(config);


    sampleGitRepo.init();
    sampleGitRepo.write("Jenkinsfile", "echo readFile('file')");
    sampleGitRepo.git("add", "Jenkinsfile");
    sampleGitRepo.write("file", "initial content");
    sampleGitRepo.git("commit", "--all", "--message=flow");
    WorkflowMultiBranchProject mp = r.jenkins.createProject(PipelineMultiBranchDefaultsProject.class, "p");
    mp.getSourcesList().add(new BranchSource(new GitSCMSource(null, sampleGitRepo.toString(), "", "*", "", false),
        new DefaultBranchPropertyStrategy(new BranchProperty[0])));
    WorkflowJob p = PipelineMultiBranchDefaultsProjectTest.scheduleAndFindBranchProject(mp, "master");
    SemaphoreStep.waitForStart("wait/1", null);
    WorkflowRun b1 = p.getLastBuild();
    assertNotNull(b1);
    assertEquals(1, b1.getNumber());
    SemaphoreStep.success("wait/1", null);
    r.assertLogContains("initial content", r.waitForCompletion(b1));
}
 
开发者ID:vaimr,项目名称:pipeline-multibranch-defaults-plugin,代码行数:26,代码来源:DefaultsBinderTest.java


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