You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2006/07/20 00:13:45 UTC
svn commit: r423634 [6/7] - in /maven/maven-1/core/trunk/src:
java/org/apache/maven/ java/org/apache/maven/cli/
java/org/apache/maven/jelly/ java/org/apache/maven/jelly/tags/
java/org/apache/maven/jelly/tags/jeez/
java/org/apache/maven/jelly/tags/maven...
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/plugin/PluginManagerTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/plugin/PluginManagerTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/plugin/PluginManagerTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/plugin/PluginManagerTest.java Wed Jul 19 15:13:40 2006
@@ -17,9 +17,10 @@
* ====================================================================
*/
-import junit.framework.TestCase;
+import java.io.File;
+import java.io.FileInputStream;
-import com.werken.forehead.Forehead;
+import junit.framework.TestCase;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenSession;
@@ -27,14 +28,14 @@
import org.apache.maven.jelly.MavenJellyContext;
import org.apache.maven.project.Project;
-import java.io.File;
-import java.io.FileInputStream;
+import com.werken.forehead.Forehead;
/**
* @author Brett Porter <a href="mailto:brett@apache.org">brett@apache.org</a>
*
*/
-public class PluginManagerTest extends TestCase
+public class PluginManagerTest
+ extends TestCase
{
/** instance being tested */
@@ -49,8 +50,8 @@
private static String FS = File.separator;
/** source base */
- private static final String SOURCE_BASE = FS + "src" + FS + "test" + FS + "java" + FS + "org" + FS
- + "apache" + FS + "maven" + FS + "plugin" + FS;
+ private static final String SOURCE_BASE = FS + "src" + FS + "test" + FS + "java" + FS + "org" + FS + "apache" + FS
+ + "maven" + FS + "plugin" + FS;
/** base directory */
private String basedir;
@@ -62,60 +63,61 @@
* Constructor for PluginManagerTest.
* @param name the name of the test case
*/
- public PluginManagerTest(String name)
+ public PluginManagerTest( String name )
{
- super(name);
+ super( name );
}
/**
* Set up the test case
* @throws Exception when any error occurs
*/
- public void setUp() throws Exception
+ public void setUp()
+ throws Exception
{
super.setUp();
- basedir = System.getProperty("user.dir");
+ basedir = System.getProperty( "user.dir" );
assertNotNull( basedir );
-
+
// 1) need to fake out maven home, so that the unpacked plugin dir in the test
// directory
fakeHome = basedir + SOURCE_BASE + "maven.home";
- System.setProperty("maven.home", fakeHome);
-
+ System.setProperty( "maven.home", fakeHome );
+
MavenJellyContext context = MavenUtils.createContext( new File( basedir ) );
- assertNotNull(context);
+ assertNotNull( context );
// 2) need to fake out maven home local
String fakeHomeLocal = basedir + FAKE_BASE + "maven.home.local";
- new File(fakeHomeLocal).mkdirs();
- context.setVariable(MavenConstants.MAVEN_HOME_LOCAL, fakeHomeLocal);
+ new File( fakeHomeLocal ).mkdirs();
+ context.setVariable( MavenConstants.MAVEN_HOME_LOCAL, fakeHomeLocal );
// 3) Need to fake out unpacked plugins dir so that the plugins are
// unpacked locally in the test directory
String fakeUnpackedPlugins = basedir + FAKE_BASE + "maven.plugin.unpacked.dir";
- new File(fakeUnpackedPlugins).mkdirs();
- context.setVariable(MavenConstants.MAVEN_UNPACKED_PLUGINS_DIR, fakeUnpackedPlugins);
+ new File( fakeUnpackedPlugins ).mkdirs();
+ context.setVariable( MavenConstants.MAVEN_UNPACKED_PLUGINS_DIR, fakeUnpackedPlugins );
// fake forehead up - must be done before MavenSession creation
- FileInputStream fis = new FileInputStream(basedir + SOURCE_BASE + "forehead.conf");
- Forehead.getInstance().config(fis);
+ FileInputStream fis = new FileInputStream( basedir + SOURCE_BASE + "forehead.conf" );
+ Forehead.getInstance().config( fis );
fis.close();
// setup maven session
MavenSession mavenSession = new MavenSession();
mavenSession.setRootContext( context );
- File projectFile = new File(basedir + "/src/test/touchstone-build/project.xml");
+ File projectFile = new File( basedir + "/src/test/touchstone-build/project.xml" );
// set the project being run
MavenSession.setRootDescriptorFile( projectFile );
- project = MavenUtils.getProject(projectFile, context);
+ project = MavenUtils.getProject( projectFile, context );
// This seems like a glitch in the context assembly that doesn't affect the real world, so work around it
project.getContext().setMavenRepoLocal( fakeHomeLocal + "/repository" );
- assertNotNull(project);
+ assertNotNull( project );
pluginManager = mavenSession.getPluginManager();
}
@@ -125,43 +127,45 @@
* @throws Exception when any error occurs
* @todo uncomment
*/
- public void tearDown() throws Exception
+ public void tearDown()
+ throws Exception
{
-// try
-// {
-// // clean up directories
-// String fake = basedir + FAKE_BASE;
-// FileUtils.deleteDirectory(fake);
-// }
-// catch (IOException e)
-// {
-// // ignore
-// }
+ // try
+ // {
+ // // clean up directories
+ // String fake = basedir + FAKE_BASE;
+ // FileUtils.deleteDirectory(fake);
+ // }
+ // catch (IOException e)
+ // {
+ // // ignore
+ // }
}
/**
* Make sure the plugin manager has loaded the plugins from the directory specified
* @throws Exception when any error occurs
*/
- public void testLoading() throws Exception
+ public void testLoading()
+ throws Exception
{
- assertNotNull(pluginManager);
+ assertNotNull( pluginManager );
pluginManager.initialize();
- assertTrue("clean plugin is not loaded properly", pluginManager.getGoalNames().contains("clean"));
- assertTrue("clean plugin is not loaded properly", pluginManager.getGoalNames().contains("clean:clean"));
- assertTrue("clean plugin is not loaded properly", pluginManager.getGoalNames().contains("clean:original"));
+ assertTrue( "clean plugin is not loaded properly", pluginManager.getGoalNames().contains( "clean" ) );
+ assertTrue( "clean plugin is not loaded properly", pluginManager.getGoalNames().contains( "clean:clean" ) );
+ assertTrue( "clean plugin is not loaded properly", pluginManager.getGoalNames().contains( "clean:original" ) );
}
/**
* Make sure the plugin manager can install a plugin
* @throws Exception when any error occurs
*/
- public void testInstall() throws Exception
+ public void testInstall()
+ throws Exception
{
- installPlugin("maven-java-plugin-1.3.jar");
+ installPlugin( "maven-java-plugin-1.3.jar" );
- assertTrue("java plugin is not loaded properly",
- pluginManager.getGoalNames().contains("java:compile"));
+ assertTrue( "java plugin is not loaded properly", pluginManager.getGoalNames().contains( "java:compile" ) );
}
/**
@@ -169,17 +173,16 @@
* effects.
* @throws Exception when any error occurs
*/
- public void testInstallTwice() throws Exception
+ public void testInstallTwice()
+ throws Exception
{
- installPlugin("maven-java-plugin-1.3.jar");
+ installPlugin( "maven-java-plugin-1.3.jar" );
- assertTrue("java plugin is not loaded properly",
- pluginManager.getGoalNames().contains("java:compile"));
+ assertTrue( "java plugin is not loaded properly", pluginManager.getGoalNames().contains( "java:compile" ) );
- installPlugin("maven-java-plugin-1.3.jar");
+ installPlugin( "maven-java-plugin-1.3.jar" );
- assertTrue("java plugin is not loaded properly",
- pluginManager.getGoalNames().contains("java:compile"));
+ assertTrue( "java plugin is not loaded properly", pluginManager.getGoalNames().contains( "java:compile" ) );
}
/**
@@ -187,13 +190,13 @@
* @throws Exception when any error occurs
* @todo what is a valid way to check the correct plugin will be used?
*/
- public void testUpgrade() throws Exception
+ public void testUpgrade()
+ throws Exception
{
- installPlugin("maven-clean-plugin-1.2-SNAPSHOT.jar");
+ installPlugin( "maven-clean-plugin-1.2-SNAPSHOT.jar" );
- assertTrue(
- "upgraded clean plugin is not loaded properly",
- pluginManager.getGoalNames().contains("clean:other"));
+ assertTrue( "upgraded clean plugin is not loaded properly", pluginManager.getGoalNames()
+ .contains( "clean:other" ) );
//assertFalse("original clean plugin is not removed properly",
//pluginManager.getGoalNames().contains("clean:original"));
}
@@ -203,12 +206,13 @@
* @throws Exception when any error occurs
* @todo what is a valid way to check the correct plugin will be used?
*/
- public void testDowngrade() throws Exception
+ public void testDowngrade()
+ throws Exception
{
- installPlugin("maven-clean-plugin-1.0.jar");
+ installPlugin( "maven-clean-plugin-1.0.jar" );
- assertTrue("downgraded clean plugin is not loaded properly",
- pluginManager.getGoalNames().contains("clean:first"));
+ assertTrue( "downgraded clean plugin is not loaded properly", pluginManager.getGoalNames()
+ .contains( "clean:first" ) );
//assertFalse("original clean plugin is not removed properly",
//pluginManager.getGoalNames().contains("clean:original"));
}
@@ -218,12 +222,13 @@
* @param name the file name of the plugin to install relative to the source base
* @throws Exception when any error occurs
*/
- private void installPlugin(String name) throws Exception
+ private void installPlugin( String name )
+ throws Exception
{
- assertNotNull(pluginManager);
+ assertNotNull( pluginManager );
pluginManager.initialize();
- File pluginToInstall = new File(basedir + SOURCE_BASE + name);
- pluginManager.installPlugin(pluginToInstall, project);
+ File pluginToInstall = new File( basedir + SOURCE_BASE + name );
+ pluginManager.installPlugin( pluginToInstall, project );
}
/**
@@ -231,10 +236,11 @@
* @param name the file name of the plugin to install relative to the source base
* @throws Exception when any error occurs
*/
- private void deletePlugin(String name) throws Exception
+ private void deletePlugin( String name )
+ throws Exception
{
- File plugin = new File(fakeHome + "/plugins/" + name);
- if (plugin.exists())
+ File plugin = new File( fakeHome + "/plugins/" + name );
+ if ( plugin.exists() )
{
plugin.delete();
}
@@ -244,21 +250,22 @@
* Test extracted plugins are loaded from maven.home - for the bootstrap.
* @throws Exception on failure
*/
- public void testExtractedPluginInMavenHome() throws Exception
+ public void testExtractedPluginInMavenHome()
+ throws Exception
{
- assertNotNull(pluginManager);
+ assertNotNull( pluginManager );
pluginManager.initialize();
- assertTrue( "check extracted jar plugin is loaded",
- pluginManager.getGoalNames().contains( "jar:jar" ) );
+ assertTrue( "check extracted jar plugin is loaded", pluginManager.getGoalNames().contains( "jar:jar" ) );
}
/**
* Test plugin property substitution.
*/
- public void testPluginPropertySubstitution() throws Exception
+ public void testPluginPropertySubstitution()
+ throws Exception
{
- assertNotNull(pluginManager);
+ assertNotNull( pluginManager );
pluginManager.initialize();
pluginManager.setupBaseContext( project );
@@ -266,9 +273,9 @@
assertNotNull( "check context exists", context );
assertEquals( "check plugin.resources", fakeHome + FS + "plugins" + FS + "jar" + FS + "plugin-resources",
- ( (File) context.getVariable( "plugin.resources" ) ).getAbsolutePath() );
- assertEquals( "check plugin property", fakeHome + FS + "plugins" + FS + "jar" + FS +
- "plugin-resources/foo.bar", context.getVariable( "maven.jar.foo" ) );
+ ( (File) context.getVariable( "plugin.resources" ) ).getAbsolutePath() );
+ assertEquals( "check plugin property",
+ fakeHome + FS + "plugins" + FS + "jar" + FS + "plugin-resources/foo.bar", context
+ .getVariable( "maven.jar.foo" ) );
}
}
-
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/BasedirTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/BasedirTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/BasedirTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/BasedirTest.java Wed Jul 19 15:13:40 2006
@@ -17,60 +17,67 @@
* ====================================================================
*/
+import java.io.File;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.maven.MavenUtils;
-import java.io.File;
-
/**
* Test the semantics of basedir inside project.xml.
*
* @author Brett Porter <a href="mailto:brett@apache.org">brett@apache.org</a>
* @version $Id$
*/
-public class BasedirTest extends TestCase
+public class BasedirTest
+ extends TestCase
{
/**
* Test relative paths.
*/
- public void testRelativePaths() throws Exception
+ public void testRelativePaths()
+ throws Exception
{
String basedir = System.getProperty( "basedir" );
Project p = MavenUtils.getProject( new File( basedir, "src/test/basedir/extend-2/project.xml" ) );
assertEquals( "check group ID", p.getGroupId(), "maven" );
- assertEquals( "check source directory", p.getBuild().getSourceDirectory(), new File( basedir, "src/java" ).getCanonicalPath() );
+ assertEquals( "check source directory", p.getBuild().getSourceDirectory(), new File( basedir, "src/java" )
+ .getCanonicalPath() );
assertEquals( "check unit test source directory", p.getBuild().getUnitTestSourceDirectory(),
new File( basedir, "src/test" ).getCanonicalPath() );
assertEquals( "check iutest source directory", p.getBuild().getIntegrationUnitTestSourceDirectory(),
new File( basedir, "src/test" ).getCanonicalPath() );
- assertEquals( "check aspect source directory", p.getBuild().getAspectSourceDirectory(),
- new File( basedir, "src/java" ).getCanonicalPath() );
+ assertEquals( "check aspect source directory", p.getBuild().getAspectSourceDirectory(), new File( basedir,
+ "src/java" )
+ .getCanonicalPath() );
}
/**
* Test basedir relative paths.
*/
- public void testRelativePathsWithBasedir() throws Exception
+ public void testRelativePathsWithBasedir()
+ throws Exception
{
String basedir = System.getProperty( "basedir" );
Project p = MavenUtils.getProject( new File( basedir, "src/test/basedir/extend-1/project.xml" ) );
assertEquals( "check group ID", p.getGroupId(), "maven" );
- assertEquals( "check source directory", new File( p.getBuild().getSourceDirectory() ).getCanonicalPath(), new File( basedir, "src/java" ).getCanonicalPath() );
- assertEquals( "check unit test source directory", new File( p.getBuild().getUnitTestSourceDirectory() ).getCanonicalPath(),
- new File( basedir, "src/test" ).getCanonicalPath() );
- assertEquals( "check iutest source directory", new File( p.getBuild().getIntegrationUnitTestSourceDirectory() ).getCanonicalPath(),
- new File( basedir, "src/test" ).getCanonicalPath() );
- assertEquals( "check aspect source directory", new File( p.getBuild().getAspectSourceDirectory() ).getCanonicalPath(),
+ assertEquals( "check source directory", new File( p.getBuild().getSourceDirectory() ).getCanonicalPath(),
new File( basedir, "src/java" ).getCanonicalPath() );
+ assertEquals( "check unit test source directory", new File( p.getBuild().getUnitTestSourceDirectory() )
+ .getCanonicalPath(), new File( basedir, "src/test" ).getCanonicalPath() );
+ assertEquals( "check iutest source directory", new File( p.getBuild().getIntegrationUnitTestSourceDirectory() )
+ .getCanonicalPath(), new File( basedir, "src/test" ).getCanonicalPath() );
+ assertEquals( "check aspect source directory", new File( p.getBuild().getAspectSourceDirectory() )
+ .getCanonicalPath(), new File( basedir, "src/java" ).getCanonicalPath() );
}
/**
* Test relative paths (no ..).
*/
- public void testRelativePathsForwards() throws Exception
+ public void testRelativePathsForwards()
+ throws Exception
{
String basedir = System.getProperty( "basedir" );
Project p = MavenUtils.getProject( new File( basedir, "src/test/basedir/project.xml" ) );
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/LegacyIdTest.java Wed Jul 19 15:13:40 2006
@@ -17,12 +17,13 @@
* ====================================================================
*/
+import java.io.File;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.maven.MavenUtils;
-import java.io.File;
+import org.apache.maven.MavenUtils;
/**
* Test the semantics of ids inside project.xml.
@@ -112,8 +113,8 @@
public void testIdOnly()
throws Exception
{
- Project p = MavenUtils.getProject(
- new File( System.getProperty( "basedir" ), "src/test/test-data/pom/test-id-only.xml" ) );
+ Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/test-id-only.xml" ) );
assertEquals( "check id", "artifactId:artifactId", p.getId() );
assertEquals( "check artifact id", "artifactId", p.getArtifactId() );
assertEquals( "check group id", "artifactId", p.getGroupId() );
@@ -123,8 +124,8 @@
public void testGroupIdAndArtifactId()
throws Exception
{
- Project p = MavenUtils.getProject(
- new File( System.getProperty( "basedir" ), "src/test/test-data/pom/test-group-id-and-artifact-id.xml" ) );
+ Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/test-group-id-and-artifact-id.xml" ) );
assertEquals( "check id", "groupId:artifactId", p.getId() );
assertEquals( "check artifact id", "artifactId", p.getArtifactId() );
assertEquals( "check group id", "groupId", p.getGroupId() );
@@ -134,8 +135,9 @@
public void testGroupIdAndIdAsArtifactId()
throws Exception
{
- Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
- "src/test/test-data/pom/test-group-id-and-id-as-artifact-id.xml" ) );
+ Project p = MavenUtils
+ .getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/test-group-id-and-id-as-artifact-id.xml" ) );
assertEquals( "check id", "groupId:artifactId", p.getId() );
assertEquals( "check artifact id", "artifactId", p.getArtifactId() );
assertEquals( "check group id", "groupId", p.getGroupId() );
@@ -145,16 +147,16 @@
public void testExtendNone()
throws Exception
{
- Project p = MavenUtils.getProject(
- new File( System.getProperty( "basedir" ), "src/test/test-data/pom/extend/test-none.xml" ) );
+ Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-none.xml" ) );
assertEquals( "check group id", "base-groupId", p.getGroupId() );
}
public void testExtendIdOnly()
throws Exception
{
- Project p = MavenUtils.getProject(
- new File( System.getProperty( "basedir" ), "src/test/test-data/pom/extend/test-id-only.xml" ) );
+ Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-id-only.xml" ) );
assertEquals( "check id", "base-groupId:extend-artifactId", p.getId() );
assertEquals( "check artifact id", "extend-artifactId", p.getArtifactId() );
assertEquals( "check group id", "base-groupId", p.getGroupId() );
@@ -164,8 +166,8 @@
public void testExtendArtifactIdOnly()
throws Exception
{
- Project p = MavenUtils.getProject(
- new File( System.getProperty( "basedir" ), "src/test/test-data/pom/extend/test-artifact-id-only.xml" ) );
+ Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-artifact-id-only.xml" ) );
assertEquals( "check id", "base-groupId:extend-artifactId", p.getId() );
assertEquals( "check artifact id", "extend-artifactId", p.getArtifactId() );
assertEquals( "check group id", "base-groupId", p.getGroupId() );
@@ -175,8 +177,9 @@
public void testExtendArtifactIdOnlyOverMatching()
throws Exception
{
- Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
- "src/test/test-data/pom/extend/test-artifact-id-only-over-matching.xml" ) );
+ Project p = MavenUtils
+ .getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-artifact-id-only-over-matching.xml" ) );
assertEquals( "check id", "base-id:extend-artifactId", p.getId() );
assertEquals( "check artifact id", "extend-artifactId", p.getArtifactId() );
assertEquals( "check group id", "base-id", p.getGroupId() );
@@ -186,8 +189,9 @@
public void testExtendArtifactIdOnlyOverDifferent()
throws Exception
{
- Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
- "src/test/test-data/pom/extend/test-artifact-id-only-over-different.xml" ) );
+ Project p = MavenUtils
+ .getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-artifact-id-only-over-different.xml" ) );
assertEquals( "check id", "base-groupId:extend-artifactId", p.getId() );
assertEquals( "check artifact id", "extend-artifactId", p.getArtifactId() );
assertEquals( "check group id", "base-groupId", p.getGroupId() );
@@ -197,8 +201,8 @@
public void testExtendIdOverrideGroupId()
throws Exception
{
- Project p = MavenUtils.getProject(
- new File( System.getProperty( "basedir" ), "src/test/test-data/pom/extend/test-id-override-groupid.xml" ) );
+ Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-id-override-groupid.xml" ) );
assertEquals( "check id", "extend-artifactId:extend-artifactId", p.getId() );
assertEquals( "check artifact id", "extend-artifactId", p.getArtifactId() );
assertEquals( "check group id", "extend-artifactId", p.getGroupId() );
@@ -208,8 +212,9 @@
public void testExtendGroupIdAndArtifactId()
throws Exception
{
- Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
- "src/test/test-data/pom/extend/test-group-id-and-artifact-id.xml" ) );
+ Project p = MavenUtils
+ .getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-group-id-and-artifact-id.xml" ) );
assertEquals( "check id", "extend-groupId:extend-artifactId", p.getId() );
assertEquals( "check artifact id", "extend-artifactId", p.getArtifactId() );
assertEquals( "check group id", "extend-groupId", p.getGroupId() );
@@ -219,8 +224,9 @@
public void testExtendGroupIdAndIdAsArtifactId()
throws Exception
{
- Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
- "src/test/test-data/pom/extend/test-group-id-and-id-as-artifact-id.xml" ) );
+ Project p = MavenUtils
+ .getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/extend/test-group-id-and-id-as-artifact-id.xml" ) );
assertEquals( "check id", "extend-groupId:extend-artifactId", p.getId() );
assertEquals( "check artifact id", "extend-artifactId", p.getArtifactId() );
assertEquals( "check group id", "extend-groupId", p.getGroupId() );
@@ -230,14 +236,14 @@
public void testDependencies()
throws Exception
{
- Project p = MavenUtils.getProject(
- new File( System.getProperty( "basedir" ), "src/test/test-data/pom/dependencies.xml" ) );
+ Project p = MavenUtils.getProject( new File( System.getProperty( "basedir" ),
+ "src/test/test-data/pom/dependencies.xml" ) );
assertEquals( "check id", "ant:ant", p.getDependency( "ant:ant" ).getId() );
assertEquals( "check id with +", "ant:ant-optional", p.getDependency( "ant:ant-optional" ).getId() );
- assertEquals( "check id with -", "ant-optional:ant-optional",
- p.getDependency( "ant-optional:ant-optional" ).getId() );
- assertEquals( "check id with id and artifactId", "groupId:artifactId",
- p.getDependency( "groupId:artifactId" ).getId() );
+ assertEquals( "check id with -", "ant-optional:ant-optional", p.getDependency( "ant-optional:ant-optional" )
+ .getId() );
+ assertEquals( "check id with id and artifactId", "groupId:artifactId", p.getDependency( "groupId:artifactId" )
+ .getId() );
}
/**
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/project/ProjectInheritanceTest.java Wed Jul 19 15:13:40 2006
@@ -17,26 +17,30 @@
* ====================================================================
*/
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.maven.MavenUtils;
-import org.codehaus.plexus.util.StringUtils;
-
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.maven.MavenUtils;
+import org.codehaus.plexus.util.StringUtils;
+
public class ProjectInheritanceTest
extends TestCase
{
private String TEST_DOCUMENT = null;
+
private String TEST_DOCUMENT2 = null;
+
private String baseDir;
- private String FS = null;
-
+
+ private String FS = null;
+
public ProjectInheritanceTest( String testName )
{
super( testName );
@@ -47,7 +51,8 @@
return new TestSuite( ProjectInheritanceTest.class );
}
- protected void setUp() throws Exception
+ protected void setUp()
+ throws Exception
{
super.setUp();
baseDir = System.getProperty( "basedir" );
@@ -59,29 +64,28 @@
TEST_DOCUMENT2 = baseDir + "/src/test/extend/child_project/project-child2.xml";
}
- public void testProjectMapping() throws Exception
+ public void testProjectMapping()
+ throws Exception
{
Project p = MavenUtils.getProject( new File( TEST_DOCUMENT ) );
// Make sure the groupId is inherited correctly.
assertEquals( "groupId", p.getGroupId() );
-
+
assertEquals( "Super Extendo", p.getName() );
assertEquals( "groupId:super-extendo", p.getId() );
assertEquals( "Apache Software Foundation", p.getOrganization().getName() );
assertEquals( "http://www.apache.org/", p.getOrganization().getUrl() );
-
+
//Test siteAddress / siteDirectory
- assertEquals( "theSiteAddress", p.getSiteAddress());
- assertEquals( "theSiteDirectory", p.getSiteDirectory());
+ assertEquals( "theSiteAddress", p.getSiteAddress() );
+ assertEquals( "theSiteDirectory", p.getSiteDirectory() );
// Test Dependencies
- assertEquals( "child-dep1:child-dep1",
- ( (Dependency) p.getDependencies().get( 0 ) ).getId() );
- assertEquals( "1.0",
- ( (Dependency) p.getDependencies().get( 0 ) ).getVersion() );
+ assertEquals( "child-dep1:child-dep1", ( (Dependency) p.getDependencies().get( 0 ) ).getId() );
+ assertEquals( "1.0", ( (Dependency) p.getDependencies().get( 0 ) ).getVersion() );
- baseDir = new File(p.getContext().findVariable("basedir").toString()).getCanonicalPath();
+ baseDir = new File( p.getContext().findVariable( "basedir" ).toString() ).getCanonicalPath();
// Test Source Directories
assertEquals( baseDir + FS + "src" + FS + "java", p.getBuild().getSourceDirectory() );
// Unit Test Source Directories
@@ -91,8 +95,7 @@
//assertEquals("src/aspect", p.getBuild().getAspectSourceDirectory());
String iuSrc = p.getBuild().getIntegrationUnitTestSourceDirectory();
- assertTrue( "Should be empty in maven's project descriptor: [" + iuSrc + "]",
- StringUtils.isEmpty( iuSrc ) );
+ assertTrue( "Should be empty in maven's project descriptor: [" + iuSrc + "]", StringUtils.isEmpty( iuSrc ) );
// Unit Test patterns
List unitTestIncludes = p.getBuild().getUnitTest().getIncludes();
@@ -118,36 +121,38 @@
assertEquals( "1.0-b4", v4.getName() );
assertEquals( "MAVEN_1_0_B4", v4.getTag() );
}
-
- public void testProjectMappingExtends() throws Exception
+
+ public void testProjectMappingExtends()
+ throws Exception
{
Project p = MavenUtils.getProject( new File( TEST_DOCUMENT2 ) );
-
+
// Make sure the groupId is inherited correctly.
assertEquals( "groupId", p.getGroupId() );
-
+
assertEquals( "Child Project", p.getName() );
assertEquals( "groupId:child", p.getId() );
-
+
// Test organization inheritance.
assertNotNull( p.getOrganization() );
assertEquals( "Apache Software Foundation", p.getOrganization().getName() );
assertEquals( "http://www.apache.org/", p.getOrganization().getUrl() );
-
+
// Test siteAddress / siteDirectory
- assertEquals( "theSiteAddress", p.getSiteAddress());
- assertEquals( "theSiteDirectory", p.getSiteDirectory());
+ assertEquals( "theSiteAddress", p.getSiteAddress() );
+ assertEquals( "theSiteDirectory", p.getSiteDirectory() );
boolean found = false;
List resources = p.getBuild().getResources();
for ( Iterator i = resources.iterator(); i.hasNext(); )
{
- Resource r = ( Resource ) i.next();
+ Resource r = (Resource) i.next();
File dir = new File( p.getFile().getParent(), "src" + FS + "messages" ).getCanonicalFile();
if ( r.getDirectory().equals( dir.getPath() ) )
{
assertEquals( "check target path", "org/apache/maven/messages", r.getTargetPath() );
- assertEquals( "check includes", Arrays.asList( new String[] { "messages*.properties" } ), r.getIncludes() );
+ assertEquals( "check includes", Arrays.asList( new String[] { "messages*.properties" } ), r
+ .getIncludes() );
assertEquals( "check excludes", Collections.EMPTY_LIST, r.getExcludes() );
found = true;
}
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLFormatterTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLFormatterTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLFormatterTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLFormatterTest.java Wed Jul 19 15:13:40 2006
@@ -23,67 +23,72 @@
* @author Ben Walding
*
*/
-public class DVSLFormatterTest extends TestCase {
+public class DVSLFormatterTest
+ extends TestCase
+{
- public void testFormatNumberSimple() {
- testFormat("1", "1", "0");
-// testFormat("1.0", "1", "0.0");
-// testFormat("1.00", "1", "0.00");
-// testFormat("1.000", "1", "0.000");
-// testFormat("1.0000", "1", "0.0000");
-//
-// testFormat("1.10", "1.10", "0.00");
-// testFormat("1.100", "1.1000", "0.000");
-// testFormat("1.123", "1.1234", "0.000");
-// testFormat("1.1234", "1.1234", "0.0000");
+ public void testFormatNumberSimple()
+ {
+ testFormat( "1", "1", "0" );
+ // testFormat("1.0", "1", "0.0");
+ // testFormat("1.00", "1", "0.00");
+ // testFormat("1.000", "1", "0.000");
+ // testFormat("1.0000", "1", "0.0000");
+ //
+ // testFormat("1.10", "1.10", "0.00");
+ // testFormat("1.100", "1.1000", "0.000");
+ // testFormat("1.123", "1.1234", "0.000");
+ // testFormat("1.1234", "1.1234", "0.0000");
}
- public void testFormatNumberNegative() {
- testFormat("-1", "-1", "0");
-// testFormat("-1.0", "-1", "0.0");
-// testFormat("-1.00", "-1", "0.00");
-// testFormat("-1.000", "-1", "0.000");
-// testFormat("-1.0000", "-1", "0.0000");
-//
-// testFormat("-1.10", "-1.10", "0.00");
-// testFormat("-1.100", "-1.1000", "0.000");
-// testFormat("-1.123", "-1.1234", "0.000");
-// testFormat("-1.1234", "-1.1234", "0.0000");
+ public void testFormatNumberNegative()
+ {
+ testFormat( "-1", "-1", "0" );
+ // testFormat("-1.0", "-1", "0.0");
+ // testFormat("-1.00", "-1", "0.00");
+ // testFormat("-1.000", "-1", "0.000");
+ // testFormat("-1.0000", "-1", "0.0000");
+ //
+ // testFormat("-1.10", "-1.10", "0.00");
+ // testFormat("-1.100", "-1.1000", "0.000");
+ // testFormat("-1.123", "-1.1234", "0.000");
+ // testFormat("-1.1234", "-1.1234", "0.0000");
}
- public void testFormatNumberPercent() {
- testFormat("100%", "1", "0%");
-// testFormat("100.0%", "1", "0.0%");
-// testFormat("100.00%", "1", "0.00%");
-// testFormat("100.000%", "1", "0.000%");
-// testFormat("100.0000%", "1", "0.0000%");
-//
-// testFormat("-110.00%", "-1.10", "0.00%");
-// testFormat("-110.000%", "-1.1000", "0.000%");
-// testFormat("-112.340%", "-1.1234", "0.000%");
-// testFormat("-112.3400%", "-1.1234", "0.0000%");
+ public void testFormatNumberPercent()
+ {
+ testFormat( "100%", "1", "0%" );
+ // testFormat("100.0%", "1", "0.0%");
+ // testFormat("100.00%", "1", "0.00%");
+ // testFormat("100.000%", "1", "0.000%");
+ // testFormat("100.0000%", "1", "0.0000%");
+ //
+ // testFormat("-110.00%", "-1.10", "0.00%");
+ // testFormat("-110.000%", "-1.1000", "0.000%");
+ // testFormat("-112.340%", "-1.1234", "0.000%");
+ // testFormat("-112.3400%", "-1.1234", "0.0000%");
- testFormat("-100%", "-1", "0%");
-// testFormat("-100.0%", "-1", "0.0%");
-// testFormat("-100.00%", "-1", "0.00%");
-// testFormat("-100.000%", "-1", "0.000%");
-// testFormat("-100.0000%", "-1", "0.0000%");
-//
-// testFormat("-110.00%", "-1.10", "0.00%");
-// testFormat("-110.000%", "-1.1000", "0.000%");
-// testFormat("-112.340%", "-1.1234", "0.000%");
-// testFormat("-112.3400%", "-1.1234", "0.0000%");
+ testFormat( "-100%", "-1", "0%" );
+ // testFormat("-100.0%", "-1", "0.0%");
+ // testFormat("-100.00%", "-1", "0.00%");
+ // testFormat("-100.000%", "-1", "0.000%");
+ // testFormat("-100.0000%", "-1", "0.0000%");
+ //
+ // testFormat("-110.00%", "-1.10", "0.00%");
+ // testFormat("-110.000%", "-1.1000", "0.000%");
+ // testFormat("-112.340%", "-1.1234", "0.000%");
+ // testFormat("-112.3400%", "-1.1234", "0.0000%");
}
- protected void testFormat(String expected, String value, String pattern) {
- String actual = DVSLFormatter.formatNumber(value, pattern);
- String function =
- "DVSLFormatter.formatNumber(" + value + "," + pattern + ")";
- if (!actual.equals(expected)) {
- System.out.println(
- function + " Actual: " + actual + ", Expected: " + expected);
+ protected void testFormat( String expected, String value, String pattern )
+ {
+ String actual = DVSLFormatter.formatNumber( value, pattern );
+ String function = "DVSLFormatter.formatNumber(" + value + "," + pattern + ")";
+ if ( !actual.equals( expected ) )
+ {
+ System.out.println( function + " Actual: " + actual + ", Expected: " + expected );
}
- assertEquals(function, expected, actual);
+ assertEquals( function, expected, actual );
}
}
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLPathToolTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLPathToolTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLPathToolTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/DVSLPathToolTest.java Wed Jul 19 15:13:40 2006
@@ -27,7 +27,8 @@
* @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
* @version $Id$
*/
-public class DVSLPathToolTest extends TestCase
+public class DVSLPathToolTest
+ extends TestCase
{
/**
* Create the test case
@@ -52,23 +53,9 @@
*/
public void testGetDirectoryComponent()
{
- String[] test =
- {
- "file1.xml",
- "ref/file1",
- "/home/test/file2.vm",
- "d1\\d2\\d3\\file",
- "/d1/d2/"
- };
-
- String[] expected =
- {
- ".",
- "ref",
- "/home/test",
- "d1\\d2\\d3",
- "/d1/d2"
- };
+ String[] test = { "file1.xml", "ref/file1", "/home/test/file2.vm", "d1\\d2\\d3\\file", "/d1/d2/" };
+
+ String[] expected = { ".", "ref", "/home/test", "d1\\d2\\d3", "/d1/d2" };
for ( int i = 0; i < test.length; i++ )
{
@@ -81,93 +68,74 @@
*/
public void testGetRelativePath()
{
- TestArgs[] tests =
- {
- new TestArgs( "", "/home/www/html", "", "../.." ),
- new TestArgs( "/", "/home/www/html", "../..", "../.." ),
- new TestArgs( "", "/home/www/html/", "", "../.." ),
- new TestArgs( "/", "/home/www/html/", "../..", "../.." ),
- new TestArgs( "", "home/www/html", "", "../.." ),
- new TestArgs( "/", "home/www/html", "", "../.." ),
- new TestArgs( "", "home/www/html/", "", "../.." ),
- new TestArgs( "/", "home/www/html/", "", "../.." ),
- new TestArgs( "/", "/home", ".", "." ),
- new TestArgs( "/usr/local", null, "", "" ),
- new TestArgs( null, "/usr/local", "", ".." ),
- new TestArgs( null, null, "", "" ),
- new TestArgs( "/home/kaz", "/home/kaz", "", ".." ),
- new TestArgs( "/home/kaz", "/home/kaz/", "", ".." ),
- new TestArgs( "/home/kaz/", "/home/kaz", "", ".." ),
- new TestArgs( "/home/kaz/", "/home/kaz/", "", ".." ),
- new TestArgs( "/home/kaz", "/home/kaz/file.html", ".", "../.." ),
- new TestArgs( "/home/kaz/", "/home/kaz/file.html", ".", "../.." ),
- new TestArgs( "/home/kaz", "/home/kaz/howto/jeff.html", "..",
- "../../.." ),
- new TestArgs( "/home/", "/home/kaz/howto/images/", "../..",
- "../../.." ),
- new TestArgs( "/home/", "/home/kaz/howto/jeff.html", "../..",
- "../../.." ),
- new TestArgs( "/home/", "/home/kaz/howto/u/y/z/jeff.html",
- "../../../../..", "../../../../../.." ),
- new TestArgs( "/home/boston", "/usr/local/where/am/i", "",
- "../../../.." ),
- new TestArgs( "home/boston", "/usr/local/where/am/i", "",
- "../../../.." ),
- new TestArgs( "home/boston", "home/boston/where/am/i", "../..",
- "../../../.." ),
- new TestArgs( "", "\\home\\www\\html", "", "../.." ),
- new TestArgs( "\\", "\\home\\www\\html", "../..", "../.." ),
- new TestArgs( "", "\\home\\www\\html\\", "", "../.." ),
- new TestArgs( "\\", "\\home\\www\\html\\", "../..", "../.." ),
- new TestArgs( "", "home\\www\\html", "", "../.." ),
- new TestArgs( "\\", "home\\www\\html", "", "../.." ),
- new TestArgs( "", "home\\www\\html\\", "", "../.." ),
- new TestArgs( "\\", "home\\www\\html\\", "", "../.." ),
- new TestArgs( "\\", "\\home", ".", "." ),
- new TestArgs( "\\usr\\local", null, "", "" ),
- new TestArgs( null, "\\usr\\local", "", ".." ),
- new TestArgs( null, null, "", "" ),
- new TestArgs( "\\home\\kaz", "\\home\\kaz", "", ".." ),
- new TestArgs( "\\home\\kaz", "\\home\\kaz\\", "", ".." ),
- new TestArgs( "\\home\\kaz\\", "\\home\\kaz", "", ".." ),
- new TestArgs( "\\home\\kaz\\", "\\home\\kaz\\", "", ".." ),
- new TestArgs( "\\home\\kaz", "\\home\\kaz\\file.html", ".",
- "../.." ),
- new TestArgs( "\\home\\kaz\\", "\\home\\kaz\\file.html", ".",
- "../.." ),
- new TestArgs( "\\home\\kaz", "\\home\\kaz\\howto\\jeff.html", "..",
- "../../.." ),
- new TestArgs( "\\home\\", "\\home\\kaz\\howto\\images\\", "../..",
- "../../.." ),
- new TestArgs( "\\home\\", "\\home\\kaz\\howto\\jeff.html", "../..",
- "../../.." ),
- new TestArgs( "\\home\\", "\\home\\kaz\\howto\\u\\y\\z\\jeff.html",
- "../../../../..", "../../../../../.." ),
- new TestArgs( "\\home\\boston", "\\usr\\local\\where\\am\\i", "",
- "../../../.." ),
- new TestArgs( "home\\boston", "\\usr\\local\\where\\am\\i", "",
- "../../../.." ),
- new TestArgs( "home\\boston", "home\\boston\\where\\am\\i", "../..",
- "../../../.." ),
- new TestArgs( "/x/y/z/", "/x/y/z/a\\b\\c", ".", "../../.." ),
- new TestArgs( "/x/y/z/", "\\x\\y\\z\\a\\b\\c", "", "../../../../.." ),
- new TestArgs( "\\x\\y\\z", "\\x\\y\\z\\a/b\\c", "..", "../../../.." ),
- new TestArgs( "\\x\\y\\z/", "\\x\\y\\z/\\a/b\\c", "..",
- "../../../.." ),
- new TestArgs( "D:/a/b", "D:/a/b/c", ".", "../../.." ),
- new TestArgs( "d:/a/b", "D:/a/b/c.html", ".", "../../.." ),
- };
+ TestArgs[] tests = {
+ new TestArgs( "", "/home/www/html", "", "../.." ),
+ new TestArgs( "/", "/home/www/html", "../..", "../.." ),
+ new TestArgs( "", "/home/www/html/", "", "../.." ),
+ new TestArgs( "/", "/home/www/html/", "../..", "../.." ),
+ new TestArgs( "", "home/www/html", "", "../.." ),
+ new TestArgs( "/", "home/www/html", "", "../.." ),
+ new TestArgs( "", "home/www/html/", "", "../.." ),
+ new TestArgs( "/", "home/www/html/", "", "../.." ),
+ new TestArgs( "/", "/home", ".", "." ),
+ new TestArgs( "/usr/local", null, "", "" ),
+ new TestArgs( null, "/usr/local", "", ".." ),
+ new TestArgs( null, null, "", "" ),
+ new TestArgs( "/home/kaz", "/home/kaz", "", ".." ),
+ new TestArgs( "/home/kaz", "/home/kaz/", "", ".." ),
+ new TestArgs( "/home/kaz/", "/home/kaz", "", ".." ),
+ new TestArgs( "/home/kaz/", "/home/kaz/", "", ".." ),
+ new TestArgs( "/home/kaz", "/home/kaz/file.html", ".", "../.." ),
+ new TestArgs( "/home/kaz/", "/home/kaz/file.html", ".", "../.." ),
+ new TestArgs( "/home/kaz", "/home/kaz/howto/jeff.html", "..", "../../.." ),
+ new TestArgs( "/home/", "/home/kaz/howto/images/", "../..", "../../.." ),
+ new TestArgs( "/home/", "/home/kaz/howto/jeff.html", "../..", "../../.." ),
+ new TestArgs( "/home/", "/home/kaz/howto/u/y/z/jeff.html", "../../../../..", "../../../../../.." ),
+ new TestArgs( "/home/boston", "/usr/local/where/am/i", "", "../../../.." ),
+ new TestArgs( "home/boston", "/usr/local/where/am/i", "", "../../../.." ),
+ new TestArgs( "home/boston", "home/boston/where/am/i", "../..", "../../../.." ),
+ new TestArgs( "", "\\home\\www\\html", "", "../.." ),
+ new TestArgs( "\\", "\\home\\www\\html", "../..", "../.." ),
+ new TestArgs( "", "\\home\\www\\html\\", "", "../.." ),
+ new TestArgs( "\\", "\\home\\www\\html\\", "../..", "../.." ),
+ new TestArgs( "", "home\\www\\html", "", "../.." ),
+ new TestArgs( "\\", "home\\www\\html", "", "../.." ),
+ new TestArgs( "", "home\\www\\html\\", "", "../.." ),
+ new TestArgs( "\\", "home\\www\\html\\", "", "../.." ),
+ new TestArgs( "\\", "\\home", ".", "." ),
+ new TestArgs( "\\usr\\local", null, "", "" ),
+ new TestArgs( null, "\\usr\\local", "", ".." ),
+ new TestArgs( null, null, "", "" ),
+ new TestArgs( "\\home\\kaz", "\\home\\kaz", "", ".." ),
+ new TestArgs( "\\home\\kaz", "\\home\\kaz\\", "", ".." ),
+ new TestArgs( "\\home\\kaz\\", "\\home\\kaz", "", ".." ),
+ new TestArgs( "\\home\\kaz\\", "\\home\\kaz\\", "", ".." ),
+ new TestArgs( "\\home\\kaz", "\\home\\kaz\\file.html", ".", "../.." ),
+ new TestArgs( "\\home\\kaz\\", "\\home\\kaz\\file.html", ".", "../.." ),
+ new TestArgs( "\\home\\kaz", "\\home\\kaz\\howto\\jeff.html", "..", "../../.." ),
+ new TestArgs( "\\home\\", "\\home\\kaz\\howto\\images\\", "../..", "../../.." ),
+ new TestArgs( "\\home\\", "\\home\\kaz\\howto\\jeff.html", "../..", "../../.." ),
+ new TestArgs( "\\home\\", "\\home\\kaz\\howto\\u\\y\\z\\jeff.html", "../../../../..", "../../../../../.." ),
+ new TestArgs( "\\home\\boston", "\\usr\\local\\where\\am\\i", "", "../../../.." ),
+ new TestArgs( "home\\boston", "\\usr\\local\\where\\am\\i", "", "../../../.." ),
+ new TestArgs( "home\\boston", "home\\boston\\where\\am\\i", "../..", "../../../.." ),
+ new TestArgs( "/x/y/z/", "/x/y/z/a\\b\\c", ".", "../../.." ),
+ new TestArgs( "/x/y/z/", "\\x\\y\\z\\a\\b\\c", "", "../../../../.." ),
+ new TestArgs( "\\x\\y\\z", "\\x\\y\\z\\a/b\\c", "..", "../../../.." ),
+ new TestArgs( "\\x\\y\\z/", "\\x\\y\\z/\\a/b\\c", "..", "../../../.." ),
+ new TestArgs( "D:/a/b", "D:/a/b/c", ".", "../../.." ),
+ new TestArgs( "d:/a/b", "D:/a/b/c.html", ".", "../../.." ), };
for ( int i = 0; i < tests.length; i++ )
{
- assertEquals( tests[i].toString(), tests[i].expected,
- DVSLPathTool.getRelativePath( tests[i].basedir, tests[i].filename ) );
+ assertEquals( tests[i].toString(), tests[i].expected, DVSLPathTool.getRelativePath( tests[i].basedir,
+ tests[i].filename ) );
}
for ( int i = 0; i < tests.length; i++ )
{
- assertEquals( tests[i].toString(), tests[i].expectedNoBase,
- DVSLPathTool.getRelativePath( tests[i].filename ) );
+ assertEquals( tests[i].toString(), tests[i].expectedNoBase, DVSLPathTool
+ .getRelativePath( tests[i].filename ) );
}
}
@@ -186,13 +154,16 @@
{
/** base directory for tests */
private String basedir;
+
/** the file to test*/
private String filename;
+
/**
* expected result when calling <code>getRelativePath(basedir,
* filename)</code>.
*/
private String expected;
+
/**
* expected result when calling <code>getRelativePath(filename)</code>.
*/
@@ -233,35 +204,37 @@
return sb.toString();
}
}
-
- public void testUppercaseDrive() {
- assertEquals("c:/b/", "C:/b/", DVSLPathTool.uppercaseDrive("c:/b/"));
- assertEquals("c:", "C:", DVSLPathTool.uppercaseDrive("c:"));
- assertEquals(".", ".", DVSLPathTool.uppercaseDrive("."));
- assertEquals("null", null, DVSLPathTool.uppercaseDrive(null));
-
+
+ public void testUppercaseDrive()
+ {
+ assertEquals( "c:/b/", "C:/b/", DVSLPathTool.uppercaseDrive( "c:/b/" ) );
+ assertEquals( "c:", "C:", DVSLPathTool.uppercaseDrive( "c:" ) );
+ assertEquals( ".", ".", DVSLPathTool.uppercaseDrive( "." ) );
+ assertEquals( "null", null, DVSLPathTool.uppercaseDrive( null ) );
+
}
-
- public void testCalculateLink(String expected, String link, String relativePath)
+
+ public void testCalculateLink( String expected, String link, String relativePath )
{
- String actual = DVSLPathTool.calculateLink(link, relativePath);
+ String actual = DVSLPathTool.calculateLink( link, relativePath );
String function = "DVSLPathTool.calculateLink(" + link + "," + relativePath + ")";
- if (!expected.equals(actual)) {
- System.out.println("Function:" + function);
- System.out.println("Actual:" + actual);
- System.out.println("Expected:" + expected);
+ if ( !expected.equals( actual ) )
+ {
+ System.out.println( "Function:" + function );
+ System.out.println( "Actual:" + actual );
+ System.out.println( "Expected:" + expected );
}
- assertEquals(function, expected, actual);
+ assertEquals( function, expected, actual );
}
public void testCalculateLink()
{
- testCalculateLink("/bob.html", "/absolute//bob.html", "..");
- testCalculateLink("http://crazyhorse.com", "/absolute/http://crazyhorse.com", "..");
- testCalculateLink("http://crazyhorse.com", "http://crazyhorse.com", "..");
- testCalculateLink("../index.html", "/index.html", "..");
- testCalculateLink("index.html", "/index.html", ".");
- testCalculateLink("../other-module/index.html", "../other-module/index.html", ".");
- testCalculateLink("../../other-module/index.html", "../other-module/index.html", "..");
+ testCalculateLink( "/bob.html", "/absolute//bob.html", ".." );
+ testCalculateLink( "http://crazyhorse.com", "/absolute/http://crazyhorse.com", ".." );
+ testCalculateLink( "http://crazyhorse.com", "http://crazyhorse.com", ".." );
+ testCalculateLink( "../index.html", "/index.html", ".." );
+ testCalculateLink( "index.html", "/index.html", "." );
+ testCalculateLink( "../other-module/index.html", "../other-module/index.html", "." );
+ testCalculateLink( "../../other-module/index.html", "../other-module/index.html", ".." );
}
}
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/EnhancedStringTokenizerTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/EnhancedStringTokenizerTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/EnhancedStringTokenizerTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/EnhancedStringTokenizerTest.java Wed Jul 19 15:13:40 2006
@@ -19,99 +19,101 @@
import junit.framework.TestCase;
-public class EnhancedStringTokenizerTest extends TestCase
+public class EnhancedStringTokenizerTest
+ extends TestCase
{
- public EnhancedStringTokenizerTest(String name)
+ public EnhancedStringTokenizerTest( String name )
{
- super(name);
+ super( name );
}
- protected void setUp() throws Exception
+ protected void setUp()
+ throws Exception
{
}
- protected void tearDown() throws Exception
+ protected void tearDown()
+ throws Exception
{
}
public void testSimple()
{
- EnhancedStringTokenizer tok = new EnhancedStringTokenizer("a,b,c,d,,e,,,f,,,,,g", ",");
- checkTokens(tok);
+ EnhancedStringTokenizer tok = new EnhancedStringTokenizer( "a,b,c,d,,e,,,f,,,,,g", "," );
+ checkTokens( tok );
}
/**
* @param tok The tokenizer to check
*/
- private void checkTokens(EnhancedStringTokenizer tok)
+ private void checkTokens( EnhancedStringTokenizer tok )
{
- assertEquals("Token 1", "a", tok.nextToken());
- assertEquals("Token 2", "b", tok.nextToken());
- assertEquals("Token 3", "c", tok.nextToken());
- assertEquals("Token 4", "d", tok.nextToken());
- assertEquals("Token 5", "", tok.nextToken());
- assertEquals("Token 6", "e", tok.nextToken());
- assertEquals("Token 7", "", tok.nextToken());
- assertEquals("Token 8", "", tok.nextToken());
- assertEquals("Token 9", "f", tok.nextToken());
- assertEquals("Token 10", "", tok.nextToken());
- assertEquals("Token 11", "", tok.nextToken());
- assertEquals("Token 12", "", tok.nextToken());
- assertEquals("Token 13", "", tok.nextToken());
- assertEquals("Token 14", "g", tok.nextToken());
- assertEquals("tok.hasMoreTokens()", false, tok.hasMoreTokens());
+ assertEquals( "Token 1", "a", tok.nextToken() );
+ assertEquals( "Token 2", "b", tok.nextToken() );
+ assertEquals( "Token 3", "c", tok.nextToken() );
+ assertEquals( "Token 4", "d", tok.nextToken() );
+ assertEquals( "Token 5", "", tok.nextToken() );
+ assertEquals( "Token 6", "e", tok.nextToken() );
+ assertEquals( "Token 7", "", tok.nextToken() );
+ assertEquals( "Token 8", "", tok.nextToken() );
+ assertEquals( "Token 9", "f", tok.nextToken() );
+ assertEquals( "Token 10", "", tok.nextToken() );
+ assertEquals( "Token 11", "", tok.nextToken() );
+ assertEquals( "Token 12", "", tok.nextToken() );
+ assertEquals( "Token 13", "", tok.nextToken() );
+ assertEquals( "Token 14", "g", tok.nextToken() );
+ assertEquals( "tok.hasMoreTokens()", false, tok.hasMoreTokens() );
}
public void testSimpleTab()
{
- EnhancedStringTokenizer tok =
- new EnhancedStringTokenizer("a\tb\tc\td\t\te\t\t\tf\t\t\t\t\tg", "\t");
- checkTokens(tok);
+ EnhancedStringTokenizer tok = new EnhancedStringTokenizer( "a\tb\tc\td\t\te\t\t\tf\t\t\t\t\tg", "\t" );
+ checkTokens( tok );
}
public void testNoDelim()
{
- EnhancedStringTokenizer tok = new EnhancedStringTokenizer("a,b,c,d,,e,,,f,,,,,g", "\t");
- assertEquals("Token 1", "a,b,c,d,,e,,,f,,,,,g", tok.nextToken());
- assertEquals("tok.hasMoreTokens()", false, tok.hasMoreTokens());
+ EnhancedStringTokenizer tok = new EnhancedStringTokenizer( "a,b,c,d,,e,,,f,,,,,g", "\t" );
+ assertEquals( "Token 1", "a,b,c,d,,e,,,f,,,,,g", tok.nextToken() );
+ assertEquals( "tok.hasMoreTokens()", false, tok.hasMoreTokens() );
}
public void testNoText()
{
- EnhancedStringTokenizer tok = new EnhancedStringTokenizer("", ",");
- assertEquals("tok.hasMoreTokens()", false, tok.hasMoreTokens());
+ EnhancedStringTokenizer tok = new EnhancedStringTokenizer( "", "," );
+ assertEquals( "tok.hasMoreTokens()", false, tok.hasMoreTokens() );
}
public void testReturnDelim()
{
- EnhancedStringTokenizer tok = new EnhancedStringTokenizer("a,b,,c,d", ",", true);
- assertEquals("Token 1", "a", tok.nextToken());
- assertEquals("Token 2", ",", tok.nextToken());
- assertEquals("Token 3", "b", tok.nextToken());
- assertEquals("Token 4", ",", tok.nextToken());
- assertEquals("Token 5", "", tok.nextToken());
- assertEquals("Token 6", ",", tok.nextToken());
- assertEquals("Token 7", "c", tok.nextToken());
- assertEquals("Token 2", ",", tok.nextToken());
- assertEquals("Token 8", "d", tok.nextToken());
- assertEquals("tok.hasMoreTokens()", false, tok.hasMoreTokens());
+ EnhancedStringTokenizer tok = new EnhancedStringTokenizer( "a,b,,c,d", ",", true );
+ assertEquals( "Token 1", "a", tok.nextToken() );
+ assertEquals( "Token 2", ",", tok.nextToken() );
+ assertEquals( "Token 3", "b", tok.nextToken() );
+ assertEquals( "Token 4", ",", tok.nextToken() );
+ assertEquals( "Token 5", "", tok.nextToken() );
+ assertEquals( "Token 6", ",", tok.nextToken() );
+ assertEquals( "Token 7", "c", tok.nextToken() );
+ assertEquals( "Token 2", ",", tok.nextToken() );
+ assertEquals( "Token 8", "d", tok.nextToken() );
+ assertEquals( "tok.hasMoreTokens()", false, tok.hasMoreTokens() );
}
public void testMultipleDelim()
{
- EnhancedStringTokenizer tok = new EnhancedStringTokenizer("a.,b.,c.d", ".,", true);
- assertEquals("Token 1", "a", tok.nextToken());
- assertEquals("Token 2", ".", tok.nextToken());
- assertEquals("Token 3", "", tok.nextToken());
- assertEquals("Token 4", ",", tok.nextToken());
- assertEquals("Token 5", "b", tok.nextToken());
- assertEquals("Token 6", ".", tok.nextToken());
- assertEquals("Token 7", "", tok.nextToken());
- assertEquals("Token 8", ",", tok.nextToken());
- assertEquals("Token 9", "c", tok.nextToken());
- assertEquals("Token 10", ".", tok.nextToken());
- assertEquals("Token 11", "d", tok.nextToken());
- assertEquals("tok.hasMoreTokens()", false, tok.hasMoreTokens());
+ EnhancedStringTokenizer tok = new EnhancedStringTokenizer( "a.,b.,c.d", ".,", true );
+ assertEquals( "Token 1", "a", tok.nextToken() );
+ assertEquals( "Token 2", ".", tok.nextToken() );
+ assertEquals( "Token 3", "", tok.nextToken() );
+ assertEquals( "Token 4", ",", tok.nextToken() );
+ assertEquals( "Token 5", "b", tok.nextToken() );
+ assertEquals( "Token 6", ".", tok.nextToken() );
+ assertEquals( "Token 7", "", tok.nextToken() );
+ assertEquals( "Token 8", ",", tok.nextToken() );
+ assertEquals( "Token 9", "c", tok.nextToken() );
+ assertEquals( "Token 10", ".", tok.nextToken() );
+ assertEquals( "Token 11", "d", tok.nextToken() );
+ assertEquals( "tok.hasMoreTokens()", false, tok.hasMoreTokens() );
}
}
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/InsertionOrderedSetTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/InsertionOrderedSetTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/InsertionOrderedSetTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/InsertionOrderedSetTest.java Wed Jul 19 15:13:40 2006
@@ -31,19 +31,26 @@
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
-public class InsertionOrderedSetTest extends TestCase
+public class InsertionOrderedSetTest
+ extends TestCase
{
private Set set = new InsertionOrderedSet();
private static final String STRING_1 = "zzz";
+
private static final String STRING_2 = "qqq";
+
private static final String STRING_3 = "www";
private static final HashSet REMOVED_ELEMENT_SET = new HashSet( Arrays.asList( new String[] { STRING_1, STRING_3 } ) );
- private static final HashSet OUTPUT_SET = new HashSet( Arrays.asList( new String[] { STRING_1, STRING_2, STRING_3 } ) );
+
+ private static final HashSet OUTPUT_SET = new HashSet( Arrays
+ .asList( new String[] { STRING_1, STRING_2, STRING_3 } ) );
+
private static final List INPUT_SET = Arrays.asList( new String[] { STRING_1, STRING_2, STRING_1, STRING_3 } );
-
- public void setUp() throws Exception
+
+ public void setUp()
+ throws Exception
{
}
@@ -98,6 +105,5 @@
assertEquals( REMOVED_ELEMENT_SET, set );
}
-
-}
+}
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MD5SumTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MD5SumTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MD5SumTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MD5SumTest.java Wed Jul 19 15:13:40 2006
@@ -17,12 +17,12 @@
* ====================================================================
*/
+import java.io.File;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import java.io.File;
-
/**
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @version $Id$
@@ -55,8 +55,8 @@
throws Exception
{
MD5Sum md5 = new MD5Sum();
- String basedir = System.getProperty("basedir");
- assertNotNull("basedir not provided", basedir);
+ String basedir = System.getProperty( "basedir" );
+ assertNotNull( "basedir not provided", basedir );
md5.setFile( new File( basedir + "/src/test/checksum/input.jar" ) );
md5.execute();
String checksum = md5.getChecksum();
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MavenToolTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MavenToolTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MavenToolTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/MavenToolTest.java Wed Jul 19 15:13:40 2006
@@ -17,30 +17,26 @@
* ====================================================================
*/
+import java.io.File;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import java.io.File;
-
/**
* Unit test for <code>MavenTool</code>.
*
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @version $Id$
*/
-public class MavenToolTest extends TestCase
+public class MavenToolTest
+ extends TestCase
{
/** fragment to be resolved */
- private static final String NEEDLE =
- "org/apache/maven/util/MavenTool.java";
+ private static final String NEEDLE = "org/apache/maven/util/MavenTool.java";
+
/** where to search for the fragment */
- private static final String[] HAYSTACK =
- {
- "docs",
- "src" + File.separator + "java",
- "xdocs"
- };
+ private static final String[] HAYSTACK = { "docs", "src" + File.separator + "java", "xdocs" };
/**
* Create the test with the given name
@@ -75,7 +71,6 @@
assertNotNull( "The system property basedir was not defined.", basedir );
String path = tool.resolvePathFragment( basedir, NEEDLE, HAYSTACK );
- assertEquals( "Couldn't resolve fragment using a base directory of "
- + basedir, HAYSTACK[1], path );
+ assertEquals( "Couldn't resolve fragment using a base directory of " + basedir, HAYSTACK[1], path );
}
}
Modified: maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/StringToolTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/StringToolTest.java?rev=423634&r1=423633&r2=423634&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/StringToolTest.java (original)
+++ maven/maven-1/core/trunk/src/test/java/org/apache/maven/util/StringToolTest.java Wed Jul 19 15:13:40 2006
@@ -17,20 +17,22 @@
* ====================================================================
*/
-import junit.framework.TestCase;
-
import java.util.List;
+import junit.framework.TestCase;
+
/**
* @author Ben Walding
*
*/
-public class StringToolTest extends TestCase
+public class StringToolTest
+ extends TestCase
{
private StringTool cst;
- public StringToolTest(String name)
+
+ public StringToolTest( String name )
{
- super(name);
+ super( name );
}
public void setUp()
@@ -45,19 +47,19 @@
public void testSplitStringAtLastDelim()
{
- testSplitStringAtLastDelim("org.apache.maven.StringTool", ".", "org.apache.maven", "StringTool");
- testSplitStringAtLastDelim("org/apache/maven/StringTool.java", ".", "org/apache/maven/StringTool", "java");
- testSplitStringAtLastDelim("org.apache.maven.StringTool", "|", "org.apache.maven.StringTool", "");
- testSplitStringAtLastDelim(null, null, null, null);
+ testSplitStringAtLastDelim( "org.apache.maven.StringTool", ".", "org.apache.maven", "StringTool" );
+ testSplitStringAtLastDelim( "org/apache/maven/StringTool.java", ".", "org/apache/maven/StringTool", "java" );
+ testSplitStringAtLastDelim( "org.apache.maven.StringTool", "|", "org.apache.maven.StringTool", "" );
+ testSplitStringAtLastDelim( null, null, null, null );
}
- public void testSplitStringAtLastDelim(String input, String delim, String s0, String s1)
+ public void testSplitStringAtLastDelim( String input, String delim, String s0, String s1 )
{
- List result = cst.splitStringAtLastDelim(input, delim);
+ List result = cst.splitStringAtLastDelim( input, delim );
String f = "splitStringAtLastDelim(" + input + "," + delim + ")";
- assertEquals(f + "[0]", s0, result.get(0));
- assertEquals(f + "[1]", s1, result.get(1));
+ assertEquals( f + "[0]", s0, result.get( 0 ) );
+ assertEquals( f + "[1]", s1, result.get( 1 ) );
}
}