You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by jo...@apache.org on 2008/04/27 22:50:20 UTC

svn commit: r652012 [2/2] - in /incubator/rat/import/rat-maven-plugin: ./ src/ src/changes/ src/main/ src/main/filtered-resources/ src/main/java/ src/main/java/org/ src/main/java/org/codehaus/ src/main/java/org/codehaus/mojo/ src/main/java/org/codehaus...

Added: incubator/rat/import/rat-maven-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/site/apt/usage.apt?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/site/apt/usage.apt (added)
+++ incubator/rat/import/rat-maven-plugin/src/site/apt/usage.apt Sun Apr 27 13:49:55 2008
@@ -0,0 +1,79 @@
+~~   Licensed to the Apache Software Foundation (ASF) under one or more
+~~   contributor license agreements.  See the NOTICE file distributed with
+~~   this work for additional information regarding copyright ownership.
+~~   The ASF licenses this file to You under the Apache License, Version 2.0
+~~   (the "License"); you may not use this file except in compliance with
+~~   the License.  You may obtain a copy of the License at
+~~  
+~~        http://www.apache.org/licenses/LICENSE-2.0
+~~  
+~~   Unless required by applicable law or agreed to in writing, software
+~~   distributed under the License is distributed on an "AS IS" BASIS,
+~~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~   See the License for the specific language governing permissions and
+~~   limitations under the License.
+
+ ------
+ Usage
+ ------
+
+Usage
+
+  To use the plugin, you've got two options: First of all, it can
+  create a simple text file, called <<<target/rat.txt>>>, with the
+  plugins output. This is done by invoking the <<<rat:check>>> goal.
+
+  You may also add a report to the generated site. This is your
+  second option.
+
+*Writing the report to a text file
+
+  To create a text file with the report, you need to run the
+  <<<rat:check>>> goal. Add a section like the following to your POM:
+
+------------------------------------------------------------------
+  <build>
+    <plugins>
+      ...
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+      </plugin>
+      ...
+    </plugins>
+  </build>
+------------------------------------------------------------------
+
+  Once you have done that, the plugin can be run from the command
+  line by simply typing
+
+------------------------------------------------------------------
+  mvn rat:check
+------------------------------------------------------------------
+
+  An example for running the plugin automatically can be found
+  {{{examples/verify.apt}here}}.
+
+*Adding the report to the generated site
+
+  A section like the following must be added to your POM:
+
+------------------------------------------------------------------
+  <reporting>
+    <plugins>
+      ...
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+      </plugin>
+      ...
+    </plugins>
+  </reporting>
+------------------------------------------------------------------
+
+  The report will be created automatically when you generate the
+  site:
+
+------------------------------------------------------------------
+  mvn site
+------------------------------------------------------------------

Added: incubator/rat/import/rat-maven-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/site/fml/faq.fml?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/site/fml/faq.fml (added)
+++ incubator/rat/import/rat-maven-plugin/src/site/fml/faq.fml Sun Apr 27 13:49:55 2008
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!-- 
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+  
+        http://www.apache.org/licenses/LICENSE-2.0
+  
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<faqs id="FAQ" title="Frequently Asked Questions">
+  <part id="General">
+    <faq id="what">
+      <question>What is RAT?</question>
+      <answer>
+        <p>
+          Basically, you can think of it as a tool that checks,
+          whether you're source files are carrying proper
+          license headers. Almost any non-trivial organization
+          has a policy for license headers. In the case
+          of the <a href="http://www.apache.org/">Apache Software
+          Foundation (ASF)</a>, this is the
+          <a href="http://www.apache.org/legal/src-headers.html">ASF
+          Source Header and Copyright Notice Policy</a>.
+        </p>
+      </answer>
+    </faq>
+    <faq id="where">
+      <question>Where do I find RAT?</question>
+      <answer>
+        <p>
+          Rat can be found <a href="http://code.google.com/p/arat/">
+          http://code.google.com/p/arat/</a>. In other words, it is
+          a <a href="http://code.google.com/">code.google.com</a>
+          project, a somewhat unusual location for a project, which
+          is so closely coupled to the ASF guidelines.
+        </p>
+      </answer>
+    </faq>
+    <faq id="why">
+      <question>Why should I use the Maven plugin to run RAT?</question>
+      <answer>
+        <p>Because it makes running RAT trivial. Basically, you just
+          add the plugin to the <code>build/plugins</code> section
+          of your POM and run <code>mvn rat:check</code>. Using RAT
+          cannot be simpler.
+        </p>
+      </answer>
+    </faq>
+  </part>
+
+  <part id="Configuration">
+    <faq id="includeSubprojects">
+      <question>
+        The rat-maven-plugin creates a report for every subproject.
+        I want a single report for the whole project, which includes
+        the subprojects.
+      </question>
+      <answer>
+        <p>Set the configuration parameter "excludeSubProjects"
+          to false.</p>
+      </answer>
+    </faq>
+  </part>
+</faqs>

Added: incubator/rat/import/rat-maven-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/site/site.xml?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/site/site.xml (added)
+++ incubator/rat/import/rat-maven-plugin/src/site/site.xml Sun Apr 27 13:49:55 2008
@@ -0,0 +1,32 @@
+<!-- 
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+  
+        http://www.apache.org/licenses/LICENSE-2.0
+  
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+      <item name="Usage" href="usage.html"/>
+      <item name="FAQ" href="faq.html"/>
+      <item name="Changes" href="changes-report.html"/>
+    </menu>
+    <menu name="Examples">
+      <item name="Basic use" href="examples/basic.html"/>
+      <item name="Running the plugin automatically" href="examples/verify.html"/>
+      <item name="Adding a report to the site" href="examples/site.html"/>
+    </menu>
+  </body>
+</project>
\ No newline at end of file

Added: incubator/rat/import/rat-maven-plugin/src/test/it1/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/test/it1/pom.xml?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/test/it1/pom.xml (added)
+++ incubator/rat/import/rat-maven-plugin/src/test/it1/pom.xml Sun Apr 27 13:49:55 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <groupId>org.codehaus.mojo.rat.test</groupId>
+  <artifactId>it1</artifactId>
+  <version>1.0</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+        <version>1.0-alpha-3-SNAPSHOT</version>
+        <configuration>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: incubator/rat/import/rat-maven-plugin/src/test/it2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/test/it2/pom.xml?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/test/it2/pom.xml (added)
+++ incubator/rat/import/rat-maven-plugin/src/test/it2/pom.xml Sun Apr 27 13:49:55 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <groupId>org.codehaus.mojo.rat.test</groupId>
+  <artifactId>it2</artifactId>
+  <version>1.0</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+        <version>1.0-alpha-3-SNAPSHOT</version>
+        <configuration>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: incubator/rat/import/rat-maven-plugin/src/test/it2/src.txt
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/test/it2/src.txt?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/test/it2/src.txt (added)
+++ incubator/rat/import/rat-maven-plugin/src/test/it2/src.txt Sun Apr 27 13:49:55 2008
@@ -0,0 +1,2 @@
+This is a text file, which intentionally has no Apache License Header.
+The RAT plugin should detect it.

Added: incubator/rat/import/rat-maven-plugin/src/test/it3/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/test/it3/pom.xml?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/test/it3/pom.xml (added)
+++ incubator/rat/import/rat-maven-plugin/src/test/it3/pom.xml Sun Apr 27 13:49:55 2008
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <groupId>org.codehaus.mojo.rat.test</groupId>
+  <artifactId>it1</artifactId>
+  <version>1.0</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+        <version>1.0-alpha-3-SNAPSHOT</version>
+        <configuration>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+        <version>1.0-alpha-3-SNAPSHOT</version>
+        <configuration>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Added: incubator/rat/import/rat-maven-plugin/src/test/java/org/codehaus/mojo/rat/RatCheckMojoTest.java
URL: http://svn.apache.org/viewvc/incubator/rat/import/rat-maven-plugin/src/test/java/org/codehaus/mojo/rat/RatCheckMojoTest.java?rev=652012&view=auto
==============================================================================
--- incubator/rat/import/rat-maven-plugin/src/test/java/org/codehaus/mojo/rat/RatCheckMojoTest.java (added)
+++ incubator/rat/import/rat-maven-plugin/src/test/java/org/codehaus/mojo/rat/RatCheckMojoTest.java Sun Apr 27 13:49:55 2008
@@ -0,0 +1,285 @@
+package org.codehaus.mojo.rat;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.factory.DefaultArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.DefaultArtifactResolver;
+import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.model.Build;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
+
+
+/**
+ * Test case for the {@link RatCheckMojo}.
+ */
+public class RatCheckMojoTest extends AbstractMojoTestCase
+{
+    /**
+     * Creates a new instance of {@link Renderer}.
+     * @return A configured instance of {@link DefaultRenderer}.
+     * @throws Exception Creating the object failed.
+     */
+    private Renderer newSiteRenderer()
+            throws Exception
+    {
+        return (Renderer) container.lookup( Renderer.ROLE, "default" );
+    }
+
+    /**
+     * Creates a new instance of {@link ArtifactFactory}.
+     * @return A configured instance of {@link DefaultArtifactFactory}.
+     * @throws Exception Creating the object failed.
+     */
+    private ArtifactFactory newArtifactFactory()
+            throws Exception
+    {
+        final InvocationHandler handler = new InvocationHandler(){
+            public Object invoke( Object pProxy, Method pMethod, Object[] pArgs )
+                throws Throwable
+            {
+                System.out.println("Invoking method " + pMethod);
+                throw new IllegalStateException( "Not implemented" );
+            }
+        };
+        return (ArtifactFactory)
+            Proxy.newProxyInstance( Thread.currentThread().getContextClassLoader(),
+                                    new Class[]{ ArtifactFactory.class },
+                                    handler );
+    }
+
+    /**
+     * Creates a new instance of {@link ArtifactResolver}.
+     * @return A configured instance of {@link DefaultArtifactResolver}.
+     * @throws Exception Creating the object failed.
+     */
+    private ArtifactResolver newArtifactResolver()
+            throws Exception
+    {
+        final InvocationHandler handler = new InvocationHandler(){
+            public Object invoke( Object pProxy, Method pMethod, Object[] pArgs )
+                throws Throwable
+            {
+                System.out.println("Invoking method " + pMethod);
+                throw new IllegalStateException( "Not implemented" );
+            }
+        };
+        return (ArtifactResolver)
+            Proxy.newProxyInstance( Thread.currentThread().getContextClassLoader(),
+                                    new Class[]{ ArtifactResolver.class },
+                                    handler );
+    }
+
+    /**
+     * Creates an instance of {@link ArtifactRepository}.
+     * @return A configured instance of {@link DefaultArtifactRepository}.
+     * @throws Exception Creating the object failed.
+     */
+    private ArtifactRepository newArtifactRepository()
+            throws Exception
+    {
+        File m2Dir = new File( System.getProperty( "user.home" ), ".m2" );
+        File settingsFile = new File( m2Dir, "settings.xml" );
+        String localRepo = null;
+        if ( settingsFile.exists() )
+        {
+            Settings settings = new SettingsXpp3Reader().read( new FileReader( settingsFile ) );
+            localRepo = settings.getLocalRepository();
+        }
+        if ( localRepo == null )
+        {
+            localRepo = System.getProperty( "user.home" ) + "/.m2/repository";
+        }
+        ArtifactRepositoryLayout repositoryLayout =
+            (ArtifactRepositoryLayout) container.lookup(ArtifactRepositoryLayout.ROLE, "default" );
+        return new DefaultArtifactRepository( "local", "file://" + localRepo, repositoryLayout );
+    }
+
+    /**
+     * Creates a new instance of {@link RatCheckMojo}.
+     * @param pDir The directory, where to look for a pom.xml file.
+     * @return The configured Mojo.
+     * @throws Exception An error occurred while creating the Mojo.
+     */
+    private RatCheckMojo newRatCheckMojo( String pDir )
+            throws Exception
+    {
+        return (RatCheckMojo) newRatMojo( pDir, "check" );
+    }
+
+    /**
+     * Creates a new instance of {@link AbstractRatMojo}.
+     * @param pDir The directory, where to look for a pom.xml file.
+     * @param pGoal The goal, which the Mojo must implement.
+     * @return The configured Mojo.
+     * @throws Exception An error occurred while creating the Mojo.
+     */
+    private AbstractRatMojo newRatMojo( String pDir, String pGoal )
+            throws Exception
+    {
+        final File baseDir = new File( getBasedir() );
+        final File testBaseDir = new File( new File( baseDir, "src/test" ), pDir );
+        File testPom = new File( testBaseDir, "pom.xml" );
+        AbstractRatMojo mojo = (AbstractRatMojo) lookupMojo( pGoal, testPom );
+        assertNotNull( mojo );
+        final File buildDirectory = new File( new File( baseDir, "target/test" ), pDir );
+        setVariableValueToObject( mojo, "basedir", testBaseDir );
+        setVariableValueToObject( mojo, "addDefaultLicenseMatchers", Boolean.TRUE );
+        setVariableValueToObject( mojo, "useDefaultExcludes", Boolean.TRUE );
+        setVariableValueToObject( mojo, "useMavenDefaultExcludes", Boolean.TRUE );
+        setVariableValueToObject( mojo, "useEclipseDefaultExcludes", Boolean.TRUE );
+        final Build build = new Build();
+        build.setDirectory( buildDirectory.getPath() );
+        final MavenProjectStub project = new MavenProjectStub(){
+            public Build getBuild()
+            {
+                return build;
+            }
+        };
+        setVariableValueToObject( mojo, "project", project );
+        if (mojo instanceof RatReportMojo)
+        {
+            setVariableValueToObject( mojo, "localRepository", newArtifactRepository() );
+            setVariableValueToObject( mojo, "resolver", newArtifactResolver() );
+            setVariableValueToObject( mojo, "factory", newArtifactFactory() );
+            setVariableValueToObject( mojo, "siteRenderer", newSiteRenderer() );
+        }
+        else if ( mojo instanceof RatCheckMojo )
+        {
+            final File ratTxtFile = new File( buildDirectory, "rat.txt" );
+            setVariableValueToObject( mojo, "reportFile", ratTxtFile );
+        }
+        return mojo;
+    }
+
+    /**
+     * Creates a new instance of {@link RatReportMojo}.
+     * @param pDir The directory where to read the POM file.
+     * @return The configured Mojo.
+     * @throws Exception An error occurred while creating the Mojo.
+     */
+    private RatReportMojo newRatReportMojo( String pDir )
+            throws Exception
+    {
+        return (RatReportMojo) newRatMojo( pDir, "rat" );
+    }
+
+    /**
+     * Reads the location of the rat text file from the Mojo.
+     * @param pMojo The configured Mojo.
+     * @return Value of the "reportFile" property.
+     * @throws Exception An error occurred while reading the property.
+     */
+    private File getRatTxtFile( RatCheckMojo pMojo )
+            throws Exception
+    {
+        return (File) getVariableValueFromObject( pMojo, "reportFile" );
+    }
+
+    /**
+     * Runs a check, which should expose no problems.
+     * @throws Exception The test failed.
+     */
+    public void testIt1() throws Exception {
+        final RatCheckMojo mojo = newRatCheckMojo( "it1" );
+        final File ratTxtFile = getRatTxtFile(mojo);
+        mojo.execute();
+        checkResult( ratTxtFile, 1, 0 );
+    }
+
+    /**
+     * Reads the created report file and verifies, whether the detected numbers
+     * are matching.
+     * @param pRatTxtFile The file to read.
+     * @param pNumAslFiles The number of files with ASL.
+     * @param pNumNoLicenseFiles The number of files without license.
+     * @throws IOException An error occurred while reading the file.
+     */
+    private void checkResult( File pRatTxtFile, int pNumAslFiles, int pNumNoLicenseFiles )
+            throws IOException
+    {
+        assertTrue( pRatTxtFile.exists() );
+        BufferedReader reader = new BufferedReader( new FileReader( pRatTxtFile ) );
+        Integer numAslFiles = null;
+        Integer numNoLicenseFiles = null;
+        for (;;)
+        {
+            String line = reader.readLine();
+            if ( line == null )
+            {
+                break;
+            }
+            int offset = line.indexOf( "Apache Licensed: " );
+            if ( offset >= 0 )
+            {
+                numAslFiles = new Integer( line.substring( offset + "Apache Licensed: ".length() ).trim() );
+            }
+            offset = line.indexOf( "Unknown Licenses" );
+            if ( offset >= 0 )
+            {
+                numNoLicenseFiles = new Integer( line.substring( 0, offset ).trim() );
+            }
+        }
+        reader.close();
+        assertEquals( new Integer( pNumAslFiles), numAslFiles );
+        assertEquals( new Integer( pNumNoLicenseFiles ), numNoLicenseFiles );
+    }
+
+    /**
+     * Runs a check, which should detect a problem.
+     * @throws Exception The test failed.
+     */
+    public void testIt2() throws Exception {
+        final RatCheckMojo mojo = newRatCheckMojo( "it2" );
+        final File ratTxtFile = getRatTxtFile(mojo);
+        try
+        {
+            mojo.execute();
+            fail( "Expected RatCheckException" );
+        }
+        catch ( RatCheckException e )
+        {
+            // Ok
+        }
+        checkResult( ratTxtFile, 1, 1 );
+    }
+
+//    /**
+//     * Runs a report, which should detect no problems.
+//     * @throws Exception The test failed.
+//     */
+//    public void testIt3() throws Exception {
+//        final RatReportMojo mojo = newRatReportMojo( "it3" );
+//        mojo.execute();
+//    }
+}