Package org.apache.rat.api

Examples of org.apache.rat.api.Document


    public void testNoMatch() throws Exception {
        BufferedReader in = Resources.getBufferedResourceReader("elements/Source.java");
        String line = in.readLine();
        boolean result = false;
        final Document subject = new MockLocation("subject");
        while (line != null) {
            result = license.match(subject, line);
            line = in.readLine();
        }
        assertFalse("OASIS license should not be matched", result);
View Full Code Here


  protected void tearDown() throws Exception {
    super.tearDown();
  }
 
  public void testIsFinished() throws Exception {
        final Document subject = new MockLocation("subject");
    HeaderCheckWorker worker = new HeaderCheckWorker(new StringReader(""), new ApacheSoftwareLicense20(), subject);
    assertFalse(worker.isFinished());
    worker.read();
    assertTrue(worker.isFinished());
  }
View Full Code Here

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testMatch() throws Exception {
        final Document subject = new MockLocation("subject");
        assertFalse("Does not match regex", license.match(subject, "Not at all"));
        assertTrue("Matches regex", license.match(subject, "This is Generated"));
    }
View Full Code Here

    assertFalse(worker.matches("'Behold, Telemachus! (nor fear the sight,)"));
  }
 
  public void testMatch() throws Exception {
    ApacheSoftwareLicense20 worker = new ApacheSoftwareLicense20();
    final Document subject = new MockLocation("subject");
    assertTrue(worker.match(subject, ApacheSoftwareLicense20.FIRST_LICENSE_LINE));
        assertTrue(worker.match(subject, "    Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, "Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, " * Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, " // Licensed under the Apache License, Version 2.0 (the \"License\");"));
View Full Code Here

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testMatch() throws Exception {
        final Document subject = new MockLocation("subject");
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL));
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_COMMENTED));
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_XML));
        assertFalse("Return null if the license isn't matched", license.match(subject, "Bogus"));
    }
View Full Code Here

  }
 
  public void testMatcherLine() throws Exception {
        matcherOne.result = false;
        matcherTwo.result = false;
        final Document subject = new MockLocation("subject");
    multiplexer.match(subject, LINE_ONE);
    assertEquals("One line", 1, matcherOne.lines.size());
    assertEquals("Same as line passed", LINE_ONE, matcherOne.lines.get(0));
    assertEquals("One line", 1, matcherTwo.lines.size());
    assertEquals("Same as line passed", LINE_ONE, matcherTwo.lines.get(0));
View Full Code Here

     * @param file the file to be reported on
     * @throws RatException
     */
    private void report(final RatReport report, byte[] contents, File file) throws RatException {

        Document document = new ArchiveEntryDocument(file, contents);
        report.report(document);

    }
View Full Code Here

     * @param file the file to be reported on
     * @throws RatException
     */
    private void report(final RatReport report, File file) throws RatException {

        Document document = new FileDocument(file);
        report.report(document);

    }
View Full Code Here

    }

    @Test
    public void match() throws Exception {
        ApacheSoftwareLicense20 worker = new ApacheSoftwareLicense20();
        final Document subject = new MockLocation("subject");
        assertTrue(worker.match(subject, ApacheSoftwareLicense20.FIRST_LICENSE_LINE));
        assertTrue(worker.match(subject, "    Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, "Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, " * Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, " // Licensed under the Apache License, Version 2.0 (the \"License\");"));
View Full Code Here

        reporter = new MockClaimReporter();
    }

    @Test
    public void match() throws Exception {
        final Document subject = new MockLocation("subject");
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL));
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_COMMENTED));
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_XML));
        assertFalse("Return null if the license isn't matched", license.match(subject, "Bogus"));
    }
View Full Code Here

TOP

Related Classes of org.apache.rat.api.Document

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.