gpt4 book ai didi

com.palantir.gradle.circlestyle.XmlUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 18:22:40 27 4
gpt4 key购买 nike

本文整理了Java中com.palantir.gradle.circlestyle.XmlUtils类的一些代码示例,展示了XmlUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlUtils类的具体详情如下:
包路径:com.palantir.gradle.circlestyle.XmlUtils
类名称:XmlUtils

XmlUtils介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.com.palantir/gradle-circle-style

@Override
  public void execute(BuildResult result) {
    String name = (container != null) ? "container " + container : "gradle";
    Report report = new Report.Builder()
        .name(name)
        .subname(name)
        .elapsedTimeNanos(System.nanoTime() - startTimeNanos)
        .addAllTestCases(failureListener.getTestCases())
        .build();
    Document xml = reportToXml(report);

    targetFile.getParentFile().mkdirs();
    try (FileWriter writer = new FileWriter(targetFile)) {
      XmlUtils.write(writer, xml);
    } catch (IOException | TransformerException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: palantir/gradle-baseline

@Override
public List<Failure> getFailures() throws IOException {
  File sourceReport = reporting.getReports().findByName("xml").getDestination();
  return XmlUtils.parseXml(reportHandler, new FileInputStream(sourceReport)).failures();
}

代码示例来源:origin: palantir/gradle-circle-style

@Override
  public void execute(BuildResult result) {
    String name = (container != null) ? "container " + container : "gradle";
    Report report = new Report.Builder()
        .name(name)
        .subname(name)
        .elapsedTimeNanos(System.nanoTime() - startTimeNanos)
        .addAllTestCases(failureListener.getTestCases())
        .build();
    Document xml = reportToXml(report);

    targetFile.getParentFile().mkdirs();
    try (FileWriter writer = new FileWriter(targetFile)) {
      XmlUtils.write(writer, xml);
    } catch (IOException | TransformerException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: palantir/gradle-circle-style

@Override
  public List<Failure> getFailures() throws IOException {
    File sourceReport = reporting.getReports().findByName("xml").getDestination();
    return parseXml(reportHandler, new FileInputStream(sourceReport)).failures();
  }
}

代码示例来源:origin: com.palantir.baseline/gradle-circle-style

@Override
  public void execute(BuildResult result) {
    String name = (container != null) ? "container " + container : "gradle";
    Report report = new Report.Builder()
        .name(name)
        .subname(name)
        .elapsedTimeNanos(System.nanoTime() - startTimeNanos)
        .addAllTestCases(failureListener.getTestCases())
        .build();
    Document xml = JUnitReportCreator.reportToXml(report);

    try {
      Files.createDirectories(targetFile.getParent());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    try (Writer writer = Files.newBufferedWriter(targetFile, StandardCharsets.UTF_8)) {
      XmlUtils.write(writer, xml);
    } catch (IOException | TransformerException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: com.palantir.baseline/gradle-circle-style

@Override
public List<Failure> getFailures() throws IOException {
  File sourceReport = reporting.getReports().findByName("xml").getDestination();
  return XmlUtils.parseXml(reportHandler, new FileInputStream(sourceReport)).failures();
}

代码示例来源:origin: palantir/gradle-baseline

@Override
  public void execute(BuildResult result) {
    String name = (container != null) ? "container " + container : "gradle";
    Report report = new Report.Builder()
        .name(name)
        .subname(name)
        .elapsedTimeNanos(System.nanoTime() - startTimeNanos)
        .addAllTestCases(failureListener.getTestCases())
        .build();
    Document xml = JUnitReportCreator.reportToXml(report);

    try {
      Files.createDirectories(targetFile.getParent());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    try (Writer writer = Files.newBufferedWriter(targetFile, StandardCharsets.UTF_8)) {
      XmlUtils.write(writer, xml);
    } catch (IOException | TransformerException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: palantir/gradle-circle-style

@Test
public void testNoErrors() throws IOException {
  List<Failure> failures =
      parseXml(new CheckstyleReportHandler(), testFile("no-failures-checkstyle.xml").openStream())
          .failures();
  assertThat(failures).isEmpty();
}

代码示例来源:origin: palantir/gradle-baseline

@Test
  public void testTwoErrors() throws TransformerException {
    Document junitReport = reportToXml(REPORT);
    String xml = XmlUtils.write(new StringWriter(), junitReport).toString()
        .replaceAll("\\p{Blank}*(?=<)", "");

    assertThat(xml).isEqualTo(readTestFile("two-namecheck-failures-checkstyle-report.xml"));
  }
}

代码示例来源:origin: palantir/gradle-baseline

@Test
public void testNoErrors() throws IOException {
  List<Failure> failures =
      parseXml(new CheckstyleReportHandler(), testFile("no-failures-checkstyle.xml").openStream())
          .failures();
  assertThat(failures).isEmpty();
}

代码示例来源:origin: palantir/gradle-circle-style

@Test
  public void testTwoErrors() throws TransformerException {
    Document junitReport = reportToXml(REPORT);
    String xml = XmlUtils.write(new StringWriter(), junitReport).toString();

    assertThat(xml).isEqualTo(readTestFile("two-namecheck-failures-checkstyle-report.xml"));
  }
}

代码示例来源:origin: palantir/gradle-circle-style

@Test
public void testNoErrors() throws IOException {
  List<Failure> failures =
      parseXml(new FindBugsReportHandler(), testFile("no-errors-findbugs.xml").openStream()).failures();
  assertThat(failures).isEmpty();
}

代码示例来源:origin: palantir/gradle-circle-style

@TaskAction
  public void createCircleReport() throws IOException, TransformerException {
    if (!styleTask.getDidWork()) {
      setDidWork(false);
      return;
    }

    File rootDir = getProject().getRootProject().getProjectDir();
    String projectName = getProject().getName();
    List<Failure> failures = failuresSupplier.getFailures();
    long taskTimeNanos = styleTaskTimer.getTaskTimeNanos(styleTask);

    Document report = reportToXml(failuresReport(
        rootDir, projectName, styleTask.getName(), taskTimeNanos, failures));
    targetFile.getParentFile().mkdirs();
    try (FileWriter writer = new FileWriter(targetFile)) {
      XmlUtils.write(writer, report);
    }
  }
}

代码示例来源:origin: palantir/gradle-circle-style

/** @see <a href="https://github.com/palantir/gradle-circle-style/issues/7">Issue 7</a> */
  @Test
  public void testSyntheticSourceLine() throws IOException {
    parseXml(new FindBugsReportHandler(), testFile("synthetic-sourceline-findbugs.xml").openStream());
  }
}

代码示例来源:origin: gradle.plugin.com.palantir/gradle-circle-style

@TaskAction
  public void createCircleReport() throws IOException, TransformerException {
    if (!styleTask.getDidWork()) {
      setDidWork(false);
      return;
    }

    File rootDir = getProject().getRootProject().getProjectDir();
    String projectName = getProject().getName();
    File sourceReport = reporting.getReports().findByName("xml").getDestination();

    List<Failure> failures = reportParser.loadFailures(new FileInputStream(sourceReport));
    long taskTimeNanos = styleTaskTimer.getTaskTimeNanos(styleTask);
    Document report = reportToXml(failuresReport(
        rootDir, projectName, styleTask.getName(), taskTimeNanos, failures));
    targetFile.getParentFile().mkdirs();
    try (FileWriter writer = new FileWriter(targetFile)) {
      XmlUtils.write(writer, report);
    }
  }
}

代码示例来源:origin: palantir/gradle-circle-style

@Test
  public void testTwoErrors() throws IOException {
    List<Failure> failures =
        parseXml(new CheckstyleReportHandler(), testFile("two-namecheck-failures-checkstyle.xml").openStream())
            .failures();
    assertThat(failures).containsExactlyElementsOf(CHECKSTYLE_FAILURES);
  }
}

代码示例来源:origin: palantir/gradle-baseline

targetFile.getParentFile().mkdirs();
try (Writer writer = Files.newBufferedWriter(targetFile.toPath(), StandardCharsets.UTF_8)) {
  XmlUtils.write(writer, report);

代码示例来源:origin: palantir/gradle-baseline

@Test
  public void testTwoErrors() throws IOException {
    List<Failure> failures =
        parseXml(new CheckstyleReportHandler(), testFile("two-namecheck-failures-checkstyle.xml").openStream())
            .failures();
    assertThat(failures).containsExactlyElementsOf(CHECKSTYLE_FAILURES);
  }
}

代码示例来源:origin: com.palantir.baseline/gradle-circle-style

targetFile.getParentFile().mkdirs();
try (Writer writer = Files.newBufferedWriter(targetFile.toPath(), StandardCharsets.UTF_8)) {
  XmlUtils.write(writer, report);

代码示例来源:origin: palantir/gradle-circle-style

@Test
public void testTwoErrors() throws IOException {
  List<Failure> failures =
      parseXml(new FindBugsReportHandler(), testFile("two-exit-errors-findbugs.xml").openStream()).failures();
  assertThat(failures).containsExactlyElementsOf(FINDBUGS_FAILURES);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com