/** End-to-end installation test. */ private void doTestAutoInstallation(String id, String fullversion) throws Exception { Assume.assumeTrue( "this is a really time consuming test, so only run it when we really want", Boolean.getBoolean("jenkins.testJDKInstaller")); retrieveUpdateCenterData(); JDKInstaller installer = new JDKInstaller(id, true); JDK jdk = new JDK( "test", tmp.getRoot().getAbsolutePath(), Arrays.asList(new InstallSourceProperty(Arrays.<ToolInstaller>asList(installer)))); j.jenkins.getJDKs().add(jdk); FreeStyleProject p = j.createFreeStyleProject(); p.setJDK(jdk); p.getBuildersList().add(new Shell("java -fullversion\necho $JAVA_HOME")); FreeStyleBuild b = j.buildAndAssertSuccess(p); @SuppressWarnings("deprecation") String log = b.getLog(); System.out.println(log); // make sure it runs with the JDK that just got installed assertTrue(log.contains(fullversion)); assertTrue(log.contains(tmp.getRoot().getAbsolutePath())); }
@Test public void testTriggerName() throws Exception { List<RecipientProvider> recProviders = Collections.emptyList(); PreBuildTrigger trigger = new PreBuildTrigger( recProviders, "$DEFAULT_RECIPIENTS", "$DEFAULT_REPLYTO", "$DEFAULT_SUBJECT", "$DEFAULT_CONTENT", "", 0, "project"); addEmailType(trigger); publisher.getConfiguredTriggers().add(trigger); FreeStyleBuild build = project.scheduleBuild2(0).get(); j.assertBuildStatusSuccess(build); assertThat( "Email should have been triggered, so we should see it in the logs.", build.getLog(100), hasItems("Email was triggered for: " + PreBuildTrigger.TRIGGER_NAME)); assertEquals(1, Mailbox.get("*****@*****.**").size()); Message message = Mailbox.get("*****@*****.**").get(0); assertEquals(PreBuildTrigger.TRIGGER_NAME, message.getSubject()); }
protected FreeStyleBuild build( final FreeStyleProject project, final Result expectedResult, final String... expectedNewlyCommittedFiles) throws Exception { final FreeStyleBuild build = project.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(build.getLog(50)); return build; }