Author: bentmann
Date: Sun Oct 10 11:43:05 2010
New Revision: 1006279
URL: http://svn.apache.org/viewvc?rev=1006279&view=rev
Log:
o Formatted code
Modified:
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/MakeMojoTest.java
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/NoopScmManager.java
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java
Modified:
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/MakeMojoTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/MakeMojoTest.java?rev=1006279&r1=1006278&r2=1006279&view=diff
==============================================================================
---
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/MakeMojoTest.java
(original)
+++
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/MakeMojoTest.java
Sun Oct 10 11:43:05 2010
@@ -42,49 +42,58 @@ import org.apache.maven.shared.invoker.I
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
-
-public class MakeMojoTest extends TestCase
+public class MakeMojoTest
+ extends TestCase
{
MavenProject dataAccess = new MavenProject();
+
MavenProject businessLogic = new MavenProject();
+
MavenProject ui = new MavenProject();
+
List configuredProjects;
+
String ps = File.separator;
+
File baseDir;
-
- public void setUp() throws Exception {
- File tempDir = new File(System.getProperty( "java.io.tmpdir" ));
+
+ public void setUp()
+ throws Exception
+ {
+ File tempDir = new File( System.getProperty( "java.io.tmpdir" ) );
baseDir = File.createTempFile( "makeMojoTest", "", tempDir );
baseDir.delete();
configureProject( dataAccess, "dataAccess", "reactortest", "1.0" );
configureProject( businessLogic, "businessLogic", "reactortest", "1.0"
);
configureProject( ui, "ui", "reactortest", "1.0" );
-
- configuredProjects = Arrays.asList( new MavenProject[] { dataAccess,
businessLogic, ui} );
-
+
+ configuredProjects = Arrays.asList( new MavenProject[] { dataAccess,
businessLogic, ui } );
+
// ui depends on businessLogic
// businessLogic depends on dataAccess
- createDependency(businessLogic, ui);
- createDependency(dataAccess, businessLogic);
+ createDependency( businessLogic, ui );
+ createDependency( dataAccess, businessLogic );
}
-
- public void tearDown() throws Exception
+
+ public void tearDown()
+ throws Exception
{
FileUtils.deleteDirectory( baseDir );
}
- void configureProject(MavenProject p, String artifactId, String groupId,
String version) throws IOException
+ void configureProject( MavenProject p, String artifactId, String groupId,
String version )
+ throws IOException
{
p.setArtifactId( artifactId );
p.setGroupId( groupId );
p.setVersion( version );
- File file = new File(baseDir, artifactId+"/pom.xml");
+ File file = new File( baseDir, artifactId + "/pom.xml" );
file.getParentFile().mkdirs();
file.createNewFile();
p.setFile( file.getAbsoluteFile() );
}
-
- void createDependency(MavenProject provider, MavenProject consumer)
+
+ void createDependency( MavenProject provider, MavenProject consumer )
{
Dependency d = new Dependency();
d.setArtifactId( provider.getArtifactId() );
@@ -92,8 +101,10 @@ public class MakeMojoTest extends TestCa
d.setVersion( provider.getVersion() );
consumer.getDependencies().add( d );
}
-
- public void testMake() throws MojoExecutionException, MojoFailureException
{
+
+ public void testMake()
+ throws MojoExecutionException, MojoFailureException
+ {
MakeMojo m = new MakeMojo();
m.collectedProjects = configuredProjects;
m.artifactList = "reactortest:businessLogic";
@@ -102,10 +113,12 @@ public class MakeMojoTest extends TestCa
FakeInvoker fi = new FakeInvoker();
m.simpleInvoker = fi;
m.execute();
- assertEquals("dataAccess/pom.xml,businessLogic/pom.xml",
fi.getIncludes());
+ assertEquals( "dataAccess/pom.xml,businessLogic/pom.xml",
fi.getIncludes() );
}
-
- public void testMakeDependents() throws MojoExecutionException,
MojoFailureException {
+
+ public void testMakeDependents()
+ throws MojoExecutionException, MojoFailureException
+ {
MakeDependentsMojo m = new MakeDependentsMojo();
m.collectedProjects = configuredProjects;
m.artifactList = "reactortest:businessLogic";
@@ -114,68 +127,79 @@ public class MakeMojoTest extends TestCa
FakeInvoker fi = new FakeInvoker();
m.simpleInvoker = fi;
m.execute();
- assertEquals("businessLogic/pom.xml,ui/pom.xml", fi.getIncludes());
+ assertEquals( "businessLogic/pom.xml,ui/pom.xml", fi.getIncludes() );
}
-
- public void testMakeScmChanges() throws Exception {
+
+ public void testMakeScmChanges()
+ throws Exception
+ {
MakeScmChanges m = new MakeScmChanges();
m.collectedProjects = configuredProjects;
m.baseDir = baseDir;
m.goals = "install";
FakeInvoker fi = new FakeInvoker();
m.simpleInvoker = fi;
-
- ScmFile sf = new ScmFile(businessLogic.getFile().getAbsolutePath(),
ScmFileStatus.MODIFIED);
- m.scmManager = new FakeScmManager(Arrays.asList(new ScmFile[] {sf} ));
+
+ ScmFile sf = new ScmFile( businessLogic.getFile().getAbsolutePath(),
ScmFileStatus.MODIFIED );
+ m.scmManager = new FakeScmManager( Arrays.asList( new ScmFile[] { sf }
) );
m.scmConnection = "";
-
+
m.execute();
- assertEquals("businessLogic/pom.xml,ui/pom.xml", fi.getIncludes());
+ assertEquals( "businessLogic/pom.xml,ui/pom.xml", fi.getIncludes() );
}
-
- public void testMakeResume() throws Exception {
+
+ public void testMakeResume()
+ throws Exception
+ {
MakeMojo m = new MakeMojo();
m.collectedProjects = configuredProjects;
m.artifactList = "reactortest:ui";
- m.continueFromFolder = new File(baseDir, "businessLogic");
+ m.continueFromFolder = new File( baseDir, "businessLogic" );
m.baseDir = baseDir;
m.goals = "install";
FakeInvoker fi = new FakeInvoker();
m.simpleInvoker = fi;
m.execute();
- assertEquals("businessLogic/pom.xml,ui/pom.xml", fi.getIncludes());
+ assertEquals( "businessLogic/pom.xml,ui/pom.xml", fi.getIncludes() );
}
-
- class FakeInvoker extends SimpleInvoker {
+
+ class FakeInvoker
+ extends SimpleInvoker
+ {
String[] reactorIncludes;
+
List goalList;
-
+
void runReactor( String[] reactorIncludes, List goalList, Invoker
invoker, boolean printOnly, Log log )
throws InvokerExecutionException
{
this.reactorIncludes = reactorIncludes;
this.goalList = goalList;
}
-
- String getIncludes() {
+
+ String getIncludes()
+ {
String includes = StringUtils.join( reactorIncludes, "," );
includes = includes.replaceAll( "\\\\", "/" );
return includes;
}
}
-
- class FakeScmManager extends NoopScmManager {
+
+ class FakeScmManager
+ extends NoopScmManager
+ {
List changedFiles;
- public FakeScmManager(List changedFiles)
+
+ public FakeScmManager( List changedFiles )
{
this.changedFiles = changedFiles;
}
-
+
public StatusScmResult status( ScmRepository repository, ScmFileSet
fileSet )
throws ScmException
{
- return new StatusScmResult(changedFiles, new ScmResult(null, null,
null, true));
+ return new StatusScmResult( changedFiles, new ScmResult( null,
null, null, true ) );
}
}
-
+
}
Modified:
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/NoopScmManager.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/NoopScmManager.java?rev=1006279&r1=1006278&r2=1006279&view=diff
==============================================================================
---
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/NoopScmManager.java
(original)
+++
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/NoopScmManager.java
Sun Oct 10 11:43:05 2010
@@ -251,13 +251,11 @@ public class NoopScmManager
public void setScmProvider( String providerType, ScmProvider provider )
{
-
}
public void setScmProviderImplementation( String providerType, String
providerImplementation )
{
-
}
public StatusScmResult status( ScmRepository repository, ScmFileSet
fileSet )
Modified:
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java?rev=1006279&r1=1006278&r2=1006279&view=diff
==============================================================================
---
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java
(original)
+++
maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java
Sun Oct 10 11:43:05 2010
@@ -25,65 +25,87 @@ import org.apache.maven.plugin.reactor.R
import junit.framework.TestCase;
-public class RelativePatherTest extends TestCase {
+public class RelativePatherTest
+ extends TestCase
+{
File root;
+
File differentRoot;
+
char S = File.separatorChar;
-
- public void setUp() {
+
+ public void setUp()
+ {
File[] roots = File.listRoots();
root = roots[0];
- if (roots.length > 1) {
+ if ( roots.length > 1 )
+ {
differentRoot = roots[1];
}
}
-
- public void testIdenticalRoots() {
- assertEquals("", getRelativePath(root, root));
+
+ public void testIdenticalRoots()
+ {
+ assertEquals( "", getRelativePath( root, root ) );
}
-
- public void testDifferentRoots() {
+
+ public void testDifferentRoots()
+ {
// skip this test on systems with only one root
- if (differentRoot == null) return;
- try {
- getRelativePath(root, differentRoot);
- fail("Expected different roots exception");
- } catch (DifferentRootsException e) {}
- }
-
- public void testIdenticalFoo() {
- File foo = new File(root, "foo");
- assertEquals("", getRelativePath(foo, foo));
- }
-
- public void testIdenticalFooFoo() {
- File foo = new File(root, "foo/foo");
- assertEquals("", getRelativePath(foo, foo));
- }
-
- public void testFooBar() {
- File foo = new File(root, "foo");
- File bar = new File(root, "bar");
- assertEquals(".." + S + "bar", getRelativePath(foo, bar));
- }
-
- public void testRootFoo() {
- File foo = new File(root, "foo");
- assertEquals("foo", getRelativePath(root, foo));
- }
-
- public void testFooRoot() {
- File foo = new File(root, "foo");
- assertEquals("..", getRelativePath(foo, root));
- }
-
- public void testFooFooBarBar() {
- File foo = new File(root, "foo/foo");
- File bar = new File(root, "bar/bar");
- assertEquals(".." + S + ".." + S + "bar" + S + "bar",
getRelativePath(foo, bar));
- }
-
- public String getRelativePath(File context, File dest) {
- return RelativePather.getRelativePath(context, dest);
+ if ( differentRoot == null )
+ {
+ return;
+ }
+ try
+ {
+ getRelativePath( root, differentRoot );
+ fail( "Expected different roots exception" );
+ }
+ catch ( DifferentRootsException e )
+ {
+ }
+ }
+
+ public void testIdenticalFoo()
+ {
+ File foo = new File( root, "foo" );
+ assertEquals( "", getRelativePath( foo, foo ) );
+ }
+
+ public void testIdenticalFooFoo()
+ {
+ File foo = new File( root, "foo/foo" );
+ assertEquals( "", getRelativePath( foo, foo ) );
+ }
+
+ public void testFooBar()
+ {
+ File foo = new File( root, "foo" );
+ File bar = new File( root, "bar" );
+ assertEquals( ".." + S + "bar", getRelativePath( foo, bar ) );
+ }
+
+ public void testRootFoo()
+ {
+ File foo = new File( root, "foo" );
+ assertEquals( "foo", getRelativePath( root, foo ) );
+ }
+
+ public void testFooRoot()
+ {
+ File foo = new File( root, "foo" );
+ assertEquals( "..", getRelativePath( foo, root ) );
+ }
+
+ public void testFooFooBarBar()
+ {
+ File foo = new File( root, "foo/foo" );
+ File bar = new File( root, "bar/bar" );
+ assertEquals( ".." + S + ".." + S + "bar" + S + "bar",
getRelativePath( foo, bar ) );
+ }
+
+ public String getRelativePath( File context, File dest )
+ {
+ return RelativePather.getRelativePath( context, dest );
}
}