Search in sources :

Example 1 with WithoutJenkins

use of org.jvnet.hudson.test.WithoutJenkins 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)

Example 2 with WithoutJenkins

use of org.jvnet.hudson.test.WithoutJenkins in project phabricator-jenkins-plugin by uber.

the class CoberturaCoverageProviderTest method testConvertCobertura.

@WithoutJenkins
@Test
public void testConvertCobertura() {
    CoverageResult result = getMockResult();
    CodeCoverageMetrics metrics = CoberturaCoverageProvider.convertCobertura(result);
    assertEquals(75.0f, metrics.getLineCoveragePercent(), 0.0f);
    assertEquals(0.0f, metrics.getPackageCoveragePercent(), 0.0f);
}
Also used : CoverageResult(hudson.plugins.cobertura.targets.CoverageResult) Test(org.junit.Test) WithoutJenkins(org.jvnet.hudson.test.WithoutJenkins)

Example 3 with WithoutJenkins

use of org.jvnet.hudson.test.WithoutJenkins in project blueocean-plugin by jenkinsci.

the class OrganizationFolderTest method testOrgFolderRun.

@Test
@WithoutJenkins
public void testOrgFolderRun() {
    OrganizationFolderPipelineImpl organizationFolder = new OrganizationFolderPipelineImpl(mockOrganization(), orgFolder, new Link("/a/b/")) {
    };
    OrganizationFolderRunImpl organizationFolderRun = new OrganizationFolderRunImpl(organizationFolder, new Reachable() {

        @Override
        public Link getLink() {
            return new Link("/a/b/");
        }
    });
    assertEquals(orgFolder.getName(), organizationFolderRun.getPipeline());
    assertEquals(organization.getName(), organizationFolderRun.getOrganization());
    assertNotNull(organizationFolder.getRuns());
}
Also used : Reachable(io.jenkins.blueocean.rest.Reachable) Link(io.jenkins.blueocean.rest.hal.Link) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test) WithoutJenkins(org.jvnet.hudson.test.WithoutJenkins)

Aggregations

Test (org.junit.Test)3 WithoutJenkins (org.jvnet.hudson.test.WithoutJenkins)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 CoverageResult (hudson.plugins.cobertura.targets.CoverageResult)1 Reachable (io.jenkins.blueocean.rest.Reachable)1 Link (io.jenkins.blueocean.rest.hal.Link)1 BlueOrganizationFolder (io.jenkins.blueocean.rest.model.BlueOrganizationFolder)1 MultiBranchProject (jenkins.branch.MultiBranchProject)1 AvatarMetadataAction (jenkins.scm.api.metadata.AvatarMetadataAction)1