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;
}
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;
}
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;
}
Aggregations