Search in sources :

Example 1 with JiraContainer

use of org.jenkinsci.test.acceptance.docker.fixtures.JiraContainer in project acceptance-test-harness by jenkinsci.

the class JiraPluginTest method jira_ticket_gets_updated_with_a_build_link.

@Test
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { USERNAME, PASSWORD }, id = CREDENTIALS_ID)
public void jira_ticket_gets_updated_with_a_build_link() throws Exception {
    JiraContainer jira = docker.get();
    jira.waitForReady(this);
    jira.createProject("ABC");
    jira.createIssue("ABC");
    jira.createIssue("ABC");
    jenkins.configure();
    {
        new JiraGlobalConfig(jenkins).addSite(jira.getURL(), CREDENTIALS_ID);
    }
    jenkins.save();
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    {
        job.useScm(GitScm.class).url(git.dir.toString());
        job.addPublisher(JiraUpdater.class);
    }
    job.save();
    git.changeAndCommitFoo("initial commit");
    job.startBuild().shouldSucceed();
    git.changeAndCommitFoo("[ABC-1] fixed");
    git.changeAndCommitFoo("[ABC-2] fixed");
    Build b = job.startBuild().shouldSucceed();
    b.open();
    find(by.link("ABC-1"));
    find(by.link("ABC-2"));
    String buildUrl = job.build(b.getNumber()).url.toString();
    for (RemoteComment c : jira.getComments("ABC-1")) {
        if (c.getBody().contains(buildUrl)) {
            return;
        }
    }
    fail("Comment back to Jenkins not found");
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) JiraGlobalConfig(org.jenkinsci.test.acceptance.plugins.jira.JiraGlobalConfig) RemoteComment(hudson.plugins.jira.soap.RemoteComment) JiraContainer(org.jenkinsci.test.acceptance.docker.fixtures.JiraContainer) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) JiraUpdater(org.jenkinsci.test.acceptance.plugins.jira.JiraUpdater) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Aggregations

RemoteComment (hudson.plugins.jira.soap.RemoteComment)1 JiraContainer (org.jenkinsci.test.acceptance.docker.fixtures.JiraContainer)1 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)1 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)1 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)1 JiraGlobalConfig (org.jenkinsci.test.acceptance.plugins.jira.JiraGlobalConfig)1 JiraUpdater (org.jenkinsci.test.acceptance.plugins.jira.JiraUpdater)1 Build (org.jenkinsci.test.acceptance.po.Build)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 Test (org.junit.Test)1