mirror of https://github.com/apache/maven.git
split test methods with a common setup, replace file comparison with manual checks for module1 classpath file (entries are sorted in a different order in maven 2.0.1 due to the optional dependencies fix)
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@332366 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cd0f56165b
commit
b91ab29a07
|
@ -98,6 +98,8 @@ public class EclipsePluginMasterProjectTest
|
|||
projectList.add( maven.readProjectWithDependencies( new File( basedir, "pom.xml" ) ) );
|
||||
|
||||
super.setUp();
|
||||
|
||||
executeMaven2CommandLine( basedir );
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
|
@ -115,7 +117,7 @@ public class EclipsePluginMasterProjectTest
|
|||
* </ul>
|
||||
* @throws Exception
|
||||
*/
|
||||
public void disabledTestMasterProjectWithEmbedder()
|
||||
public void executeMaven2WithEmbedder()
|
||||
throws Exception
|
||||
{
|
||||
EventMonitor eventMonitor = new DefaultEventMonitor( new PlexusLoggerAdapter( new MavenEmbedderConsoleLogger() ) );
|
||||
|
@ -124,36 +126,53 @@ public class EclipsePluginMasterProjectTest
|
|||
"org.apache.maven.plugins:maven-eclipse-plugin:clean",
|
||||
"org.apache.maven.plugins:maven-eclipse-plugin:eclipse" } ), eventMonitor, new ConsoleDownloadMonitor(),
|
||||
new Properties(), this.basedir );
|
||||
|
||||
compareFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test using a command line. Should be replaced by the embedder test.
|
||||
*/
|
||||
public void testMasterProject()
|
||||
throws Exception
|
||||
{
|
||||
executeMaven2CommandLine( basedir );
|
||||
compareFiles();
|
||||
}
|
||||
|
||||
private void compareFiles()
|
||||
public void testModule1Project()
|
||||
throws Exception
|
||||
{
|
||||
assertFileEquals( null, new File( basedir, "module-1/project" ), new File( basedir, "module-1/.project" ) );
|
||||
assertFileEquals( null, new File( basedir, "module-1/classpath" ), new File( basedir, "module-1/.classpath" ) );
|
||||
assertFileEquals( null, new File( basedir, "module-1/wtpmodules" ), new File( basedir, "module-1/.wtpmodules" ) );
|
||||
assertFileEquals( null, new File( basedir, "module-2/project" ), new File( basedir, "module-2/.project" ) );
|
||||
|
||||
checkModule2Classpath( new File( basedir, "module-2/.classpath" ) );
|
||||
checkModule2Wtpmodules( new File( basedir, "module-2/.wtpmodules" ) );
|
||||
}
|
||||
|
||||
private void checkModule2Classpath( File file )
|
||||
public void testModule1Classpath()
|
||||
throws Exception
|
||||
{
|
||||
InputStream fis = new FileInputStream( file );
|
||||
|
||||
InputStream fis = new FileInputStream( new File( basedir, "module-1/.classpath" ) );
|
||||
String classpath = IOUtil.toString( fis );
|
||||
IOUtil.close( fis );
|
||||
|
||||
// direct dependencies, include all
|
||||
assertContains( "Invalid classpath", classpath, "/refproject-compile" );
|
||||
assertContains( "Invalid classpath", classpath, "/refproject-sysdep" );
|
||||
assertContains( "Invalid classpath", classpath, "/refproject-test" );
|
||||
assertContains( "Invalid classpath", classpath, "/refproject-optional" );
|
||||
assertContains( "Invalid classpath", classpath, "/refproject-provided" );
|
||||
|
||||
// transitive dependencies
|
||||
assertContains( "Invalid classpath", classpath, "/deps-refproject-compile" );
|
||||
assertDoesNotContain( "Invalid classpath", classpath, "/deps-refproject-test" );
|
||||
assertDoesNotContain( "Invalid classpath", classpath, "/deps-refproject-optional" );
|
||||
assertDoesNotContain( "Invalid classpath", classpath, "/deps-refproject-provided" );
|
||||
|
||||
}
|
||||
|
||||
public void testModule1Wtpmodules()
|
||||
throws Exception
|
||||
{
|
||||
assertFileEquals( null, new File( basedir, "module-1/wtpmodules" ), new File( basedir, "module-1/.wtpmodules" ) );
|
||||
}
|
||||
|
||||
public void testModule2Project()
|
||||
throws Exception
|
||||
{
|
||||
assertFileEquals( null, new File( basedir, "module-2/project" ), new File( basedir, "module-2/.project" ) );
|
||||
}
|
||||
|
||||
public void testModule2Classpath()
|
||||
throws Exception
|
||||
{
|
||||
InputStream fis = new FileInputStream( new File( basedir, "module-2/.classpath" ) );
|
||||
String classpath = IOUtil.toString( fis );
|
||||
IOUtil.close( fis );
|
||||
|
||||
|
@ -186,10 +205,10 @@ public class EclipsePluginMasterProjectTest
|
|||
assertDoesNotContain( "Invalid classpath", classpath, "/deps-refproject-provided" );
|
||||
}
|
||||
|
||||
private void checkModule2Wtpmodules( File file )
|
||||
public void testModule2Wtpmodules()
|
||||
throws Exception
|
||||
{
|
||||
InputStream fis = new FileInputStream( file );
|
||||
InputStream fis = new FileInputStream( new File( basedir, "module-2/.wtpmodules" ) );
|
||||
String wtpmodules = IOUtil.toString( fis );
|
||||
IOUtil.close( fis );
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="var" path="M2_REPO/eclipsetest/refproject-test/1.0/refproject-test-1.0.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/eclipsetest/refproject-compile/1.0/refproject-compile-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="${basedir}/src/test/projects/master-test/module-1/refproject-sysdep.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/eclipsetest/deps-refproject-compile/1.0/deps-refproject-compile-1.0.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/eclipsetest/refproject-provided/1.0/refproject-provided-1.0.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/eclipsetest/refproject-optional/1.0/refproject-optional-1.0.jar"/>
|
||||
</classpath>
|
Loading…
Reference in New Issue