diff --git a/maven-plugins/maven-project-info-reports-plugin/pom.xml b/maven-plugins/maven-project-info-reports-plugin/pom.xml
index 05f131f2da..9afb84ca1e 100644
--- a/maven-plugins/maven-project-info-reports-plugin/pom.xml
+++ b/maven-plugins/maven-project-info-reports-plugin/pom.xml
@@ -82,5 +82,35 @@
Maven Reports
generated.
+ *
+ * @phase test
+ *
+ * @author Vincent Siveton
+ * @version $Id $
+ */
+public abstract class AbstractMavenReportTestCase
+ extends PlexusTestCase
+{
+ /**
+ * The default projects directory.
+ */
+ private static String PROJECTS_DIR = "src/test/projects";
+
+ /**
+ * The default M2 goal to generate reports.
+ */
+ protected static String M2_SITE_GOAL = "site:site";
+
+ /**
+ * Set this to 'true' to bypass unit tests entirely.
+ *
+ * @parameter expression="${maven.test.skip}"
+ */
+ protected boolean skip;
+
+ /**
+ * The default locale is English.
+ */
+ protected Locale locale = Locale.ENGLISH;
+
+ /**
+ * The current project to be test.
+ */
+ protected MavenProject testMavenProject;
+
+ /**
+ * The I18N plexus component.
+ */
+ private I18N i18n;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ i18n = (I18N) lookup( I18N.ROLE );
+ }
+
+ /**
+ * @see org.codehaus.plexus.PlexusTestCase#getCustomConfiguration()
+ */
+ protected InputStream getCustomConfiguration()
+ throws Exception
+ {
+ // Allow sub classes to have their own configuration...
+ if ( super.getConfiguration() == null )
+ {
+ String className = AbstractMavenReportTestCase.class.getName();
+
+ String config = className.substring( className.lastIndexOf( "." ) + 1 ) + ".xml";
+
+ return AbstractMavenReportTestCase.class.getResourceAsStream( config );
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the current locale
+ *
+ * @return the locale
+ */
+ protected Locale getLocale()
+ {
+ return locale;
+ }
+
+ /**
+ * Get the current i18n
+ *
+ * @return the i18n
+ */
+ public I18N getI18n()
+ {
+ return i18n;
+ }
+
+ /**
+ * Get the current Maven project
+ *
+ * @return the maven project
+ */
+ protected MavenProject getTestMavenProject()
+ {
+ return testMavenProject;
+ }
+
+ /**
+ * Load and build a Maven project from the test projects directory.
+ *
+ * @see #getTestProjectDir()
+ *
+ * @param projectDirName not null name of the test project dir in the PROJECTS_DIR
directory.
+ * @throws Exception is any
+ */
+ protected void loadTestMavenProject( String projectDirName )
+ throws Exception
+ {
+ File projectDir = getTestProjectDir( projectDirName );
+
+ File pom = new File( projectDir, Maven.POMv4 );
+ if ( !pom.exists() )
+ {
+ throw new IllegalArgumentException( "No '" + Maven.POMv4 + "' file exists in the test project directory '"
+ + projectDir.getAbsolutePath() + "'" );
+ }
+
+ MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
+ ProfileManager profileManager = new DefaultProfileManager( getContainer() );
+
+ testMavenProject = builder.build( pom, null, profileManager );
+ }
+
+ /**
+ * Execute a m2 command line to execute the specific goal M2_SITE_GOAL
to generate report
+ * for the current Maven proeject.
+ *
+ * @see #M2_SITE_GOAL
+ *
+ * @throws CommandLineException if any Exception is caught
+ */
+ protected void executeMaven2CommandLine()
+ throws CommandLineException
+ {
+ File workingDir = getTestProjectDir();
+
+ Commandline cmd = createMaven2CommandLine( workingDir, M2_SITE_GOAL );
+
+ int exitCode = CommandLineUtils.executeCommandLine( cmd, new DefaultConsumer(), new DefaultConsumer() );
+
+ if ( exitCode != 0 )
+ {
+ throw new CommandLineException( "The command line failed. Exit code: " + exitCode );
+ }
+ }
+
+ /**
+ * Gets a trimmed String for the given key from the resource bundle defined by Plexus.
+ *
+ * @param key the key for the desired string
+ * @return the string for the given key
+ * @throws IllegalArgumentException if the parameter is empty.
+ */
+ protected String getString( String key )
+ {
+ if ( StringUtils.isEmpty( key ) )
+ {
+ throw new IllegalArgumentException( "The key cannot be empty" );
+ }
+
+ return i18n.getString( key, getLocale() ).trim();
+ }
+
+ /**
+ * Get the basedir for the current test Maven project.
+ *
+ * @see #getTestMavenProject()
+ *
+ * @return the basedir of the current test project
+ */
+ protected File getTestProjectDir()
+ {
+ return getTestMavenProject().getBasedir();
+ }
+
+ /**
+ * Get the generated report as file in the test maven project.
+ *
+ * @see #getReportName()
+ *
+ * @return the generated report as file
+ * @throws IOException if the return file doesnt exist
+ */
+ protected File getGeneratedReport()
+ throws IOException
+ {
+ // TODO how to be more dynamic?
+ String outputDirectory = getTestMavenProject().getBuild().getDirectory() + File.separator + "site";
+
+ if ( getReportName() == null )
+ {
+ throw new IOException( "getReportName() should be return a report name." );
+ }
+
+ File report = new File( outputDirectory, getReportName() );
+ if ( !report.exists() )
+ {
+ throw new IOException( "File not found. Attempted :" + report );
+ }
+
+ return report;
+ }
+
+ /**
+ * Abstract method to get the report name to be tested, eg index.html
+ *
+ * @return the report name
+ */
+ protected abstract String getReportName();
+
+ /**
+ * Convenience method to create a m2 command line from a given working directory.
+ *
We suppose that the m2
executable is present in the command path
m2 clean:clean site:site
+ * @throws IllegalArgumentException if the parameter workingDir is empty or doesnt exist.
+ */
+ private static Commandline createMaven2CommandLine( File workingDir, String goal )
+ {
+ if ( workingDir == null )
+ {
+ throw new IllegalArgumentException( "The workingDir cant be null" );
+ }
+ if ( !workingDir.exists() )
+ {
+ throw new IllegalArgumentException( "The workingDir doesnt exist" );
+ }
+
+ Commandline cmd = new Commandline();
+
+ cmd.setWorkingDirectory( workingDir.getAbsolutePath() );
+
+ cmd.setExecutable( "m2" );
+ cmd.createArgument().setValue( "clean:clean" );
+ if ( !StringUtils.isEmpty( goal ) )
+ {
+ cmd.createArgument().setValue( goal );
+ }
+
+ return cmd;
+ }
+
+ /**
+ * Get the path for the directory which contains test projects.
+ *
+ * @see #PROJECTS_DIR
+ * @see PlexusTestCase#getBasedir()
+ *
+ * @return the projects directory full path.
+ */
+ private static String getTestProjectsPath()
+ {
+ return getBasedir() + File.separator + PROJECTS_DIR;
+ }
+
+ /**
+ * Get a specific project path defined by the project name in the PROJECTS_DIR
directory.
+ *
+ * @see #getTestProjectsPath()
+ *
+ * @param projectName not null name of the test project dir in the PROJECTS_DIR
directory.
+ * @return the specific path for a project in the test projects directory.
+ * @throws IllegalArgumentException if the parameter is empty.
+ */
+ private static String getTestProjectPath( String projectName )
+ {
+ return getTestProjectsPath() + File.separator + projectName;
+ }
+
+ /**
+ * Get the specific project file defined by the project name in the PROJECTS_DIR
directory.
+ *
+ * @see #getTestProjectPath(String)
+ *
+ * @param projectName not null name of the test project dir in the PROJECTS_DIR
directory.
+ * @return the specific path for a project in the test projects directory.
+ * @throws IOException if the return file doesnt exist
+ * @throws IllegalArgumentException if the parameter is empty.
+ */
+ private static File getTestProjectDir( String projectName )
+ throws IOException
+ {
+ File projectDir = new File( getTestProjectPath( projectName ) );
+ if ( !projectDir.exists() )
+ {
+ throw new IOException( "File not found. Attempted :" + projectDir );
+ }
+
+ return projectDir;
+ }
+}
diff --git a/maven-plugins/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java b/maven-plugins/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java
new file mode 100644
index 0000000000..2480495f05
--- /dev/null
+++ b/maven-plugins/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java
@@ -0,0 +1,99 @@
+package org.apache.maven.report.projectinfo;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.net.URL;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+import com.meterware.httpunit.WebTable;
+
+/**
+ * Test the Scm Report
generation for defined projects in the PROJECTS_DIR
directory.
+ * Testing only section title and links with HTTPUnit framework.
+ * + * @author Vincent Siveton + * @version $Id $ + */ +public class DependenciesReportTest + extends AbstractHttpUnitReportTestCase +{ + private static final String TEST1 = "project-info-reports-plugin-test1"; + + /** WebConversation object */ + private static final WebConversation webConversation = new WebConversation(); + + /** + * @see org.apache.maven.report.projectinfo.AbstractMavenReportTestCase#getReportName() + */ + protected String getReportName() + { + return "dependencies.html"; + } + + /** + * Test a theClearCase
SCM report
+ */
+ public void testClearCaseScmReport()
+ {
+ if ( skip )
+ {
+ return;
+ }
+
+ try
+ {
+ loadTestMavenProject( TEST1 );
+
+ assertNotNull( getTestMavenProject() );
+ assertNotNull( getTestMavenProject().getDependencies() );
+
+ executeMaven2CommandLine();
+
+ URL reportURL = getGeneratedReport().toURL();
+ assertNotNull( reportURL );
+
+ // HTTPUnit
+ WebRequest request = new GetMethodWebRequest( reportURL.toString() );
+ WebResponse response = webConversation.getResponse( request );
+
+ // Basic HTML tests
+ assertTrue( response.isHTML() );
+ assertTrue( response.getContentLength() > 0 );
+
+ // Test the Page title
+ assertEquals( getString( "report.dependencies.title" ), response.getTitle() );
+
+ // Test the tables
+ WebTable[] webTables = response.getTables();
+ assertEquals( webTables.length, 2 );
+
+ assertEquals( webTables[0].getColumnCount(), 5);
+ assertEquals( webTables[0].getRowCount(), 1 + getTestMavenProject().getDependencies().size());
+
+ assertEquals( webTables[1].getColumnCount(), 5);
+
+ testLinks( response );
+ }
+ catch ( Exception e )
+ {
+ assertFalse( true );
+ }
+ }
+}
diff --git a/maven-plugins/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java b/maven-plugins/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java
new file mode 100644
index 0000000000..dd4d592432
--- /dev/null
+++ b/maven-plugins/maven-project-info-reports-plugin/src/test/java/org/apache/maven/report/projectinfo/ScmReportTest.java
@@ -0,0 +1,395 @@
+package org.apache.maven.report.projectinfo;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.net.URL;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.TextBlock;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+/**
+ * Test the Scm Report
generation for defined projects in the PROJECTS_DIR
directory.
+ * Testing only section title and links with HTTPUnit framework.
+ * + * @author Vincent Siveton + * @version $Id $ + */ +public class ScmReportTest + extends AbstractHttpUnitReportTestCase +{ + private static final String CLEARCASE_PROJECT = "project-info-reports-plugin-scm-ClearCase"; + + private static final String CVS_PROJECT = "project-info-reports-plugin-scm-CVS"; + + private static final String PERFORCE_PROJECT = "project-info-reports-plugin-scm-Perforce"; + + private static final String STARTEAM_PROJECT = "project-info-reports-plugin-scm-Starteam"; + + private static final String SVN_PROJECT = "project-info-reports-plugin-scm-SVN"; + + private static final String UNKNOWN_PROJECT = "project-info-reports-plugin-scm-unknown"; + + /** WebConversation object */ + private static final WebConversation webConversation = new WebConversation(); + + /** + * @see org.apache.maven.report.projectinfo.AbstractMavenReportTestCase#getReportName() + */ + protected String getReportName() + { + return "source-repository.html"; + } + + /** + * Test a theClearCase
SCM report
+ */
+ public void testClearCaseScmReport()
+ {
+ if ( skip )
+ {
+ return;
+ }
+
+ try
+ {
+ loadTestMavenProject( CLEARCASE_PROJECT );
+
+ assertNotNull( getTestMavenProject() );
+ assertNotNull( getTestMavenProject().getScm() );
+
+ executeMaven2CommandLine();
+
+ URL reportURL = getGeneratedReport().toURL();
+ assertNotNull( reportURL );
+
+ // HTTPUnit
+ WebRequest request = new GetMethodWebRequest( reportURL.toString() );
+ WebResponse response = webConversation.getResponse( request );
+
+ // Basic HTML tests
+ assertTrue( response.isHTML() );
+ assertTrue( response.getContentLength() > 0 );
+
+ // Test the Page title
+ assertEquals( getString( "report.scm.title" ), response.getTitle() );
+
+ // Test the sections
+ TextBlock[] textBlocks = response.getTextBlocks();
+
+ assertEquals( textBlocks.length, 8 );
+
+ assertEquals( getString( "report.scm.overview.title" ), textBlocks[1].getText() );
+ assertEquals( getString( "report.scm.webaccess.title" ), textBlocks[2].getText() );
+ assertEquals( getString( "report.scm.webaccess.url" ), textBlocks[3].getText() );
+ assertEquals( getString( "report.scm.devaccess.title" ), textBlocks[4].getText() );
+ assertEquals( getString( "report.scm.devaccess.clearcase.intro" ), textBlocks[5].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.title" ), textBlocks[6].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.general.intro" ), textBlocks[7].getText() );
+
+ testLinks( response );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ assertFalse( true );
+ }
+ }
+
+ /**
+ * Test a the CVS
SCM report
+ */
+ public void testCVSScmReport()
+ {
+ if ( skip )
+ {
+ return;
+ }
+
+ try
+ {
+ loadTestMavenProject( CVS_PROJECT );
+
+ assertNotNull( getTestMavenProject() );
+ assertNotNull( getTestMavenProject().getScm() );
+
+ executeMaven2CommandLine();
+
+ URL reportURL = getGeneratedReport().toURL();
+ assertNotNull( reportURL );
+
+ // HTTPUnit
+ WebRequest request = new GetMethodWebRequest( reportURL.toString() );
+ WebResponse response = webConversation.getResponse( request );
+
+ // Basic HTML tests
+ assertTrue( response.isHTML() );
+ assertTrue( response.getContentLength() > 0 );
+
+ // Test the Page title
+ assertEquals( getString( "report.scm.title" ), response.getTitle() );
+
+ // Test the sections
+ TextBlock[] textBlocks = response.getTextBlocks();
+
+ assertEquals( textBlocks.length, 9 );
+
+ assertEquals( getString( "report.scm.overview.title" ), textBlocks[1].getText() );
+ assertEquals( getString( "report.scm.webaccess.title" ), textBlocks[2].getText() );
+ assertEquals( getString( "report.scm.webaccess.url" ), textBlocks[3].getText() );
+ assertEquals( getString( "report.scm.anonymousaccess.title" ), textBlocks[4].getText() );
+ assertEquals( getString( "report.scm.anonymousaccess.cvs.intro" ), textBlocks[5].getText() );
+ assertEquals( getString( "report.scm.devaccess.title" ), textBlocks[6].getText() );
+ assertEquals( getString( "report.scm.devaccess.cvs.intro" ), textBlocks[7].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.title" ), textBlocks[8].getText() );
+
+ testLinks( response );
+ }
+ catch ( Exception e )
+ {
+ assertFalse( true );
+ }
+ }
+
+ /**
+ * Test a the Perforce
SCM report
+ */
+ public void testPerforceScmReport()
+ {
+ if ( skip )
+ {
+ return;
+ }
+
+ try
+ {
+ loadTestMavenProject( PERFORCE_PROJECT );
+
+ assertNotNull( getTestMavenProject() );
+ assertNotNull( getTestMavenProject().getScm() );
+
+ executeMaven2CommandLine();
+
+ URL reportURL = getGeneratedReport().toURL();
+ assertNotNull( reportURL );
+
+ // HTTPUnit
+ WebRequest request = new GetMethodWebRequest( reportURL.toString() );
+ WebResponse response = webConversation.getResponse( request );
+
+ // Basic HTML tests
+ assertTrue( response.isHTML() );
+ assertTrue( response.getContentLength() > 0 );
+
+ // Test the Page title
+ assertEquals( getString( "report.scm.title" ), response.getTitle() );
+
+ // Test the sections
+ TextBlock[] textBlocks = response.getTextBlocks();
+
+ assertEquals( textBlocks.length, 8 );
+
+ assertEquals( getString( "report.scm.overview.title" ), textBlocks[1].getText() );
+ assertEquals( getString( "report.scm.webaccess.title" ), textBlocks[2].getText() );
+ assertEquals( getString( "report.scm.webaccess.url" ), textBlocks[3].getText() );
+ assertEquals( getString( "report.scm.devaccess.title" ), textBlocks[4].getText() );
+ assertEquals( getString( "report.scm.devaccess.perforce.intro" ), textBlocks[5].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.title" ), textBlocks[6].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.general.intro" ), textBlocks[7].getText() );
+
+ testLinks( response );
+ }
+ catch ( Exception e )
+ {
+ assertFalse( true );
+ }
+ }
+
+ /**
+ * Test a the Starteam
SCM report
+ */
+ public void testStarteamScmReport()
+ {
+ if ( skip )
+ {
+ return;
+ }
+
+ try
+ {
+ loadTestMavenProject( STARTEAM_PROJECT );
+
+ assertNotNull( getTestMavenProject() );
+ assertNotNull( getTestMavenProject().getScm() );
+
+ executeMaven2CommandLine();
+
+ URL reportURL = getGeneratedReport().toURL();
+ assertNotNull( reportURL );
+
+ // HTTPUnit
+ WebRequest request = new GetMethodWebRequest( reportURL.toString() );
+ WebResponse response = webConversation.getResponse( request );
+
+ // Basic HTML tests
+ assertTrue( response.isHTML() );
+ assertTrue( response.getContentLength() > 0 );
+
+ // Test the Page title
+ assertEquals( getString( "report.scm.title" ), response.getTitle() );
+
+ // Test the sections
+ TextBlock[] textBlocks = response.getTextBlocks();
+
+ assertEquals( textBlocks.length, 8 );
+
+ assertEquals( getString( "report.scm.overview.title" ), textBlocks[1].getText() );
+ assertEquals( getString( "report.scm.webaccess.title" ), textBlocks[2].getText() );
+ assertEquals( getString( "report.scm.webaccess.url" ), textBlocks[3].getText() );
+ assertEquals( getString( "report.scm.devaccess.title" ), textBlocks[4].getText() );
+ assertEquals( getString( "report.scm.devaccess.starteam.intro" ), textBlocks[5].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.title" ), textBlocks[6].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.general.intro" ), textBlocks[7].getText() );
+
+ testLinks( response );
+ }
+ catch ( Exception e )
+ {
+ assertFalse( true );
+ }
+ }
+
+ /**
+ * Test a the SVN
SCM report
+ */
+ public void testSVNScmReport()
+ {
+ if ( skip )
+ {
+ return;
+ }
+
+ try
+ {
+ loadTestMavenProject( SVN_PROJECT );
+
+ assertNotNull( getTestMavenProject() );
+ assertNotNull( getTestMavenProject().getScm() );
+
+ executeMaven2CommandLine();
+
+ URL reportURL = getGeneratedReport().toURL();
+ assertNotNull( reportURL );
+
+ // HTTPUnit
+ WebRequest request = new GetMethodWebRequest( reportURL.toString() );
+ WebResponse response = webConversation.getResponse( request );
+
+ // Basic HTML tests
+ assertTrue( response.isHTML() );
+ assertTrue( response.getContentLength() > 0 );
+
+ // Test the Page title
+ assertEquals( getString( "report.scm.title" ), response.getTitle() );
+
+ // Test the sections
+ TextBlock[] textBlocks = response.getTextBlocks();
+
+ assertEquals( textBlocks.length, 15 );
+
+ assertEquals( getString( "report.scm.overview.title" ), textBlocks[1].getText() );
+ assertEquals( getString( "report.scm.webaccess.title" ), textBlocks[2].getText() );
+ assertEquals( getString( "report.scm.webaccess.url" ), textBlocks[3].getText() );
+ assertEquals( getString( "report.scm.anonymousaccess.title" ), textBlocks[4].getText() );
+ assertEquals( getString( "report.scm.anonymousaccess.svn.intro" ), textBlocks[5].getText() );
+ assertEquals( getString( "report.scm.devaccess.title" ), textBlocks[6].getText() );
+ assertEquals( getString( "report.scm.devaccess.svn.intro1" ), textBlocks[7].getText() );
+ assertEquals( getString( "report.scm.devaccess.svn.intro2" ), textBlocks[8].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.title" ), textBlocks[9].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.svn.intro" ), textBlocks[10].getText() );
+ assertEquals( getString( "report.scm.accessthroughtproxy.title" ), textBlocks[11].getText() );
+ assertEquals( getString( "report.scm.accessthroughtproxy.svn.intro1" ), textBlocks[12].getText() );
+ assertEquals( getString( "report.scm.accessthroughtproxy.svn.intro2" ), textBlocks[13].getText() );
+ assertEquals( getString( "report.scm.accessthroughtproxy.svn.intro3" ), textBlocks[14].getText() );
+
+ testLinks( response );
+ }
+ catch ( Exception e )
+ {
+ assertFalse( true );
+ }
+ }
+
+ /**
+ * Test a the unknown
SCM report
+ */
+ public void testUnknownScmReport()
+ {
+ if ( skip )
+ {
+ return;
+ }
+
+ try
+ {
+ loadTestMavenProject( UNKNOWN_PROJECT );
+
+ assertNotNull( getTestMavenProject() );
+ assertNotNull( getTestMavenProject().getScm() );
+
+ executeMaven2CommandLine();
+
+ URL reportURL = getGeneratedReport().toURL();
+ assertNotNull( reportURL );
+
+ // HTTPUnit
+ WebRequest request = new GetMethodWebRequest( reportURL.toString() );
+ WebResponse response = webConversation.getResponse( request );
+
+ // Basic HTML tests
+ assertTrue( response.isHTML() );
+ assertTrue( response.getContentLength() > 0 );
+
+ // Test the Page title
+ assertEquals( getString( "report.scm.title" ), response.getTitle() );
+
+ // Test the sections
+ TextBlock[] textBlocks = response.getTextBlocks();
+
+ assertEquals( textBlocks.length, 11 );
+
+ assertEquals( getString( "report.scm.overview.title" ), textBlocks[1].getText() );
+ assertEquals( getString( "report.scm.general.intro" ), textBlocks[2].getText() );
+ assertEquals( getString( "report.scm.webaccess.title" ), textBlocks[3].getText() );
+ assertEquals( getString( "report.scm.webaccess.url" ), textBlocks[4].getText() );
+ assertEquals( getString( "report.scm.anonymousaccess.title" ), textBlocks[5].getText() );
+ assertEquals( getString( "report.scm.anonymousaccess.general.intro" ), textBlocks[6].getText() );
+ assertEquals( getString( "report.scm.devaccess.title" ), textBlocks[7].getText() );
+ assertEquals( getString( "report.scm.devaccess.general.intro" ), textBlocks[8].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.title" ), textBlocks[9].getText() );
+ assertEquals( getString( "report.scm.accessbehindfirewall.general.intro" ), textBlocks[10].getText() );
+
+ testLinks( response );
+ }
+ catch ( Exception e )
+ {
+ assertFalse( true );
+ }
+ }
+}
diff --git a/maven-plugins/maven-project-info-reports-plugin/src/test/projects/project-info-reports-plugin-scm-CVS/pom.xml b/maven-plugins/maven-project-info-reports-plugin/src/test/projects/project-info-reports-plugin-scm-CVS/pom.xml
new file mode 100644
index 0000000000..930f68ae3e
--- /dev/null
+++ b/maven-plugins/maven-project-info-reports-plugin/src/test/projects/project-info-reports-plugin-scm-CVS/pom.xml
@@ -0,0 +1,65 @@
+
+
+
+
+