use of io.jenkins.blueocean.rest.model.BlueOrganizationFolder in project blueocean-plugin by jenkinsci.
the class OrganizationFolderTest method testOrgFolderPipeline.
@Test
@WithoutJenkins
public void testOrgFolderPipeline() throws IOException {
AvatarMetadataAction avatarMetadataAction = mock(AvatarMetadataAction.class);
when(orgFolder.getAction(AvatarMetadataAction.class)).thenReturn(avatarMetadataAction);
BlueOrganizationFolder organizationFolder = new OrganizationFolderPipelineImpl(organization, orgFolder, organization.getLink().rel("/pipelines/")) {
};
assertEquals(organizationFolder.getName(), organizationFolder.getName());
assertEquals(organizationFolder.getDisplayName(), organizationFolder.getDisplayName());
assertEquals(organization.getName(), organizationFolder.getOrganizationName());
assertNotNull(organizationFolder.getIcon());
MultiBranchProject multiBranchProject = PowerMockito.mock(MultiBranchProject.class);
when(orgFolder.getItem("repo1")).thenReturn(multiBranchProject);
PowerMockito.when(OrganizationFactory.getInstance().getContainingOrg((ItemGroup) multiBranchProject)).thenReturn(organization);
PowerMockito.when(multiBranchProject.getFullName()).thenReturn("p1");
PowerMockito.when(multiBranchProject.getName()).thenReturn("p1");
MultiBranchPipelineContainerImpl multiBranchPipelineContainer = new MultiBranchPipelineContainerImpl(organization, orgFolder, organizationFolder);
assertEquals(multiBranchProject.getName(), multiBranchPipelineContainer.get("repo1").getName());
when(orgFolder.getItems()).thenReturn(Collections.singletonList(multiBranchProject));
assertNotNull(organizationFolder.getPipelineFolderNames());
}
Aggregations