Search in sources :

Example 6 with ScmFile

use of io.jenkins.blueocean.rest.impl.pipeline.scm.ScmFile in project blueocean-plugin by jenkinsci.

the class BitbucketCloudScmContentProviderTest method getContent.

@Test
public void getContent() throws UnirestException, IOException {
    String credentialId = createCredential(BitbucketCloudScm.ID);
    StaplerRequest staplerRequest = mockStapler();
    MultiBranchProject mbp = mockMbp(credentialId);
    ScmFile<GitContent> content = (ScmFile<GitContent>) new BitbucketCloudScmContentProvider().getContent(staplerRequest, mbp);
    assertEquals("Jenkinsfile", content.getContent().getName());
    assertEquals("04553981a05754d4bffef56a59d9d996d500301c", content.getContent().getCommitId());
    assertEquals("demo1", content.getContent().getRepo());
    assertEquals("vivekp7", content.getContent().getOwner());
}
Also used : StaplerRequest(org.kohsuke.stapler.StaplerRequest) MultiBranchProject(jenkins.branch.MultiBranchProject) GitContent(io.jenkins.blueocean.rest.impl.pipeline.scm.GitContent) ScmFile(io.jenkins.blueocean.rest.impl.pipeline.scm.ScmFile) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 7 with ScmFile

use of io.jenkins.blueocean.rest.impl.pipeline.scm.ScmFile in project blueocean-plugin by jenkinsci.

the class BitbucketServerScmContentProviderTest method getContent.

@Test
public void getContent() throws UnirestException, IOException {
    String credentialId = createCredential(BitbucketServerScm.ID);
    StaplerRequest staplerRequest = mockStapler();
    MultiBranchProject mbp = mockMbp(credentialId);
    ScmFile<GitContent> content = (ScmFile<GitContent>) new BitbucketServerScmContentProvider().getContent(staplerRequest, mbp);
    assertEquals("Jenkinsfile", content.getContent().getName());
    assertEquals("0bae0ddbed2e897d3b44abc3aca9ba26e2f61710", content.getContent().getCommitId());
    assertEquals("pipeline-demo-test", content.getContent().getRepo());
    assertEquals("TESTP", content.getContent().getOwner());
}
Also used : StaplerRequest(org.kohsuke.stapler.StaplerRequest) MultiBranchProject(jenkins.branch.MultiBranchProject) GitContent(io.jenkins.blueocean.rest.impl.pipeline.scm.GitContent) ScmFile(io.jenkins.blueocean.rest.impl.pipeline.scm.ScmFile) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

GitContent (io.jenkins.blueocean.rest.impl.pipeline.scm.GitContent)7 ScmFile (io.jenkins.blueocean.rest.impl.pipeline.scm.ScmFile)7 MultiBranchProject (jenkins.branch.MultiBranchProject)5 Test (org.junit.Test)5 StaplerRequest (org.kohsuke.stapler.StaplerRequest)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 JSONObject (net.sf.json.JSONObject)4 BitbucketScmSaveFileRequest (io.jenkins.blueocean.blueocean_bitbucket_pipeline.BitbucketScmSaveFileRequest)3 BufferedReader (java.io.BufferedReader)3 StringReader (java.io.StringReader)3 ServiceException (io.jenkins.blueocean.commons.ServiceException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 BbBranch (io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbBranch)1 BbSaveContentResponse (io.jenkins.blueocean.blueocean_bitbucket_pipeline.model.BbSaveContentResponse)1 ErrorMessage (io.jenkins.blueocean.commons.ErrorMessage)1 IOException (java.io.IOException)1