Search in sources :

Example 1 with NagiosOutput

use of org.sakuli.services.forwarder.gearman.model.NagiosOutput in project sakuli by ConSol.

the class NagiosOutputBuilderTest method testBuild.

@Test
public void testBuild() throws Exception {
    doReturn("STATUS").when(testling).getStatusSummary(testSuite, gearmanProperties);
    doReturn("PERFORMANCE").when(nagiosPerformanceDataBuilder).build();
    NagiosOutput result = testling.build();
    assertEquals(result.getStatusSummary(), "STATUS");
    assertEquals(result.getPerformanceData(), "PERFORMANCE");
}
Also used : NagiosOutput(org.sakuli.services.forwarder.gearman.model.NagiosOutput) Test(org.testng.annotations.Test) BaseTest(org.sakuli.BaseTest)

Example 2 with NagiosOutput

use of org.sakuli.services.forwarder.gearman.model.NagiosOutput in project sakuli by ConSol.

the class NagiosOutputBuilderTest method testGetStatusSummary.

@Test
public void testGetStatusSummary() throws Exception {
    TestSuite testSuite = new TestSuiteExampleBuilder().withState(TestSuiteState.OK).withId("TEST-SUITE-ID").withTestCases(Collections.singletonList(new TestCaseExampleBuilder().withId("TEST-CASE-ID").buildExample())).buildExample();
    String lastRun = AbstractOutputBuilder.dateFormat.format(testSuite.getStopDate());
    String expectedHTML = "[OK] Sakuli suite \"TEST-SUITE-ID\" ok (120.00s). (Last suite run: " + lastRun + ")\\\\n" + String.format(ScreenshotDiv.STYLE_TEMPLATE, testling.getOutputScreenshotDivWidth()) + "<table style=\"border-collapse: collapse;\">" + "<tr valign=\"top\">" + "<td class=\"serviceOK\">[OK] Sakuli suite \"TEST-SUITE-ID\" ok (120.00s). (Last suite run: " + lastRun + ")" + "</td>" + "</tr>" + "<tr valign=\"top\">" + "<td class=\"serviceOK\">[OK] case \"TEST-CASE-ID\" ran in 3.00s - ok</td>" + "</tr>" + "</table>";
    String statusSummary = testling.getStatusSummary(testSuite, gearmanProperties);
    assertEquals(statusSummary, expectedHTML);
    ReflectionTestUtils.setField(testling, "testSuite", testSuite);
    ReflectionTestUtils.setField(testling, "gearmanProperties", gearmanProperties);
    NagiosOutput output = testling.build();
    String substringStatusSummary = output.getOutputString().substring(0, output.getOutputString().indexOf("|"));
    assertEquals(substringStatusSummary, expectedHTML);
}
Also used : NagiosOutput(org.sakuli.services.forwarder.gearman.model.NagiosOutput) TestSuite(org.sakuli.datamodel.TestSuite) TestCaseExampleBuilder(org.sakuli.builder.TestCaseExampleBuilder) TestSuiteExampleBuilder(org.sakuli.builder.TestSuiteExampleBuilder) Test(org.testng.annotations.Test) BaseTest(org.sakuli.BaseTest)

Example 3 with NagiosOutput

use of org.sakuli.services.forwarder.gearman.model.NagiosOutput in project sakuli by ConSol.

the class NagiosOutputBuilder method build.

@Override
public NagiosOutput build() {
    NagiosOutput output = new NagiosOutput();
    output.setStatusSummary(getStatusSummary(testSuite, gearmanProperties));
    output.setPerformanceData(nagiosPerformanceDataBuilder.build());
    return output;
}
Also used : NagiosOutput(org.sakuli.services.forwarder.gearman.model.NagiosOutput)

Example 4 with NagiosOutput

use of org.sakuli.services.forwarder.gearman.model.NagiosOutput in project sakuli by ConSol.

the class GearmanCacheServiceTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    ReflectionTestUtils.setField(checkResultBuilder, "testSuite", new TestSuiteExampleBuilder().buildExample());
    when(nagiosOutputBuilder.build()).thenReturn(new NagiosOutput());
    MonitoringPropertiesTestHelper.initMock(gearmanProperties);
}
Also used : NagiosOutput(org.sakuli.services.forwarder.gearman.model.NagiosOutput) TestSuiteExampleBuilder(org.sakuli.builder.TestSuiteExampleBuilder) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

NagiosOutput (org.sakuli.services.forwarder.gearman.model.NagiosOutput)4 BaseTest (org.sakuli.BaseTest)2 TestSuiteExampleBuilder (org.sakuli.builder.TestSuiteExampleBuilder)2 Test (org.testng.annotations.Test)2 TestCaseExampleBuilder (org.sakuli.builder.TestCaseExampleBuilder)1 TestSuite (org.sakuli.datamodel.TestSuite)1 BeforeMethod (org.testng.annotations.BeforeMethod)1