First implementation of report testing (See the following thrad http://www.mail-archive.com/dev@maven.apache.org/msg31289.html

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@312875 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vincent Siveton 2005-10-11 13:18:36 +00:00
parent 097005a98f
commit 55bbfd0fd6
14 changed files with 1372 additions and 31 deletions

View File

@ -82,5 +82,35 @@
<artifactId>maven-scm-provider-cvs</artifactId>
<version>1.0-alpha-2</version>
</dependency>
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
<version>2.0-beta-1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-beta-1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.0-beta-3-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-i18n</artifactId>
<version>1.0-beta-5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,61 @@
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 org.xml.sax.SAXException;
import com.meterware.httpunit.WebLink;
import com.meterware.httpunit.WebResponse;
/**
* Abstract class to test reports with <a href="http://www.httpunit.org/">HTTPUnit</a> framework.
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @version $Id $
*/
public abstract class AbstractHttpUnitReportTestCase
extends AbstractMavenReportTestCase
{
/**
* Test links in a generated report
*
* @param response HTTPUnit response object
* @throws SAXException if any
*/
protected void testLinks( WebResponse response )
throws SAXException
{
// Test links
WebLink[] links = response.getLinks();
assertTrue( links.length > 9 );
// Header
assertEquals( getTestMavenProject().getUrl(), links[0].getURLString() );
// NavBar
assertEquals( "index.html", links[1].getURLString() );
assertEquals( "project-info.html", links[2].getURLString() );
assertEquals( "integration.html", links[3].getURLString() );
assertEquals( "dependencies.html", links[4].getURLString() );
assertEquals( "issue-tracking.html", links[5].getURLString() );
assertEquals( "license.html", links[6].getURLString() );
assertEquals( "mail-lists.html", links[7].getURLString() );
assertEquals( "source-repository.html", links[8].getURLString() );
assertEquals( "team-list.html", links[9].getURLString() );
// Content skipped
}
}

View File

@ -0,0 +1,335 @@
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.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import org.apache.maven.Maven;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.i18n.I18N;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
import org.codehaus.plexus.util.cli.DefaultConsumer;
/**
* An abstract TestCase class to test <code>Maven Reports</code> generated.
*
* @phase test
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @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 <code>PROJECTS_DIR</code> 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 <code>M2_SITE_GOAL</code> 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 <code>index.html</code>
*
* @return the report name
*/
protected abstract String getReportName();
/**
* Convenience method to create a m2 command line from a given working directory.
* <p>We suppose that the <code>m2</code> executable is present in the command path</p>.
*
* @param workingDir a not null working directory.
* @param goal the wanted goal
* @return the m2 command line, eg <code>m2 clean:clean site:site</code>
* @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 <code>PROJECTS_DIR</code> directory.
*
* @see #getTestProjectsPath()
*
* @param projectName not null name of the test project dir in the <code>PROJECTS_DIR</code> 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 <code>PROJECTS_DIR</code> directory.
*
* @see #getTestProjectPath(String)
*
* @param projectName not null name of the test project dir in the <code>PROJECTS_DIR</code> 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;
}
}

View File

@ -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 <code>Scm Report</code> generation for defined projects in the <code>PROJECTS_DIR</code> directory.
* <p>Testing only section title and links with <a href="http://www.httpunit.org/">HTTPUnit</a> framework.</p>
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @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 the <code>ClearCase</code> 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 );
}
}
}

View File

@ -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 <code>Scm Report</code> generation for defined projects in the <code>PROJECTS_DIR</code> directory.
* <p>Testing only section title and links with <a href="http://www.httpunit.org/">HTTPUnit</a> framework.</p>
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @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 the <code>ClearCase</code> 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 <code>CVS</code> 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 <code>Perforce</code> 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 <code>Starteam</code> 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 <code>SVN</code> 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 <code>unknown</code> 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 );
}
}
}

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.report.projectinfo.scm-CVS</groupId>
<artifactId>project-info-reports-plugin-scm-CVS</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Maven ProjectInfo Report Test</name>
<description>Test the SCM report with CVS</description>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/dist</connection>
<developerConnection>scm:cvs:ext:developer@cvs.apache.org:/home/cvs:maven-plugins/dist</developerConnection>
<url>http://cvs.apache.org/</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.report.projectinfo.scm-ClearCase</groupId>
<artifactId>project-info-reports-plugin-scm-ClearCase</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Maven ProjectInfo Report Test</name>
<description>Test the SCM report with ClearCase</description>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:clearcase:</connection>
<developerConnection>scm:clearcase:</developerConnection>
<url>http://clearcase.apache.org/</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.report.projectinfo.scm-Perforce</groupId>
<artifactId>project-info-reports-plugin-scm-Perforce</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Maven ProjectInfo Report Test</name>
<description>Test the SCM report with Perforce</description>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:perforce:apache.org:1234://depot/maven-plugins</connection>
<developerConnection>scm:perforce:developer@apache.org:1234://depot/projects/maven-plugins</developerConnection>
<url>http://perforce.apache.org/</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.report.projectinfo.scm-CVS</groupId>
<artifactId>project-info-reports-plugin-scm-CVS</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Maven ProjectInfo Report Test</name>
<description>Test the SCM report with CVS</description>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:svn:http://svn.apache.org/svn/trunk</connection>
<developerConnection>scm:svn:https://svn.apache.org/svn/trunk</developerConnection>
<url>http://svn.apache.org</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.report.projectinfo.scm-Starteam</groupId>
<artifactId>project-info-reports-plugin-scm-Starteam</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Maven ProjectInfo Report Test</name>
<description>Test the SCM report with Starteam</description>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:starteam:apache.org:1234/projects/maven-plugins</connection>
<developerConnection>scm:starteam:developer:mypassword@apache.org:1234/projects/maven-plugins</developerConnection>
<url>http://starteam.apache.org/</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.report.projectinfo.scm-CVS</groupId>
<artifactId>project-info-reports-plugin-scm-CVS</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Maven ProjectInfo Report Test</name>
<description>Test the SCM report with CVS</description>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:unknownscm:unknownscm.apache.org:/dist</connection>
<developerConnection>scm:unknownscm:developer@unknownscm.apache.org:/dist</developerConnection>
<url>http://unknownscm.apache.org</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-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.
*/
-->
<plexus xmlns="http://plexus.codehaus.org/xml/ns/plexus" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<components>
<component>
<role>org.codehaus.plexus.i18n.I18N</role>
<implementation>org.codehaus.plexus.i18n.DefaultI18N</implementation>
<configuration>
<default-bundle-name>project-info-report</default-bundle-name>
</configuration>
</component>
</components>
</plexus>