if (!wrappers.contains(wrapper.getDescriptor())) wrappers.add(wrapper); p.scheduleBuild2(jenkins.getQuietPeriod(),new WorkflowCause("triggered by workflow"),ja); return;
/** * Tests with no extensions. * * @throws IOException * IOException * @throws InterruptedException * InterruptedException * @throws ExecutionException * ExecutionException */ public void testNoRebuildValidatorExtension() throws IOException, InterruptedException, ExecutionException { Project projectA = createFreeStyleProject("testFreeStyleA"); Build buildA = (Build) projectA.scheduleBuild2( 0, new Cause.UserIdCause(), new ParametersAction(new StringParameterValue("party", "megaparty"))).get(); assertNotNull(buildA.getAction(RebuildAction.class)); }
/** * Tests with an extension returning isApplicable false. * * @throws IOException * IOException * @throws InterruptedException * InterruptedException * @throws ExecutionException * ExecutionException */ public void testRebuildValidatorExtensionIsApplicableFalse() throws IOException, InterruptedException, ExecutionException { hudson.getExtensionList(RebuildValidator.class).add(0, new ValidatorNeverApplicable()); Project projectA = createFreeStyleProject("testFreeStyleC"); Build buildA = (Build) projectA.scheduleBuild2( 0, new Cause.UserIdCause(), new ParametersAction(new StringParameterValue("party", "megaparty"))).get(); assertNotNull(buildA.getAction(RebuildAction.class)); }
/** * Tests with an extension returning isApplicable true. * * @throws IOException * IOException * @throws InterruptedException * InterruptedException * @throws ExecutionException * ExecutionException */ public void testRebuildValidatorExtensionIsApplicableTrue() throws IOException, InterruptedException, ExecutionException { hudson.getExtensionList(RebuildValidator.class).add(0, new ValidatorAlwaysApplicable()); Project projectA = createFreeStyleProject("testFreeStyleB"); Build buildA = (Build) projectA.scheduleBuild2( 0, new Cause.UserIdCause(), new ParametersAction(new StringParameterValue("party", "megaparty"))).get(); assertNull(buildA.getAction(RebuildAction.class)); }
/** * Tests with two extensions returning isApplicable true AND false. * * @throws IOException * IOException * @throws InterruptedException * InterruptedException * @throws ExecutionException * ExecutionException */ public void testRebuildValidatorExtensionIsApplicableTrueFalse() throws IOException, InterruptedException, ExecutionException { hudson.getExtensionList(RebuildValidator.class).add(0, new ValidatorAlwaysApplicable()); hudson.getExtensionList(RebuildValidator.class).add(0, new ValidatorNeverApplicable()); Project projectA = createFreeStyleProject("testFreeStyleC"); Build buildA = (Build) projectA.scheduleBuild2( 0, new Cause.UserIdCause(), new ParametersAction(new StringParameterValue("party", "megaparty"))).get(); assertNull(buildA.getAction(RebuildAction.class)); }