minor clean up

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@278662 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-05 02:12:44 +00:00
parent 488cac14ff
commit 31e79ea14f
7 changed files with 149 additions and 161 deletions

View File

@ -316,11 +316,11 @@ public class MBoot
reader.parse( new File( basedir, "maven-plugins/maven-surefire-plugin/pom.xml" ) ); reader.parse( new File( basedir, "maven-plugins/maven-surefire-plugin/pom.xml" ) );
List surefireDependencies = new ArrayList(); List surefireDependencies = new ArrayList();
// TODO: while we have maven-artifact in there, it needs to be filtered... // while we have maven-artifact in there, it needs to be filtered...
for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); ) for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); )
{ {
Dependency d = (Dependency) i.next(); Dependency d = (Dependency) i.next();
if ( d.getGroupId().equals( "surefire" ) || d.getGroupId().equals( "junit" ) ) if ( "surefire".equals( d.getGroupId() ) || "junit".equals( d.getGroupId() ) )
{ {
surefireDependencies.add( d ); surefireDependencies.add( d );
} }
@ -817,6 +817,7 @@ public class MBoot
if ( version.indexOf( "SNAPSHOT" ) >= 0 ) if ( version.indexOf( "SNAPSHOT" ) >= 0 )
{ {
// TODO: replace
File metadata = localRepository.getMetadataFile( groupId, artifactId, version, type, File metadata = localRepository.getMetadataFile( groupId, artifactId, version, type,
finalName + ".version.txt" ); finalName + ".version.txt" );
@ -827,6 +828,7 @@ public class MBoot
FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + finalName + ".jar" ), file ); FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + finalName + ".jar" ), file );
// TODO: replace
file = localRepository.getMetadataFile( groupId, artifactId, null, type, artifactId + "-RELEASE.version.txt" ); file = localRepository.getMetadataFile( groupId, artifactId, null, type, artifactId + "-RELEASE.version.txt" );
IOUtil.copy( new StringReader( version ), new FileWriter( file ) ); IOUtil.copy( new StringReader( version ), new FileWriter( file ) );
} }

View File

@ -60,9 +60,8 @@ public class JavacCompiler
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
// TODO: use getLogger() - but for some reason it is null when this is used
System.out.println( "Compiling " + sources.length + " source file" + ( sources.length == 1 ? "" : "s" ) + System.out.println( "Compiling " + sources.length + " source file" + ( sources.length == 1 ? "" : "s" ) +
" to " + destinationDir.getAbsolutePath() ); " to " + destinationDir.getAbsolutePath() );
Map compilerOptions = config.getCompilerOptions(); Map compilerOptions = config.getCompilerOptions();

View File

@ -34,23 +34,20 @@ import java.net.URLConnection;
* @author costin@dnt.ro * @author costin@dnt.ro
* @author gg@grtmail.com (Added Java 1.1 style HTTP basic auth) * @author gg@grtmail.com (Added Java 1.1 style HTTP basic auth)
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a> * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
* @todo Need to add a timeout so we can flip to a backup repository.
* @todo Download everything in a single session.
* @todo Throw meaningful exception when authentication fails.
*/ */
public class HttpUtils public class HttpUtils
{ {
/** /**
* Use a proxy to bypass the firewall with or without authentication * Use a proxy to bypass the firewall with or without authentication
* *
* @param proxyHost Proxy Host (if proxy is required), or null * @param proxyHost Proxy Host (if proxy is required), or null
* @param proxyPort Proxy Port (if proxy is required), or null * @param proxyPort Proxy Port (if proxy is required), or null
* @param proxyUserName Proxy Username (if authentification is required), * @param proxyUserName Proxy Username (if authentification is required),
* or null * or null
* @param proxyPassword Proxy Password (if authentification is required), * @param proxyPassword Proxy Password (if authentification is required),
* or null * or null
* @throws SecurityException if an operation is not authorized by the * @throws SecurityException if an operation is not authorized by the
* SecurityManager * SecurityManager
*/ */
public static void useProxyUser( final String proxyHost, final String proxyPort, final String proxyUserName, public static void useProxyUser( final String proxyHost, final String proxyPort, final String proxyUserName,
final String proxyPassword ) final String proxyPassword )
@ -67,8 +64,8 @@ public class HttpUtils
{ {
protected PasswordAuthentication getPasswordAuthentication() protected PasswordAuthentication getPasswordAuthentication()
{ {
return new PasswordAuthentication( proxyUserName, proxyPassword == null return new PasswordAuthentication( proxyUserName, proxyPassword == null ? new char[0]
? new char[0] : proxyPassword.toCharArray() ); : proxyPassword.toCharArray() );
} }
} ); } );
} }
@ -79,20 +76,20 @@ public class HttpUtils
* Retrieve a remote file. Throws an Exception on errors unless the * Retrieve a remote file. Throws an Exception on errors unless the
* ifnoreErrors flag is set to True * ifnoreErrors flag is set to True
* *
* @param url the of the file to retrieve * @param url the of the file to retrieve
* @param destinationFile where to store it * @param destinationFile where to store it
* @param ignoreErrors whether to ignore errors during I/O or throw an * @param ignoreErrors whether to ignore errors during I/O or throw an
* exception when they happen * exception when they happen
* @param useTimestamp whether to check the modified timestamp on the * @param useTimestamp whether to check the modified timestamp on the
* <code>destinationFile</code> against the remote <code>source</code> * <code>destinationFile</code> against the remote <code>source</code>
* @param proxyHost Proxy Host (if proxy is required), or null * @param proxyHost Proxy Host (if proxy is required), or null
* @param proxyPort Proxy Port (if proxy is required), or null * @param proxyPort Proxy Port (if proxy is required), or null
* @param proxyUserName Proxy Username (if authentification is required), * @param proxyUserName Proxy Username (if authentification is required),
* or null. * or null.
* @param proxyPassword Proxy Password (if authentification is required), * @param proxyPassword Proxy Password (if authentification is required),
* or null. * or null.
* @param useChecksum Flag to indicate the use of the checksum for the retrieved * @param useChecksum Flag to indicate the use of the checksum for the retrieved
* artifact if it is available. * artifact if it is available.
* @throws IOException If an I/O exception occurs. * @throws IOException If an I/O exception occurs.
*/ */
public static void getFile( String url, File destinationFile, boolean ignoreErrors, boolean useTimestamp, public static void getFile( String url, File destinationFile, boolean ignoreErrors, boolean useTimestamp,
@ -125,18 +122,18 @@ public class HttpUtils
* Retrieve a remote file. Throws an Exception on errors unless the * Retrieve a remote file. Throws an Exception on errors unless the
* ifnoreErrors flag is set to True * ifnoreErrors flag is set to True
* *
* @param url the of the file to retrieve * @param url the of the file to retrieve
* @param destinationFile where to store it * @param destinationFile where to store it
* @param ignoreErrors whether to ignore errors during I/O or throw an * @param ignoreErrors whether to ignore errors during I/O or throw an
* exception when they happen * exception when they happen
* @param useTimestamp whether to check the modified timestamp on the * @param useTimestamp whether to check the modified timestamp on the
* <code>destinationFile</code> against the remote <code>source</code> * <code>destinationFile</code> against the remote <code>source</code>
* @param proxyHost Proxy Host (if proxy is required), or null * @param proxyHost Proxy Host (if proxy is required), or null
* @param proxyPort Proxy Port (if proxy is required), or null * @param proxyPort Proxy Port (if proxy is required), or null
* @param proxyUserName Proxy Username (if authentification is required), * @param proxyUserName Proxy Username (if authentification is required),
* or null * or null
* @param proxyPassword Proxy Password (if authentification is required), * @param proxyPassword Proxy Password (if authentification is required),
* or null * or null
* @throws IOException If an I/O exception occurs. * @throws IOException If an I/O exception occurs.
*/ */
public static void getFile( String url, File destinationFile, boolean ignoreErrors, boolean useTimestamp, public static void getFile( String url, File destinationFile, boolean ignoreErrors, boolean useTimestamp,
@ -166,17 +163,17 @@ public class HttpUtils
/** /**
* Retrieve a remote file. * Retrieve a remote file.
* *
* @param url the URL of the file to retrieve * @param url the URL of the file to retrieve
* @param destinationFile where to store it * @param destinationFile where to store it
* @param timestamp if provided, the remote URL is only retrieved if it was * @param timestamp if provided, the remote URL is only retrieved if it was
* modified more recently than timestamp. Otherwise, negative value indicates that * modified more recently than timestamp. Otherwise, negative value indicates that
* the remote URL should be retrieved unconditionally. * the remote URL should be retrieved unconditionally.
* @param proxyHost Proxy Host (if proxy is required), or null * @param proxyHost Proxy Host (if proxy is required), or null
* @param proxyPort Proxy Port (if proxy is required), or null * @param proxyPort Proxy Port (if proxy is required), or null
* @param proxyUserName Proxy Username (if authentification is required), * @param proxyUserName Proxy Username (if authentification is required),
* or null * or null
* @param proxyPassword Proxy Password (if authentification is required), * @param proxyPassword Proxy Password (if authentification is required),
* or null * or null
* @throws IOException If an I/O exception occurs. * @throws IOException If an I/O exception occurs.
*/ */
public static void getFile( String url, File destinationFile, long timestamp, String proxyHost, String proxyPort, public static void getFile( String url, File destinationFile, long timestamp, String proxyHost, String proxyPort,
@ -223,8 +220,7 @@ public class HttpUtils
if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND ) if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND )
{ {
throw new FileNotFoundException( url.toString() + " (HTTP Error: " + httpConnection.getResponseCode() + throw new FileNotFoundException( url.toString() + " (HTTP Error: " + httpConnection.getResponseCode() +
" " + " " + httpConnection.getResponseMessage() + ")" );
httpConnection.getResponseMessage() + ")" );
} }
if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED ) if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED )
{ {
@ -338,12 +334,12 @@ public class HttpUtils
/** /**
* set the timestamp of a named file to a specified time. * set the timestamp of a named file to a specified time.
* *
* @param file the file to touch * @param file the file to touch
* @param timemillis in milliseconds since the start of the era * @param timemillis in milliseconds since the start of the era
* @return true if it succeeded. False means that this is a java1.1 system * @return true if it succeeded. False means that this is a java1.1 system
* and that file times can not be set * and that file times can not be set
* @throws RuntimeException Thrown in unrecoverable error. Likely this * @throws RuntimeException Thrown in unrecoverable error. Likely this
* comes from file access failures. * comes from file access failures.
*/ */
private static boolean touchFile( File file, long timemillis ) private static boolean touchFile( File file, long timemillis )
{ {

View File

@ -236,7 +236,7 @@ public class FileUtils
* Writes data to a file. The file will be created if it does not exist. * Writes data to a file. The file will be created if it does not exist.
* *
* @param fileName The name of the file to write. * @param fileName The name of the file to write.
* @param data The content to write to the file. * @param data The content to write to the file.
*/ */
public static void fileWrite( String fileName, String data ) public static void fileWrite( String fileName, String data )
throws IOException throws IOException
@ -261,7 +261,7 @@ public class FileUtils
* Waits for NFS to propagate a file creation, imposing a timeout. * Waits for NFS to propagate a file creation, imposing a timeout.
* *
* @param fileName The name of the file. * @param fileName The name of the file.
* @param seconds The maximum time in seconds to wait. * @param seconds The maximum time in seconds to wait.
* @return True if file exists. * @return True if file exists.
*/ */
public static boolean waitFor( String fileName, int seconds ) public static boolean waitFor( String fileName, int seconds )
@ -308,9 +308,6 @@ public class FileUtils
/** /**
* Given a directory and an array of extensions return an array of compliant files. * Given a directory and an array of extensions return an array of compliant files.
* <p/> * <p/>
* TODO Should an ignore list be passed in?
* TODO Should a recurse flag be passed in?
* <p/>
* The given extensions should be like "java" and not like ".java" * The given extensions should be like "java" and not like ".java"
*/ */
public static String[] getFilesFromExtension( String directory, String[] extensions ) public static String[] getFilesFromExtension( String directory, String[] extensions )
@ -341,7 +338,6 @@ public class FileUtils
continue; continue;
} }
//ok... transverse into this directory and get all the files... then combine //ok... transverse into this directory and get all the files... then combine
//them with the current list. //them with the current list.
@ -650,12 +646,12 @@ public class FileUtils
* (and any parent directories) will be created. If a file <code>source</code> in * (and any parent directories) will be created. If a file <code>source</code> in
* <code>destinationDirectory</code> exists, it will be overwritten. * <code>destinationDirectory</code> exists, it will be overwritten.
* *
* @param source An existing <code>File</code> to copy. * @param source An existing <code>File</code> to copy.
* @param destinationDirectory A directory to copy <code>source</code> into. * @param destinationDirectory A directory to copy <code>source</code> into.
* @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file. * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
* @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory. * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
* @throws IOException if <code>source</code> does not exist, the file in * @throws IOException if <code>source</code> does not exist, the file in
* <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying. * <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
*/ */
public static void copyFileToDirectory( final String source, final String destinationDirectory ) public static void copyFileToDirectory( final String source, final String destinationDirectory )
throws IOException throws IOException
@ -668,12 +664,12 @@ public class FileUtils
* (and any parent directories) will be created. If a file <code>source</code> in * (and any parent directories) will be created. If a file <code>source</code> in
* <code>destinationDirectory</code> exists, it will be overwritten. * <code>destinationDirectory</code> exists, it will be overwritten.
* *
* @param source An existing <code>File</code> to copy. * @param source An existing <code>File</code> to copy.
* @param destinationDirectory A directory to copy <code>source</code> into. * @param destinationDirectory A directory to copy <code>source</code> into.
* @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file. * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
* @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory. * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
* @throws IOException if <code>source</code> does not exist, the file in * @throws IOException if <code>source</code> does not exist, the file in
* <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying. * <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
*/ */
public static void copyFileToDirectory( final File source, final File destinationDirectory ) public static void copyFileToDirectory( final File source, final File destinationDirectory )
throws IOException throws IOException
@ -691,13 +687,13 @@ public class FileUtils
* created if they don't already exist. <code>destination</code> will be overwritten if it * created if they don't already exist. <code>destination</code> will be overwritten if it
* already exists. * already exists.
* *
* @param source An existing non-directory <code>File</code> to copy bytes from. * @param source An existing non-directory <code>File</code> to copy bytes from.
* @param destination A non-directory <code>File</code> to write bytes to (possibly * @param destination A non-directory <code>File</code> to write bytes to (possibly
* overwriting). * overwriting).
* @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be * @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be
* written to, or an IO error occurs during copying. * written to, or an IO error occurs during copying.
* @throws java.io.FileNotFoundException if <code>destination</code> is a directory * @throws java.io.FileNotFoundException if <code>destination</code> is a directory
* (use {@link #copyFileToDirectory}). * (use {@link #copyFileToDirectory}).
*/ */
public static void copyFile( final File source, final File destination ) public static void copyFile( final File source, final File destination )
throws IOException throws IOException
@ -741,15 +737,15 @@ public class FileUtils
* The directories up to <code>destination</code> will be created if they don't already exist. * The directories up to <code>destination</code> will be created if they don't already exist.
* <code>destination</code> will be overwritten if it already exists. * <code>destination</code> will be overwritten if it already exists.
* *
* @param source A <code>URL</code> to copy bytes from. * @param source A <code>URL</code> to copy bytes from.
* @param destination A non-directory <code>File</code> to write bytes to (possibly * @param destination A non-directory <code>File</code> to write bytes to (possibly
* overwriting). * overwriting).
* @throws IOException if * @throws IOException if
* <ul> * <ul>
* <li><code>source</code> URL cannot be opened</li> * <li><code>source</code> URL cannot be opened</li>
* <li><code>destination</code> cannot be written to</li> * <li><code>destination</code> cannot be written to</li>
* <li>an IO error occurs during copying</li> * <li>an IO error occurs during copying</li>
* </ul> * </ul>
*/ */
public static void copyURLToFile( final URL source, final File destination ) public static void copyURLToFile( final URL source, final File destination )
throws IOException throws IOException
@ -884,7 +880,7 @@ public class FileUtils
* <code>baseFile</code>, otherwise it is treated as a normal root-relative path. * <code>baseFile</code>, otherwise it is treated as a normal root-relative path.
* *
* @param baseFile Where to resolve <code>filename</code> from, if <code>filename</code> is * @param baseFile Where to resolve <code>filename</code> from, if <code>filename</code> is
* relative. * relative.
* @param filename Absolute or relative file path to resolve. * @param filename Absolute or relative file path to resolve.
* @return The canonical <code>File</code> of <code>filename</code>. * @return The canonical <code>File</code> of <code>filename</code>.
*/ */
@ -916,8 +912,6 @@ public class FileUtils
return file; return file;
} }
// FIXME: I'm almost certain this // removal is unnecessary, as getAbsoluteFile() strips
// them. However, I'm not sure about this UNC stuff. (JT)
final char[] chars = filename.toCharArray(); final char[] chars = filename.toCharArray();
final StringBuffer sb = new StringBuffer(); final StringBuffer sb = new StringBuffer();
@ -1374,10 +1368,10 @@ public class FileUtils
* well.</p> * well.</p>
* *
* @param from the file to move * @param from the file to move
* @param to the new file name * @param to the new file name
* @throws IOException if anything bad happens during this * @throws IOException if anything bad happens during this
* process. Note that <code>to</code> may have been deleted * process. Note that <code>to</code> may have been deleted
* already when this happens. * already when this happens.
*/ */
public static void rename( File from, File to ) public static void rename( File from, File to )
throws IOException throws IOException
@ -1418,10 +1412,10 @@ public class FileUtils
* when the parentDir attribute is * when the parentDir attribute is
* null.</p> * null.</p>
* *
* @param prefix prefix before the random number * @param prefix prefix before the random number
* @param suffix file extension; include the '.' * @param suffix file extension; include the '.'
* @param parentDir Directory to create the temporary file in - * @param parentDir Directory to create the temporary file in -
* java.io.tmpdir used if not specificed * java.io.tmpdir used if not specificed
* @return a File reference to the new temporary file. * @return a File reference to the new temporary file.
*/ */
public static File createTempFile( String prefix, String suffix, File parentDir ) public static File createTempFile( String prefix, String suffix, File parentDir )

View File

@ -2,7 +2,6 @@ package org.apache.maven.profiles.activation;
import org.apache.maven.model.Activation; import org.apache.maven.model.Activation;
import org.apache.maven.model.ActivationFile; import org.apache.maven.model.ActivationFile;
import org.apache.maven.model.BuildBase;
import org.apache.maven.model.Profile; import org.apache.maven.model.Profile;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;

View File

@ -1,117 +1,115 @@
package org.apache.maven.project.injection; package org.apache.maven.project.injection;
import junit.framework.TestCase;
import org.apache.maven.model.Build; import org.apache.maven.model.Build;
import org.apache.maven.model.BuildBase; import org.apache.maven.model.BuildBase;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
import org.apache.maven.model.Profile; import org.apache.maven.model.Profile;
import org.apache.maven.model.Repository; import org.apache.maven.model.Repository;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.util.List; import java.util.List;
import junit.framework.TestCase;
public class DefaultProfileInjectorTest public class DefaultProfileInjectorTest
extends TestCase extends TestCase
{ {
public void testProfilePluginConfigurationShouldOverrideModelPluginConfiguration() public void testProfilePluginConfigurationShouldOverrideModelPluginConfiguration()
{ {
Plugin mPlugin = new Plugin(); Plugin mPlugin = new Plugin();
mPlugin.setGroupId("test"); mPlugin.setGroupId( "test" );
mPlugin.setArtifactId("test-artifact"); mPlugin.setArtifactId( "test-artifact" );
mPlugin.setVersion("1.0-SNAPSHOT"); mPlugin.setVersion( "1.0-SNAPSHOT" );
Xpp3Dom mConfigChild = new Xpp3Dom("test"); Xpp3Dom mConfigChild = new Xpp3Dom( "test" );
mConfigChild.setValue("value"); mConfigChild.setValue( "value" );
Xpp3Dom mConfig = new Xpp3Dom("configuration"); Xpp3Dom mConfig = new Xpp3Dom( "configuration" );
mConfig.addChild( mConfigChild ); mConfig.addChild( mConfigChild );
mPlugin.setConfiguration(mConfig); mPlugin.setConfiguration( mConfig );
Build mBuild = new Build(); Build mBuild = new Build();
mBuild.addPlugin(mPlugin); mBuild.addPlugin( mPlugin );
Model model = new Model(); Model model = new Model();
model.setBuild(mBuild); model.setBuild( mBuild );
Plugin pPlugin = new Plugin(); Plugin pPlugin = new Plugin();
pPlugin.setGroupId("test"); pPlugin.setGroupId( "test" );
pPlugin.setArtifactId("test-artifact"); pPlugin.setArtifactId( "test-artifact" );
pPlugin.setVersion("1.0-SNAPSHOT"); pPlugin.setVersion( "1.0-SNAPSHOT" );
Xpp3Dom pConfigChild = new Xpp3Dom("test"); Xpp3Dom pConfigChild = new Xpp3Dom( "test" );
pConfigChild.setValue("replacedValue"); pConfigChild.setValue( "replacedValue" );
Xpp3Dom pConfig = new Xpp3Dom("configuration"); Xpp3Dom pConfig = new Xpp3Dom( "configuration" );
pConfig.addChild( pConfigChild ); pConfig.addChild( pConfigChild );
pPlugin.setConfiguration(pConfig); pPlugin.setConfiguration( pConfig );
BuildBase pBuild = new BuildBase(); BuildBase pBuild = new BuildBase();
pBuild.addPlugin(pPlugin); pBuild.addPlugin( pPlugin );
Profile profile = new Profile(); Profile profile = new Profile();
profile.setId("testId"); profile.setId( "testId" );
profile.setBuild(pBuild); profile.setBuild( pBuild );
new DefaultProfileInjector().inject(profile, model); new DefaultProfileInjector().inject( profile, model );
Build rBuild = model.getBuild(); Build rBuild = model.getBuild();
Plugin rPlugin = (Plugin) rBuild.getPlugins().get(0); Plugin rPlugin = (Plugin) rBuild.getPlugins().get( 0 );
Xpp3Dom rConfig = (Xpp3Dom) rPlugin.getConfiguration(); Xpp3Dom rConfig = (Xpp3Dom) rPlugin.getConfiguration();
Xpp3Dom rChild = rConfig.getChild("test"); Xpp3Dom rChild = rConfig.getChild( "test" );
assertEquals("replacedValue", rChild.getValue()); assertEquals( "replacedValue", rChild.getValue() );
} }
public void testProfileRepositoryShouldOverrideModelRepository() public void testProfileRepositoryShouldOverrideModelRepository()
{ {
Repository mRepository = new Repository(); Repository mRepository = new Repository();
mRepository.setId("testId"); mRepository.setId( "testId" );
mRepository.setName("Test repository"); mRepository.setName( "Test repository" );
mRepository.setUrl("http://www.google.com"); mRepository.setUrl( "http://www.google.com" );
Model model = new Model(); Model model = new Model();
model.addRepository(mRepository); model.addRepository( mRepository );
Repository pRepository = new Repository(); Repository pRepository = new Repository();
pRepository.setId("testId"); pRepository.setId( "testId" );
pRepository.setName("Test repository"); pRepository.setName( "Test repository" );
pRepository.setUrl("http://www.yahoo.com"); pRepository.setUrl( "http://www.yahoo.com" );
Profile profile = new Profile(); Profile profile = new Profile();
profile.setId("testId"); profile.setId( "testId" );
profile.addRepository(pRepository); profile.addRepository( pRepository );
new DefaultProfileInjector().inject(profile, model); new DefaultProfileInjector().inject( profile, model );
Repository rRepository = (Repository) model.getRepositories().get(0); Repository rRepository = (Repository) model.getRepositories().get( 0 );
assertEquals("http://www.yahoo.com", rRepository.getUrl()); assertEquals( "http://www.yahoo.com", rRepository.getUrl() );
} }
public void testShouldPreserveModelModulesWhenProfileHasNone() public void testShouldPreserveModelModulesWhenProfileHasNone()
{ {
Model model = new Model(); Model model = new Model();
model.addModule("module1"); model.addModule( "module1" );
Profile profile = new Profile(); Profile profile = new Profile();
profile.setId("testId"); profile.setId( "testId" );
new DefaultProfileInjector().inject(profile, model); new DefaultProfileInjector().inject( profile, model );
List rModules = model.getModules(); List rModules = model.getModules();
assertEquals( 1, rModules.size()); assertEquals( 1, rModules.size() );
assertEquals("module1", rModules.get(0)); assertEquals( "module1", rModules.get( 0 ) );
} }
} }

View File

@ -390,7 +390,7 @@ Type Reference
*----------------------+--------------------------------------------------------+ *----------------------+--------------------------------------------------------+
| <<<layout>>> | The layout of the remote repository. The valid options are <<<legacy>>> (Maven 1), or <<<default>>> (Maven 2). | <<<layout>>> | The layout of the remote repository. The valid options are <<<legacy>>> (Maven 1), or <<<default>>> (Maven 2).
*----------------------+--------------------------------------------------------+ *----------------------+--------------------------------------------------------+
| <<<snapshotPolicy>>> | How often to check for updates on dependencies with a version that includes <<<SNAPSHOT>>>. Valid values are <<<never>>>, <<<interval:XXX>>>, <<<daily>>> (<default)>, <<<always>>>. | <<<snapshotPolicy>>> | How often to check for updates on dependencies with a version that includes <<<SNAPSHOT>>>. Valid values are <<<never>>>, <<<interval:MINUTES>>>, <<<daily>>> (<default)>, <<<always>>>.
*----------------------+--------------------------------------------------------+ *----------------------+--------------------------------------------------------+
| <<<checksumPolicy>>> | How to treat missing or incorrect checksums for the dependencies that are downloaded. Valid values are <<<warn>>> (<default>) and <<<fail>>>. | <<<checksumPolicy>>> | How to treat missing or incorrect checksums for the dependencies that are downloaded. Valid values are <<<warn>>> (<default>) and <<<fail>>>.
*----------------------+--------------------------------------------------------+ *----------------------+--------------------------------------------------------+