Package org.apache.rat.report.claim

Examples of org.apache.rat.report.claim.ClaimStatistic


        PipedReader reader = new PipedReader();
        PipedWriter writer = new PipedWriter(reader);
        ReportTransformer transformer = new ReportTransformer(out, style, reader);
        Thread transformerThread = new Thread(transformer);
        transformerThread.start();
        final ClaimStatistic statistic = report(base, writer, pConfiguration);
        writer.flush();
        writer.close();
        transformerThread.join();
        return statistic;
    }
View Full Code Here


     * @return the currently collected numerical statistics.
     */
    public static ClaimStatistic report(final IReportable container, final Writer out,
            ReportConfiguration pConfiguration) throws IOException, RatException {
        IXmlWriter writer = new XmlWriter(out);
        final ClaimStatistic statistic = new ClaimStatistic();
        RatReport report = XmlReportFactory.createStandardReport(writer, statistic, pConfiguration);
        report.startReport();
        container.run(report);
        report.endReport();
        writer.closeDocument();
View Full Code Here

    @Test
    public void standardReport() throws Exception {
        final String elementsPath = Resources.getResourceDirectory("elements/Source.java");
        final MockLicenseMatcher mockLicenseMatcher = new MockLicenseMatcher();
        DirectoryWalker directory = new DirectoryWalker(new File(elementsPath), IGNORE_EMPTY);
        final ClaimStatistic statistic = new ClaimStatistic();
        final ReportConfiguration configuration = new ReportConfiguration();
        configuration.setHeaderMatcher(mockLicenseMatcher);
        RatReport report = XmlReportFactory.createStandardReport(writer, statistic, configuration);
        report.startReport();
        report(directory, report);
        report.endReport();
        writer.closeDocument();
        final String output = out.toString();
        assertTrue("Preamble and document element are OK",
                   output.startsWith("<?xml version='1.0'?>" +
                "<rat-report timestamp="));
        assertTrue("Part after timestamp attribute is OK",
                   output.endsWith(">" +
                "<resource name='" + elementsPath + "/ILoggerFactory.java'><type name='standard'/></resource>" +
                "<resource name='" + elementsPath + "/Image.png'><type name='binary'/></resource>" +
                "<resource name='" + elementsPath + "/LICENSE'><type name='notice'/></resource>" +
                "<resource name='" + elementsPath + "/NOTICE'><type name='notice'/></resource>" +
                "<resource name='" + elementsPath + "/Source.java'><type name='standard'/>" +
                "</resource>" +
                "<resource name='" + elementsPath + "/Text.txt'><type name='standard'/>" +
                "</resource>" +
                "<resource name='" + elementsPath + "/Xml.xml'><type name='standard'/>" +
                "</resource>" +
                "<resource name='" + elementsPath + "/buildr.rb'><type name='standard'/>" +
                "</resource>" +
                "<resource name='" + elementsPath + "/dummy.jar'><type name='archive'/></resource>" +
                                   "</rat-report>"));
        assertTrue("Is well formed", XmlUtils.isWellFormedXml(output));
        assertEquals("Binary files", Integer.valueOf(1), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_BINARY));
        assertEquals("Notice files", Integer.valueOf(2), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_NOTICE));
        assertEquals("Standard files", Integer.valueOf(5), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_STANDARD));
        assertEquals("Archives", Integer.valueOf(1), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_ARCHIVE));
    }
View Full Code Here

        PipedReader reader = new PipedReader();
        PipedWriter writer = new PipedWriter(reader);
        ReportTransformer transformer = new ReportTransformer(out, style, reader);
        Thread transformerThread = new Thread(transformer);
        transformerThread.start();
        final ClaimStatistic statistic = report(base, writer, pConfiguration);
        writer.flush();
        writer.close();
        transformerThread.join();
        return statistic;
    }
View Full Code Here

     * @throws RatException
     */
    public static ClaimStatistic report(final IReportable container, final Writer out,
            ReportConfiguration pConfiguration) throws IOException, RatException {
        IXmlWriter writer = new XmlWriter(out);
        final ClaimStatistic statistic = new ClaimStatistic();
        RatReport report = XmlReportFactory.createStandardReport(writer, statistic, pConfiguration);
        report.startReport();
        container.run(report);
        report.endReport();
        writer.closeDocument();
View Full Code Here

        PipedReader reader = new PipedReader();
        PipedWriter writer = new PipedWriter(reader);
        ReportTransformer transformer = new ReportTransformer(out, style, reader);
        Thread transformerThread = new Thread(transformer);
        transformerThread.start();
        final ClaimStatistic statistic = report(base, writer, pConfiguration);
        writer.flush();
        writer.close();
        transformerThread.join();
        return statistic;
    }
View Full Code Here

     * @throws RatException
     */
    public static ClaimStatistic report(final IReportable container, final Writer out,
            ReportConfiguration pConfiguration) throws IOException, RatException {
        IXmlWriter writer = new XmlWriter(out);
        final ClaimStatistic statistic = new ClaimStatistic();
        RatReport report = XmlReportFactory.createStandardReport(writer, statistic, pConfiguration);
        report.startReport();
        container.run(report);
        report.endReport();
        writer.closeDocument();
View Full Code Here

    {
        FileWriter fw = null;
        try
        {
            fw = new FileWriter( reportFile );
            final ClaimStatistic statistic = createReport( fw, getStyleSheet() );
            fw.close();
            fw = null;
            return statistic;
        }
        catch ( IOException e )
View Full Code Here

        File parent = reportFile.getParentFile();
        if(!parent.mkdirs() && !parent.isDirectory()) {
            throw new MojoExecutionException("Could not create report parent directory " + parent);
        }

        final ClaimStatistic report = getRawReport();
        check( report );
    }
View Full Code Here

    {
        FileWriter fw = null;
        try
        {
            fw = new FileWriter( reportFile );
            final ClaimStatistic statistic = createReport( fw, getStyleSheet() );
            fw.close();
            fw = null;
            return statistic;
        }
        catch ( IOException e )
View Full Code Here

TOP

Related Classes of org.apache.rat.report.claim.ClaimStatistic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.