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");
}
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);
}
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;
}
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);
}
Aggregations