本文整理了Java中com.palantir.gradle.circlestyle.XmlReportFailuresSupplier
类的一些代码示例,展示了XmlReportFailuresSupplier
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlReportFailuresSupplier
类的具体详情如下:
包路径:com.palantir.gradle.circlestyle.XmlReportFailuresSupplier
类名称:XmlReportFailuresSupplier
暂无
代码示例来源:origin: palantir/gradle-circle-style
public static <T extends Task & Reporting<? extends ReportContainer<SingleFileReport>>>
XmlReportFailuresSupplier create(final T task, final ReportHandler<T> reportHandler) {
// Ensure any necessary output is enabled
task.doFirst(new Action<Task>() {
@Override
public void execute(Task ignored) {
reportHandler.configureTask(task);
}
});
return new XmlReportFailuresSupplier(task, reportHandler);
}
代码示例来源:origin: palantir/gradle-baseline
checkstyle,
timer,
XmlReportFailuresSupplier.create(checkstyle, new CheckstyleReportHandler()),
Paths.get(circleReportsDir, "checkstyle")));
proj.getTasks().withType(JavaCompile.class, javac ->
代码示例来源:origin: palantir/gradle-baseline
@Test
public void translatesCheckstyleReport() throws IOException, TransformerException {
Project project = ProjectBuilder.builder().withName("fooproject").withProjectDir(projectDir.getRoot()).build();
Checkstyle checkstyle = createCheckstyleTask(project);
checkstyle.setDidWork(true);
TaskTimer timer = mock(TaskTimer.class);
when(timer.getTaskTimeNanos(checkstyle)).thenReturn(FAILED_CHECKSTYLE_TIME_NANOS);
File targetFile = new File(projectDir.getRoot(), "reports/report.xml");
CircleStyleFinalizer finalizer = (CircleStyleFinalizer) project
.task(ImmutableMap.of("type", CircleStyleFinalizer.class), "checkstyleTestCircleFinalizer");
finalizer.setStyleTask(checkstyle);
finalizer.setTaskTimer(timer);
finalizer.setFailuresSupplier(XmlReportFailuresSupplier.create(checkstyle, new CheckstyleReportHandler()));
finalizer.setTargetFile(targetFile);
finalizer.createCircleReport();
String report = Resources.toString(targetFile.toURI().toURL(), StandardCharsets.UTF_8)
.replaceAll("\\p{Blank}*(?=<)", "");
String expectedReport = Resources.toString(
testFile("two-namecheck-failures-checkstyle-report.xml"), StandardCharsets.UTF_8);
assertThat(report).isEqualTo(expectedReport);
}
代码示例来源:origin: palantir/gradle-circle-style
@Test
public void translatesCheckstyleReport() throws IOException, TransformerException {
Project project = ProjectBuilder.builder().withName("fooproject").withProjectDir(projectDir.getRoot()).build();
Checkstyle checkstyle = createCheckstyleTask(project);
checkstyle.setDidWork(true);
StyleTaskTimer timer = mock(StyleTaskTimer.class);
when(timer.getTaskTimeNanos(checkstyle)).thenReturn(FAILED_CHECKSTYLE_TIME_NANOS);
File targetFile = new File(projectDir.getRoot(), "reports/report.xml");
CircleStyleFinalizer finalizer = (CircleStyleFinalizer) project
.task(ImmutableMap.of("type", CircleStyleFinalizer.class), "checkstyleTestCircleFinalizer");
finalizer.setStyleTask(checkstyle);
finalizer.setStyleTaskTimer(timer);
finalizer.setFailuresSupplier(XmlReportFailuresSupplier.create(checkstyle, new CheckstyleReportHandler()));
finalizer.setTargetFile(targetFile);
finalizer.createCircleReport();
String report = Resources.toString(targetFile.toURI().toURL(), UTF_8);
String expectedReport = Resources.toString(testFile("two-namecheck-failures-checkstyle-report.xml"), UTF_8);
assertThat(report).isEqualTo(expectedReport);
}
代码示例来源:origin: com.palantir.baseline/gradle-circle-style
public static <T extends Task & Reporting<? extends ReportContainer<SingleFileReport>>>
XmlReportFailuresSupplier create(final T task, final ReportHandler<T> reportHandler) {
// Ensure any necessary output is enabled
task.doFirst(ignored -> reportHandler.configureTask(task));
return new XmlReportFailuresSupplier(task, reportHandler);
}
代码示例来源:origin: palantir/gradle-baseline
@Test
public void doesNothingIfTaskSkipped() throws IOException, TransformerException {
Project project = ProjectBuilder.builder().withName("fooproject").withProjectDir(projectDir.getRoot()).build();
Checkstyle checkstyle = createCheckstyleTask(project);
checkstyle.setDidWork(false);
TaskTimer timer = mock(TaskTimer.class);
when(timer.getTaskTimeNanos(checkstyle)).thenReturn(FAILED_CHECKSTYLE_TIME_NANOS);
File targetFile = new File(projectDir.getRoot(), "reports/report.xml");
CircleStyleFinalizer finalizer = (CircleStyleFinalizer) project
.task(ImmutableMap.of("type", CircleStyleFinalizer.class), "checkstyleTestCircleFinalizer");
finalizer.setStyleTask(checkstyle);
finalizer.setTaskTimer(timer);
finalizer.setFailuresSupplier(XmlReportFailuresSupplier.create(checkstyle, new CheckstyleReportHandler()));
finalizer.setTargetFile(targetFile);
finalizer.createCircleReport();
assertThat(targetFile).doesNotExist();
assertThat(finalizer.getDidWork()).isFalse();
}
代码示例来源:origin: palantir/gradle-baseline
public static <T extends Task & Reporting<? extends ReportContainer<SingleFileReport>>>
XmlReportFailuresSupplier create(final T task, final ReportHandler<T> reportHandler) {
// Ensure any necessary output is enabled
task.doFirst(ignored -> reportHandler.configureTask(task));
return new XmlReportFailuresSupplier(task, reportHandler);
}
代码示例来源:origin: palantir/gradle-circle-style
@Test
public void doesNothingIfTaskSkipped() throws IOException, TransformerException {
Project project = ProjectBuilder.builder().withName("fooproject").withProjectDir(projectDir.getRoot()).build();
Checkstyle checkstyle = createCheckstyleTask(project);
checkstyle.setDidWork(false);
StyleTaskTimer timer = mock(StyleTaskTimer.class);
when(timer.getTaskTimeNanos(checkstyle)).thenReturn(FAILED_CHECKSTYLE_TIME_NANOS);
File targetFile = new File(projectDir.getRoot(), "reports/report.xml");
CircleStyleFinalizer finalizer = (CircleStyleFinalizer) project
.task(ImmutableMap.of("type", CircleStyleFinalizer.class), "checkstyleTestCircleFinalizer");
finalizer.setStyleTask(checkstyle);
finalizer.setStyleTaskTimer(timer);
finalizer.setFailuresSupplier(XmlReportFailuresSupplier.create(checkstyle, new CheckstyleReportHandler()));
finalizer.setTargetFile(targetFile);
finalizer.createCircleReport();
assertThat(targetFile).doesNotExist();
assertThat(finalizer.getDidWork()).isFalse();
}
内容来源于网络,如有侵权,请联系作者删除!