/** * 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)); }
private ClaimBuildAction applyClaimWithFailureCauseSelected( String element, String error, String reason, String description) throws Exception { HtmlPage page = whenNavigatingtoClaimPage(); page.getElementById(element).click(); HtmlForm form = page.getFormByName("claim"); form.getTextAreaByName("reason").setText(reason); HtmlSelect select = form.getSelectByName("_.errors"); HtmlOption option = select.getOptionByValue(error); select.setSelectedAttribute(option, true); assertEquals(description, form.getTextAreaByName("errordesc").getTextContent()); form.submit((HtmlButton) j.last(form.getHtmlElementsByTagName("button"))); ClaimBuildAction action = build.getAction(ClaimBuildAction.class); return action; }