本文整理汇总了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));
}
示例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}]}>
}
示例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)));
}
示例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));
}