adding testcase for MNG-1329 duplicate project references (already working)

renaming project.xml->pom.xml in test projects according to m2 standard

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@329655 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Fabrizio Giustina 2005-10-30 21:32:13 +00:00
parent 96de59c076
commit 4c89459ed5
13 changed files with 87 additions and 16 deletions

View File

@ -78,6 +78,19 @@ public class EclipsePluginTest
testProject( "project-6", null ); testProject( "project-6", null );
} }
public void testProject7()
throws Exception
{
testProject( "project-7", null );
}
// @todo testcase for MNG-1324 "System" dependencies path non correctly added to eclipse buildpath
// public void testProject8()
// throws Exception
// {
// testProject( "project-8", null );
// }
private void testProject( String projectName, File outputDir ) private void testProject( String projectName, File outputDir )
throws Exception throws Exception
{ {
@ -90,13 +103,14 @@ public class EclipsePluginTest
File repo = getTestFile( "src/test/repository" ); File repo = getTestFile( "src/test/repository" );
ArtifactRepositoryLayout localRepositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout localRepositoryLayout = (ArtifactRepositoryLayout) lookup(
ArtifactRepositoryLayout.ROLE, "legacy" ); ArtifactRepositoryLayout.ROLE,
"legacy" );
ArtifactRepository localRepository = new DefaultArtifactRepository( "local", "file://" + repo.getAbsolutePath(), ArtifactRepository localRepository = new DefaultArtifactRepository( "local",
"file://" + repo.getAbsolutePath(),
localRepositoryLayout ); localRepositoryLayout );
MavenProject project = builder MavenProject project = builder.buildWithDependencies( new File( basedir, "pom.xml" ), localRepository, null );
.buildWithDependencies( new File( basedir, "project.xml" ), localRepository, null );
File projectOutputDir = basedir; File projectOutputDir = basedir;
@ -150,14 +164,14 @@ public class EclipsePluginTest
plugin.execute(); plugin.execute();
assertFileEquals( localRepository.getBasedir(), new File( basedir, "project" ), assertFileEquals( localRepository.getBasedir(), new File( basedir, "project" ), new File( projectOutputDir,
new File( projectOutputDir, ".project" ) ); ".project" ) );
assertFileEquals( localRepository.getBasedir(), new File( basedir, "classpath" ), assertFileEquals( localRepository.getBasedir(), new File( basedir, "classpath" ), new File( projectOutputDir,
new File( projectOutputDir, ".classpath" ) ); ".classpath" ) );
assertFileEquals( localRepository.getBasedir(), new File( basedir, "wtpmodules" ), assertFileEquals( localRepository.getBasedir(), new File( basedir, "wtpmodules" ), new File( projectOutputDir,
new File( projectOutputDir, ".wtpmodules" ) ); ".wtpmodules" ) );
if ( new File( basedir, "settings" ).exists() ) if ( new File( basedir, "settings" ).exists() )
{ {
@ -184,8 +198,8 @@ public class EclipsePluginTest
if ( actualLines.size() <= i ) if ( actualLines.size() <= i )
{ {
fail( "Too few lines in the actual file. Was " + actualLines.size() + ", expected: " + fail( "Too few lines in the actual file. Was " + actualLines.size() + ", expected: "
expectedLines.size() ); + expectedLines.size() );
} }
String actual = actualLines.get( i ).toString(); String actual = actualLines.get( i ).toString();
@ -213,8 +227,7 @@ public class EclipsePluginTest
while ( ( line = reader.readLine() ) != null ) while ( ( line = reader.readLine() ) != null )
{ {
lines.add( lines.add( line );//StringUtils.replace( line, "#ArtifactRepositoryPath#", mavenRepo.replace( '\\', '/' ) ) );
line );//StringUtils.replace( line, "#ArtifactRepositoryPath#", mavenRepo.replace( '\\', '/' ) ) );
} }
return lines; return lines;

View File

@ -13,9 +13,9 @@
</natures> </natures>
<linkedResources> <linkedResources>
<link> <link>
<name>project.xml</name> <name>pom.xml</name>
<type>1</type> <type>1</type>
<location>${basedir}/src/test/projects/project-4/project.xml</location> <location>${basedir}/src/test/projects/project-4/pom.xml</location>
</link> </link>
<link> <link>
<name>src-main-java</name> <name>src-main-java</name>

View File

@ -0,0 +1,6 @@
<classpath>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/maven/jars/maven-core-98.0-tests.jar" sourcepath="M2_REPO/maven/java-sources/maven-core-98.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/maven/jars/maven-core-98.0.jar" sourcepath="M2_REPO/maven/java-sources/maven-core-98.0-sources.jar"/>
</classpath>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<packaging>war</packaging>
<groupId>eclipse</groupId>
<artifactId>maven-eclipse-plugin-test-project-7</artifactId>
<version>99.0</version>
<name>Maven</name>
<dependencies>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-core</artifactId>
<version>98.0</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-core</artifactId>
<classifier>tests</classifier>
<version>98.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,14 @@
<projectDescription>
<name>maven-eclipse-plugin-test-project-7</name>
<comment/>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,15 @@
<project-modules id="moduleCoreId">
<wb-module deploy-name="maven-eclipse-plugin-test-project-7">
<module-type module-type-id="jst.web">
<version>2.4</version>
<property name="context-root" value="maven-eclipse-plugin-test-project-7"/>
</module-type>
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/var/M2_REPO/maven/jars/maven-core-98.0-tests.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/var/M2_REPO/maven/jars/maven-core-98.0.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
</wb-module>
</project-modules>