Search in sources :

Example 1 with AbstractFolderPropertyDescriptor

use of com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor in project blueocean-plugin by jenkinsci.

the class GithubMockBase method mockMbp.

protected MultiBranchProject mockMbp(String credentialId, User user, String credentialDomainName) {
    MultiBranchProject mbp = mock(MultiBranchProject.class);
    when(mbp.getName()).thenReturn("PR-demo");
    when(mbp.getParent()).thenReturn(j.jenkins);
    GitHubSCMSource scmSource = mock(GitHubSCMSource.class);
    when(scmSource.getApiUri()).thenReturn(githubApiUrl);
    when(scmSource.getCredentialsId()).thenReturn(credentialId);
    when(scmSource.getRepoOwner()).thenReturn("cloudbeers");
    when(scmSource.getRepository()).thenReturn("PR-demo");
    when(mbp.getSCMSources()).thenReturn(Lists.<SCMSource>newArrayList(scmSource));
    BlueOceanCredentialsProvider.FolderPropertyImpl folderProperty = mock(BlueOceanCredentialsProvider.FolderPropertyImpl.class);
    DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor> mbpProperties = new DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor>(mbp);
    mbpProperties.add(new BlueOceanCredentialsProvider.FolderPropertyImpl(user.getId(), credentialId, BlueOceanCredentialsProvider.createDomain(githubApiUrl)));
    Domain domain = mock(Domain.class);
    when(domain.getName()).thenReturn(credentialDomainName);
    when(folderProperty.getDomain()).thenReturn(domain);
    when(mbp.getProperties()).thenReturn(mbpProperties);
    return mbp;
}
Also used : BlueOceanCredentialsProvider(io.jenkins.blueocean.rest.impl.pipeline.credential.BlueOceanCredentialsProvider) DescribableList(hudson.util.DescribableList) MultiBranchProject(jenkins.branch.MultiBranchProject) GitHubSCMSource(org.jenkinsci.plugins.github_branch_source.GitHubSCMSource) AbstractFolderPropertyDescriptor(com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor) Domain(com.cloudbees.plugins.credentials.domains.Domain) AbstractFolderProperty(com.cloudbees.hudson.plugins.folder.AbstractFolderProperty)

Example 2 with AbstractFolderPropertyDescriptor

use of com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor in project blueocean-plugin by jenkinsci.

the class BitbucketCloudScmContentProviderTest method mockMbp.

private MultiBranchProject mockMbp(String credentialId, User user) {
    MultiBranchProject mbp = mock(MultiBranchProject.class);
    when(mbp.getName()).thenReturn("pipeline1");
    when(mbp.getParent()).thenReturn(j.jenkins);
    BitbucketSCMSource scmSource = mock(BitbucketSCMSource.class);
    when(scmSource.getServerUrl()).thenReturn(apiUrl);
    when(scmSource.getCredentialsId()).thenReturn(credentialId);
    when(scmSource.getRepoOwner()).thenReturn("vivekp7");
    when(scmSource.getRepository()).thenReturn("demo1");
    when(mbp.getSCMSources()).thenReturn(Lists.<SCMSource>newArrayList(scmSource));
    // mock blueocean credential provider stuff
    BlueOceanCredentialsProvider.FolderPropertyImpl folderProperty = mock(BlueOceanCredentialsProvider.FolderPropertyImpl.class);
    DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor> properties = new DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor>(mbp);
    properties.add(new BlueOceanCredentialsProvider.FolderPropertyImpl(user.getId(), credentialId, BlueOceanCredentialsProvider.createDomain(apiUrl)));
    Domain domain = mock(Domain.class);
    when(domain.getName()).thenReturn(BitbucketCloudScm.DOMAIN_NAME);
    when(folderProperty.getDomain()).thenReturn(domain);
    when(mbp.getProperties()).thenReturn(properties);
    return mbp;
}
Also used : BlueOceanCredentialsProvider(io.jenkins.blueocean.rest.impl.pipeline.credential.BlueOceanCredentialsProvider) DescribableList(hudson.util.DescribableList) MultiBranchProject(jenkins.branch.MultiBranchProject) AbstractFolderPropertyDescriptor(com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor) Domain(com.cloudbees.plugins.credentials.domains.Domain) BitbucketSCMSource(com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource) AbstractFolderProperty(com.cloudbees.hudson.plugins.folder.AbstractFolderProperty)

Example 3 with AbstractFolderPropertyDescriptor

use of com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor in project blueocean-plugin by jenkinsci.

the class BitbucketServerScmContentProviderTest method mockMbp.

private MultiBranchProject mockMbp(String credentialId, User user) {
    MultiBranchProject mbp = mock(MultiBranchProject.class);
    when(mbp.getName()).thenReturn("pipeline1");
    when(mbp.getParent()).thenReturn(j.jenkins);
    BitbucketSCMSource scmSource = mock(BitbucketSCMSource.class);
    when(scmSource.getServerUrl()).thenReturn(apiUrl);
    when(scmSource.getCredentialsId()).thenReturn(credentialId);
    when(scmSource.getRepoOwner()).thenReturn("TESTP");
    when(scmSource.getRepository()).thenReturn("pipeline-demo-test");
    when(mbp.getSCMSources()).thenReturn(Lists.<SCMSource>newArrayList(scmSource));
    // mock blueocean credential provider stuff
    BlueOceanCredentialsProvider.FolderPropertyImpl folderProperty = mock(BlueOceanCredentialsProvider.FolderPropertyImpl.class);
    DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor> properties = new DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor>(mbp);
    properties.add(new BlueOceanCredentialsProvider.FolderPropertyImpl(user.getId(), credentialId, BlueOceanCredentialsProvider.createDomain(apiUrl)));
    Domain domain = mock(Domain.class);
    when(domain.getName()).thenReturn(BitbucketServerScm.DOMAIN_NAME);
    when(folderProperty.getDomain()).thenReturn(domain);
    when(mbp.getProperties()).thenReturn(properties);
    return mbp;
}
Also used : BlueOceanCredentialsProvider(io.jenkins.blueocean.rest.impl.pipeline.credential.BlueOceanCredentialsProvider) DescribableList(hudson.util.DescribableList) MultiBranchProject(jenkins.branch.MultiBranchProject) AbstractFolderPropertyDescriptor(com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor) Domain(com.cloudbees.plugins.credentials.domains.Domain) BitbucketSCMSource(com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource) AbstractFolderProperty(com.cloudbees.hudson.plugins.folder.AbstractFolderProperty)

Aggregations

AbstractFolderProperty (com.cloudbees.hudson.plugins.folder.AbstractFolderProperty)3 AbstractFolderPropertyDescriptor (com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor)3 Domain (com.cloudbees.plugins.credentials.domains.Domain)3 DescribableList (hudson.util.DescribableList)3 BlueOceanCredentialsProvider (io.jenkins.blueocean.rest.impl.pipeline.credential.BlueOceanCredentialsProvider)3 MultiBranchProject (jenkins.branch.MultiBranchProject)3 BitbucketSCMSource (com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource)2 GitHubSCMSource (org.jenkinsci.plugins.github_branch_source.GitHubSCMSource)1