Search in sources :

Example 1 with BbBranch

use of io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch in project blueocean-plugin by jenkinsci.

the class BitbucketApiTest method testDefaultBranchPre5_6_0.

@Test
public void testDefaultBranchPre5_6_0() {
    BbBranch branch = api.getDefaultBranch("TESTP", "empty-repo-test");
    assertNull(branch);
}
Also used : BbBranch(io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with BbBranch

use of io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch in project blueocean-plugin by jenkinsci.

the class BitbucketApiTest method testDefaultBranch5_6_0.

@Test
public void testDefaultBranch5_6_0() {
    BbBranch branch = api.getDefaultBranch("TESTP", "empty1");
    assertNull(branch);
}
Also used : BbBranch(io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with BbBranch

use of io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch in project blueocean-plugin by jenkinsci.

the class BitbucketApiTest method getRepoContent.

@Test
public void getRepoContent() throws JsonProcessingException, UnsupportedEncodingException {
    BbBranch branch = api.getDefaultBranch("TESTP", "pipeline-demo-test");
    assertNotNull(branch);
    String content = api.getContent("TESTP", "pipeline-demo-test", "Jenkinsfile", branch.getLatestCommit());
    assertEquals("node{\n" + "  echo 'hello world'\n" + "}", content);
}
Also used : BbBranch(io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with BbBranch

use of io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch in project blueocean-plugin by jenkinsci.

the class BitbucketApiTest method testEmptyRepo204.

@Test
public void testEmptyRepo204() {
    BbBranch branch = api.getDefaultBranch("TESTP", "empty1");
    assertNull(branch);
}
Also used : BbBranch(io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 5 with BbBranch

use of io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch in project blueocean-plugin by jenkinsci.

the class BitbucketApiTest method updateRepoContent.

@Test
public void updateRepoContent() throws JsonProcessingException, UnsupportedEncodingException {
    BbBranch branch = api.getBranch("TESTP", "pipeline-demo-test", "master");
    assertEquals("master", branch.getDisplayId());
    assertTrue(branch instanceof BbServerBranch);
    assertEquals("refs/heads/master", ((BbServerBranch) branch).getId());
    assertNotNull(branch.getLatestCommit());
    String content = api.getContent("TESTP", "pipeline-demo-test", "Jenkinsfile", branch.getLatestCommit());
    assertEquals("node{\n" + "  echo 'hello world'\n" + "}", content);
    // update content
    api.saveContent("TESTP", "pipeline-demo-test", "Jenkinsfile", "node{\n" + "  echo 'hello world!'\n" + "}", "another commit", "master", null, branch.getLatestCommit());
}
Also used : BbBranch(io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch) BbServerBranch(io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.model.BbServerBranch) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

BbBranch (io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch)9 Test (org.junit.Test)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)8 BbServerBranch (io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.model.BbServerBranch)2 ServiceException (io.jenkins.blueocean.commons.ServiceException)1 GitContent (io.jenkins.blueocean.rest.impl.pipeline.scm.GitContent)1 ScmFile (io.jenkins.blueocean.rest.impl.pipeline.scm.ScmFile)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1