use of org.jenkinsci.test.acceptance.po.JenkinsLogger in project acceptance-test-harness by jenkinsci.
the class SupportCorePluginTest method emptyLogger.
@Issue("JENKINS-27669")
@Test
public void emptyLogger() throws Exception {
JenkinsLogger logger = jenkins.createLogger("test", Collections.singletonMap("", Level.ALL));
assertFalse(logger.isEmpty());
}
use of org.jenkinsci.test.acceptance.po.JenkinsLogger in project acceptance-test-harness by jenkinsci.
the class DiskUsage method reloaded.
public static Matcher<DiskUsage> reloaded() {
return new Matcher<DiskUsage>("disk usage reloaded") {
private Exception cause;
@Override
public boolean matchesSafely(DiskUsage item) {
JenkinsLogger logger = item.getJenkins().getLogger("all");
try {
logger.waitForLogged(Pattern.compile("Finished Project disk usage. \\d+ ms"));
return true;
} catch (TimeoutException ex) {
// v0.22 and newer
cause = ex;
}
try {
logger.waitForLogged(Pattern.compile("Finished Calculation of builds disk usage.*"));
logger.waitForLogged(Pattern.compile("Finished Calculation of job directories.*"));
logger.waitForLogged(Pattern.compile("Finished Calculation of workspace usage.*"));
return true;
} catch (TimeoutException ex) {
cause = ex;
return false;
}
}
@Override
public void describeMismatchSafely(DiskUsage item, Description dsc) {
dsc.appendText(cause.getMessage());
}
};
}
use of org.jenkinsci.test.acceptance.po.JenkinsLogger in project acceptance-test-harness by jenkinsci.
the class PlotPluginTest method no_exception_visit_plot_page.
/**
* Test if NumberFormatException is logged only if a non-zero length string is found in the data set.
* Fix introduced in plot@1.10
*/
@Test
@Issue("JENKINS-25849")
public void no_exception_visit_plot_page() {
job.configure();
job.copyResource(resource(csvWithStringsFilePath));
PlotPublisher pub = job.addPublisher(PlotPublisher.class);
Plot plot = pub.getPlot(1);
plot.setGroup("My group");
plot.setTitle("My plot");
plot.addDataSeries(CsvDataSeries.class, csvWithStringsFileName);
job.save();
job.startBuild().shouldSucceed();
job.visit("plot");
assertThatBuildHasPlot("My plot", "My group");
JenkinsLogger jLog = job.getJenkins().getLogger("all");
Pattern p1 = Pattern.compile(EMPTY_STRING, Pattern.DOTALL);
Pattern p2 = Pattern.compile(NON_EMPTY_STRING, Pattern.DOTALL);
assertThat("NumberFormatException was logged for empty string.", jLog.hasLogged(p1), is(false));
assertThat("NumberFormatException was not logged for non empty string.", jLog.hasLogged(p2), is(true));
}
Aggregations