You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2016/09/03 20:23:31 UTC
[08/51] [partial] maven-aether git commit: [MNG-6007] rename Aether
to Maven Artifact Resolver
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/RootQueueTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/RootQueueTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/RootQueueTest.java
deleted file mode 100644
index f609ed7..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/RootQueueTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.aether.util.graph.transformer;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.util.graph.transformer.ConflictIdSorter.ConflictId;
-import org.eclipse.aether.util.graph.transformer.ConflictIdSorter.RootQueue;
-import org.junit.Test;
-
-public class RootQueueTest
-{
-
- @Test
- public void testIsEmpty()
- {
- ConflictId id = new ConflictId( "a", 0 );
- RootQueue queue = new RootQueue( 10 );
- assertTrue( queue.isEmpty() );
- queue.add( id );
- assertFalse( queue.isEmpty() );
- assertSame( id, queue.remove() );
- assertTrue( queue.isEmpty() );
- }
-
- @Test
- public void testAddSortsByDepth()
- {
- ConflictId id1 = new ConflictId( "a", 0 );
- ConflictId id2 = new ConflictId( "b", 1 );
- ConflictId id3 = new ConflictId( "c", 2 );
- ConflictId id4 = new ConflictId( "d", 3 );
-
- RootQueue queue = new RootQueue( 10 );
- queue.add( id1 );
- queue.add( id2 );
- queue.add( id3 );
- queue.add( id4 );
- assertSame( id1, queue.remove() );
- assertSame( id2, queue.remove() );
- assertSame( id3, queue.remove() );
- assertSame( id4, queue.remove() );
-
- queue = new RootQueue( 10 );
- queue.add( id4 );
- queue.add( id3 );
- queue.add( id2 );
- queue.add( id1 );
- assertSame( id1, queue.remove() );
- assertSame( id2, queue.remove() );
- assertSame( id3, queue.remove() );
- assertSame( id4, queue.remove() );
- }
-
- @Test
- public void testAddWithArrayCompact()
- {
- ConflictId id = new ConflictId( "a", 0 );
-
- RootQueue queue = new RootQueue( 10 );
- assertTrue( queue.isEmpty() );
- queue.add( id );
- assertFalse( queue.isEmpty() );
- assertSame( id, queue.remove() );
- assertTrue( queue.isEmpty() );
- queue.add( id );
- assertFalse( queue.isEmpty() );
- assertSame( id, queue.remove() );
- assertTrue( queue.isEmpty() );
- }
-
- @Test
- public void testAddMinimumAfterSomeRemoves()
- {
- ConflictId id1 = new ConflictId( "a", 0 );
- ConflictId id2 = new ConflictId( "b", 1 );
- ConflictId id3 = new ConflictId( "c", 2 );
-
- RootQueue queue = new RootQueue( 10 );
- queue.add( id2 );
- queue.add( id3 );
- assertSame( id2, queue.remove() );
- queue.add( id1 );
- assertSame( id1, queue.remove() );
- assertSame( id3, queue.remove() );
- assertTrue( queue.isEmpty() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleConflictMarker.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleConflictMarker.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleConflictMarker.java
deleted file mode 100644
index df30368..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleConflictMarker.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.aether.util.graph.transformer;
-
-/*
- * 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.IdentityHashMap;
-import java.util.Map;
-
-import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.collection.DependencyGraphTransformationContext;
-import org.eclipse.aether.collection.DependencyGraphTransformer;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.util.graph.transformer.TransformationContextKeys;
-
-/**
- * Set "groupId:artId:classifier:extension" as conflict marker for every node.
- */
-class SimpleConflictMarker
- implements DependencyGraphTransformer
-{
-
- public DependencyNode transformGraph( DependencyNode node, DependencyGraphTransformationContext context )
- throws RepositoryException
- {
- @SuppressWarnings( "unchecked" )
- Map<DependencyNode, Object> conflictIds =
- (Map<DependencyNode, Object>) context.get( TransformationContextKeys.CONFLICT_IDS );
- if ( conflictIds == null )
- {
- conflictIds = new IdentityHashMap<DependencyNode, Object>();
- context.put( TransformationContextKeys.CONFLICT_IDS, conflictIds );
- }
-
- mark( node, conflictIds );
-
- return node;
- }
-
- private void mark( DependencyNode node, Map<DependencyNode, Object> conflictIds )
- {
- Dependency dependency = node.getDependency();
- if ( dependency != null )
- {
- Artifact artifact = dependency.getArtifact();
-
- String key =
- String.format( "%s:%s:%s:%s", artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getClassifier(), artifact.getExtension() );
-
- if ( conflictIds.put( node, key ) != null )
- {
- return;
- }
- }
-
- for ( DependencyNode child : node.getChildren() )
- {
- mark( child, conflictIds );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleOptionalitySelectorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleOptionalitySelectorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleOptionalitySelectorTest.java
deleted file mode 100644
index f6d268f..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/transformer/SimpleOptionalitySelectorTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.aether.util.graph.transformer;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.collection.DependencyGraphTransformer;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.internal.test.util.DependencyGraphParser;
-import org.junit.Test;
-
-public class SimpleOptionalitySelectorTest
- extends AbstractDependencyGraphTransformerTest
-{
-
- @Override
- protected DependencyGraphTransformer newTransformer()
- {
- return new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(),
- new SimpleOptionalitySelector(), new JavaScopeDeriver() );
- }
-
- @Override
- protected DependencyGraphParser newParser()
- {
- return new DependencyGraphParser( "transformer/optionality-selector/" );
- }
-
- @Test
- public void testDeriveOptionality()
- throws Exception
- {
- DependencyNode root = parseResource( "derive.txt" );
- assertSame( root, transform( root ) );
-
- assertEquals( 2, root.getChildren().size() );
- assertEquals( true, root.getChildren().get( 0 ).getDependency().isOptional() );
- assertEquals( true, root.getChildren().get( 0 ).getChildren().get( 0 ).getDependency().isOptional() );
- assertEquals( false, root.getChildren().get( 1 ).getDependency().isOptional() );
- assertEquals( false, root.getChildren().get( 1 ).getChildren().get( 0 ).getDependency().isOptional() );
- }
-
- @Test
- public void testResolveOptionalityConflict_NonOptionalWins()
- throws Exception
- {
- DependencyNode root = parseResource( "conflict.txt" );
- assertSame( root, transform( root ) );
-
- assertEquals( 2, root.getChildren().size() );
- assertEquals( true, root.getChildren().get( 0 ).getDependency().isOptional() );
- assertEquals( false, root.getChildren().get( 0 ).getChildren().get( 0 ).getDependency().isOptional() );
- }
-
- @Test
- public void testResolveOptionalityConflict_DirectDeclarationWins()
- throws Exception
- {
- DependencyNode root = parseResource( "conflict-direct-dep.txt" );
- assertSame( root, transform( root ) );
-
- assertEquals( 2, root.getChildren().size() );
- assertEquals( true, root.getChildren().get( 1 ).getDependency().isOptional() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/AndDependencyTraverserTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/AndDependencyTraverserTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/AndDependencyTraverserTest.java
deleted file mode 100644
index 74d744e..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/AndDependencyTraverserTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.aether.util.graph.traverser;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.DependencyCollectionContext;
-import org.eclipse.aether.collection.DependencyTraverser;
-import org.eclipse.aether.graph.Dependency;
-import org.junit.Test;
-
-public class AndDependencyTraverserTest
-{
-
- static class DummyDependencyTraverser
- implements DependencyTraverser
- {
-
- private final boolean traverse;
-
- private final DependencyTraverser child;
-
- public DummyDependencyTraverser()
- {
- this( true );
- }
-
- public DummyDependencyTraverser( boolean traverse )
- {
- this.traverse = traverse;
- this.child = this;
- }
-
- public DummyDependencyTraverser( boolean traverse, DependencyTraverser child )
- {
- this.traverse = traverse;
- this.child = child;
- }
-
- public boolean traverseDependency( Dependency dependency )
- {
- return traverse;
- }
-
- public DependencyTraverser deriveChildTraverser( DependencyCollectionContext context )
- {
- return child;
- }
-
- }
-
- @Test
- public void testNewInstance()
- {
- assertNull( AndDependencyTraverser.newInstance( null, null ) );
- DependencyTraverser traverser = new DummyDependencyTraverser();
- assertSame( traverser, AndDependencyTraverser.newInstance( traverser, null ) );
- assertSame( traverser, AndDependencyTraverser.newInstance( null, traverser ) );
- assertSame( traverser, AndDependencyTraverser.newInstance( traverser, traverser ) );
- assertNotNull( AndDependencyTraverser.newInstance( traverser, new DummyDependencyTraverser() ) );
- }
-
- @Test
- public void testTraverseDependency()
- {
- Dependency dependency = new Dependency( new DefaultArtifact( "g:a:v:1" ), "runtime" );
-
- DependencyTraverser traverser = new AndDependencyTraverser();
- assertTrue( traverser.traverseDependency( dependency ) );
-
- traverser =
- new AndDependencyTraverser( new DummyDependencyTraverser( false ), new DummyDependencyTraverser( false ) );
- assertFalse( traverser.traverseDependency( dependency ) );
-
- traverser =
- new AndDependencyTraverser( new DummyDependencyTraverser( true ), new DummyDependencyTraverser( false ) );
- assertFalse( traverser.traverseDependency( dependency ) );
-
- traverser =
- new AndDependencyTraverser( new DummyDependencyTraverser( true ), new DummyDependencyTraverser( true ) );
- assertTrue( traverser.traverseDependency( dependency ) );
- }
-
- @Test
- public void testDeriveChildTraverser_Unchanged()
- {
- DependencyTraverser other1 = new DummyDependencyTraverser( true );
- DependencyTraverser other2 = new DummyDependencyTraverser( false );
- DependencyTraverser traverser = new AndDependencyTraverser( other1, other2 );
- assertSame( traverser, traverser.deriveChildTraverser( null ) );
- }
-
- @Test
- public void testDeriveChildTraverser_OneRemaining()
- {
- DependencyTraverser other1 = new DummyDependencyTraverser( true );
- DependencyTraverser other2 = new DummyDependencyTraverser( false, null );
- DependencyTraverser traverser = new AndDependencyTraverser( other1, other2 );
- assertSame( other1, traverser.deriveChildTraverser( null ) );
- }
-
- @Test
- public void testDeriveChildTraverser_ZeroRemaining()
- {
- DependencyTraverser other1 = new DummyDependencyTraverser( true, null );
- DependencyTraverser other2 = new DummyDependencyTraverser( false, null );
- DependencyTraverser traverser = new AndDependencyTraverser( other1, other2 );
- assertNull( traverser.deriveChildTraverser( null ) );
- }
-
- @Test
- public void testEquals()
- {
- DependencyTraverser other1 = new DummyDependencyTraverser( true );
- DependencyTraverser other2 = new DummyDependencyTraverser( false );
- DependencyTraverser traverser1 = new AndDependencyTraverser( other1, other2 );
- DependencyTraverser traverser2 = new AndDependencyTraverser( other2, other1 );
- DependencyTraverser traverser3 = new AndDependencyTraverser( other1 );
- assertEquals( traverser1, traverser1 );
- assertEquals( traverser1, traverser2 );
- assertNotEquals( traverser1, traverser3 );
- assertNotEquals( traverser1, this );
- assertNotEquals( traverser1, null );
- }
-
- @Test
- public void testHashCode()
- {
- DependencyTraverser other1 = new DummyDependencyTraverser( true );
- DependencyTraverser other2 = new DummyDependencyTraverser( false );
- DependencyTraverser traverser1 = new AndDependencyTraverser( other1, other2 );
- DependencyTraverser traverser2 = new AndDependencyTraverser( other2, other1 );
- assertEquals( traverser1.hashCode(), traverser2.hashCode() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/FatArtifactTraverserTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/FatArtifactTraverserTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/FatArtifactTraverserTest.java
deleted file mode 100644
index 641e593..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/FatArtifactTraverserTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.aether.util.graph.traverser;
-
-/*
- * 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.*;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.aether.artifact.ArtifactProperties;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.DependencyTraverser;
-import org.eclipse.aether.graph.Dependency;
-import org.junit.Test;
-
-public class FatArtifactTraverserTest
-{
-
- @Test
- public void testTraverseDependency()
- {
- DependencyTraverser traverser = new FatArtifactTraverser();
- Map<String, String> props = null;
- assertTrue( traverser.traverseDependency( new Dependency( new DefaultArtifact( "g:a:v:1", props ), "test" ) ) );
- props = Collections.singletonMap( ArtifactProperties.INCLUDES_DEPENDENCIES, "false" );
- assertTrue( traverser.traverseDependency( new Dependency( new DefaultArtifact( "g:a:v:1", props ), "test" ) ) );
- props = Collections.singletonMap( ArtifactProperties.INCLUDES_DEPENDENCIES, "unrecognized" );
- assertTrue( traverser.traverseDependency( new Dependency( new DefaultArtifact( "g:a:v:1", props ), "test" ) ) );
- props = Collections.singletonMap( ArtifactProperties.INCLUDES_DEPENDENCIES, "true" );
- assertFalse( traverser.traverseDependency( new Dependency( new DefaultArtifact( "g:a:v:1", props ), "test" ) ) );
- }
-
- @Test
- public void testDeriveChildTraverser()
- {
- DependencyTraverser traverser = new FatArtifactTraverser();
- assertSame( traverser, traverser.deriveChildTraverser( null ) );
- }
-
- @Test
- public void testEquals()
- {
- DependencyTraverser traverser1 = new FatArtifactTraverser();
- DependencyTraverser traverser2 = new FatArtifactTraverser();
- assertEquals( traverser1, traverser1 );
- assertEquals( traverser1, traverser2 );
- assertNotEquals( traverser1, this );
- assertNotEquals( traverser1, null );
- }
-
- @Test
- public void testHashCode()
- {
- DependencyTraverser traverser1 = new FatArtifactTraverser();
- DependencyTraverser traverser2 = new FatArtifactTraverser();
- assertEquals( traverser1.hashCode(), traverser2.hashCode() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/StaticDependencyTraverserTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/StaticDependencyTraverserTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/StaticDependencyTraverserTest.java
deleted file mode 100644
index 0ac1d91..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/traverser/StaticDependencyTraverserTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.aether.util.graph.traverser;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.DependencyTraverser;
-import org.eclipse.aether.graph.Dependency;
-import org.junit.Test;
-
-public class StaticDependencyTraverserTest
-{
-
- @Test
- public void testTraverseDependency()
- {
- Dependency dependency = new Dependency( new DefaultArtifact( "g:a:v:1" ), "runtime" );
- DependencyTraverser traverser = new StaticDependencyTraverser( true );
- assertTrue( traverser.traverseDependency( dependency ) );
- traverser = new StaticDependencyTraverser( false );
- assertFalse( traverser.traverseDependency( dependency ) );
- }
-
- @Test
- public void testDeriveChildTraverser()
- {
- DependencyTraverser traverser = new StaticDependencyTraverser( true );
- assertSame( traverser, traverser.deriveChildTraverser( null ) );
- }
-
- @Test
- public void testEquals()
- {
- DependencyTraverser traverser1 = new StaticDependencyTraverser( true );
- DependencyTraverser traverser2 = new StaticDependencyTraverser( true );
- DependencyTraverser traverser3 = new StaticDependencyTraverser( false );
- assertEquals( traverser1, traverser1 );
- assertEquals( traverser1, traverser2 );
- assertNotEquals( traverser1, traverser3 );
- assertNotEquals( traverser1, this );
- assertNotEquals( traverser1, null );
- }
-
- @Test
- public void testHashCode()
- {
- DependencyTraverser traverser1 = new StaticDependencyTraverser( true );
- DependencyTraverser traverser2 = new StaticDependencyTraverser( true );
- assertEquals( traverser1.hashCode(), traverser2.hashCode() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/AbstractVersionFilterTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/AbstractVersionFilterTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/AbstractVersionFilterTest.java
deleted file mode 100644
index 13fd4b0..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/AbstractVersionFilterTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.aether.util.graph.versions;
-
-/*
- * 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.*;
-
-import java.util.Iterator;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.VersionFilter;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.internal.test.util.TestUtils;
-import org.eclipse.aether.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.util.version.GenericVersionScheme;
-import org.eclipse.aether.version.InvalidVersionSpecificationException;
-import org.eclipse.aether.version.Version;
-import org.eclipse.aether.version.VersionScheme;
-import org.junit.After;
-import org.junit.Before;
-
-public abstract class AbstractVersionFilterTest
-{
-
- protected DefaultRepositorySystemSession session;
-
- @Before
- public void setUp()
- {
- session = TestUtils.newSession();
- }
-
- @After
- public void tearDown()
- {
- session = null;
- }
-
- protected VersionFilter.VersionFilterContext newContext( String gav, String... versions )
- {
- VersionRangeRequest request = new VersionRangeRequest();
- request.setArtifact( new DefaultArtifact( gav ) );
- VersionRangeResult result = new VersionRangeResult( request );
- VersionScheme scheme = new GenericVersionScheme();
- try
- {
- result.setVersionConstraint( scheme.parseVersionConstraint( request.getArtifact().getVersion() ) );
- for ( String version : versions )
- {
- result.addVersion( scheme.parseVersion( version ) );
- }
- }
- catch ( InvalidVersionSpecificationException e )
- {
- throw new IllegalArgumentException( e );
- }
- return TestUtils.newVersionFilterContext( session, result );
- }
-
- protected VersionFilter derive( VersionFilter filter, String gav )
- {
- return filter.deriveChildFilter( TestUtils.newCollectionContext( session,
- new Dependency( new DefaultArtifact( gav ), "" ),
- null ) );
- }
-
- protected void assertVersions( VersionFilter.VersionFilterContext context, String... versions )
- {
- assertEquals( versions.length, context.getCount() );
- Iterator<Version> it = context.iterator();
- for ( String version : versions )
- {
- assertTrue( it.hasNext() );
- assertEquals( version, it.next().toString() );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ChainedVersionFilterTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ChainedVersionFilterTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ChainedVersionFilterTest.java
deleted file mode 100644
index 1e8a5bd..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ChainedVersionFilterTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.aether.util.graph.versions;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.collection.DependencyCollectionContext;
-import org.eclipse.aether.collection.VersionFilter;
-import org.eclipse.aether.collection.VersionFilter.VersionFilterContext;
-import org.eclipse.aether.util.graph.version.ChainedVersionFilter;
-import org.eclipse.aether.util.graph.version.HighestVersionFilter;
-import org.eclipse.aether.util.graph.version.SnapshotVersionFilter;
-import org.junit.Test;
-
-public class ChainedVersionFilterTest
- extends AbstractVersionFilterTest
-{
-
- @Test
- public void testFilterVersions()
- throws Exception
- {
- VersionFilter filter =
- ChainedVersionFilter.newInstance( new SnapshotVersionFilter(), new HighestVersionFilter() );
- VersionFilterContext ctx = newContext( "g:a:[1,9]", "1", "2", "3-SNAPSHOT" );
- filter.filterVersions( ctx );
- assertVersions( ctx, "2" );
- }
-
- @Test
- public void testDeriveChildFilter()
- {
- VersionFilter filter1 = new HighestVersionFilter();
- VersionFilter filter2 = new VersionFilter()
- {
- public void filterVersions( VersionFilterContext context )
- {
- }
-
- public VersionFilter deriveChildFilter( DependencyCollectionContext context )
- {
- return null;
- }
- };
-
- VersionFilter filter = ChainedVersionFilter.newInstance( filter1 );
- assertSame( filter, derive( filter, "g:a:1" ) );
-
- filter = ChainedVersionFilter.newInstance( filter2 );
- assertSame( null, derive( filter, "g:a:1" ) );
-
- filter = ChainedVersionFilter.newInstance( filter1, filter2 );
- assertSame( filter1, derive( filter, "g:a:1" ) );
-
- filter = ChainedVersionFilter.newInstance( filter2, filter1 );
- assertSame( filter1, derive( filter, "g:a:1" ) );
- }
-
- @Test
- public void testEquals()
- {
- VersionFilter filter = ChainedVersionFilter.newInstance( new HighestVersionFilter() );
- assertFalse( filter.equals( null ) );
- assertTrue( filter.equals( filter ) );
- assertTrue( filter.equals( ChainedVersionFilter.newInstance( new HighestVersionFilter() ) ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ContextualSnapshotVersionFilterTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ContextualSnapshotVersionFilterTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ContextualSnapshotVersionFilterTest.java
deleted file mode 100644
index dd88a66..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/ContextualSnapshotVersionFilterTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.aether.util.graph.versions;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.collection.VersionFilter;
-import org.eclipse.aether.collection.VersionFilter.VersionFilterContext;
-import org.eclipse.aether.util.graph.version.ContextualSnapshotVersionFilter;
-import org.eclipse.aether.util.graph.version.SnapshotVersionFilter;
-import org.junit.Test;
-
-public class ContextualSnapshotVersionFilterTest
- extends AbstractVersionFilterTest
-{
-
- @Test
- public void testFilterVersions()
- throws Exception
- {
- VersionFilter filter = new ContextualSnapshotVersionFilter();
- VersionFilterContext ctx = newContext( "g:a:[1,9]", "1", "2-SNAPSHOT" );
- filter.filterVersions( ctx );
- assertVersions( ctx, "1", "2-SNAPSHOT" );
-
- ctx = newContext( "g:a:[1,9]", "1", "2-SNAPSHOT" );
- derive( filter, "g:a:1" ).filterVersions( ctx );
- assertVersions( ctx, "1" );
-
- ctx = newContext( "g:a:[1,9]", "1", "2-SNAPSHOT" );
- session.setConfigProperty( ContextualSnapshotVersionFilter.CONFIG_PROP_ENABLE, "true" );
- derive( filter, "g:a:1-SNAPSHOT" ).filterVersions( ctx );
- assertVersions( ctx, "1" );
- }
-
- @Test
- public void testDeriveChildFilter()
- {
- ContextualSnapshotVersionFilter filter = new ContextualSnapshotVersionFilter();
- assertTrue( derive( filter, "g:a:1" ) instanceof SnapshotVersionFilter );
- assertSame( null, derive( filter, "g:a:1-SNAPSHOT" ) );
- session.setConfigProperty( ContextualSnapshotVersionFilter.CONFIG_PROP_ENABLE, "true" );
- assertTrue( derive( filter, "g:a:1-SNAPSHOT" ) instanceof SnapshotVersionFilter );
- }
-
- @Test
- public void testEquals()
- {
- ContextualSnapshotVersionFilter filter = new ContextualSnapshotVersionFilter();
- assertFalse( filter.equals( null ) );
- assertTrue( filter.equals( filter ) );
- assertTrue( filter.equals( new ContextualSnapshotVersionFilter() ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/HighestVersionFilterTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/HighestVersionFilterTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/HighestVersionFilterTest.java
deleted file mode 100644
index 3926c66..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/HighestVersionFilterTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.aether.util.graph.versions;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.collection.VersionFilter.VersionFilterContext;
-import org.eclipse.aether.util.graph.version.HighestVersionFilter;
-import org.junit.Test;
-
-public class HighestVersionFilterTest
- extends AbstractVersionFilterTest
-{
-
- @Test
- public void testFilterVersions()
- {
- HighestVersionFilter filter = new HighestVersionFilter();
- VersionFilterContext ctx = newContext( "g:a:[1,9]", "1", "2", "3", "4", "5", "6", "7", "8", "9" );
- filter.filterVersions( ctx );
- assertVersions( ctx, "9" );
- }
-
- @Test
- public void testDeriveChildFilter()
- {
- HighestVersionFilter filter = new HighestVersionFilter();
- assertSame( filter, derive( filter, "g:a:1" ) );
- }
-
- @Test
- public void testEquals()
- {
- HighestVersionFilter filter = new HighestVersionFilter();
- assertFalse( filter.equals( null ) );
- assertTrue( filter.equals( filter ) );
- assertTrue( filter.equals( new HighestVersionFilter() ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/SnapshotVersionFilterTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/SnapshotVersionFilterTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/SnapshotVersionFilterTest.java
deleted file mode 100644
index 70c26f9..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/versions/SnapshotVersionFilterTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.aether.util.graph.versions;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.collection.VersionFilter.VersionFilterContext;
-import org.eclipse.aether.util.graph.version.SnapshotVersionFilter;
-import org.junit.Test;
-
-public class SnapshotVersionFilterTest
- extends AbstractVersionFilterTest
-{
-
- @Test
- public void testFilterVersions()
- {
- SnapshotVersionFilter filter = new SnapshotVersionFilter();
- VersionFilterContext ctx = newContext( "g:a:[1,9]", "1", "2-SNAPSHOT", "3.1", "4.0-SNAPSHOT", "5.0.0" );
- filter.filterVersions( ctx );
- assertVersions( ctx, "1", "3.1", "5.0.0" );
- }
-
- @Test
- public void testDeriveChildFilter()
- {
- SnapshotVersionFilter filter = new SnapshotVersionFilter();
- assertSame( filter, derive( filter, "g:a:1" ) );
- }
-
- @Test
- public void testEquals()
- {
- SnapshotVersionFilter filter = new SnapshotVersionFilter();
- assertFalse( filter.equals( null ) );
- assertTrue( filter.equals( filter ) );
- assertTrue( filter.equals( new SnapshotVersionFilter() ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/FilteringDependencyVisitorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/FilteringDependencyVisitorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/FilteringDependencyVisitorTest.java
deleted file mode 100644
index 65a02a8..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/FilteringDependencyVisitorTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.aether.util.graph.visitor;
-
-/*
- * 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.*;
-
-import java.util.List;
-
-import org.eclipse.aether.graph.DependencyFilter;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.internal.test.util.DependencyGraphParser;
-import org.junit.Test;
-
-public class FilteringDependencyVisitorTest
-{
-
- private DependencyNode parse( String resource )
- throws Exception
- {
- return new DependencyGraphParser( "visitor/filtering/" ).parseResource( resource );
- }
-
- @Test
- public void testFilterCalledWithProperParentStack()
- throws Exception
- {
- DependencyNode root = parse( "parents.txt" );
-
- final StringBuilder buffer = new StringBuilder( 256 );
- DependencyFilter filter = new DependencyFilter()
- {
- public boolean accept( DependencyNode node, List<DependencyNode> parents )
- {
- for ( DependencyNode parent : parents )
- {
- buffer.append( parent.getDependency().getArtifact().getArtifactId() );
- }
- buffer.append( "," );
- return false;
- }
- };
-
- FilteringDependencyVisitor visitor = new FilteringDependencyVisitor( new PreorderNodeListGenerator(), filter );
- root.accept( visitor );
-
- assertEquals( ",a,ba,cba,a,ea,", buffer.toString() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PathRecordingDependencyVisitorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PathRecordingDependencyVisitorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PathRecordingDependencyVisitorTest.java
deleted file mode 100644
index cd766a0..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PathRecordingDependencyVisitorTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.aether.util.graph.visitor;
-
-/*
- * 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.*;
-
-import java.util.List;
-
-import org.eclipse.aether.graph.DependencyFilter;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.internal.test.util.DependencyGraphParser;
-import org.junit.Test;
-
-public class PathRecordingDependencyVisitorTest
-{
-
- private DependencyNode parse( String resource )
- throws Exception
- {
- return new DependencyGraphParser( "visitor/path-recorder/" ).parseResource( resource );
- }
-
- private void assertPath( List<DependencyNode> actual, String... expected )
- {
- assertEquals( actual.toString(), expected.length, actual.size() );
- for ( int i = 0; i < expected.length; i++ )
- {
- DependencyNode node = actual.get( i );
- assertEquals( actual.toString(), expected[i], node.getDependency().getArtifact().getArtifactId() );
- }
- }
-
- @Test
- public void testGetPaths_RecordsMatchesBeneathUnmatchedParents()
- throws Exception
- {
- DependencyNode root = parse( "simple.txt" );
-
- PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor( new ArtifactMatcher() );
- root.accept( visitor );
-
- List<List<DependencyNode>> paths = visitor.getPaths();
- assertEquals( paths.toString(), 2, paths.size() );
- assertPath( paths.get( 0 ), "a", "b", "x" );
- assertPath( paths.get( 1 ), "a", "x" );
- }
-
- @Test
- public void testGetPaths_DoesNotRecordMatchesBeneathMatchedParents()
- throws Exception
- {
- DependencyNode root = parse( "nested.txt" );
-
- PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor( new ArtifactMatcher() );
- root.accept( visitor );
-
- List<List<DependencyNode>> paths = visitor.getPaths();
- assertEquals( paths.toString(), 1, paths.size() );
- assertPath( paths.get( 0 ), "x" );
- }
-
- @Test
- public void testGetPaths_RecordsMatchesBeneathMatchedParentsIfRequested()
- throws Exception
- {
- DependencyNode root = parse( "nested.txt" );
-
- PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor( new ArtifactMatcher(), false );
- root.accept( visitor );
-
- List<List<DependencyNode>> paths = visitor.getPaths();
- assertEquals( paths.toString(), 3, paths.size() );
- assertPath( paths.get( 0 ), "x" );
- assertPath( paths.get( 1 ), "x", "a", "y" );
- assertPath( paths.get( 2 ), "x", "y" );
- }
-
- @Test
- public void testFilterCalledWithProperParentStack()
- throws Exception
- {
- DependencyNode root = parse( "parents.txt" );
-
- final StringBuilder buffer = new StringBuilder( 256 );
- DependencyFilter filter = new DependencyFilter()
- {
- public boolean accept( DependencyNode node, List<DependencyNode> parents )
- {
- for ( DependencyNode parent : parents )
- {
- buffer.append( parent.getDependency().getArtifact().getArtifactId() );
- }
- buffer.append( "," );
- return false;
- }
- };
-
- PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor( filter );
- root.accept( visitor );
-
- assertEquals( ",a,ba,cba,a,ea,", buffer.toString() );
- }
-
- @Test
- public void testGetPaths_HandlesCycles()
- throws Exception
- {
- DependencyNode root = parse( "cycle.txt" );
-
- PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor( new ArtifactMatcher(), false );
- root.accept( visitor );
-
- List<List<DependencyNode>> paths = visitor.getPaths();
- assertEquals( paths.toString(), 4, paths.size() );
- assertPath( paths.get( 0 ), "a", "b", "x" );
- assertPath( paths.get( 1 ), "a", "x" );
- assertPath( paths.get( 2 ), "a", "x", "b", "x" );
- assertPath( paths.get( 3 ), "a", "x", "x" );
- }
-
- private static class ArtifactMatcher
- implements DependencyFilter
- {
- public boolean accept( DependencyNode node, List<DependencyNode> parents )
- {
- return node.getDependency() != null && node.getDependency().getArtifact().getGroupId().equals( "match" );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PostorderNodeListGeneratorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PostorderNodeListGeneratorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PostorderNodeListGeneratorTest.java
deleted file mode 100644
index 8d6f525..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PostorderNodeListGeneratorTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.aether.util.graph.visitor;
-
-/*
- * 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.*;
-
-import java.util.List;
-
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.internal.test.util.DependencyGraphParser;
-import org.junit.Test;
-
-public class PostorderNodeListGeneratorTest
-{
-
- private DependencyNode parse( String resource )
- throws Exception
- {
- return new DependencyGraphParser( "visitor/ordered-list/" ).parseResource( resource );
- }
-
- private void assertSequence( List<DependencyNode> actual, String... expected )
- {
- assertEquals( actual.toString(), expected.length, actual.size() );
- for ( int i = 0; i < expected.length; i++ )
- {
- DependencyNode node = actual.get( i );
- assertEquals( actual.toString(), expected[i], node.getDependency().getArtifact().getArtifactId() );
- }
- }
-
- @Test
- public void testOrdering()
- throws Exception
- {
- DependencyNode root = parse( "simple.txt" );
-
- PostorderNodeListGenerator visitor = new PostorderNodeListGenerator();
- root.accept( visitor );
-
- assertSequence( visitor.getNodes(), "c", "b", "e", "d", "a" );
- }
-
- @Test
- public void testDuplicateSuppression()
- throws Exception
- {
- DependencyNode root = parse( "cycles.txt" );
-
- PostorderNodeListGenerator visitor = new PostorderNodeListGenerator();
- root.accept( visitor );
-
- assertSequence( visitor.getNodes(), "c", "b", "e", "d", "a" );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PreorderNodeListGeneratorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PreorderNodeListGeneratorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PreorderNodeListGeneratorTest.java
deleted file mode 100644
index 200dd3b..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/PreorderNodeListGeneratorTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.aether.util.graph.visitor;
-
-/*
- * 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.*;
-
-import java.util.List;
-
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.internal.test.util.DependencyGraphParser;
-import org.junit.Test;
-
-public class PreorderNodeListGeneratorTest
-{
-
- private DependencyNode parse( String resource )
- throws Exception
- {
- return new DependencyGraphParser( "visitor/ordered-list/" ).parseResource( resource );
- }
-
- private void assertSequence( List<DependencyNode> actual, String... expected )
- {
- assertEquals( actual.toString(), expected.length, actual.size() );
- for ( int i = 0; i < expected.length; i++ )
- {
- DependencyNode node = actual.get( i );
- assertEquals( actual.toString(), expected[i], node.getDependency().getArtifact().getArtifactId() );
- }
- }
-
- @Test
- public void testOrdering()
- throws Exception
- {
- DependencyNode root = parse( "simple.txt" );
-
- PreorderNodeListGenerator visitor = new PreorderNodeListGenerator();
- root.accept( visitor );
-
- assertSequence( visitor.getNodes(), "a", "b", "c", "d", "e" );
- }
-
- @Test
- public void testDuplicateSuppression()
- throws Exception
- {
- DependencyNode root = parse( "cycles.txt" );
-
- PreorderNodeListGenerator visitor = new PreorderNodeListGenerator();
- root.accept( visitor );
-
- assertSequence( visitor.getNodes(), "a", "b", "c", "d", "e" );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/TreeDependencyVisitorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/TreeDependencyVisitorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/TreeDependencyVisitorTest.java
deleted file mode 100644
index 36cb6ac..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/graph/visitor/TreeDependencyVisitorTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.aether.util.graph.visitor;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.graph.DependencyVisitor;
-import org.eclipse.aether.internal.test.util.DependencyGraphParser;
-import org.junit.Test;
-
-public class TreeDependencyVisitorTest
-{
-
- private DependencyNode parse( String resource )
- throws Exception
- {
- return new DependencyGraphParser( "visitor/tree/" ).parseResource( resource );
- }
-
- @Test
- public void testDuplicateSuppression()
- throws Exception
- {
- DependencyNode root = parse( "cycles.txt" );
-
- RecordingVisitor rec = new RecordingVisitor();
- TreeDependencyVisitor visitor = new TreeDependencyVisitor( rec );
- root.accept( visitor );
-
- assertEquals( ">a >b >c <c <b >d <d <a ", rec.buffer.toString() );
- }
-
- private static class RecordingVisitor
- implements DependencyVisitor
- {
-
- StringBuilder buffer = new StringBuilder( 256 );
-
- public boolean visitEnter( DependencyNode node )
- {
- buffer.append( '>' ).append( node.getDependency().getArtifact().getArtifactId() ).append( ' ' );
- return true;
- }
-
- public boolean visitLeave( DependencyNode node )
- {
- buffer.append( '<' ).append( node.getDependency().getArtifact().getArtifactId() ).append( ' ' );
- return true;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedRepositoryListenerTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedRepositoryListenerTest.java b/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedRepositoryListenerTest.java
deleted file mode 100644
index 6eaa25b..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedRepositoryListenerTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.aether.util.listener;
-
-/*
- * 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.*;
-
-import java.lang.reflect.Method;
-
-import org.eclipse.aether.RepositoryListener;
-import org.eclipse.aether.util.listener.ChainedRepositoryListener;
-import org.junit.Test;
-
-/**
- */
-public class ChainedRepositoryListenerTest
-{
-
- @Test
- public void testAllEventTypesHandled()
- throws Exception
- {
- for ( Method method : RepositoryListener.class.getMethods() )
- {
- assertNotNull( ChainedRepositoryListener.class.getDeclaredMethod( method.getName(),
- method.getParameterTypes() ) );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedTransferListenerTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedTransferListenerTest.java b/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedTransferListenerTest.java
deleted file mode 100644
index 7e7e969..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/listener/ChainedTransferListenerTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.aether.util.listener;
-
-/*
- * 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.*;
-
-import java.lang.reflect.Method;
-
-import org.eclipse.aether.transfer.TransferListener;
-import org.eclipse.aether.util.listener.ChainedTransferListener;
-import org.junit.Test;
-
-/**
- */
-public class ChainedTransferListenerTest
-{
-
- @Test
- public void testAllEventTypesHandled()
- throws Exception
- {
- for ( Method method : TransferListener.class.getMethods() )
- {
- assertNotNull( ChainedTransferListener.class.getDeclaredMethod( method.getName(),
- method.getParameterTypes() ) );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/repository/ComponentAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/repository/ComponentAuthenticationTest.java b/aether-util/src/test/java/org/eclipse/aether/util/repository/ComponentAuthenticationTest.java
deleted file mode 100644
index 25d53f2..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/repository/ComponentAuthenticationTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.aether.util.repository;
-
-/*
- * 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.*;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.Authentication;
-import org.eclipse.aether.repository.AuthenticationContext;
-import org.eclipse.aether.repository.AuthenticationDigest;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.junit.Test;
-
-public class ComponentAuthenticationTest
-{
-
- private static class Component
- {
- }
-
- private RepositorySystemSession newSession()
- {
- return new DefaultRepositorySystemSession();
- }
-
- private RemoteRepository newRepo( Authentication auth )
- {
- return new RemoteRepository.Builder( "test", "default", "http://localhost" ).setAuthentication( auth ).build();
- }
-
- private AuthenticationContext newContext( Authentication auth )
- {
- return AuthenticationContext.forRepository( newSession(), newRepo( auth ) );
- }
-
- private String newDigest( Authentication auth )
- {
- return AuthenticationDigest.forRepository( newSession(), newRepo( auth ) );
- }
-
- @Test
- public void testFill()
- {
- Component comp = new Component();
- Authentication auth = new ComponentAuthentication( "key", comp );
- AuthenticationContext context = newContext( auth );
- assertEquals( null, context.get( "another-key" ) );
- assertSame( comp, context.get( "key", Component.class ) );
- }
-
- @Test
- public void testDigest()
- {
- Authentication auth1 = new ComponentAuthentication( "key", new Component() );
- Authentication auth2 = new ComponentAuthentication( "key", new Component() );
- String digest1 = newDigest( auth1 );
- String digest2 = newDigest( auth2 );
- assertEquals( digest1, digest2 );
-
- Authentication auth3 = new ComponentAuthentication( "key", new Object() );
- String digest3 = newDigest( auth3 );
- assertFalse( digest3.equals( digest1 ) );
-
- Authentication auth4 = new ComponentAuthentication( "Key", new Component() );
- String digest4 = newDigest( auth4 );
- assertFalse( digest4.equals( digest1 ) );
- }
-
- @Test
- public void testEquals()
- {
- Authentication auth1 = new ComponentAuthentication( "key", new Component() );
- Authentication auth2 = new ComponentAuthentication( "key", new Component() );
- Authentication auth3 = new ComponentAuthentication( "key", new Object() );
- assertEquals( auth1, auth2 );
- assertFalse( auth1.equals( auth3 ) );
- assertFalse( auth1.equals( null ) );
- }
-
- @Test
- public void testHashCode()
- {
- Authentication auth1 = new ComponentAuthentication( "key", new Component() );
- Authentication auth2 = new ComponentAuthentication( "key", new Component() );
- assertEquals( auth1.hashCode(), auth2.hashCode() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultMirrorSelectorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultMirrorSelectorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultMirrorSelectorTest.java
deleted file mode 100644
index d436658..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultMirrorSelectorTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.aether.util.repository;
-
-/*
- * 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.*;
-
-import java.util.Arrays;
-
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.util.repository.DefaultMirrorSelector.*;
-import org.junit.Test;
-
-/**
- */
-public class DefaultMirrorSelectorTest
-{
-
- private RemoteRepository newRepo( String id, String type, String url )
- {
- return new RemoteRepository.Builder( id, type, url ).build();
- }
-
- private static boolean matchesType( String repoType, String mirrorType )
- {
- return new TypeMatcher( DefaultMirrorSelector.split( mirrorType ) ).isMatch( repoType );
- }
-
- private boolean matchesPattern( RemoteRepository repository, String pattern )
- {
- return new IdMatcher( DefaultMirrorSelector.split( pattern ) ).isMatch( repository );
- }
-
- private static boolean isExternalRepo( RemoteRepository repository )
- {
- return IdMatcher.isExternalRepo( repository );
- }
-
- @Test
- public void testIsExternalRepo()
- {
- assertEquals( false, isExternalRepo( newRepo( "", "", "http://localhost/path" ) ) );
- assertEquals( false, isExternalRepo( newRepo( "", "", "http://127.0.0.1/path" ) ) );
- assertEquals( false, isExternalRepo( newRepo( "", "", "file:/path" ) ) );
- assertEquals( true, isExternalRepo( newRepo( "", "", "http://eclipse.org/" ) ) );
- assertEquals( true, isExternalRepo( newRepo( "", "", "" ) ) );
- }
-
- @Test
- public void testMatchesType()
- {
- assertEquals( true, matchesType( null, null ) );
- assertEquals( true, matchesType( "any", null ) );
- assertEquals( true, matchesType( "any", "" ) );
- assertEquals( true, matchesType( "any", "*" ) );
-
- assertEquals( false, matchesType( null, "default" ) );
- assertEquals( false, matchesType( "", "default" ) );
- assertEquals( false, matchesType( "any", "default" ) );
-
- assertEquals( true, matchesType( "default", "default" ) );
-
- assertEquals( false, matchesType( "default", "DEFAULT" ) );
- assertEquals( false, matchesType( "DEFAULT", "default" ) );
-
- assertEquals( true, matchesType( "default", "default,foo" ) );
- assertEquals( true, matchesType( "default", "foo,default" ) );
-
- assertEquals( true, matchesType( "default", "*,foo" ) );
- assertEquals( true, matchesType( "default", "foo,*" ) );
-
- assertEquals( false, matchesType( "p2", "*,!p2" ) );
- assertEquals( false, matchesType( "p2", "!p2,*" ) );
- }
-
- @Test
- public void testMatchesType_Trimming()
- {
- assertEquals( true, matchesType( "any", " " ) );
- assertEquals( true, matchesType( "default", " default " ) );
- assertEquals( true, matchesType( "default", "foo, default ,bar" ) );
- assertEquals( true, matchesType( "default", " default ,bar" ) );
- assertEquals( true, matchesType( "default", "foo, default " ) );
- }
-
- @Test
- public void testMatchesPattern()
- {
- assertEquals( false, matchesPattern( newRepo( "id", "type", "url" ), null ) );
- assertEquals( false, matchesPattern( newRepo( "id", "type", "url" ), "" ) );
- assertEquals( false, matchesPattern( newRepo( "id", "type", "url" ), "central" ) );
-
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), "central" ) );
-
- assertEquals( false, matchesPattern( newRepo( "central", "type", "url" ), "CENTRAL" ) );
- assertEquals( false, matchesPattern( newRepo( "CENTRAL", "type", "url" ), "central" ) );
-
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), "central,foo" ) );
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), "foo,central" ) );
-
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), "*,foo" ) );
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), "foo,*" ) );
-
- assertEquals( false, matchesPattern( newRepo( "central", "type", "url" ), "*,!central" ) );
- assertEquals( false, matchesPattern( newRepo( "central", "type", "url" ), "!central,*" ) );
- }
-
- @Test
- public void testMatchesPattern_Trimming()
- {
- assertEquals( false, matchesPattern( newRepo( "central", "type", "url" ), " " ) );
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), " central " ) );
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), "foo, central ,bar" ) );
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), " central ,bar" ) );
- assertEquals( true, matchesPattern( newRepo( "central", "type", "url" ), "foo, central " ) );
- }
-
- @Test
- public void testGetMirror_FirstMatchWins()
- {
- DefaultMirrorSelector selector = new DefaultMirrorSelector();
- selector.add( "mirror1", "http://host1", "default", false, "*", "*" );
- selector.add( "mirror2", "http://host2", "default", false, "*", "*" );
- RemoteRepository mirror = selector.getMirror( newRepo( "central", "default", "http://localhost" ) );
- assertNotNull( mirror );
- assertEquals( "mirror1", mirror.getId() );
- assertEquals( "http://host1", mirror.getUrl() );
- }
-
- @Test
- public void testGetMirror_ExactMatchWins()
- {
- DefaultMirrorSelector selector = new DefaultMirrorSelector();
- selector.add( "mirror1", "http://host1", "default", false, "*", "*" );
- selector.add( "mirror2", "http://host2", "default", false, "central", "*" );
- selector.add( "mirror3", "http://host3", "default", false, "*", "*" );
- RemoteRepository mirror = selector.getMirror( newRepo( "central", "default", "http://localhost" ) );
- assertNotNull( mirror );
- assertEquals( "mirror2", mirror.getId() );
- assertEquals( "http://host2", mirror.getUrl() );
- }
-
- @Test
- public void testGetMirror_WithoutMirrorLayout()
- {
- DefaultMirrorSelector selector = new DefaultMirrorSelector();
- selector.add( "mirror", "http://host", "", false, "*", "*" );
- RemoteRepository mirror = selector.getMirror( newRepo( "central", "default", "http://localhost" ) );
- assertNotNull( mirror );
- assertEquals( "mirror", mirror.getId() );
- assertEquals( "http://host", mirror.getUrl() );
- assertEquals( "default", mirror.getContentType() );
- }
-
- @Test
- public void testGetMirror_WithMirrorLayout()
- {
- DefaultMirrorSelector selector = new DefaultMirrorSelector();
- selector.add( "mirror", "http://host", "layout", false, "*", "*" );
- RemoteRepository mirror = selector.getMirror( newRepo( "central", "default", "http://localhost" ) );
- assertNotNull( mirror );
- assertEquals( "mirror", mirror.getId() );
- assertEquals( "http://host", mirror.getUrl() );
- assertEquals( "layout", mirror.getContentType() );
- }
-
- @Test
- public void testGetMirror_MirroredRepos()
- {
- DefaultMirrorSelector selector = new DefaultMirrorSelector();
- selector.add( "mirror", "http://host", "layout", false, "*", "*" );
- RemoteRepository repo = newRepo( "central", "default", "http://localhost" );
- RemoteRepository mirror = selector.getMirror( repo );
- assertNotNull( mirror );
- assertEquals( Arrays.asList( repo ), mirror.getMirroredRepositories() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java b/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
deleted file mode 100644
index 02a665a..0000000
--- a/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.eclipse.aether.util.repository;
-
-/*
- * 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.*;
-
-import java.util.Arrays;
-
-import org.eclipse.aether.repository.Proxy;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.util.repository.DefaultProxySelector.NonProxyHosts;
-import org.junit.Test;
-
-/**
- */
-public class DefaultProxySelectorTest
-{
-
- private RemoteRepository newRepo( String url )
- {
- return new RemoteRepository.Builder( "id", "type", url ).build();
- }
-
- private boolean isNonProxyHost( String host, String nonProxyHosts )
- {
- return new NonProxyHosts( NonProxyHosts.split( nonProxyHosts ) ).isNonProxyHost( host );
- }
-
- private boolean isNonProxyHost( String host, String... nonProxyHosts )
- {
- return new NonProxyHosts( nonProxyHosts != null ? Arrays.asList( nonProxyHosts ) : null ).isNonProxyHost( host );
- }
-
- @Test
- public void testIsNonProxyHost_Blank()
- {
- assertFalse( isNonProxyHost( "www.eclipse.org", (String) null ) );
- assertFalse( isNonProxyHost( "www.eclipse.org", "" ) );
- assertFalse( isNonProxyHost( "", "" ) );
-
- assertFalse( isNonProxyHost( "www.eclipse.org", (String[]) null ) );
- assertFalse( isNonProxyHost( "www.eclipse.org", new String[0] ) );
- assertFalse( isNonProxyHost( "", new String[0] ) );
- assertFalse( isNonProxyHost( "", new String[] { null } ) );
- assertFalse( isNonProxyHost( "", new String[] { "" } ) );
- }
-
- @Test
- public void testIsNonProxyHost_Wildcard()
- {
- assertTrue( isNonProxyHost( "www.eclipse.org", "*" ) );
- assertTrue( isNonProxyHost( "www.eclipse.org", "*.org" ) );
- assertFalse( isNonProxyHost( "www.eclipse.org", "*.com" ) );
- assertTrue( isNonProxyHost( "www.eclipse.org", "www.*" ) );
- assertTrue( isNonProxyHost( "www.eclipse.org", "www.*.org" ) );
- }
-
- @Test
- public void testIsNonProxyHost_Multiple()
- {
- assertTrue( isNonProxyHost( "eclipse.org", "eclipse.org|host2" ) );
- assertTrue( isNonProxyHost( "eclipse.org", "host1|eclipse.org" ) );
- assertTrue( isNonProxyHost( "eclipse.org", "host1|eclipse.org|host2" ) );
-
- assertTrue( isNonProxyHost( "eclipse.org", "eclipse.org,host2" ) );
- assertTrue( isNonProxyHost( "eclipse.org", "host1,eclipse.org" ) );
- assertTrue( isNonProxyHost( "eclipse.org", "host1,eclipse.org,host2" ) );
-
- assertFalse( isNonProxyHost( "", "||host||" ) );
- assertFalse( isNonProxyHost( "", ",,host,," ) );
- }
-
- @Test
- public void testIsNonProxyHost_Trimming()
- {
- assertFalse( isNonProxyHost( "", " " ) );
- assertTrue( isNonProxyHost( "eclipse.org", " eclipse.org " ) );
- assertTrue( isNonProxyHost( "eclipse.org", "host1| eclipse.org |host2" ) );
- assertTrue( isNonProxyHost( "eclipse.org", "host1|eclipse.org " ) );
- assertTrue( isNonProxyHost( "eclipse.org", " eclipse.org|host2" ) );
- }
-
- @Test
- public void testIsNonProxyHost_Misc()
- {
- assertFalse( isNonProxyHost( "www.eclipse.org", "www.eclipse.com" ) );
- assertFalse( isNonProxyHost( "www.eclipse.org", "eclipse.org" ) );
- }
-
- @Test
- public void testIsNonProxyHost_CaseInsensitivity()
- {
- assertTrue( isNonProxyHost( "www.eclipse.org", "www.ECLIPSE.org" ) );
- assertTrue( isNonProxyHost( "www.ECLIPSE.org", "www.eclipse.org" ) );
- }
-
- @Test
- public void testGetProxy_FirstMatchWins()
- {
- DefaultProxySelector selector = new DefaultProxySelector();
- Proxy proxy1 = new Proxy( Proxy.TYPE_HTTP, "proxy", 88 );
- selector.add( proxy1, "localhost" );
- Proxy proxy2 = new Proxy( Proxy.TYPE_HTTP, "other", 8888 );
- selector.add( proxy2, "" );
-
- assertSame( proxy1, selector.getProxy( newRepo( "http://eclipse.org/" ) ) );
- assertSame( proxy2, selector.getProxy( newRepo( "http://localhost/" ) ) );
- }
-
- @Test
- public void testGetProxy_Http()
- {
- DefaultProxySelector selector = new DefaultProxySelector();
- Proxy proxy1 = new Proxy( Proxy.TYPE_HTTP, "proxy", 88 );
- selector.add( proxy1, "localhost" );
-
- assertSame( proxy1, selector.getProxy( newRepo( "http://eclipse.org/" ) ) );
- assertSame( proxy1, selector.getProxy( newRepo( "HTTP://eclipse.org/" ) ) );
-
- assertSame( proxy1, selector.getProxy( newRepo( "https://eclipse.org/" ) ) );
- assertSame( proxy1, selector.getProxy( newRepo( "HTTPS://eclipse.org/" ) ) );
-
- assertNull( selector.getProxy( newRepo( "http://localhost/" ) ) );
-
- Proxy proxy2 = new Proxy( Proxy.TYPE_HTTPS, "sproxy", 888 );
- selector.add( proxy2, "localhost" );
-
- assertSame( proxy1, selector.getProxy( newRepo( "http://eclipse.org/" ) ) );
- assertSame( proxy1, selector.getProxy( newRepo( "HTTP://eclipse.org/" ) ) );
-
- assertSame( proxy2, selector.getProxy( newRepo( "https://eclipse.org/" ) ) );
- assertSame( proxy2, selector.getProxy( newRepo( "HTTPS://eclipse.org/" ) ) );
- }
-
- @Test
- public void testGetProxy_WebDav()
- {
- DefaultProxySelector selector = new DefaultProxySelector();
- Proxy proxy1 = new Proxy( Proxy.TYPE_HTTP, "proxy", 88 );
- selector.add( proxy1, "localhost" );
-
- assertSame( proxy1, selector.getProxy( newRepo( "dav://eclipse.org/" ) ) );
- assertSame( proxy1, selector.getProxy( newRepo( "dav:http://eclipse.org/" ) ) );
-
- assertSame( proxy1, selector.getProxy( newRepo( "davs://eclipse.org/" ) ) );
- assertSame( proxy1, selector.getProxy( newRepo( "dav:https://eclipse.org/" ) ) );
-
- assertNull( selector.getProxy( newRepo( "dav://localhost/" ) ) );
-
- Proxy proxy2 = new Proxy( Proxy.TYPE_HTTPS, "sproxy", 888 );
- selector.add( proxy2, "localhost" );
-
- assertSame( proxy1, selector.getProxy( newRepo( "dav://eclipse.org/" ) ) );
- assertSame( proxy1, selector.getProxy( newRepo( "dav:http://eclipse.org/" ) ) );
-
- assertSame( proxy2, selector.getProxy( newRepo( "davs://eclipse.org/" ) ) );
- assertSame( proxy2, selector.getProxy( newRepo( "dav:https://eclipse.org/" ) ) );
- }
-
-}