Search in sources :

Example 1 with BitbucketServerScmContentProvider

use of io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerScmContentProvider in project blueocean-plugin by jenkinsci.

the class BitbucketCloudScmContentProviderTest method checkScmProperties.

@Test
public void checkScmProperties() throws Exception {
    // ensure cloud provider works with cloud multibranch pipeline
    String credentialId = createCredential(BitbucketCloudScm.ID, authenticatedUser);
    MultiBranchProject mbp = mockMbp(credentialId);
    ScmContentProvider provider = new BitbucketCloudScmContentProvider();
    // unfortunately overriding the apiUrl for WireMock returns a "localhost" URL here, so we mock the call
    when(((BitbucketSCMSource) mbp.getSCMSources().get(0)).getServerUrl()).thenReturn(BitbucketCloudScm.API_URL);
    assertTrue(provider.support(mbp));
    assertEquals(provider.getScmId(), BitbucketCloudScm.ID);
    assertEquals(provider.getApiUrl(mbp), BitbucketCloudScm.API_URL);
    // ensure server provider doesn't work with cloud multibranch pipeline
    provider = new BitbucketServerScmContentProvider();
    assertFalse(provider.support(mbp));
}
Also used : BitbucketServerScmContentProvider(io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerScmContentProvider) ScmContentProvider(io.jenkins.blueocean.rest.impl.pipeline.ScmContentProvider) MultiBranchProject(jenkins.branch.MultiBranchProject) BitbucketSCMSource(com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource) BitbucketServerScmContentProvider(io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerScmContentProvider) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

BitbucketSCMSource (com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource)1 BitbucketServerScmContentProvider (io.jenkins.blueocean.blueocean_bitbucket_pipeline.server.BitbucketServerScmContentProvider)1 ScmContentProvider (io.jenkins.blueocean.rest.impl.pipeline.ScmContentProvider)1 MultiBranchProject (jenkins.branch.MultiBranchProject)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1