Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 48771 invoked from network); 2 Jul 2007 16:06:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Jul 2007 16:06:59 -0000 Received: (qmail 46138 invoked by uid 500); 2 Jul 2007 16:07:00 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 46099 invoked by uid 500); 2 Jul 2007 16:07:00 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 46085 invoked by uid 99); 2 Jul 2007 16:06:59 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 09:06:59 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 09:06:51 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 847161A9820; Mon, 2 Jul 2007 09:06:31 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r552524 [3/9] - in /maven/plugins/trunk/maven-dependency-plugin: ./ src/changes/ src/it/copy-dependencies/ src/it/copy-dependencies2/ src/it/mdep-27/ src/it/mdep-50/ src/it/mdep-61/ src/it/mdep-66/ src/it/mdep-67/ src/main/java/org/apache/m... Date: Mon, 02 Jul 2007 16:06:24 -0000 To: commits@maven.apache.org From: markh@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070702160631.847161A9820@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java?view=diff&rev=552524&r1=552523&r2=552524 ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java Mon Jul 2 09:06:19 2007 @@ -1,68 +1,68 @@ -package org.apache.maven.plugin.dependency.utils.filters; - -/* - * 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 org.apache.maven.artifact.Artifact; - -/** - * Filter on GroupId Name. - * - * @author clove - * @see org.apache.maven.plugin.dependency.utils.filters.AbstractArtifactFeatureFilter - * @since 2.0 - * @version $Id$ - */ -public class GroupIdFilter - extends AbstractArtifactFeatureFilter -{ - - /** - * Construction will setup the super call with a filtertype of 'GroupId' - * - * @param include - * @param exclude - */ - public GroupIdFilter( String include, String exclude ) - { - super( include, exclude, "GroupId" ); - } - - /* - * (non-Javadoc) - * - * @see org.apache.maven.plugin.dependency.utils.filters.AbstractArtifactFeatureFilter#getArtifactFeature(org.apache.maven.artifact.Artifact) - */ - protected String getArtifactFeature( Artifact artifact ) - { - return artifact.getGroupId(); - } - - /* - * (non-Javadoc) - * - * @see org.apache.maven.plugin.dependency.utils.filters.AbstractArtifactFeatureFilter#compareFeatures(String,String) - */ - - protected boolean compareFeatures( String lhs, String rhs ) - { - return lhs.startsWith( rhs ); - } - -} +package org.apache.maven.plugin.dependency.utils.filters; + +/* + * 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 org.apache.maven.artifact.Artifact; + +/** + * Filter on GroupId Name. + * + * @author clove + * @see org.apache.maven.plugin.dependency.utils.filters.AbstractArtifactFeatureFilter + * @since 2.0 + * @version $Id$ + */ +public class GroupIdFilter + extends AbstractArtifactFeatureFilter +{ + + /** + * Construction will setup the super call with a filtertype of 'GroupId' + * + * @param include + * @param exclude + */ + public GroupIdFilter( String include, String exclude ) + { + super( include, exclude, "GroupId" ); + } + + /* + * (non-Javadoc) + * + * @see org.apache.maven.plugin.dependency.utils.filters.AbstractArtifactFeatureFilter#getArtifactFeature(org.apache.maven.artifact.Artifact) + */ + protected String getArtifactFeature( Artifact artifact ) + { + return artifact.getGroupId(); + } + + /* + * (non-Javadoc) + * + * @see org.apache.maven.plugin.dependency.utils.filters.AbstractArtifactFeatureFilter#compareFeatures(String,String) + */ + + protected boolean compareFeatures( String lhs, String rhs ) + { + return lhs.startsWith( rhs ); + } + +} Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/GroupIdFilter.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/MarkerFileFilter.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ResolveFileFilter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ResolveFileFilter.java?view=diff&rev=552524&r1=552523&r2=552524 ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ResolveFileFilter.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ResolveFileFilter.java Mon Jul 2 09:06:19 2007 @@ -1,49 +1,49 @@ -package org.apache.maven.plugin.dependency.utils.filters; - -/* - * 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 org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.dependency.fromConfiguration.ArtifactItem; -import org.apache.maven.plugin.dependency.utils.markers.MarkerHandler; - -/** - * @author Brian Fox - * @version $Id$ - */ -public class ResolveFileFilter - extends MarkerFileFilter -{ - - public ResolveFileFilter( MarkerHandler handler ) - { - super( true, true, true, handler ); - } - - public boolean okToProcess( ArtifactItem item ) - throws MojoExecutionException - { - handler.setArtifact( item.getArtifact() ); - return ( !handler.isMarkerSet() ); - } -} +package org.apache.maven.plugin.dependency.utils.filters; + +/* + * 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 org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.dependency.fromConfiguration.ArtifactItem; +import org.apache.maven.plugin.dependency.utils.markers.MarkerHandler; + +/** + * @author Brian Fox + * @version $Id$ + */ +public class ResolveFileFilter + extends MarkerFileFilter +{ + + public ResolveFileFilter( MarkerHandler handler ) + { + super( true, true, true, handler ); + } + + public boolean okToProcess( ArtifactItem item ) + throws MojoExecutionException + { + handler.setArtifact( item.getArtifact() ); + return ( !handler.isMarkerSet() ); + } +} Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ResolveFileFilter.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ResolveFileFilter.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/ScopeFilter.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/TransitivityFilter.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/filters/TypeFilter.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/markers/DefaultFileMarkerHandler.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/markers/MarkerHandler.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/markers/SourcesFileMarkerHandler.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/resolvers/ArtifactsResolver.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/resolvers/DefaultArtifactsResolver.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/translators/ArtifactTranslator.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/translators/ClassifierTypeTranslator.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Propchange: maven/plugins/trunk/maven-dependency-plugin/src/site/site.xml ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java?view=diff&rev=552524&r1=552523&r2=552524 ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java Mon Jul 2 09:06:19 2007 @@ -1,78 +1,78 @@ -package org.apache.maven.plugin.dependency; - -/* - * 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 org.apache.maven.plugin.dependency.testUtils.DependencyArtifactStubFactory; -import org.apache.maven.plugin.dependency.testUtils.DependencyTestUtils; -import org.apache.maven.plugin.testing.AbstractMojoTestCase; - -public class AbstractDependencyMojoTestCase - extends AbstractMojoTestCase -{ - - protected File testDir; - - protected DependencyArtifactStubFactory stubFactory; - - public AbstractDependencyMojoTestCase() - { - super(); - } - - protected void setUp( String testDirStr, boolean createFiles ) - throws Exception - { - // required for mojo lookups to work - super.setUp(); - testDir = new File( getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar - + testDirStr + File.separatorChar ); - DependencyTestUtils.removeDirectory( testDir ); - assertFalse( testDir.exists() ); - - stubFactory = new DependencyArtifactStubFactory( this.testDir, createFiles ); - - } - - protected void tearDown() - { - if ( testDir != null ) - { - try - { - DependencyTestUtils.removeDirectory( testDir ); - } - catch ( IOException e ) - { - // TODO Auto-generated catch block - e.printStackTrace(); - fail( "Trying to remove directory:" + testDir + "\r\n" + e.toString() ); - } - assertFalse( testDir.exists() ); - - testDir = null; - } - - stubFactory = null; - } - -} +package org.apache.maven.plugin.dependency; + +/* + * 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 org.apache.maven.plugin.dependency.testUtils.DependencyArtifactStubFactory; +import org.apache.maven.plugin.dependency.testUtils.DependencyTestUtils; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; + +public class AbstractDependencyMojoTestCase + extends AbstractMojoTestCase +{ + + protected File testDir; + + protected DependencyArtifactStubFactory stubFactory; + + public AbstractDependencyMojoTestCase() + { + super(); + } + + protected void setUp( String testDirStr, boolean createFiles ) + throws Exception + { + // required for mojo lookups to work + super.setUp(); + testDir = new File( getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar + + testDirStr + File.separatorChar ); + DependencyTestUtils.removeDirectory( testDir ); + assertFalse( testDir.exists() ); + + stubFactory = new DependencyArtifactStubFactory( this.testDir, createFiles ); + + } + + protected void tearDown() + { + if ( testDir != null ) + { + try + { + DependencyTestUtils.removeDirectory( testDir ); + } + catch ( IOException e ) + { + // TODO Auto-generated catch block + e.printStackTrace(); + fail( "Trying to remove directory:" + testDir + "\r\n" + e.toString() ); + } + assertFalse( testDir.exists() ); + + testDir = null; + } + + stubFactory = null; + } + +} Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestAnalyzeDepMgt.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestAnalyzeDepMgt.java?view=diff&rev=552524&r1=552523&r2=552524 ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestAnalyzeDepMgt.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestAnalyzeDepMgt.java Mon Jul 2 09:06:19 2007 @@ -1,248 +1,248 @@ -package org.apache.maven.plugin.dependency; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import junit.framework.TestCase; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.model.Exclusion; -import org.apache.maven.plugin.dependency.testUtils.DependencyArtifactStubFactory; -import org.apache.maven.plugin.dependency.testUtils.stubs.DependencyProjectStub; -import org.apache.maven.project.MavenProject; - -/* - * 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. - */ - -public class TestAnalyzeDepMgt - extends TestCase -{ - - AnalyzeDepMgt mojo; - - DependencyArtifactStubFactory stubFactory; - - Dependency exclusion; - - Exclusion ex; - - Artifact exclusionArtifact; - - DependencyManagement depMgt; - protected void setUp() - throws Exception - { - - mojo = new AnalyzeDepMgt(); - MavenProject project = new DependencyProjectStub(); - - stubFactory = new DependencyArtifactStubFactory( new File( "" ), false ); - - Set allArtifacts = stubFactory.getMixedArtifacts(); - Set directArtifacts = stubFactory.getClassifiedArtifacts(); - - - exclusionArtifact = stubFactory.getReleaseArtifact(); - directArtifacts.add( exclusionArtifact ); - ex = new Exclusion(); - ex.setArtifactId( exclusionArtifact.getArtifactId() ); - ex.setGroupId( exclusionArtifact.getGroupId() ); - - exclusion = new Dependency(); - exclusion.setArtifactId( exclusionArtifact.getArtifactId() ); - exclusion.setGroupId( exclusionArtifact.getGroupId() ); - exclusion.setType( exclusionArtifact.getType() ); - exclusion.setClassifier( "" ); - exclusion.setVersion( "3.0" ); - - exclusion.addExclusion( ex ); - ArrayList list = new ArrayList(); - list.add( exclusion ); - - depMgt = new DependencyManagement(); - depMgt.setDependencies( list ); - - - project.setArtifacts( allArtifacts ); - project.setDependencyArtifacts( directArtifacts ); - - mojo.setProject( project ); - - } - - public void testGetManagementKey() - throws IOException - { - Dependency dep = new Dependency(); - dep.setArtifactId( "artifact" ); - dep.setClassifier( "class" ); - dep.setGroupId( "group" ); - dep.setType( "type" ); - - // version isn't used in the key, it can be different - dep.setVersion( "1.1" ); - - Artifact artifact = stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type", - "class" ); - - // basic case ok - assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); - - // now change each one and make sure it fails, then set it back and make - // sure it's ok before - // testing the next one - dep.setType( "t" ); - assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); - - dep.setType( "type" ); - assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); - - dep.setArtifactId( "a" ); - assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); - - dep.setArtifactId( "artifact" ); - assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); - - dep.setClassifier( "c" ); - assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); - - dep.setClassifier( "class" ); - assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); - - dep.setGroupId( "g" ); - assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); - - dep.setGroupId( "group" ); - dep.setClassifier( null ); - artifact = stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type", null ); - assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); - - dep.setClassifier( "" ); - artifact = stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type", "" ); - assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); - } - - public void testAddExclusions() - { - - assertEquals( 0, mojo.addExclusions( null ).size() ); - - ArrayList list = new ArrayList(); - list.add( ex ); - Map map = mojo.addExclusions( list ); - - assertEquals( 1,map.size() ); - assertTrue( map.containsKey( mojo.getExclusionKey( ex ) ) ); - assertSame( ex, map.get( mojo.getExclusionKey( ex ) ) ); - } - - public void testGetExclusionErrors() - { - ArrayList list = new ArrayList(); - list.add( ex ); - - // already tested this method so I can trust it. - Map map = mojo.addExclusions( list ); - - List l = mojo.getExclusionErrors( map, mojo.getProject().getArtifacts() ); - - assertEquals( 1, l.size() ); - - assertEquals( mojo.getExclusionKey( ex ), mojo.getExclusionKey(( Artifact) l.get( 0 ) ) ); - } - - public void testGetMismatch() - throws IOException - { - Map depMgtMap = new HashMap(); - - depMgtMap.put( exclusion.getManagementKey(), exclusion ); - - Map results = mojo.getMismatch( depMgtMap, mojo.getProject().getArtifacts() ); - - assertEquals( 1, results.size() ); - // the release artifact is used to create the exclusion - assertTrue( results.containsKey( stubFactory.getReleaseArtifact() ) ); - assertSame( exclusion, results.get( stubFactory.getReleaseArtifact() ) ); - } - - public void testMojo() throws IOException - { - mojo.setIgnoreDirect( false ); - try - { - // test with nothing in depMgt - mojo.execute(); - } - catch ( Exception e ) - { - e.printStackTrace(); - fail("Caught Unexpected Exception:"+e.getLocalizedMessage()); - } - - try - { - DependencyProjectStub project = (DependencyProjectStub) mojo.getProject(); - project.setDependencyManagement( depMgt ); - // test with exclusion - mojo.execute(); - } - catch ( Exception e ) - { - e.printStackTrace(); - fail("Caught Unexpected Exception:"+e.getLocalizedMessage()); - } - - try - { - DependencyProjectStub project = (DependencyProjectStub) mojo.getProject(); - project.setDependencyManagement( depMgt ); - // test with exclusion - mojo.setFailBuild( true ); - mojo.execute(); - fail("Expected exception to fail the build."); - } - catch ( Exception e ) - { - System.out.println("Caught Expected Exception:"+e.getLocalizedMessage()); - } - - try - { - DependencyProjectStub project = (DependencyProjectStub) mojo.getProject(); - project.setDependencyManagement( depMgt ); - // test with exclusion - mojo.setFailBuild( true ); - mojo.setIgnoreDirect( true ); - mojo.execute(); - } - catch ( Exception e ) - { - e.printStackTrace(); - fail("Caught Unexpected Exception:"+e.getLocalizedMessage()); - } - } -} +package org.apache.maven.plugin.dependency; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DependencyManagement; +import org.apache.maven.model.Exclusion; +import org.apache.maven.plugin.dependency.testUtils.DependencyArtifactStubFactory; +import org.apache.maven.plugin.dependency.testUtils.stubs.DependencyProjectStub; +import org.apache.maven.project.MavenProject; + +/* + * 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. + */ + +public class TestAnalyzeDepMgt + extends TestCase +{ + + AnalyzeDepMgt mojo; + + DependencyArtifactStubFactory stubFactory; + + Dependency exclusion; + + Exclusion ex; + + Artifact exclusionArtifact; + + DependencyManagement depMgt; + protected void setUp() + throws Exception + { + + mojo = new AnalyzeDepMgt(); + MavenProject project = new DependencyProjectStub(); + + stubFactory = new DependencyArtifactStubFactory( new File( "" ), false ); + + Set allArtifacts = stubFactory.getMixedArtifacts(); + Set directArtifacts = stubFactory.getClassifiedArtifacts(); + + + exclusionArtifact = stubFactory.getReleaseArtifact(); + directArtifacts.add( exclusionArtifact ); + ex = new Exclusion(); + ex.setArtifactId( exclusionArtifact.getArtifactId() ); + ex.setGroupId( exclusionArtifact.getGroupId() ); + + exclusion = new Dependency(); + exclusion.setArtifactId( exclusionArtifact.getArtifactId() ); + exclusion.setGroupId( exclusionArtifact.getGroupId() ); + exclusion.setType( exclusionArtifact.getType() ); + exclusion.setClassifier( "" ); + exclusion.setVersion( "3.0" ); + + exclusion.addExclusion( ex ); + ArrayList list = new ArrayList(); + list.add( exclusion ); + + depMgt = new DependencyManagement(); + depMgt.setDependencies( list ); + + + project.setArtifacts( allArtifacts ); + project.setDependencyArtifacts( directArtifacts ); + + mojo.setProject( project ); + + } + + public void testGetManagementKey() + throws IOException + { + Dependency dep = new Dependency(); + dep.setArtifactId( "artifact" ); + dep.setClassifier( "class" ); + dep.setGroupId( "group" ); + dep.setType( "type" ); + + // version isn't used in the key, it can be different + dep.setVersion( "1.1" ); + + Artifact artifact = stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type", + "class" ); + + // basic case ok + assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); + + // now change each one and make sure it fails, then set it back and make + // sure it's ok before + // testing the next one + dep.setType( "t" ); + assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); + + dep.setType( "type" ); + assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); + + dep.setArtifactId( "a" ); + assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); + + dep.setArtifactId( "artifact" ); + assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); + + dep.setClassifier( "c" ); + assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); + + dep.setClassifier( "class" ); + assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); + + dep.setGroupId( "g" ); + assertFalse( dep.getManagementKey().equals( mojo.getArtifactManagementKey( artifact ) ) ); + + dep.setGroupId( "group" ); + dep.setClassifier( null ); + artifact = stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type", null ); + assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); + + dep.setClassifier( "" ); + artifact = stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type", "" ); + assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) ); + } + + public void testAddExclusions() + { + + assertEquals( 0, mojo.addExclusions( null ).size() ); + + ArrayList list = new ArrayList(); + list.add( ex ); + Map map = mojo.addExclusions( list ); + + assertEquals( 1,map.size() ); + assertTrue( map.containsKey( mojo.getExclusionKey( ex ) ) ); + assertSame( ex, map.get( mojo.getExclusionKey( ex ) ) ); + } + + public void testGetExclusionErrors() + { + ArrayList list = new ArrayList(); + list.add( ex ); + + // already tested this method so I can trust it. + Map map = mojo.addExclusions( list ); + + List l = mojo.getExclusionErrors( map, mojo.getProject().getArtifacts() ); + + assertEquals( 1, l.size() ); + + assertEquals( mojo.getExclusionKey( ex ), mojo.getExclusionKey(( Artifact) l.get( 0 ) ) ); + } + + public void testGetMismatch() + throws IOException + { + Map depMgtMap = new HashMap(); + + depMgtMap.put( exclusion.getManagementKey(), exclusion ); + + Map results = mojo.getMismatch( depMgtMap, mojo.getProject().getArtifacts() ); + + assertEquals( 1, results.size() ); + // the release artifact is used to create the exclusion + assertTrue( results.containsKey( stubFactory.getReleaseArtifact() ) ); + assertSame( exclusion, results.get( stubFactory.getReleaseArtifact() ) ); + } + + public void testMojo() throws IOException + { + mojo.setIgnoreDirect( false ); + try + { + // test with nothing in depMgt + mojo.execute(); + } + catch ( Exception e ) + { + e.printStackTrace(); + fail("Caught Unexpected Exception:"+e.getLocalizedMessage()); + } + + try + { + DependencyProjectStub project = (DependencyProjectStub) mojo.getProject(); + project.setDependencyManagement( depMgt ); + // test with exclusion + mojo.execute(); + } + catch ( Exception e ) + { + e.printStackTrace(); + fail("Caught Unexpected Exception:"+e.getLocalizedMessage()); + } + + try + { + DependencyProjectStub project = (DependencyProjectStub) mojo.getProject(); + project.setDependencyManagement( depMgt ); + // test with exclusion + mojo.setFailBuild( true ); + mojo.execute(); + fail("Expected exception to fail the build."); + } + catch ( Exception e ) + { + System.out.println("Caught Expected Exception:"+e.getLocalizedMessage()); + } + + try + { + DependencyProjectStub project = (DependencyProjectStub) mojo.getProject(); + project.setDependencyManagement( depMgt ); + // test with exclusion + mojo.setFailBuild( true ); + mojo.setIgnoreDirect( true ); + mojo.execute(); + } + catch ( Exception e ) + { + e.printStackTrace(); + fail("Caught Unexpected Exception:"+e.getLocalizedMessage()); + } + } +} Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestAnalyzeDepMgt.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestAnalyzeDepMgt.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestBuildClasspathMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestBuildClasspathMojo.java?view=diff&rev=552524&r1=552523&r2=552524 ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestBuildClasspathMojo.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestBuildClasspathMojo.java Mon Jul 2 09:06:19 2007 @@ -1,101 +1,101 @@ -package org.apache.maven.plugin.dependency; - -/* - * 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.util.Set; - -import org.apache.maven.project.MavenProject; - -public class TestBuildClasspathMojo - extends AbstractDependencyMojoTestCase -{ - - protected void setUp() - throws Exception - { - // required for mojo lookups to work - super.setUp( "build-classpath", true ); - } - - /** - * tests the proper discovery and configuration of the mojo - * - * @throws Exception - */ - public void testEnvironment() - throws Exception - { - File testPom = new File( getBasedir(), "target/test-classes/unit/build-classpath-test/plugin-config.xml" ); - BuildClasspathMojo mojo = (BuildClasspathMojo) lookupMojo( "build-classpath", testPom ); - - assertNotNull( mojo ); - assertNotNull( mojo.getProject() ); - MavenProject project = mojo.getProject(); - - // mojo.silent = true; - Set artifacts = this.stubFactory.getScopedArtifacts(); - Set directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts(); - artifacts.addAll( directArtifacts ); - - project.setArtifacts( artifacts ); - project.setDependencyArtifacts( directArtifacts ); - - mojo.execute(); - String file = null; - try - { - file = mojo.readClasspathFile(); - - fail( "Expected an illegal Argument Exception" ); - } - catch ( IllegalArgumentException e ) - { - // expected to catch this. - } - - mojo.setCpFile( new File(testDir,"buildClasspath.txt") ); - mojo.execute(); - - file = mojo.readClasspathFile(); - assertNotNull( file ); - assertTrue( file.length() > 0 ); - - assertTrue(file.indexOf( File.pathSeparator ) >= 0 ); - assertTrue(file.indexOf( File.separator ) >= 0 ); - - String fileSep = "#####"; - String pathSep = "%%%%%"; - - mojo.setFileSeparator( fileSep ); - mojo.setPathSeparator( pathSep ); - mojo.execute(); - - file = mojo.readClasspathFile(); - assertNotNull( file ); - assertTrue( file.length() > 0 ); - - assertFalse(file.indexOf( File.pathSeparator ) >= 0 ); - assertFalse(file.indexOf( File.separator ) >= 0 ); - assertTrue(file.indexOf( fileSep ) >= 0 ); - assertTrue(file.indexOf( pathSep ) >= 0 ); - } - -} +package org.apache.maven.plugin.dependency; + +/* + * 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.util.Set; + +import org.apache.maven.project.MavenProject; + +public class TestBuildClasspathMojo + extends AbstractDependencyMojoTestCase +{ + + protected void setUp() + throws Exception + { + // required for mojo lookups to work + super.setUp( "build-classpath", true ); + } + + /** + * tests the proper discovery and configuration of the mojo + * + * @throws Exception + */ + public void testEnvironment() + throws Exception + { + File testPom = new File( getBasedir(), "target/test-classes/unit/build-classpath-test/plugin-config.xml" ); + BuildClasspathMojo mojo = (BuildClasspathMojo) lookupMojo( "build-classpath", testPom ); + + assertNotNull( mojo ); + assertNotNull( mojo.getProject() ); + MavenProject project = mojo.getProject(); + + // mojo.silent = true; + Set artifacts = this.stubFactory.getScopedArtifacts(); + Set directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts(); + artifacts.addAll( directArtifacts ); + + project.setArtifacts( artifacts ); + project.setDependencyArtifacts( directArtifacts ); + + mojo.execute(); + String file = null; + try + { + file = mojo.readClasspathFile(); + + fail( "Expected an illegal Argument Exception" ); + } + catch ( IllegalArgumentException e ) + { + // expected to catch this. + } + + mojo.setCpFile( new File(testDir,"buildClasspath.txt") ); + mojo.execute(); + + file = mojo.readClasspathFile(); + assertNotNull( file ); + assertTrue( file.length() > 0 ); + + assertTrue(file.indexOf( File.pathSeparator ) >= 0 ); + assertTrue(file.indexOf( File.separator ) >= 0 ); + + String fileSep = "#####"; + String pathSep = "%%%%%"; + + mojo.setFileSeparator( fileSep ); + mojo.setPathSeparator( pathSep ); + mojo.execute(); + + file = mojo.readClasspathFile(); + assertNotNull( file ); + assertTrue( file.length() > 0 ); + + assertFalse(file.indexOf( File.pathSeparator ) >= 0 ); + assertFalse(file.indexOf( File.separator ) >= 0 ); + assertTrue(file.indexOf( fileSep ) >= 0 ); + assertTrue(file.indexOf( pathSep ) >= 0 ); + } + +} Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestBuildClasspathMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestBuildClasspathMojo.java ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords Mon Jul 2 09:06:19 2007 @@ -1 +1 @@ -Author Date Id HeadURL Revision +Author Date Id Revision