Search in sources :

Example 1 with BlueOrganizationFolder

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());
}
Also used : AvatarMetadataAction(jenkins.scm.api.metadata.AvatarMetadataAction) BlueOrganizationFolder(io.jenkins.blueocean.rest.model.BlueOrganizationFolder) MultiBranchProject(jenkins.branch.MultiBranchProject) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test) WithoutJenkins(org.jvnet.hudson.test.WithoutJenkins)

Aggregations

BlueOrganizationFolder (io.jenkins.blueocean.rest.model.BlueOrganizationFolder)1 MultiBranchProject (jenkins.branch.MultiBranchProject)1 AvatarMetadataAction (jenkins.scm.api.metadata.AvatarMetadataAction)1 Test (org.junit.Test)1 WithoutJenkins (org.jvnet.hudson.test.WithoutJenkins)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1