Set svn EOL to native
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1694580 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/AbstractFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/AbstractFilter.java
index 15e7515..2449ab5 100644
--- a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/AbstractFilter.java
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/AbstractFilter.java
@@ -1,40 +1,40 @@
-package org.apache.maven.shared.artifact.filter.resolve;
-
-/*
- * 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.util.List;
-
-/**
- * Abstract filter for custom implementations
- *
- * @author Robert Scholte
- * @since 3.0
- */
-public abstract class AbstractFilter implements TransformableFilter
-{
-
- @Override
- public final <T> T transform( FilterTransformer<T> transformer )
- {
- return transformer.transform( this );
- }
-
- public abstract boolean accept( Node node, List<Node> parents );
-}
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * 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.util.List;
+
+/**
+ * Abstract filter for custom implementations
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+public abstract class AbstractFilter implements TransformableFilter
+{
+
+ @Override
+ public final <T> T transform( FilterTransformer<T> transformer )
+ {
+ return transformer.transform( this );
+ }
+
+ public abstract boolean accept( Node node, List<Node> parents );
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/Node.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/Node.java
index 95d6a0f..763d744 100644
--- a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/Node.java
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/Node.java
@@ -1,33 +1,33 @@
-package org.apache.maven.shared.artifact.filter.resolve;
-
-/*
- * 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.
- */
-
-/**
- * Represents a node of a dependency graph
- *
- * @author Robert Scholte
- * @since 3.0
- *
- */
-public interface Node
-{
- org.apache.maven.model.Dependency getDependency();
-
-}
+package org.apache.maven.shared.artifact.filter.resolve;
+
+/*
+ * 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.
+ */
+
+/**
+ * Represents a node of a dependency graph
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ *
+ */
+public interface Node
+{
+ org.apache.maven.model.Dependency getDependency();
+
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformer.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformer.java
index 570b55d..63d915e 100644
--- a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformer.java
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformer.java
@@ -1,158 +1,158 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
-import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter;
-import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
-import org.apache.maven.shared.artifact.filter.resolve.AbstractFilter;
-import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
-import org.apache.maven.shared.artifact.filter.resolve.ExclusionsFilter;
-import org.apache.maven.shared.artifact.filter.resolve.FilterTransformer;
-import org.apache.maven.shared.artifact.filter.resolve.OrFilter;
-import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter;
-import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter;
-import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter;
-import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
-
-/**
- * Makes it possible to use the TransformableFilters for Aether and as classic Maven ArtifactFilter.
- *
- * <strong>Note:</strong> the {@link AndFilter} and {@link ExclusionsFilter} are transformed to {@link ArtifactFilter}
- * implementations of Maven Core
- *
- * @author Robert Scholte
- * @since 3.0
- */
-public class ArtifactIncludeFilterTransformer implements FilterTransformer<ArtifactFilter>
-{
-
- @Override
- public ArtifactFilter transform( final ScopeFilter scopeFilter )
- {
- return new ArtifactFilter()
- {
- @Override
- public boolean include( Artifact artifact )
- {
- boolean isIncluded;
-
- if ( scopeFilter.getIncluded() != null )
- {
- isIncluded = scopeFilter.getIncluded().contains( artifact.getScope() );
- }
- else
- {
- isIncluded = true;
- }
-
- boolean isExcluded;
-
- if ( scopeFilter.getExcluded() != null )
- {
- isExcluded = scopeFilter.getExcluded().contains( artifact.getScope() );
- }
- else
- {
- isExcluded = false;
- }
-
- return isIncluded && !isExcluded;
- }
- };
- }
-
- @Override
- public AndArtifactFilter transform( AndFilter andFilter )
- {
- AndArtifactFilter filter = new AndArtifactFilter();
-
- for ( TransformableFilter subFilter : andFilter.getFilters() )
- {
- filter.add( subFilter.transform( this ) );
- }
-
- return filter;
- }
-
- @Override
- public ArtifactFilter transform( final ExclusionsFilter exclusionsFilter )
- {
- return new ExcludesArtifactFilter( new ArrayList<String>( exclusionsFilter.getExcludes() ) );
- }
-
- @Override
- public ArtifactFilter transform( OrFilter orFilter )
- {
- final Collection<ArtifactFilter> filters = new ArrayList<ArtifactFilter>( orFilter.getFilters().size() );
-
- for ( TransformableFilter subFilter : orFilter.getFilters() )
- {
- filters.add( subFilter.transform( this ) );
- }
-
- return new ArtifactFilter()
- {
- @Override
- public boolean include( Artifact artifact )
- {
- for ( ArtifactFilter filter : filters )
- {
- if ( filter.include( artifact ) )
- {
- return true;
- }
- }
- return false;
- }
- };
- }
-
- @Override
- public ArtifactFilter transform( PatternExclusionsFilter patternExclusionsFilter )
- {
- return new PatternExcludesArtifactFilter( patternExclusionsFilter.getExcludes() );
- }
-
- @Override
- public ArtifactFilter transform( PatternInclusionsFilter patternInclusionsFilter )
- {
- return new PatternIncludesArtifactFilter( patternInclusionsFilter.getIncludes() );
- }
-
- @Override
- public ArtifactFilter transform( final AbstractFilter filter )
- {
- return new ArtifactFilter()
- {
- @Override
- public boolean include( Artifact artifact )
- {
- return filter.accept( new ArtifactIncludeNode( artifact ), null );
- }
- };
- }
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
+import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter;
+import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
+import org.apache.maven.shared.artifact.filter.resolve.AbstractFilter;
+import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.FilterTransformer;
+import org.apache.maven.shared.artifact.filter.resolve.OrFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter;
+import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
+
+/**
+ * Makes it possible to use the TransformableFilters for Aether and as classic Maven ArtifactFilter.
+ *
+ * <strong>Note:</strong> the {@link AndFilter} and {@link ExclusionsFilter} are transformed to {@link ArtifactFilter}
+ * implementations of Maven Core
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+public class ArtifactIncludeFilterTransformer implements FilterTransformer<ArtifactFilter>
+{
+
+ @Override
+ public ArtifactFilter transform( final ScopeFilter scopeFilter )
+ {
+ return new ArtifactFilter()
+ {
+ @Override
+ public boolean include( Artifact artifact )
+ {
+ boolean isIncluded;
+
+ if ( scopeFilter.getIncluded() != null )
+ {
+ isIncluded = scopeFilter.getIncluded().contains( artifact.getScope() );
+ }
+ else
+ {
+ isIncluded = true;
+ }
+
+ boolean isExcluded;
+
+ if ( scopeFilter.getExcluded() != null )
+ {
+ isExcluded = scopeFilter.getExcluded().contains( artifact.getScope() );
+ }
+ else
+ {
+ isExcluded = false;
+ }
+
+ return isIncluded && !isExcluded;
+ }
+ };
+ }
+
+ @Override
+ public AndArtifactFilter transform( AndFilter andFilter )
+ {
+ AndArtifactFilter filter = new AndArtifactFilter();
+
+ for ( TransformableFilter subFilter : andFilter.getFilters() )
+ {
+ filter.add( subFilter.transform( this ) );
+ }
+
+ return filter;
+ }
+
+ @Override
+ public ArtifactFilter transform( final ExclusionsFilter exclusionsFilter )
+ {
+ return new ExcludesArtifactFilter( new ArrayList<String>( exclusionsFilter.getExcludes() ) );
+ }
+
+ @Override
+ public ArtifactFilter transform( OrFilter orFilter )
+ {
+ final Collection<ArtifactFilter> filters = new ArrayList<ArtifactFilter>( orFilter.getFilters().size() );
+
+ for ( TransformableFilter subFilter : orFilter.getFilters() )
+ {
+ filters.add( subFilter.transform( this ) );
+ }
+
+ return new ArtifactFilter()
+ {
+ @Override
+ public boolean include( Artifact artifact )
+ {
+ for ( ArtifactFilter filter : filters )
+ {
+ if ( filter.include( artifact ) )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ }
+
+ @Override
+ public ArtifactFilter transform( PatternExclusionsFilter patternExclusionsFilter )
+ {
+ return new PatternExcludesArtifactFilter( patternExclusionsFilter.getExcludes() );
+ }
+
+ @Override
+ public ArtifactFilter transform( PatternInclusionsFilter patternInclusionsFilter )
+ {
+ return new PatternIncludesArtifactFilter( patternInclusionsFilter.getIncludes() );
+ }
+
+ @Override
+ public ArtifactFilter transform( final AbstractFilter filter )
+ {
+ return new ArtifactFilter()
+ {
+ @Override
+ public boolean include( Artifact artifact )
+ {
+ return filter.accept( new ArtifactIncludeNode( artifact ), null );
+ }
+ };
+ }
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNode.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNode.java
index fb93dcb..a392776 100644
--- a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNode.java
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNode.java
@@ -1,64 +1,64 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.shared.artifact.filter.resolve.Node;
-
-/**
- *
- * @author Robert Scholte
- * @since 3.0
- */
-class ArtifactIncludeNode implements Node
-{
- private final Artifact artifact;
-
- public ArtifactIncludeNode( Artifact artifact )
- {
- this.artifact = artifact;
- }
-
- /**
- * Note: an artifact doesn't contain exclusion information, so it won't be available here.
- * When required switch to filtering based on Aether
- *
- * @see EclipseAetherNode
- * @see SonatypeAetherNode
- */
- @Override
- public Dependency getDependency()
- {
- org.apache.maven.model.Dependency mavenDependency = new org.apache.maven.model.Dependency();
- mavenDependency.setGroupId( artifact.getGroupId() );
- mavenDependency.setArtifactId( artifact.getArtifactId() );
- mavenDependency.setVersion( artifact.getVersion() );
- mavenDependency.setClassifier( artifact.getClassifier() );
- mavenDependency.setType( artifact.getType() );
- mavenDependency.setScope( artifact.getScope() );
- mavenDependency.setOptional( artifact.isOptional() );
- // no setExcludes possible
-
- return mavenDependency;
- }
-
-
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.shared.artifact.filter.resolve.Node;
+
+/**
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+class ArtifactIncludeNode implements Node
+{
+ private final Artifact artifact;
+
+ public ArtifactIncludeNode( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+ /**
+ * Note: an artifact doesn't contain exclusion information, so it won't be available here.
+ * When required switch to filtering based on Aether
+ *
+ * @see EclipseAetherNode
+ * @see SonatypeAetherNode
+ */
+ @Override
+ public Dependency getDependency()
+ {
+ org.apache.maven.model.Dependency mavenDependency = new org.apache.maven.model.Dependency();
+ mavenDependency.setGroupId( artifact.getGroupId() );
+ mavenDependency.setArtifactId( artifact.getArtifactId() );
+ mavenDependency.setVersion( artifact.getVersion() );
+ mavenDependency.setClassifier( artifact.getClassifier() );
+ mavenDependency.setType( artifact.getType() );
+ mavenDependency.setScope( artifact.getScope() );
+ mavenDependency.setOptional( artifact.isOptional() );
+ // no setExcludes possible
+
+ return mavenDependency;
+ }
+
+
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNode.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNode.java
index 448c218..a1181ba 100644
--- a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNode.java
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNode.java
@@ -1,91 +1,91 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.shared.artifact.filter.resolve.Node;
-import org.eclipse.aether.artifact.ArtifactProperties;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.graph.Exclusion;
-
-/**
- * Adapter of an Eclipse Aether DependencyNode for common Node
- *
- * @author Robert Scholte
- * @since 3.0
- */
-class EclipseAetherNode implements Node
-{
-
- private final DependencyNode node;
-
- EclipseAetherNode( DependencyNode node )
- {
- this.node = node;
- }
-
- @Override
- public org.apache.maven.model.Dependency getDependency()
- {
- Dependency nodeDependency = node.getDependency();
-
- if ( nodeDependency == null )
- {
- return null;
- }
-
- org.apache.maven.model.Dependency mavenDependency = new org.apache.maven.model.Dependency();
- mavenDependency.setGroupId( nodeDependency.getArtifact().getGroupId() );
- mavenDependency.setArtifactId( nodeDependency.getArtifact().getArtifactId() );
- mavenDependency.setVersion( nodeDependency.getArtifact().getVersion() );
- mavenDependency.setClassifier( nodeDependency.getArtifact().getClassifier() );
- mavenDependency.setType( nodeDependency.getArtifact().getProperty( ArtifactProperties.TYPE, null ) );
- mavenDependency.setScope( nodeDependency.getScope() );
- // Eclipse Aether supports three-valued logic
- if ( nodeDependency.getOptional() != null )
- {
- mavenDependency.setOptional( nodeDependency.isOptional() );
- }
- if ( nodeDependency.getExclusions() != null )
- {
- List<org.apache.maven.model.Exclusion> mavenExclusions =
- new ArrayList<org.apache.maven.model.Exclusion>( nodeDependency.getExclusions().size() );
-
- for ( Exclusion aetherExclusion : nodeDependency.getExclusions() )
- {
- org.apache.maven.model.Exclusion mavenExclusion = new org.apache.maven.model.Exclusion();
-
- mavenExclusion.setGroupId( aetherExclusion.getGroupId() );
- mavenExclusion.setArtifactId( aetherExclusion.getArtifactId() );
- // that's all folks, although Aether has more metadata
-
- mavenExclusions.add( mavenExclusion );
- }
-
- mavenDependency.setExclusions( mavenExclusions );
- }
-
- return mavenDependency;
- }
-
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.shared.artifact.filter.resolve.Node;
+import org.eclipse.aether.artifact.ArtifactProperties;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.Exclusion;
+
+/**
+ * Adapter of an Eclipse Aether DependencyNode for common Node
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+class EclipseAetherNode implements Node
+{
+
+ private final DependencyNode node;
+
+ EclipseAetherNode( DependencyNode node )
+ {
+ this.node = node;
+ }
+
+ @Override
+ public org.apache.maven.model.Dependency getDependency()
+ {
+ Dependency nodeDependency = node.getDependency();
+
+ if ( nodeDependency == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.Dependency mavenDependency = new org.apache.maven.model.Dependency();
+ mavenDependency.setGroupId( nodeDependency.getArtifact().getGroupId() );
+ mavenDependency.setArtifactId( nodeDependency.getArtifact().getArtifactId() );
+ mavenDependency.setVersion( nodeDependency.getArtifact().getVersion() );
+ mavenDependency.setClassifier( nodeDependency.getArtifact().getClassifier() );
+ mavenDependency.setType( nodeDependency.getArtifact().getProperty( ArtifactProperties.TYPE, null ) );
+ mavenDependency.setScope( nodeDependency.getScope() );
+ // Eclipse Aether supports three-valued logic
+ if ( nodeDependency.getOptional() != null )
+ {
+ mavenDependency.setOptional( nodeDependency.isOptional() );
+ }
+ if ( nodeDependency.getExclusions() != null )
+ {
+ List<org.apache.maven.model.Exclusion> mavenExclusions =
+ new ArrayList<org.apache.maven.model.Exclusion>( nodeDependency.getExclusions().size() );
+
+ for ( Exclusion aetherExclusion : nodeDependency.getExclusions() )
+ {
+ org.apache.maven.model.Exclusion mavenExclusion = new org.apache.maven.model.Exclusion();
+
+ mavenExclusion.setGroupId( aetherExclusion.getGroupId() );
+ mavenExclusion.setArtifactId( aetherExclusion.getArtifactId() );
+ // that's all folks, although Aether has more metadata
+
+ mavenExclusions.add( mavenExclusion );
+ }
+
+ mavenDependency.setExclusions( mavenExclusions );
+ }
+
+ return mavenDependency;
+ }
+
+}
diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNode.java b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNode.java
index 668d2fc..fa612ef 100644
--- a/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNode.java
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNode.java
@@ -1,88 +1,88 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.shared.artifact.filter.resolve.Node;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.graph.DependencyNode;
-import org.sonatype.aether.graph.Exclusion;
-import org.sonatype.aether.util.artifact.ArtifactProperties;
-
-/**
- * Adapter of a Sonatype Aether DependencyNode for common Node
- *
- * @author Robert Scholte
- * @since 3.0
- */
-class SonatypeAetherNode implements Node
-{
-
- private final DependencyNode node;
-
- SonatypeAetherNode( DependencyNode node )
- {
- this.node = node;
- }
-
-
- @Override
- public org.apache.maven.model.Dependency getDependency()
- {
- Dependency nodeDependency = node.getDependency();
-
- if ( nodeDependency == null )
- {
- return null;
- }
-
- org.apache.maven.model.Dependency mavenDependency = new org.apache.maven.model.Dependency();
- mavenDependency.setGroupId( nodeDependency.getArtifact().getGroupId() );
- mavenDependency.setArtifactId( nodeDependency.getArtifact().getArtifactId() );
- mavenDependency.setVersion( nodeDependency.getArtifact().getVersion() );
- mavenDependency.setClassifier( nodeDependency.getArtifact().getClassifier() );
- mavenDependency.setType( nodeDependency.getArtifact().getProperty( ArtifactProperties.TYPE, null ) );
- mavenDependency.setScope( nodeDependency.getScope() );
- mavenDependency.setOptional( nodeDependency.isOptional() );
- if ( nodeDependency.getExclusions() != null )
- {
- List<org.apache.maven.model.Exclusion> mavenExclusions =
- new ArrayList<org.apache.maven.model.Exclusion>( nodeDependency.getExclusions().size() );
-
- for ( Exclusion aetherExclusion : nodeDependency.getExclusions() )
- {
- org.apache.maven.model.Exclusion mavenExclusion = new org.apache.maven.model.Exclusion();
-
- mavenExclusion.setGroupId( aetherExclusion.getGroupId() );
- mavenExclusion.setArtifactId( aetherExclusion.getArtifactId() );
- // that's all folks, although Aether has more metadata
-
- mavenExclusions.add( mavenExclusion );
- }
-
- mavenDependency.setExclusions( mavenExclusions );
- }
-
- return mavenDependency;
- }
-
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.shared.artifact.filter.resolve.Node;
+import org.sonatype.aether.graph.Dependency;
+import org.sonatype.aether.graph.DependencyNode;
+import org.sonatype.aether.graph.Exclusion;
+import org.sonatype.aether.util.artifact.ArtifactProperties;
+
+/**
+ * Adapter of a Sonatype Aether DependencyNode for common Node
+ *
+ * @author Robert Scholte
+ * @since 3.0
+ */
+class SonatypeAetherNode implements Node
+{
+
+ private final DependencyNode node;
+
+ SonatypeAetherNode( DependencyNode node )
+ {
+ this.node = node;
+ }
+
+
+ @Override
+ public org.apache.maven.model.Dependency getDependency()
+ {
+ Dependency nodeDependency = node.getDependency();
+
+ if ( nodeDependency == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.Dependency mavenDependency = new org.apache.maven.model.Dependency();
+ mavenDependency.setGroupId( nodeDependency.getArtifact().getGroupId() );
+ mavenDependency.setArtifactId( nodeDependency.getArtifact().getArtifactId() );
+ mavenDependency.setVersion( nodeDependency.getArtifact().getVersion() );
+ mavenDependency.setClassifier( nodeDependency.getArtifact().getClassifier() );
+ mavenDependency.setType( nodeDependency.getArtifact().getProperty( ArtifactProperties.TYPE, null ) );
+ mavenDependency.setScope( nodeDependency.getScope() );
+ mavenDependency.setOptional( nodeDependency.isOptional() );
+ if ( nodeDependency.getExclusions() != null )
+ {
+ List<org.apache.maven.model.Exclusion> mavenExclusions =
+ new ArrayList<org.apache.maven.model.Exclusion>( nodeDependency.getExclusions().size() );
+
+ for ( Exclusion aetherExclusion : nodeDependency.getExclusions() )
+ {
+ org.apache.maven.model.Exclusion mavenExclusion = new org.apache.maven.model.Exclusion();
+
+ mavenExclusion.setGroupId( aetherExclusion.getGroupId() );
+ mavenExclusion.setArtifactId( aetherExclusion.getArtifactId() );
+ // that's all folks, although Aether has more metadata
+
+ mavenExclusions.add( mavenExclusion );
+ }
+
+ mavenDependency.setExclusions( mavenExclusions );
+ }
+
+ return mavenDependency;
+ }
+
+}
diff --git a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformerTest.java b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformerTest.java
index 436b683..b309a5b 100644
--- a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformerTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeFilterTransformerTest.java
@@ -1,171 +1,171 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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 static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.plugin.testing.ArtifactStubFactory;
-import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter;
-import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
-import org.apache.maven.shared.artifact.filter.resolve.AbstractFilter;
-import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
-import org.apache.maven.shared.artifact.filter.resolve.ExclusionsFilter;
-import org.apache.maven.shared.artifact.filter.resolve.Node;
-import org.apache.maven.shared.artifact.filter.resolve.OrFilter;
-import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter;
-import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter;
-import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter;
-import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
-import org.junit.Test;
-
-public class ArtifactIncludeFilterTransformerTest
-{
-
- private ArtifactIncludeFilterTransformer transformer = new ArtifactIncludeFilterTransformer();
-
- private ArtifactStubFactory artifactFactory = new ArtifactStubFactory();
-
- @Test
- public void testTransformAndFilter()
- throws Exception
- {
- AndFilter filter =
- new AndFilter(
- Arrays.<TransformableFilter>asList( ScopeFilter.including( "compile" ),
- new ExclusionsFilter( Collections.singletonList( "x:a" ) ) ) );
-
- AndArtifactFilter dependencyFilter = (AndArtifactFilter) filter.transform( transformer );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "compile" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "test" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "test" ) ) );
- }
-
- @Test
- public void testTransformExclusionsFilter()
- throws Exception
- {
- ExclusionsFilter filter = new ExclusionsFilter( Collections.singletonList( "x:a" ) );
-
- ArtifactFilter dependencyFilter = (ArtifactFilter) filter.transform( transformer );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "compile" ) ) );
- }
-
- @Test
- public void testTransformOrFilter()
- throws Exception
- {
- OrFilter filter =
- new OrFilter( Arrays.<TransformableFilter>asList( ScopeFilter.including( "compile" ),
- ScopeFilter.including( "test" ) ) );
-
- ArtifactFilter dependencyFilter = (ArtifactFilter) filter.transform( transformer );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "test" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
- }
-
- @Test
- public void testTransformScopeFilter()
- throws Exception
- {
- ScopeFilter filter = ScopeFilter.including( Collections.singletonList( "runtime" ) );
-
- ArtifactFilter dependencyFilter = (ArtifactFilter) filter.transform( transformer );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "test" ) ) );
- }
-
- @Test
- public void testTransformPatternExclusionsFilter()
- throws Exception
- {
- PatternExclusionsFilter filter = new PatternExclusionsFilter( Collections.singletonList( "x:*" ) );
-
- PatternExcludesArtifactFilter dependencyFilter = (PatternExcludesArtifactFilter) filter.transform( transformer );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "runtime" ) ) );
- }
-
- @Test
- public void testTransformPatternInclusionsFilter()
- throws Exception
- {
- PatternInclusionsFilter filter = new PatternInclusionsFilter( Collections.singletonList( "g:*" ) );
-
- PatternIncludesArtifactFilter dependencyFilter = (PatternIncludesArtifactFilter) filter.transform( transformer );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "runtime" ) ) );
- }
-
- @Test
- public void testTransformAbstractFilter() throws Exception
- {
- AbstractFilter snapshotFilter = new AbstractFilter()
- {
- @Override
- public boolean accept( Node node, List<Node> parents )
- {
- return ArtifactUtils.isSnapshot( node.getDependency().getVersion() );
- }
- };
-
- ArtifactFilter dependencyFilter = snapshotFilter.transform( transformer );
-
- assertTrue( dependencyFilter.include( newArtifact( "g:a:1.0-SNAPSHOT", "compile" ) ) );
-
- assertFalse( dependencyFilter.include( newArtifact( "g:a:1.0", "compile" ) ) );
- }
-
- private Artifact newArtifact( String coor, String scope )
- throws Exception
- {
- String[] gav = coor.split( ":" );
- return artifactFactory.createArtifact( gav[0], gav[1], gav[2], scope );
- }
-
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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 static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter;
+import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
+import org.apache.maven.shared.artifact.filter.resolve.AbstractFilter;
+import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.Node;
+import org.apache.maven.shared.artifact.filter.resolve.OrFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter;
+import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter;
+import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
+import org.junit.Test;
+
+public class ArtifactIncludeFilterTransformerTest
+{
+
+ private ArtifactIncludeFilterTransformer transformer = new ArtifactIncludeFilterTransformer();
+
+ private ArtifactStubFactory artifactFactory = new ArtifactStubFactory();
+
+ @Test
+ public void testTransformAndFilter()
+ throws Exception
+ {
+ AndFilter filter =
+ new AndFilter(
+ Arrays.<TransformableFilter>asList( ScopeFilter.including( "compile" ),
+ new ExclusionsFilter( Collections.singletonList( "x:a" ) ) ) );
+
+ AndArtifactFilter dependencyFilter = (AndArtifactFilter) filter.transform( transformer );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "compile" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "test" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "test" ) ) );
+ }
+
+ @Test
+ public void testTransformExclusionsFilter()
+ throws Exception
+ {
+ ExclusionsFilter filter = new ExclusionsFilter( Collections.singletonList( "x:a" ) );
+
+ ArtifactFilter dependencyFilter = (ArtifactFilter) filter.transform( transformer );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "compile" ) ) );
+ }
+
+ @Test
+ public void testTransformOrFilter()
+ throws Exception
+ {
+ OrFilter filter =
+ new OrFilter( Arrays.<TransformableFilter>asList( ScopeFilter.including( "compile" ),
+ ScopeFilter.including( "test" ) ) );
+
+ ArtifactFilter dependencyFilter = (ArtifactFilter) filter.transform( transformer );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "test" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
+ }
+
+ @Test
+ public void testTransformScopeFilter()
+ throws Exception
+ {
+ ScopeFilter filter = ScopeFilter.including( Collections.singletonList( "runtime" ) );
+
+ ArtifactFilter dependencyFilter = (ArtifactFilter) filter.transform( transformer );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "compile" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "g:a:v", "test" ) ) );
+ }
+
+ @Test
+ public void testTransformPatternExclusionsFilter()
+ throws Exception
+ {
+ PatternExclusionsFilter filter = new PatternExclusionsFilter( Collections.singletonList( "x:*" ) );
+
+ PatternExcludesArtifactFilter dependencyFilter = (PatternExcludesArtifactFilter) filter.transform( transformer );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "runtime" ) ) );
+ }
+
+ @Test
+ public void testTransformPatternInclusionsFilter()
+ throws Exception
+ {
+ PatternInclusionsFilter filter = new PatternInclusionsFilter( Collections.singletonList( "g:*" ) );
+
+ PatternIncludesArtifactFilter dependencyFilter = (PatternIncludesArtifactFilter) filter.transform( transformer );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:v", "runtime" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "x:a:v", "runtime" ) ) );
+ }
+
+ @Test
+ public void testTransformAbstractFilter() throws Exception
+ {
+ AbstractFilter snapshotFilter = new AbstractFilter()
+ {
+ @Override
+ public boolean accept( Node node, List<Node> parents )
+ {
+ return ArtifactUtils.isSnapshot( node.getDependency().getVersion() );
+ }
+ };
+
+ ArtifactFilter dependencyFilter = snapshotFilter.transform( transformer );
+
+ assertTrue( dependencyFilter.include( newArtifact( "g:a:1.0-SNAPSHOT", "compile" ) ) );
+
+ assertFalse( dependencyFilter.include( newArtifact( "g:a:1.0", "compile" ) ) );
+ }
+
+ private Artifact newArtifact( String coor, String scope )
+ throws Exception
+ {
+ String[] gav = coor.split( ":" );
+ return artifactFactory.createArtifact( gav[0], gav[1], gav[2], scope );
+ }
+
+}
diff --git a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNodeTest.java b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNodeTest.java
index 001de81..49ca1ef 100644
--- a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNodeTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/ArtifactIncludeNodeTest.java
@@ -1,166 +1,166 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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 static org.junit.Assert.assertEquals;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.plugin.testing.ArtifactStubFactory;
-import org.apache.maven.shared.artifact.filter.resolve.Node;
-import org.eclipse.aether.graph.DependencyNode;
-import org.junit.Test;
-
-public class ArtifactIncludeNodeTest
-{
- private ArtifactStubFactory artifactFactory = new ArtifactStubFactory();
-
- @Test
- public void testGAV() throws Exception
- {
- Node node = new ArtifactIncludeNode( newArtifact( "g:a:v", null ) );
-
- Dependency dependency = node.getDependency();
-
- assertEquals( "g", dependency.getGroupId() );
- assertEquals( "a", dependency.getArtifactId() );
- assertEquals( "v", dependency.getVersion() );
- assertEquals( "", dependency.getClassifier() );
- // This is different compared to AetherNodes. Here it's based on artifact, which in the end always has a type.
- assertEquals( "jar", dependency.getType() );
- }
-
- @Test
- public void testClassifier() throws Exception
- {
- Node node = new ArtifactIncludeNode( newArtifact( "g:a::c:v", null ) );
-
- Dependency dependency = node.getDependency();
-
- assertEquals( "g", dependency.getGroupId() );
- assertEquals( "a", dependency.getArtifactId() );
- assertEquals( "v", dependency.getVersion() );
- assertEquals( "c", dependency.getClassifier() );
- // empty type stays empty type when using ArtifactStubFactory
- assertEquals( "", dependency.getType() );
- }
-
- @Test
- public void testType() throws Exception
- {
- Node node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null ) );
-
- Dependency dependency = node.getDependency();
-
- assertEquals( "g", dependency.getGroupId() );
- assertEquals( "a", dependency.getArtifactId() );
- assertEquals( "v", dependency.getVersion() );
- assertEquals( null, dependency.getClassifier() );
- assertEquals( "pom", dependency.getType() );
- }
-
- @Test
- public void testScope() throws Exception
- {
- Node node = new ArtifactIncludeNode( newArtifact( "g:a:v", "s" ) );
-
- Dependency dependency = node.getDependency();
-
- assertEquals( "g", dependency.getGroupId() );
- assertEquals( "a", dependency.getArtifactId() );
- assertEquals( "v", dependency.getVersion() );
- assertEquals( "", dependency.getClassifier() );
- assertEquals( "jar", dependency.getType() );
- assertEquals( "s", dependency.getScope() );
- }
-
- @Test
- public void testOptional() throws Exception
- {
- Node node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null, null ) );
-
- assertEquals( "false", node.getDependency().getOptional() );
- assertEquals( false, node.getDependency().isOptional() );
-
- node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null, true ) );
- assertEquals( "true", node.getDependency().getOptional() );
- assertEquals( true, node.getDependency().isOptional() );
-
- node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null, false ) );
- assertEquals( "false", node.getDependency().getOptional() );
- assertEquals( false, node.getDependency().isOptional() );
- }
-
- private Artifact newArtifact( String coor, String scope )
- throws Exception
- {
- return newArtifact( coor, scope, null );
- }
-
- private Artifact newArtifact( String coor, String scope, Boolean optional )
- throws Exception
- {
- String[] gav = coor.split( ":" );
- String groupId = gav[0];
- String artifactId = gav[1];
- String version = null;
- String classifier = null;
- String type = null;
-
- if ( gav.length == 3 )
- {
- version = gav[2];
- }
- else if ( gav.length == 4 )
- {
- type = gav[2];
- version = gav[3];
- }
- else if ( gav.length == 5 )
- {
- type = gav[2];
- classifier = gav[3];
- version = gav[4];
- }
-
- if( optional != null )
- {
- VersionRange versionRange = VersionRange.createFromVersion( version );
- return artifactFactory.createArtifact( groupId, artifactId, versionRange, scope, type, classifier, optional );
- }
- else if ( gav.length == 3 )
- {
- return artifactFactory.createArtifact( groupId, artifactId, version, scope );
- }
- else if ( gav.length == 4 )
- {
- return artifactFactory.createArtifact( groupId, artifactId, version, scope, type, null );
- }
- else if ( gav.length == 5 )
- {
- return artifactFactory.createArtifact( groupId, artifactId, version, scope, type, classifier );
- }
- else
- {
- throw new IllegalArgumentException( "Can't translate coor to an Artifact" );
- }
- }
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+import org.apache.maven.shared.artifact.filter.resolve.Node;
+import org.eclipse.aether.graph.DependencyNode;
+import org.junit.Test;
+
+public class ArtifactIncludeNodeTest
+{
+ private ArtifactStubFactory artifactFactory = new ArtifactStubFactory();
+
+ @Test
+ public void testGAV() throws Exception
+ {
+ Node node = new ArtifactIncludeNode( newArtifact( "g:a:v", null ) );
+
+ Dependency dependency = node.getDependency();
+
+ assertEquals( "g", dependency.getGroupId() );
+ assertEquals( "a", dependency.getArtifactId() );
+ assertEquals( "v", dependency.getVersion() );
+ assertEquals( "", dependency.getClassifier() );
+ // This is different compared to AetherNodes. Here it's based on artifact, which in the end always has a type.
+ assertEquals( "jar", dependency.getType() );
+ }
+
+ @Test
+ public void testClassifier() throws Exception
+ {
+ Node node = new ArtifactIncludeNode( newArtifact( "g:a::c:v", null ) );
+
+ Dependency dependency = node.getDependency();
+
+ assertEquals( "g", dependency.getGroupId() );
+ assertEquals( "a", dependency.getArtifactId() );
+ assertEquals( "v", dependency.getVersion() );
+ assertEquals( "c", dependency.getClassifier() );
+ // empty type stays empty type when using ArtifactStubFactory
+ assertEquals( "", dependency.getType() );
+ }
+
+ @Test
+ public void testType() throws Exception
+ {
+ Node node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null ) );
+
+ Dependency dependency = node.getDependency();
+
+ assertEquals( "g", dependency.getGroupId() );
+ assertEquals( "a", dependency.getArtifactId() );
+ assertEquals( "v", dependency.getVersion() );
+ assertEquals( null, dependency.getClassifier() );
+ assertEquals( "pom", dependency.getType() );
+ }
+
+ @Test
+ public void testScope() throws Exception
+ {
+ Node node = new ArtifactIncludeNode( newArtifact( "g:a:v", "s" ) );
+
+ Dependency dependency = node.getDependency();
+
+ assertEquals( "g", dependency.getGroupId() );
+ assertEquals( "a", dependency.getArtifactId() );
+ assertEquals( "v", dependency.getVersion() );
+ assertEquals( "", dependency.getClassifier() );
+ assertEquals( "jar", dependency.getType() );
+ assertEquals( "s", dependency.getScope() );
+ }
+
+ @Test
+ public void testOptional() throws Exception
+ {
+ Node node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null, null ) );
+
+ assertEquals( "false", node.getDependency().getOptional() );
+ assertEquals( false, node.getDependency().isOptional() );
+
+ node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null, true ) );
+ assertEquals( "true", node.getDependency().getOptional() );
+ assertEquals( true, node.getDependency().isOptional() );
+
+ node = new ArtifactIncludeNode( newArtifact( "g:a:pom:v", null, false ) );
+ assertEquals( "false", node.getDependency().getOptional() );
+ assertEquals( false, node.getDependency().isOptional() );
+ }
+
+ private Artifact newArtifact( String coor, String scope )
+ throws Exception
+ {
+ return newArtifact( coor, scope, null );
+ }
+
+ private Artifact newArtifact( String coor, String scope, Boolean optional )
+ throws Exception
+ {
+ String[] gav = coor.split( ":" );
+ String groupId = gav[0];
+ String artifactId = gav[1];
+ String version = null;
+ String classifier = null;
+ String type = null;
+
+ if ( gav.length == 3 )
+ {
+ version = gav[2];
+ }
+ else if ( gav.length == 4 )
+ {
+ type = gav[2];
+ version = gav[3];
+ }
+ else if ( gav.length == 5 )
+ {
+ type = gav[2];
+ classifier = gav[3];
+ version = gav[4];
+ }
+
+ if( optional != null )
+ {
+ VersionRange versionRange = VersionRange.createFromVersion( version );
+ return artifactFactory.createArtifact( groupId, artifactId, versionRange, scope, type, classifier, optional );
+ }
+ else if ( gav.length == 3 )
+ {
+ return artifactFactory.createArtifact( groupId, artifactId, version, scope );
+ }
+ else if ( gav.length == 4 )
+ {
+ return artifactFactory.createArtifact( groupId, artifactId, version, scope, type, null );
+ }
+ else if ( gav.length == 5 )
+ {
+ return artifactFactory.createArtifact( groupId, artifactId, version, scope, type, classifier );
+ }
+ else
+ {
+ throw new IllegalArgumentException( "Can't translate coor to an Artifact" );
+ }
+ }
+}
diff --git a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNodeTest.java b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNodeTest.java
index 8809beb..a2e9c3a 100644
--- a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNodeTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/EclipseAetherNodeTest.java
@@ -1,136 +1,136 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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 static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.maven.shared.artifact.filter.resolve.Node;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.graph.DefaultDependencyNode;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.graph.Exclusion;
-import org.junit.Test;
-
-public class EclipseAetherNodeTest
-{
- @Test
- public void testGAV()
- {
- Node node = new EclipseAetherNode( newDependencyNode( "g:a:v", null ) );
-
- org.apache.maven.model.Dependency mavenDependency = node.getDependency();
-
- assertEquals( "g", mavenDependency.getGroupId() );
- assertEquals( "a", mavenDependency.getArtifactId() );
- assertEquals( "v", mavenDependency.getVersion() );
- assertEquals( "", mavenDependency.getClassifier() );
- assertEquals( null, mavenDependency.getType() );
- assertEquals( "", mavenDependency.getScope() );
- }
-
- @Test
- public void testClassifier()
- {
- Node node = new EclipseAetherNode( newDependencyNode( "g:a::c:v", null ) );
-
- org.apache.maven.model.Dependency mavenDependency = node.getDependency();
-
- assertEquals( "g", mavenDependency.getGroupId() );
- assertEquals( "a", mavenDependency.getArtifactId() );
- assertEquals( "v", mavenDependency.getVersion() );
- assertEquals( "c", mavenDependency.getClassifier() );
- assertEquals( null, mavenDependency.getType() );
- assertEquals( "", mavenDependency.getScope() );
- }
-
- @Test
- public void testScope()
- {
- Node node = new EclipseAetherNode( newDependencyNode( "g:a:c:v", "s" ) );
-
- org.apache.maven.model.Dependency mavenDependency = node.getDependency();
-
- assertEquals( "g", mavenDependency.getGroupId() );
- assertEquals( "a", mavenDependency.getArtifactId() );
- assertEquals( "v", mavenDependency.getVersion() );
- assertEquals( "", mavenDependency.getClassifier() );
- assertEquals( null, mavenDependency.getType() );
- assertEquals( "s", mavenDependency.getScope() );
- }
-
- @Test
- public void testOptional()
- {
- Node node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, (Boolean) null ) );
-
- assertEquals( null, node.getDependency().getOptional() );
- assertEquals( false, node.getDependency().isOptional() );
-
- node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, true ) );
- assertEquals( "true", node.getDependency().getOptional() );
- assertEquals( true, node.getDependency().isOptional() );
-
- node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, false ) );
- assertEquals( "false", node.getDependency().getOptional() );
- assertEquals( false, node.getDependency().isOptional() );
- }
-
- @Test
- public void testExclusions()
- {
- Node node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, Collections.singletonList( "eg:ea" ) ) );
- assertEquals( 1, node.getDependency().getExclusions().size() );
-
- org.apache.maven.model.Exclusion mavenExclusion = node.getDependency().getExclusions().get( 0 );
- assertEquals( "eg", mavenExclusion.getGroupId() );
- assertEquals( "ea", mavenExclusion.getArtifactId() );
- }
-
- private DependencyNode newDependencyNode( String coor, String scope )
- {
- return new DefaultDependencyNode( new Dependency( new DefaultArtifact( coor ), scope ) );
- }
-
- private DependencyNode newDependencyNode( String coor, String scope, Boolean optional )
- {
- return new DefaultDependencyNode( new Dependency( new DefaultArtifact( coor ), scope, optional ) );
- }
-
- private DependencyNode newDependencyNode( String coor, String scope, Collection<String> exclusions )
- {
- Dependency dependency = new Dependency( new DefaultArtifact( coor ), scope );
-
- Collection<Exclusion> aetherExclusions = new ArrayList<Exclusion>( exclusions.size() );
- for ( String exclusion : exclusions )
- {
- String[] ga = exclusion.split( ":" );
- aetherExclusions.add( new Exclusion( ga[0], ga[1], null, null ) );
- }
- dependency = dependency.setExclusions( aetherExclusions );
-
- return new DefaultDependencyNode( dependency );
- }
-
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.maven.shared.artifact.filter.resolve.Node;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.graph.DefaultDependencyNode;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.Exclusion;
+import org.junit.Test;
+
+public class EclipseAetherNodeTest
+{
+ @Test
+ public void testGAV()
+ {
+ Node node = new EclipseAetherNode( newDependencyNode( "g:a:v", null ) );
+
+ org.apache.maven.model.Dependency mavenDependency = node.getDependency();
+
+ assertEquals( "g", mavenDependency.getGroupId() );
+ assertEquals( "a", mavenDependency.getArtifactId() );
+ assertEquals( "v", mavenDependency.getVersion() );
+ assertEquals( "", mavenDependency.getClassifier() );
+ assertEquals( null, mavenDependency.getType() );
+ assertEquals( "", mavenDependency.getScope() );
+ }
+
+ @Test
+ public void testClassifier()
+ {
+ Node node = new EclipseAetherNode( newDependencyNode( "g:a::c:v", null ) );
+
+ org.apache.maven.model.Dependency mavenDependency = node.getDependency();
+
+ assertEquals( "g", mavenDependency.getGroupId() );
+ assertEquals( "a", mavenDependency.getArtifactId() );
+ assertEquals( "v", mavenDependency.getVersion() );
+ assertEquals( "c", mavenDependency.getClassifier() );
+ assertEquals( null, mavenDependency.getType() );
+ assertEquals( "", mavenDependency.getScope() );
+ }
+
+ @Test
+ public void testScope()
+ {
+ Node node = new EclipseAetherNode( newDependencyNode( "g:a:c:v", "s" ) );
+
+ org.apache.maven.model.Dependency mavenDependency = node.getDependency();
+
+ assertEquals( "g", mavenDependency.getGroupId() );
+ assertEquals( "a", mavenDependency.getArtifactId() );
+ assertEquals( "v", mavenDependency.getVersion() );
+ assertEquals( "", mavenDependency.getClassifier() );
+ assertEquals( null, mavenDependency.getType() );
+ assertEquals( "s", mavenDependency.getScope() );
+ }
+
+ @Test
+ public void testOptional()
+ {
+ Node node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, (Boolean) null ) );
+
+ assertEquals( null, node.getDependency().getOptional() );
+ assertEquals( false, node.getDependency().isOptional() );
+
+ node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, true ) );
+ assertEquals( "true", node.getDependency().getOptional() );
+ assertEquals( true, node.getDependency().isOptional() );
+
+ node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, false ) );
+ assertEquals( "false", node.getDependency().getOptional() );
+ assertEquals( false, node.getDependency().isOptional() );
+ }
+
+ @Test
+ public void testExclusions()
+ {
+ Node node = new EclipseAetherNode( newDependencyNode( "g:a:v", null, Collections.singletonList( "eg:ea" ) ) );
+ assertEquals( 1, node.getDependency().getExclusions().size() );
+
+ org.apache.maven.model.Exclusion mavenExclusion = node.getDependency().getExclusions().get( 0 );
+ assertEquals( "eg", mavenExclusion.getGroupId() );
+ assertEquals( "ea", mavenExclusion.getArtifactId() );
+ }
+
+ private DependencyNode newDependencyNode( String coor, String scope )
+ {
+ return new DefaultDependencyNode( new Dependency( new DefaultArtifact( coor ), scope ) );
+ }
+
+ private DependencyNode newDependencyNode( String coor, String scope, Boolean optional )
+ {
+ return new DefaultDependencyNode( new Dependency( new DefaultArtifact( coor ), scope, optional ) );
+ }
+
+ private DependencyNode newDependencyNode( String coor, String scope, Collection<String> exclusions )
+ {
+ Dependency dependency = new Dependency( new DefaultArtifact( coor ), scope );
+
+ Collection<Exclusion> aetherExclusions = new ArrayList<Exclusion>( exclusions.size() );
+ for ( String exclusion : exclusions )
+ {
+ String[] ga = exclusion.split( ":" );
+ aetherExclusions.add( new Exclusion( ga[0], ga[1], null, null ) );
+ }
+ dependency = dependency.setExclusions( aetherExclusions );
+
+ return new DefaultDependencyNode( dependency );
+ }
+
+}
diff --git a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNodeTest.java b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNodeTest.java
index 9a26595..0097dda 100644
--- a/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNodeTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/filter/resolve/transform/SonatypeAetherNodeTest.java
@@ -1,135 +1,135 @@
-package org.apache.maven.shared.artifact.filter.resolve.transform;
-
-/*
- * 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 static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.maven.shared.artifact.filter.resolve.Node;
-import org.junit.Test;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.graph.DependencyNode;
-import org.sonatype.aether.graph.Exclusion;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-import org.sonatype.aether.util.graph.DefaultDependencyNode;
-
-public class SonatypeAetherNodeTest
-{
- @Test
- public void testGAV()
- {
- Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null ) );
-
- org.apache.maven.model.Dependency mavenDependency = node.getDependency();
-
- assertEquals( "g", mavenDependency.getGroupId() );
- assertEquals( "a", mavenDependency.getArtifactId() );
- assertEquals( "v", mavenDependency.getVersion() );
- assertEquals( "", mavenDependency.getClassifier() );
- assertEquals( null, mavenDependency.getType() );
- assertEquals( "", mavenDependency.getScope() );
- }
-
- @Test
- public void testClassifier()
- {
- Node node = new SonatypeAetherNode( newDependencyNode( "g:a::c:v", null ) );
-
- org.apache.maven.model.Dependency mavenDependency = node.getDependency();
-
- assertEquals( "g", mavenDependency.getGroupId() );
- assertEquals( "a", mavenDependency.getArtifactId() );
- assertEquals( "v", mavenDependency.getVersion() );
- assertEquals( "c", mavenDependency.getClassifier() );
- assertEquals( null, mavenDependency.getType() );
- assertEquals( "", mavenDependency.getScope() );
- }
-
- @Test
- public void testScope()
- {
- Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", "s" ) );
-
- org.apache.maven.model.Dependency mavenDependency = node.getDependency();
-
- assertEquals( "g", mavenDependency.getGroupId() );
- assertEquals( "a", mavenDependency.getArtifactId() );
- assertEquals( "v", mavenDependency.getVersion() );
- assertEquals( "", mavenDependency.getClassifier() );
- assertEquals( null, mavenDependency.getType() );
- assertEquals( "s", mavenDependency.getScope() );
- }
-
- @Test
- public void testOptional()
- {
- Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null ) );
-
- assertEquals( "false", node.getDependency().getOptional() );
- assertEquals( false, node.getDependency().isOptional() );
-
- node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null, true ) );
- assertEquals( "true", node.getDependency().getOptional() );
- assertEquals( true, node.getDependency().isOptional() );
-
- node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null, false ) );
- assertEquals( "false", node.getDependency().getOptional() );
- assertEquals( false, node.getDependency().isOptional() );
- }
-
- @Test
- public void testExclusions()
- {
- Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null, Collections.singletonList( "eg:ea" ) ) );
- assertEquals( 1, node.getDependency().getExclusions().size() );
-
- org.apache.maven.model.Exclusion mavenExclusion = node.getDependency().getExclusions().get( 0 );
- assertEquals( "eg", mavenExclusion.getGroupId() );
- assertEquals( "ea", mavenExclusion.getArtifactId() );
- }
-
- private DependencyNode newDependencyNode( String string, String scope )
- {
- return new DefaultDependencyNode( new Dependency( new DefaultArtifact( string ), scope ) );
- }
-
- private DependencyNode newDependencyNode( String coor, String scope, boolean optional )
- {
- return new DefaultDependencyNode( new Dependency( new DefaultArtifact( coor ), scope, optional ) );
- }
-
- private DependencyNode newDependencyNode( String coor, String scope, Collection<String> exclusions )
- {
- Dependency dependency = new Dependency( new DefaultArtifact( coor ), scope );
-
- Collection<Exclusion> aetherExclusions = new ArrayList<Exclusion>( exclusions.size() );
- for ( String exclusion : exclusions )
- {
- String[] ga = exclusion.split( ":" );
- aetherExclusions.add( new Exclusion( ga[0], ga[1], null, null ) );
- }
- dependency = dependency.setExclusions( aetherExclusions );
-
- return new DefaultDependencyNode( dependency );
- }
-}
+package org.apache.maven.shared.artifact.filter.resolve.transform;
+
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.maven.shared.artifact.filter.resolve.Node;
+import org.junit.Test;
+import org.sonatype.aether.graph.Dependency;
+import org.sonatype.aether.graph.DependencyNode;
+import org.sonatype.aether.graph.Exclusion;
+import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.sonatype.aether.util.graph.DefaultDependencyNode;
+
+public class SonatypeAetherNodeTest
+{
+ @Test
+ public void testGAV()
+ {
+ Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null ) );
+
+ org.apache.maven.model.Dependency mavenDependency = node.getDependency();
+
+ assertEquals( "g", mavenDependency.getGroupId() );
+ assertEquals( "a", mavenDependency.getArtifactId() );
+ assertEquals( "v", mavenDependency.getVersion() );
+ assertEquals( "", mavenDependency.getClassifier() );
+ assertEquals( null, mavenDependency.getType() );
+ assertEquals( "", mavenDependency.getScope() );
+ }
+
+ @Test
+ public void testClassifier()
+ {
+ Node node = new SonatypeAetherNode( newDependencyNode( "g:a::c:v", null ) );
+
+ org.apache.maven.model.Dependency mavenDependency = node.getDependency();
+
+ assertEquals( "g", mavenDependency.getGroupId() );
+ assertEquals( "a", mavenDependency.getArtifactId() );
+ assertEquals( "v", mavenDependency.getVersion() );
+ assertEquals( "c", mavenDependency.getClassifier() );
+ assertEquals( null, mavenDependency.getType() );
+ assertEquals( "", mavenDependency.getScope() );
+ }
+
+ @Test
+ public void testScope()
+ {
+ Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", "s" ) );
+
+ org.apache.maven.model.Dependency mavenDependency = node.getDependency();
+
+ assertEquals( "g", mavenDependency.getGroupId() );
+ assertEquals( "a", mavenDependency.getArtifactId() );
+ assertEquals( "v", mavenDependency.getVersion() );
+ assertEquals( "", mavenDependency.getClassifier() );
+ assertEquals( null, mavenDependency.getType() );
+ assertEquals( "s", mavenDependency.getScope() );
+ }
+
+ @Test
+ public void testOptional()
+ {
+ Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null ) );
+
+ assertEquals( "false", node.getDependency().getOptional() );
+ assertEquals( false, node.getDependency().isOptional() );
+
+ node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null, true ) );
+ assertEquals( "true", node.getDependency().getOptional() );
+ assertEquals( true, node.getDependency().isOptional() );
+
+ node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null, false ) );
+ assertEquals( "false", node.getDependency().getOptional() );
+ assertEquals( false, node.getDependency().isOptional() );
+ }
+
+ @Test
+ public void testExclusions()
+ {
+ Node node = new SonatypeAetherNode( newDependencyNode( "g:a:v", null, Collections.singletonList( "eg:ea" ) ) );
+ assertEquals( 1, node.getDependency().getExclusions().size() );
+
+ org.apache.maven.model.Exclusion mavenExclusion = node.getDependency().getExclusions().get( 0 );
+ assertEquals( "eg", mavenExclusion.getGroupId() );
+ assertEquals( "ea", mavenExclusion.getArtifactId() );
+ }
+
+ private DependencyNode newDependencyNode( String string, String scope )
+ {
+ return new DefaultDependencyNode( new Dependency( new DefaultArtifact( string ), scope ) );
+ }
+
+ private DependencyNode newDependencyNode( String coor, String scope, boolean optional )
+ {
+ return new DefaultDependencyNode( new Dependency( new DefaultArtifact( coor ), scope, optional ) );
+ }
+
+ private DependencyNode newDependencyNode( String coor, String scope, Collection<String> exclusions )
+ {
+ Dependency dependency = new Dependency( new DefaultArtifact( coor ), scope );
+
+ Collection<Exclusion> aetherExclusions = new ArrayList<Exclusion>( exclusions.size() );
+ for ( String exclusion : exclusions )
+ {
+ String[] ga = exclusion.split( ":" );
+ aetherExclusions.add( new Exclusion( ga[0], ga[1], null, null ) );
+ }
+ dependency = dependency.setExclusions( aetherExclusions );
+
+ return new DefaultDependencyNode( dependency );
+ }
+}