Search in sources :

Example 6 with ParametersAction

use of hudson.model.ParametersAction in project blueocean-plugin by jenkinsci.

the class PipelineApiTest method testPipelineQueue.

@Test
public void testPipelineQueue() throws Exception {
    FreeStyleProject p1 = j.createFreeStyleProject("pipeline1");
    p1.setConcurrentBuild(true);
    p1.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("test", "test")));
    p1.getBuildersList().add(new Shell("echo hello!\nsleep 300"));
    p1.scheduleBuild2(0).waitForStart();
    p1.scheduleBuild2(0).waitForStart();
    Jenkins.getInstance().getQueue().schedule(p1, 0, new ParametersAction(new StringParameterValue("test", "test1")), new CauseAction(new Cause.UserIdCause()));
    Jenkins.getInstance().getQueue().schedule(p1, 0, new ParametersAction(new StringParameterValue("test", "test2")), new CauseAction(new Cause.UserIdCause()));
    List queue = request().get("/organizations/jenkins/pipelines/pipeline1/queue").build(List.class);
    Assert.assertEquals(2, queue.size());
    Assert.assertEquals(4, ((Map) queue.get(0)).get("expectedBuildNumber"));
    Assert.assertEquals(3, ((Map) queue.get(1)).get("expectedBuildNumber"));
    Assert.assertEquals("Waiting for next available executor", ((Map) queue.get(0)).get("causeOfBlockage"));
    Assert.assertEquals("Waiting for next available executor", ((Map) queue.get(1)).get("causeOfBlockage"));
}
Also used : Shell(hudson.tasks.Shell) StringParameterDefinition(hudson.model.StringParameterDefinition) ParametersDefinitionProperty(hudson.model.ParametersDefinitionProperty) StringParameterValue(hudson.model.StringParameterValue) CauseAction(hudson.model.CauseAction) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) FreeStyleProject(hudson.model.FreeStyleProject) ParametersAction(hudson.model.ParametersAction) Test(org.junit.Test)

Aggregations

ParametersAction (hudson.model.ParametersAction)6 ParametersDefinitionProperty (hudson.model.ParametersDefinitionProperty)4 ParameterValue (hudson.model.ParameterValue)3 StringParameterDefinition (hudson.model.StringParameterDefinition)3 StringParameterValue (hudson.model.StringParameterValue)3 CauseAction (hudson.model.CauseAction)2 FreeStyleProject (hudson.model.FreeStyleProject)2 JobPropertyImpl (hudson.plugins.promoted_builds.JobPropertyImpl)2 Promotion (hudson.plugins.promoted_builds.Promotion)2 PromotionProcess (hudson.plugins.promoted_builds.PromotionProcess)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Bug (org.jvnet.hudson.test.Bug)2 ImmutableList (com.google.common.collect.ImmutableList)1 AbortException (hudson.AbortException)1 AbstractBuild (hudson.model.AbstractBuild)1 Cause (hudson.model.Cause)1 FreeStyleBuild (hudson.model.FreeStyleBuild)1 ParameterDefinition (hudson.model.ParameterDefinition)1 Queue (hudson.model.Queue)1