Author: hboutemy
Date: Thu Sep 10 21:58:39 2009
New Revision: 813612
URL: http://svn.apache.org/viewvc?rev=813612&view=rev
Log:
fixed errors reported by Checkstyle
Modified:
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/validation/DefaultSettingsValidatorTest.java
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
Modified:
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
Thu Sep 10 21:58:39 2009
@@ -1,18 +1,22 @@
package org.apache.maven.execution;
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.File;
@@ -41,9 +45,9 @@
private RepositoryCache repositoryCache = new SessionRepositoryCache();
private ArtifactRepository localRepository;
-
+
private File localRepositoryPath;
-
+
private boolean offline = false;
private boolean interactiveMode = true;
@@ -73,7 +77,7 @@
private File globalSettingsFile;
private File userToolchainsFile;
-
+
//
----------------------------------------------------------------------------
// Request
//
----------------------------------------------------------------------------
@@ -124,13 +128,15 @@
/**
* Suppress SNAPSHOT updates.
- *
+ *
* @issue MNG-2681
*/
private boolean noSnapshotUpdates;
-
- public DefaultMavenExecutionRequest() { }
-
+
+ public DefaultMavenExecutionRequest()
+ {
+ }
+
public static MavenExecutionRequest copy( MavenExecutionRequest original )
{
DefaultMavenExecutionRequest copy = new DefaultMavenExecutionRequest();
@@ -166,9 +172,9 @@
copy.setRepositoryCache( original.getRepositoryCache() );
copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
copy.setExecutionListener( original.getExecutionListener() );
- return original;
+ return original;
}
-
+
public String getBaseDirectory()
{
if ( basedir == null )
@@ -301,7 +307,7 @@
{
this.remoteRepositories = null;
}
-
+
return this;
}
@@ -315,7 +321,7 @@
{
this.pluginArtifactRepositories = null;
}
-
+
return this;
}
@@ -931,7 +937,7 @@
return this;
}
-
+
public List<ArtifactRepository> getPluginArtifactRepositories()
{
if ( pluginArtifactRepositories == null )
@@ -966,7 +972,7 @@
return projectBuildingRequest;
}
-
+
public MavenExecutionRequest addProfile( Profile profile )
{
if ( profile == null )
Modified:
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
(original)
+++
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
Thu Sep 10 21:58:39 2009
@@ -61,9 +61,9 @@
if ( param.isEditable() )
{
- messageBuffer.append( "Inside the definition for plugin \'" +
mojo.getPluginDescriptor().getArtifactId() +
- "\' specify the following:\n\n<configuration>\n ...\n <" +
param.getName() + ">VALUE</" +
- param.getName() + ">\n</configuration>" );
+ messageBuffer.append( "Inside the definition for plugin \'" +
mojo.getPluginDescriptor().getArtifactId()
+ + "\' specify the following:\n\n<configuration>\n ...\n <" +
param.getName() + ">VALUE</"
+ + param.getName() + ">\n</configuration>" );
String alias = param.getAlias();
if ( StringUtils.isNotEmpty( alias ) && !alias.equals(
param.getName() ) )
Modified:
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java
(original)
+++
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java
Thu Sep 10 21:58:39 2009
@@ -42,8 +42,8 @@
private static String formatMessage( String projectId, String
locationInPom, String offendingVersion,
InvalidVersionSpecificationException
cause )
{
- return "Invalid version: " + offendingVersion + " found for: " +
locationInPom + " in project: " + projectId +
- ". Reason: " + cause.getMessage();
+ return "Invalid version: " + offendingVersion + " found for: " +
locationInPom + " in project: " + projectId
+ + ". Reason: " + cause.getMessage();
}
public String getOffendingVersion()
Modified:
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
(original)
+++
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
Thu Sep 10 21:58:39 2009
@@ -43,8 +43,8 @@
public SettingsConfigurationException( String message, Throwable cause,
int lineNumber, int columnNumber )
{
- super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" )
+
- ( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause );
+ super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" )
+ + ( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause
);
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
}
@@ -58,6 +58,6 @@
{
return lineNumber;
}
-
+
}
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
Thu Sep 10 21:58:39 2009
@@ -19,7 +19,6 @@
* under the License.
*/
-
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@@ -33,7 +32,6 @@
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
@@ -69,16 +67,18 @@
throws Exception
{
super.setUp();
- factory = lookup( ArtifactFactory.class );
- artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
+ factory = lookup( ArtifactFactory.class );
+ artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
}
-
+
@Override
- protected void tearDown() throws Exception {
- factory = null;
- super.tearDown();
+ protected void tearDown()
+ throws Exception
+ {
+ factory = null;
+ super.tearDown();
}
-
+
public void testPluginDescriptorExpressionReference()
throws Exception
{
@@ -445,7 +445,7 @@
private MavenSession newMavenSession()
throws Exception
{
- return createMavenSession( null );
+ return createMavenSession( null );
}
@Override
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
Thu Sep 10 21:58:39 2009
@@ -24,22 +24,24 @@
public class MavenMetadataSourceTest
extends PlexusTestCase
-{
+{
private RepositorySystem repositorySystem;
-
+
protected void setUp()
throws Exception
{
super.setUp();
repositorySystem = lookup( RepositorySystem.class );
}
-
+
@Override
- protected void tearDown() throws Exception {
- repositorySystem = null;
- super.tearDown();
+ protected void tearDown()
+ throws Exception
+ {
+ repositorySystem = null;
+ super.tearDown();
}
-
+
public void testShouldNotCarryExclusionsOverFromDependencyToDependency()
throws Exception
{
@@ -49,39 +51,39 @@
dep1.setArtifactId( "test-artifact" );
dep1.setVersion( "1" );
dep1.setType( "jar" );
-
+
Exclusion exc = new Exclusion();
exc.setGroupId( "test" );
exc.setArtifactId( "test-artifact3" );
-
+
dep1.addExclusion( exc );
-
+
Dependency dep2 = new Dependency();
dep2.setGroupId( "test" );
dep2.setArtifactId( "test-artifact2" );
dep2.setVersion( "1" );
dep2.setType( "jar" );
-
+
List deps = new ArrayList();
deps.add( dep1 );
deps.add( dep2 );
-
+
ArtifactFactory factory = lookup( ArtifactFactory.class );
-
+
ArtifactFilter dependencyFilter = new ScopeArtifactFilter(
Artifact.SCOPE_COMPILE );
-
+
MavenProject project = new MavenProject( new Model() );
-
+
Set result = project.createArtifacts( dependencyFilter );
-
+
for ( Iterator it = result.iterator(); it.hasNext(); )
{
Artifact artifact = ( Artifact ) it.next();
-
+
if ( "test-artifact2".equals( artifact.getArtifactId() ) )
{
ArtifactFilter filter = artifact.getDependencyFilter();
-
+
assertSame( dependencyFilter, filter );
}
}
@@ -158,9 +160,9 @@
TestModelDefaultsInjector injector = new TestModelDefaultsInjector();
injector.injectDefaults( model );
-
+
project.setArtifacts( project.createArtifacts( null ) );
-
+
String key = ArtifactUtils.versionlessKey( groupId, artifactId );
Map artifactMap = project.getArtifactMap();
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java
Thu Sep 10 21:58:39 2009
@@ -67,16 +67,18 @@
assertEquals( pom0Basedir,
project1.getParent().getBasedir().getCanonicalFile() );
Set set = project1.getArtifacts();
- assertNotNull("No artifacts", set);
- assertTrue("No Artifacts", set.size() > 0);
- assertTrue("Set size should be 3, is " + set.size(), set.size() == 3);
+ assertNotNull( "No artifacts", set );
+ assertTrue( "No Artifacts", set.size() > 0 );
+ assertTrue( "Set size should be 3, is " + set.size(), set.size() == 3
);
Iterator iter = set.iterator();
- while (iter.hasNext()) {
- Artifact artifact = (Artifact)iter.next();
- System.out.println("Artifact: " +
artifact.getDependencyConflictId() + " " + artifact.getVersion() +
- " Optional=" + (artifact.isOptional() ? "true" : "false"));
- assertTrue("Incorrect version for " +
artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
+ while ( iter.hasNext() )
+ {
+ Artifact artifact = (Artifact) iter.next();
+ System.out.println( "Artifact: " +
artifact.getDependencyConflictId() + " " + artifact.getVersion()
+ + " Optional=" + ( artifact.isOptional() ? "true" : "false" ) );
+ assertTrue( "Incorrect version for " +
artifact.getDependencyConflictId(),
+ artifact.getVersion().equals( "1.0" ) );
}
}
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java
Thu Sep 10 21:58:39 2009
@@ -63,16 +63,16 @@
assertEquals( pom0Basedir,
project1.getParent().getBasedir().getCanonicalFile() );
Set set = project1.getArtifacts();
- assertNotNull("No artifacts", set);
- assertTrue("No Artifacts", set.size() > 0);
+ assertNotNull( "No artifacts", set );
+ assertTrue( "No Artifacts", set.size() > 0 );
Iterator iter = set.iterator();
- while (iter.hasNext())
+ while ( iter.hasNext() )
{
- Artifact artifact = (Artifact)iter.next();
- System.out.println("Artifact: " +
artifact.getDependencyConflictId() + " " +
- artifact.getVersion() + " Scope: " + artifact.getScope());
- assertTrue("Incorrect version for " +
artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
+ Artifact artifact = (Artifact) iter.next();
+ System.out.println( "Artifact: " +
artifact.getDependencyConflictId() + " "
+ + artifact.getVersion() + " Scope: " + artifact.getScope()
);
+ assertTrue( "Incorrect version for " +
artifact.getDependencyConflictId(), artifact.getVersion().equals( "1.0" ) );
}
}
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java
Thu Sep 10 21:58:39 2009
@@ -63,17 +63,18 @@
assertEquals( pom0Basedir,
project1.getParent().getBasedir().getCanonicalFile() );
Set set = project1.getArtifacts();
- assertNotNull("No artifacts", set);
- assertTrue("No Artifacts", set.size() > 0);
+ assertNotNull( "No artifacts", set );
+ assertTrue( "No Artifacts", set.size() > 0 );
Iterator iter = set.iterator();
- assertTrue("Set size should be 4, is " + set.size(), set.size() == 4);
+ assertTrue( "Set size should be 4, is " + set.size(), set.size() == 4
);
- while (iter.hasNext())
+ while ( iter.hasNext() )
{
- Artifact artifact = (Artifact)iter.next();
- System.out.println("Artifact: " +
artifact.getDependencyConflictId() + " " + artifact.getVersion() +
- " Optional=" + (artifact.isOptional() ? "true" : "false"));
- assertTrue("Incorrect version for " +
artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
+ Artifact artifact = (Artifact) iter.next();
+ System.out.println( "Artifact: " +
artifact.getDependencyConflictId() + " " + artifact.getVersion()
+ + " Optional=" + ( artifact.isOptional() ? "true" : "false" ) );
+ assertTrue( "Incorrect version for " +
artifact.getDependencyConflictId(),
+ artifact.getVersion().equals( "1.0" ) );
}
}
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java
Thu Sep 10 21:58:39 2009
@@ -62,19 +62,20 @@
MavenProject project1 = getProjectWithDependencies( pom1 );
assertEquals( pom0Basedir,
project1.getParent().getBasedir().getCanonicalFile() );
- System.out.println("Project " + project1.getId() + " " + project1);
+ System.out.println( "Project " + project1.getId() + " " + project1 );
Set set = project1.getArtifacts();
- assertNotNull("No artifacts", set);
- assertTrue("No Artifacts", set.size() > 0);
+ assertNotNull( "No artifacts", set );
+ assertTrue( "No Artifacts", set.size() > 0 );
Iterator iter = set.iterator();
- assertTrue("Set size should be 4, is " + set.size(), set.size() == 4);
+ assertTrue( "Set size should be 4, is " + set.size(), set.size() == 4
);
- while (iter.hasNext())
+ while ( iter.hasNext() )
{
- Artifact artifact = (Artifact)iter.next();
- System.out.println("Artifact: " +
artifact.getDependencyConflictId() + " " + artifact.getVersion() +
- " Optional=" + (artifact.isOptional() ? "true" : "false"));
- assertTrue("Incorrect version for " +
artifact.getDependencyConflictId(), artifact.getVersion().equals("1.0"));
+ Artifact artifact = (Artifact) iter.next();
+ System.out.println( "Artifact: " +
artifact.getDependencyConflictId() + " " + artifact.getVersion()
+ + " Optional=" + ( artifact.isOptional() ? "true" : "false" ) );
+ assertTrue( "Incorrect version for " +
artifact.getDependencyConflictId(),
+ artifact.getVersion().equals( "1.0" ) );
}
}
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
Thu Sep 10 21:58:39 2009
@@ -1,10 +1,28 @@
package org.apache.maven.settings;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import java.io.File;
import java.io.IOException;
import java.io.Reader;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.model.Profile;
import org.apache.maven.project.DefaultProjectBuilder;
@@ -19,15 +37,15 @@
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-public class PomConstructionWithSettingsTest
- extends PlexusTestCase
+public class PomConstructionWithSettingsTest
+ extends PlexusTestCase
{
- private static String BASE_DIR = "src/test";
+ private static final String BASE_DIR = "src/test";
- private static String BASE_POM_DIR = BASE_DIR + "/resources-settings";
+ private static final String BASE_POM_DIR = BASE_DIR +
"/resources-settings";
private DefaultProjectBuilder projectBuilder;
-
+
private RepositorySystem repositorySystem;
private File testDirectory;
@@ -41,60 +59,64 @@
}
@Override
- protected void tearDown() throws Exception {
- projectBuilder = null;
+ protected void tearDown()
+ throws Exception
+ {
+ projectBuilder = null;
- super.tearDown();
+ super.tearDown();
}
-
+
public void testSettingsNoPom() throws Exception
{
- PomTestWrapper pom = buildPom( "settings-no-pom" );
- assertEquals( "local-profile-prop-value", pom.getValue(
"properties/local-profile-prop" ) );
+ PomTestWrapper pom = buildPom( "settings-no-pom" );
+ assertEquals( "local-profile-prop-value", pom.getValue(
"properties/local-profile-prop" ) );
}
-
+
/**MNG-4107 */
public void testPomAndSettingsInterpolation() throws Exception
{
- PomTestWrapper pom = buildPom( "test-pom-and-settings-interpolation" );
- assertEquals("applied", pom.getValue( "properties/settingsProfile" ) );
- assertEquals("applied", pom.getValue( "properties/pomProfile" ) );
- assertEquals("settings", pom.getValue( "properties/pomVsSettings" ) );
- assertEquals("settings", pom.getValue(
"properties/pomVsSettingsInterpolated" ) );
- }
-
+ PomTestWrapper pom = buildPom( "test-pom-and-settings-interpolation" );
+ assertEquals( "applied", pom.getValue( "properties/settingsProfile" )
);
+ assertEquals( "applied", pom.getValue( "properties/pomProfile" ) );
+ assertEquals( "settings", pom.getValue( "properties/pomVsSettings" ) );
+ assertEquals( "settings", pom.getValue(
"properties/pomVsSettingsInterpolated" ) );
+ }
+
/**MNG-4107 */
public void testRepositories() throws Exception
{
- PomTestWrapper pom = buildPom( "repositories" );
- assertEquals("maven-core-it-0", pom.getValue( "repositories[1]/id" ));
- }
+ PomTestWrapper pom = buildPom( "repositories" );
+ assertEquals( "maven-core-it-0", pom.getValue( "repositories[1]/id" )
);
+ }
private PomTestWrapper buildPom( String pomPath )
throws Exception
- {
- File pomFile = new File( testDirectory + File.separator + pomPath ,
"pom.xml" );
- File settingsFile = new File( testDirectory + File.separator +
pomPath, "settings.xml" );
- Settings settings = readSettingsFile(settingsFile);
-
+ {
+ File pomFile = new File( testDirectory + File.separator + pomPath,
"pom.xml" );
+ File settingsFile = new File( testDirectory + File.separator +
pomPath, "settings.xml" );
+ Settings settings = readSettingsFile( settingsFile );
+
ProjectBuildingRequest config = new DefaultProjectBuildingRequest();
-
- for ( org.apache.maven.settings.Profile rawProfile :
settings.getProfiles() )
- {
- Profile profile = SettingsUtils.convertFromSettingsProfile(
rawProfile );
- config.addProfile( profile );
- }
-
- String localRepoUrl = System.getProperty( "maven.repo.local",
System.getProperty( "user.home" ) + "/.m2/repository" );
+
+ for ( org.apache.maven.settings.Profile rawProfile :
settings.getProfiles() )
+ {
+ Profile profile = SettingsUtils.convertFromSettingsProfile(
rawProfile );
+ config.addProfile( profile );
+ }
+
+ String localRepoUrl =
+ System.getProperty( "maven.repo.local", System.getProperty(
"user.home" ) + "/.m2/repository" );
localRepoUrl = "file://" + localRepoUrl;
- config.setLocalRepository( repositorySystem.createArtifactRepository(
"local", localRepoUrl, new DefaultRepositoryLayout(), null, null ) );
+ config.setLocalRepository( repositorySystem.createArtifactRepository(
"local", localRepoUrl,
+
new DefaultRepositoryLayout(), null, null ) );
config.setActiveProfileIds( settings.getActiveProfiles() );
-
- return new PomTestWrapper( pomFile, projectBuilder.build( pomFile,
config ).getProject() );
- }
-
- private static Settings readSettingsFile(File settingsFile)
- throws IOException, XmlPullParserException
+
+ return new PomTestWrapper( pomFile, projectBuilder.build( pomFile,
config ).getProject() );
+ }
+
+ private static Settings readSettingsFile( File settingsFile )
+ throws IOException, XmlPullParserException
{
Settings settings = null;
@@ -113,6 +135,6 @@
IOUtil.close( reader );
}
- return settings;
+ return settings;
}
}
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/validation/DefaultSettingsValidatorTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/validation/DefaultSettingsValidatorTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/validation/DefaultSettingsValidatorTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/settings/validation/DefaultSettingsValidatorTest.java
Thu Sep 10 21:58:39 2009
@@ -29,42 +29,50 @@
*
* @author mkleint
*/
-public class DefaultSettingsValidatorTest extends TestCase {
-
- public DefaultSettingsValidatorTest(String testName) {
- super(testName);
+public class DefaultSettingsValidatorTest
+ extends TestCase
+{
+
+ public DefaultSettingsValidatorTest( String testName )
+ {
+ super( testName );
}
-
- protected void setUp() throws Exception {
+
+ protected void setUp()
+ throws Exception
+ {
super.setUp();
}
- protected void tearDown() throws Exception {
+ protected void tearDown()
+ throws Exception
+ {
super.tearDown();
}
- public void testValidate() {
+ public void testValidate()
+ {
Settings model = new Settings();
Profile prof = new Profile();
- prof.setId("xxx");
- model.addProfile(prof);
+ prof.setId( "xxx" );
+ model.addProfile( prof );
DefaultSettingsValidator instance = new DefaultSettingsValidator();
- SettingsValidationResult result = instance.validate(model);
- assertEquals(0, result.getMessageCount());
-
+ SettingsValidationResult result = instance.validate( model );
+ assertEquals( 0, result.getMessageCount() );
+
Repository repo = new Repository();
- prof.addRepository(repo);
- result = instance.validate(model);
- assertEquals(2, result.getMessageCount());
-
- repo.setUrl("http://xxx.xxx.com");
- result = instance.validate(model);
- assertEquals(1, result.getMessageCount());
-
- repo.setId("xxx");
- result = instance.validate(model);
- assertEquals(0, result.getMessageCount());
-
+ prof.addRepository( repo );
+ result = instance.validate( model );
+ assertEquals( 2, result.getMessageCount() );
+
+ repo.setUrl( "http://xxx.xxx.com" );
+ result = instance.validate( model );
+ assertEquals( 1, result.getMessageCount() );
+
+ repo.setId( "xxx" );
+ result = instance.validate( model );
+ assertEquals( 0, result.getMessageCount() );
+
}
}
Modified:
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java?rev=813612&r1=813611&r2=813612&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
(original)
+++
maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
Thu Sep 10 21:58:39 2009
@@ -25,37 +25,42 @@
*
* @author mkleint
*/
-public class RequirementMatcherFactoryTest extends TestCase {
-
- public RequirementMatcherFactoryTest(String testName) {
- super(testName);
+public class RequirementMatcherFactoryTest
+ extends TestCase
+{
+
+ public RequirementMatcherFactoryTest( String testName )
+ {
+ super( testName );
}
/**
* Test of createExactMatcher method, of class RequirementMatcherFactory.
*/
- public void testCreateExactMatcher() {
+ public void testCreateExactMatcher()
+ {
RequirementMatcher matcher;
- matcher = RequirementMatcherFactory.createExactMatcher("foo");
- assertFalse(matcher.matches("bar"));
- assertFalse(matcher.matches("foobar"));
- assertFalse(matcher.matches("foob"));
- assertTrue(matcher.matches("foo"));
+ matcher = RequirementMatcherFactory.createExactMatcher( "foo" );
+ assertFalse( matcher.matches( "bar" ) );
+ assertFalse( matcher.matches( "foobar" ) );
+ assertFalse( matcher.matches( "foob" ) );
+ assertTrue( matcher.matches( "foo" ) );
}
/**
* Test of createVersionMatcher method, of class RequirementMatcherFactory.
*/
- public void testCreateVersionMatcher() {
+ public void testCreateVersionMatcher()
+ {
RequirementMatcher matcher;
- matcher = RequirementMatcherFactory.createVersionMatcher("1.5.2");
- assertFalse(matcher.matches("1.5"));
- assertTrue(matcher.matches("1.5.2"));
- assertFalse(matcher.matches("[1.4,1.5)"));
- assertFalse(matcher.matches("[1.5,1.5.2)"));
- assertFalse(matcher.matches("(1.5.2,1.6)"));
- assertTrue(matcher.matches("(1.4,1.5.2]"));
- assertTrue(matcher.matches("(1.5,)"));
+ matcher = RequirementMatcherFactory.createVersionMatcher( "1.5.2" );
+ assertFalse( matcher.matches( "1.5" ) );
+ assertTrue( matcher.matches( "1.5.2" ) );
+ assertFalse( matcher.matches( "[1.4,1.5)" ) );
+ assertFalse( matcher.matches( "[1.5,1.5.2)" ) );
+ assertFalse( matcher.matches( "(1.5.2,1.6)" ) );
+ assertTrue( matcher.matches( "(1.4,1.5.2]" ) );
+ assertTrue( matcher.matches( "(1.5,)" ) );
}
}