Package hudson.model

Examples of hudson.model.HealthReport$ConverterImpl


  public void testHealth() throws Exception {
   
    FreeStyleBuild build = mock(FreeStyleBuild.class);
    when(build.getUrl()).thenReturn("job/foo/32/");
   
    HealthReport healthMock = mock(HealthReport.class);
    when(healthMock.getDescription()).thenReturn("Fine");
    when(healthMock.getScore()).thenReturn(100);
   
    AbstractMavenProject job = mock(AbstractMavenProject.class);
    ItemGroup parent = mock(ItemGroup.class);
    when(parent.getFullDisplayName()).thenReturn("");
    when(job.getParent()).thenReturn(parent);
View Full Code Here


    @Test
  public void testFailure() throws Exception {
        FreeStyleBuild build = mock(FreeStyleBuild.class);
        when(build.getUrl()).thenReturn("job/foo/32/");

        HealthReport healthMock = mock(HealthReport.class);
        when(healthMock.getDescription()).thenReturn("Cloudy");
        when(healthMock.getScore()).thenReturn(0);

        AbstractMavenProject job = mock(AbstractMavenProject.class);
    ItemGroup parent = mock(ItemGroup.class);
    when(parent.getFullDisplayName()).thenReturn("");
    when(job.getParent()).thenReturn(parent);
View Full Code Here

            if (value <= minValue) {
                minValue = value;
                minMetric = target.getMetric();
            }
        }
        HealthReport report = minMetric != null?new HealthReport(minValue, results.getHealthDescription(minMetric)):null;
        return report;
    }
View Full Code Here

                for (Map.Entry<CoverageMetric, Integer> e : scores.entrySet()) {
                    minKey = e.getKey();
                }
                if (minKey != null) {
                    Localizable localizedDescription = Messages._CoberturaBuildAction_description(result.get(minKey).getPercentage(), result.get(minKey).toString(), minKey.getName());
                    health = new HealthReport(minValue, localizedDescription);
                    return health;
                }
                return null;
            }

        } else {
            Localizable localizedDescription = Messages._CoberturaBuildAction_description(result.get(minKey).getPercentage(), result.get(minKey).toString(), minKey.getName());
            health = new HealthReport(minValue, localizedDescription);
            return health;
        }
    }
View Full Code Here

      {
        @Override
        public HealthReport getBuildHealth()
        {

          return new HealthReport( 100, (Localizable) null );
        }
      };

      EasyMock.expect( build.getAction( CoberturaBuildAction.class ) ).andReturn( action ).anyTimes();
      EasyMock.expect( build.getDisplayName() ).andReturn( "#" + String.valueOf( c ) ).anyTimes();
View Full Code Here

            }
            else {
                percentage = 100 - ((counter - healthDescriptor.getHealthyAnnotations()) * 100
                        / (healthDescriptor.getUnHealthyAnnotations() - healthDescriptor.getHealthyAnnotations()));
            }
            return new HealthReport(percentage, healthDescriptor.createDescription(result));
        }
        return null;
    }
View Full Code Here

    /**
     * Tests whether we evaluate correctly to a 50% health.
     */
    @Test
    public void testMiddle() {
        HealthReport health = createHealthReport(true, 50, 150, 100);
        assertEquals(ERROR_MESSAGE, 50, health.getScore());
    }
View Full Code Here

    /**
     * Tests whether we evaluate correctly to a 100% health.
     */
    @Test
    public void testHigh() {
        HealthReport health = createHealthReport(true, 50, 150, 20);
        assertEquals(ERROR_MESSAGE, 100, health.getScore());
    }
View Full Code Here

    /**
     * Tests whether we evaluate correctly to a 100% health if lower than minimum.
     */
    @Test
    public void testHighBoundary() {
        HealthReport health = createHealthReport(true, 50, 150, 50);
        assertEquals(ERROR_MESSAGE, 100, health.getScore());
    }
View Full Code Here

    /**
     * Tests whether we evaluate correctly to a 0% health.
     */
    @Test
    public void testLow() {
        HealthReport health = createHealthReport(true, 50, 150, 200);
        assertEquals(ERROR_MESSAGE, 0, health.getScore());
    }
View Full Code Here

TOP

Related Classes of hudson.model.HealthReport$ConverterImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.