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:24:05 UTC
[42/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-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java b/aether-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java
deleted file mode 100644
index 91afeb5..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.eclipse.aether;
-
-/*
- * 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.Map;
-
-import org.eclipse.aether.repository.Authentication;
-import org.eclipse.aether.repository.AuthenticationContext;
-import org.eclipse.aether.repository.AuthenticationDigest;
-import org.eclipse.aether.repository.Proxy;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.junit.Test;
-
-/**
- */
-public class DefaultRepositorySystemSessionTest
-{
-
- @Test
- public void testDefaultProxySelectorUsesExistingProxy()
- {
- DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
-
- RemoteRepository repo = new RemoteRepository.Builder( "id", "default", "void" ).build();
- assertSame( null, session.getProxySelector().getProxy( repo ) );
-
- Proxy proxy = new Proxy( "http", "localhost", 8080, null );
- repo = new RemoteRepository.Builder( repo ).setProxy( proxy ).build();
- assertSame( proxy, session.getProxySelector().getProxy( repo ) );
- }
-
- @Test
- public void testDefaultAuthenticationSelectorUsesExistingAuth()
- {
- DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
-
- RemoteRepository repo = new RemoteRepository.Builder( "id", "default", "void" ).build();
- assertSame( null, session.getAuthenticationSelector().getAuthentication( repo ) );
-
- Authentication auth = new Authentication()
- {
- public void fill( AuthenticationContext context, String key, Map<String, String> data )
- {
- }
-
- public void digest( AuthenticationDigest digest )
- {
- }
- };
- repo = new RemoteRepository.Builder( repo ).setAuthentication( auth ).build();
- assertSame( auth, session.getAuthenticationSelector().getAuthentication( repo ) );
- }
-
- @Test
- public void testCopyConstructorCopiesPropertiesDeep()
- {
- DefaultRepositorySystemSession session1 = new DefaultRepositorySystemSession();
- session1.setUserProperties( System.getProperties() );
- session1.setSystemProperties( System.getProperties() );
- session1.setConfigProperties( System.getProperties() );
-
- DefaultRepositorySystemSession session2 = new DefaultRepositorySystemSession( session1 );
- session2.setUserProperty( "key", "test" );
- session2.setSystemProperty( "key", "test" );
- session2.setConfigProperty( "key", "test" );
-
- assertEquals( null, session1.getUserProperties().get( "key" ) );
- assertEquals( null, session1.getSystemProperties().get( "key" ) );
- assertEquals( null, session1.getConfigProperties().get( "key" ) );
- }
-
- @Test
- public void testReadOnlyProperties()
- {
- DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
-
- try
- {
- session.getUserProperties().put( "key", "test" );
- fail( "user properties are modifiable" );
- }
- catch ( UnsupportedOperationException e )
- {
- // expected
- }
-
- try
- {
- session.getSystemProperties().put( "key", "test" );
- fail( "system properties are modifiable" );
- }
- catch ( UnsupportedOperationException e )
- {
- // expected
- }
-
- try
- {
- session.getConfigProperties().put( "key", "test" );
- fail( "config properties are modifiable" );
- }
- catch ( UnsupportedOperationException e )
- {
- // expected
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/DefaultSessionDataTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/DefaultSessionDataTest.java b/aether-api/src/test/java/org/eclipse/aether/DefaultSessionDataTest.java
deleted file mode 100644
index 58f3649..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/DefaultSessionDataTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.eclipse.aether;
-
-/*
- * 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.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.junit.Test;
-
-public class DefaultSessionDataTest
-{
-
- private DefaultSessionData data = new DefaultSessionData();
-
- private Object get( Object key )
- {
- return data.get( key );
- }
-
- private void set( Object key, Object value )
- {
- data.set( key, value );
- }
-
- private boolean set( Object key, Object oldValue, Object newValue )
- {
- return data.set( key, oldValue, newValue );
- }
-
- @Test( expected = RuntimeException.class )
- public void testGet_NullKey()
- {
- get( null );
- }
-
- @Test( expected = RuntimeException.class )
- public void testSet_NullKey()
- {
- set( null, "data" );
- }
-
- @Test
- public void testGetSet()
- {
- Object key = "key";
- assertNull( get( key ) );
- set( key, "value" );
- assertEquals( "value", get( key ) );
- set( key, "changed" );
- assertEquals( "changed", get( key ) );
- set( key, null );
- assertNull( get( key ) );
- }
-
- @Test
- public void testGetSafeSet()
- {
- Object key = "key";
- assertNull( get( key ) );
- assertFalse( set( key, "wrong", "value" ) );
- assertNull( get( key ) );
- assertTrue( set( key, null, "value" ) );
- assertEquals( "value", get( key ) );
- assertTrue( set( key, "value", "value" ) );
- assertEquals( "value", get( key ) );
- assertFalse( set( key, "wrong", "changed" ) );
- assertEquals( "value", get( key ) );
- assertTrue( set( key, "value", "changed" ) );
- assertEquals( "changed", get( key ) );
- assertFalse( set( key, "wrong", null ) );
- assertEquals( "changed", get( key ) );
- assertTrue( set( key, "changed", null ) );
- assertNull( get( key ) );
- assertTrue( set( key, null, null ) );
- assertNull( get( key ) );
- }
-
- @Test( timeout = 10000 )
- public void testConcurrency()
- throws Exception
- {
- final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
- Thread threads[] = new Thread[20];
- for ( int i = 0; i < threads.length; i++ )
- {
- threads[i] = new Thread()
- {
- @Override
- public void run()
- {
- for ( int i = 0; i < 100; i++ )
- {
- String key = UUID.randomUUID().toString();
- try
- {
- set( key, Boolean.TRUE );
- assertEquals( Boolean.TRUE, get( key ) );
- }
- catch ( Throwable t )
- {
- error.compareAndSet( null, t );
- t.printStackTrace();
- }
- }
- }
- };
- }
- for ( Thread thread : threads )
- {
- thread.start();
- }
- for ( Thread thread : threads )
- {
- thread.join();
- }
- assertNull( String.valueOf( error.get() ), error.get() );
- }
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/RepositoryExceptionTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/RepositoryExceptionTest.java b/aether-api/src/test/java/org/eclipse/aether/RepositoryExceptionTest.java
deleted file mode 100644
index c3246be..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/RepositoryExceptionTest.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package org.eclipse.aether;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.CollectRequest;
-import org.eclipse.aether.collection.CollectResult;
-import org.eclipse.aether.collection.DependencyCollectionException;
-import org.eclipse.aether.collection.UnsolvableVersionConflictException;
-import org.eclipse.aether.graph.DefaultDependencyNode;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.metadata.DefaultMetadata;
-import org.eclipse.aether.metadata.Metadata;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
-import org.eclipse.aether.repository.Proxy;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.resolution.ArtifactDescriptorException;
-import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-import org.eclipse.aether.resolution.ArtifactRequest;
-import org.eclipse.aether.resolution.ArtifactResolutionException;
-import org.eclipse.aether.resolution.ArtifactResult;
-import org.eclipse.aether.resolution.DependencyRequest;
-import org.eclipse.aether.resolution.DependencyResolutionException;
-import org.eclipse.aether.resolution.DependencyResult;
-import org.eclipse.aether.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResolutionException;
-import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.resolution.VersionRequest;
-import org.eclipse.aether.resolution.VersionResolutionException;
-import org.eclipse.aether.resolution.VersionResult;
-import org.eclipse.aether.transfer.ArtifactNotFoundException;
-import org.eclipse.aether.transfer.ArtifactTransferException;
-import org.eclipse.aether.transfer.MetadataNotFoundException;
-import org.eclipse.aether.transfer.MetadataTransferException;
-import org.eclipse.aether.transfer.NoRepositoryConnectorException;
-import org.eclipse.aether.transfer.NoRepositoryLayoutException;
-import org.eclipse.aether.transfer.NoTransporterException;
-import org.eclipse.aether.transfer.RepositoryOfflineException;
-import org.junit.Test;
-
-public class RepositoryExceptionTest
-{
-
- private void assertSerializable( RepositoryException e )
- {
- try
- {
- ObjectOutputStream oos = new ObjectOutputStream( new ByteArrayOutputStream() );
- oos.writeObject( e );
- oos.close();
- }
- catch ( IOException ioe )
- {
- throw new IllegalStateException( ioe );
- }
- }
-
- private RequestTrace newTrace()
- {
- return new RequestTrace( "test" );
- }
-
- private Artifact newArtifact()
- {
- return new DefaultArtifact( "gid", "aid", "ext", "1" );
- }
-
- private Metadata newMetadata()
- {
- return new DefaultMetadata( "maven-metadata.xml", Metadata.Nature.RELEASE_OR_SNAPSHOT );
- }
-
- private RemoteRepository newRepo()
- {
- Proxy proxy = new Proxy( Proxy.TYPE_HTTP, "localhost", 8080, null );
- return new RemoteRepository.Builder( "id", "test", "http://localhost" ).setProxy( proxy ).build();
- }
-
- @Test
- public void testArtifactDescriptorException_Serializable()
- {
- ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
- request.setArtifact( newArtifact() ).addRepository( newRepo() ).setTrace( newTrace() );
- ArtifactDescriptorResult result = new ArtifactDescriptorResult( request );
- assertSerializable( new ArtifactDescriptorException( result ) );
- }
-
- @Test
- public void testArtifactResolutionException_Serializable()
- {
- ArtifactRequest request = new ArtifactRequest();
- request.setArtifact( newArtifact() ).addRepository( newRepo() ).setTrace( newTrace() );
- ArtifactResult result = new ArtifactResult( request );
- assertSerializable( new ArtifactResolutionException( Arrays.asList( result ) ) );
- }
-
- @Test
- public void testArtifactTransferException_Serializable()
- {
- assertSerializable( new ArtifactTransferException( newArtifact(), newRepo(), "error" ) );
- }
-
- @Test
- public void testArtifactNotFoundException_Serializable()
- {
- assertSerializable( new ArtifactNotFoundException( newArtifact(), newRepo(), "error" ) );
- }
-
- @Test
- public void testDependencyCollectionException_Serializable()
- {
- CollectRequest request = new CollectRequest();
- request.addDependency( new Dependency( newArtifact(), "compile" ) );
- request.addRepository( newRepo() );
- request.setTrace( newTrace() );
- CollectResult result = new CollectResult( request );
- assertSerializable( new DependencyCollectionException( result ) );
- }
-
- @Test
- public void testDependencyResolutionException_Serializable()
- {
- CollectRequest request = new CollectRequest();
- request.addDependency( new Dependency( newArtifact(), "compile" ) );
- request.addRepository( newRepo() );
- request.setTrace( newTrace() );
- DependencyRequest req = new DependencyRequest();
- req.setTrace( newTrace() );
- req.setCollectRequest( request );
- DependencyResult result = new DependencyResult( req );
- assertSerializable( new DependencyResolutionException( result, null ) );
- }
-
- @Test
- public void testMetadataTransferException_Serializable()
- {
- assertSerializable( new MetadataTransferException( newMetadata(), newRepo(), "error" ) );
- }
-
- @Test
- public void testMetadataNotFoundException_Serializable()
- {
- assertSerializable( new MetadataNotFoundException( newMetadata(), newRepo(), "error" ) );
- }
-
- @Test
- public void testNoLocalRepositoryManagerException_Serializable()
- {
- assertSerializable( new NoLocalRepositoryManagerException( new LocalRepository( "/tmp" ) ) );
- }
-
- @Test
- public void testNoRepositoryConnectorException_Serializable()
- {
- assertSerializable( new NoRepositoryConnectorException( newRepo() ) );
- }
-
- @Test
- public void testNoRepositoryLayoutException_Serializable()
- {
- assertSerializable( new NoRepositoryLayoutException( newRepo() ) );
- }
-
- @Test
- public void testNoTransporterException_Serializable()
- {
- assertSerializable( new NoTransporterException( newRepo() ) );
- }
-
- @Test
- public void testRepositoryOfflineException_Serializable()
- {
- assertSerializable( new RepositoryOfflineException( newRepo() ) );
- }
-
- @Test
- public void testUnsolvableVersionConflictException_Serializable()
- {
- DependencyNode node = new DefaultDependencyNode( new Dependency( newArtifact(), "test" ) );
- assertSerializable( new UnsolvableVersionConflictException( Collections.singleton( Arrays.asList( node ) ) ) );
- }
-
- @Test
- public void testVersionResolutionException_Serializable()
- {
- VersionRequest request = new VersionRequest();
- request.setArtifact( newArtifact() ).addRepository( newRepo() ).setTrace( newTrace() );
- VersionResult result = new VersionResult( request );
- assertSerializable( new VersionResolutionException( result ) );
- }
-
- @Test
- public void testVersionRangeResolutionException_Serializable()
- {
- VersionRangeRequest request = new VersionRangeRequest();
- request.setArtifact( newArtifact() ).addRepository( newRepo() ).setTrace( newTrace() );
- VersionRangeResult result = new VersionRangeResult( request );
- assertSerializable( new VersionRangeResolutionException( result ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/RequestTraceTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/RequestTraceTest.java b/aether-api/src/test/java/org/eclipse/aether/RequestTraceTest.java
deleted file mode 100644
index 63e5877..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/RequestTraceTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.aether;
-
-/*
- * 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.junit.Test;
-
-/**
- */
-public class RequestTraceTest
-{
-
- @Test
- public void testConstructor()
- {
- RequestTrace trace = new RequestTrace( null );
- assertSame( null, trace.getData() );
-
- trace = new RequestTrace( this );
- assertSame( this, trace.getData() );
- }
-
- @Test
- public void testParentChaining()
- {
- RequestTrace trace1 = new RequestTrace( null );
- RequestTrace trace2 = trace1.newChild( this );
-
- assertSame( null, trace1.getParent() );
- assertSame( null, trace1.getData() );
- assertSame( trace1, trace2.getParent() );
- assertSame( this, trace2.getData() );
- }
-
- @Test
- public void testNewChildRequestTrace()
- {
- RequestTrace trace = RequestTrace.newChild( null, this );
- assertNotNull( trace );
- assertSame( null, trace.getParent() );
- assertSame( this, trace.getData() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/artifact/DefaultArtifactTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/artifact/DefaultArtifactTest.java b/aether-api/src/test/java/org/eclipse/aether/artifact/DefaultArtifactTest.java
deleted file mode 100644
index d8ac40c..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/artifact/DefaultArtifactTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.eclipse.aether.artifact;
-
-/*
- * 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.io.File;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.ArtifactProperties;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.junit.Test;
-
-/**
- */
-public class DefaultArtifactTest
-{
-
- @Test
- public void testDefaultArtifactString()
- {
- Artifact a;
-
- a = new DefaultArtifact( "gid:aid:ver" );
- assertEquals( "gid", a.getGroupId() );
- assertEquals( "aid", a.getArtifactId() );
- assertEquals( "ver", a.getVersion() );
- assertEquals( "ver", a.getBaseVersion() );
- assertEquals( "jar", a.getExtension() );
- assertEquals( "", a.getClassifier() );
-
- a = new DefaultArtifact( "gid:aid:ext:ver" );
- assertEquals( "gid", a.getGroupId() );
- assertEquals( "aid", a.getArtifactId() );
- assertEquals( "ver", a.getVersion() );
- assertEquals( "ver", a.getBaseVersion() );
- assertEquals( "ext", a.getExtension() );
- assertEquals( "", a.getClassifier() );
-
- a = new DefaultArtifact( "org.gid:foo-bar:jar:1.1-20101116.150650-3" );
- assertEquals( "org.gid", a.getGroupId() );
- assertEquals( "foo-bar", a.getArtifactId() );
- assertEquals( "1.1-20101116.150650-3", a.getVersion() );
- assertEquals( "1.1-SNAPSHOT", a.getBaseVersion() );
- assertEquals( "jar", a.getExtension() );
- assertEquals( "", a.getClassifier() );
-
- a = new DefaultArtifact( "gid:aid:ext:cls:ver" );
- assertEquals( "gid", a.getGroupId() );
- assertEquals( "aid", a.getArtifactId() );
- assertEquals( "ver", a.getVersion() );
- assertEquals( "ver", a.getBaseVersion() );
- assertEquals( "ext", a.getExtension() );
- assertEquals( "cls", a.getClassifier() );
-
- a = new DefaultArtifact( "gid:aid::cls:ver" );
- assertEquals( "gid", a.getGroupId() );
- assertEquals( "aid", a.getArtifactId() );
- assertEquals( "ver", a.getVersion() );
- assertEquals( "ver", a.getBaseVersion() );
- assertEquals( "jar", a.getExtension() );
- assertEquals( "cls", a.getClassifier() );
-
- a = new DefaultArtifact( new DefaultArtifact( "gid:aid:ext:cls:ver" ).toString() );
- assertEquals( "gid", a.getGroupId() );
- assertEquals( "aid", a.getArtifactId() );
- assertEquals( "ver", a.getVersion() );
- assertEquals( "ver", a.getBaseVersion() );
- assertEquals( "ext", a.getExtension() );
- assertEquals( "cls", a.getClassifier() );
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void testDefaultArtifactBadString()
- {
- new DefaultArtifact( "gid:aid" );
- }
-
- @Test
- public void testImmutability()
- {
- Artifact a = new DefaultArtifact( "gid:aid:ext:cls:ver" );
- assertNotSame( a, a.setFile( new File( "file" ) ) );
- assertNotSame( a, a.setVersion( "otherVersion" ) );
- assertNotSame( a, a.setProperties( Collections.singletonMap( "key", "value" ) ) );
- }
-
- @Test
- public void testArtifactType()
- {
- DefaultArtifactType type = new DefaultArtifactType( "typeId", "typeExt", "typeCls", "typeLang", true, true );
-
- Artifact a = new DefaultArtifact( "gid", "aid", null, null, null, null, type );
- assertEquals( "typeExt", a.getExtension() );
- assertEquals( "typeCls", a.getClassifier() );
- assertEquals( "typeLang", a.getProperties().get( ArtifactProperties.LANGUAGE ) );
- assertEquals( "typeId", a.getProperties().get( ArtifactProperties.TYPE ) );
- assertEquals( "true", a.getProperties().get( ArtifactProperties.INCLUDES_DEPENDENCIES ) );
- assertEquals( "true", a.getProperties().get( ArtifactProperties.CONSTITUTES_BUILD_PATH ) );
-
- a = new DefaultArtifact( "gid", "aid", "cls", "ext", "ver", null, type );
- assertEquals( "ext", a.getExtension() );
- assertEquals( "cls", a.getClassifier() );
- assertEquals( "typeLang", a.getProperties().get( ArtifactProperties.LANGUAGE ) );
- assertEquals( "typeId", a.getProperties().get( ArtifactProperties.TYPE ) );
- assertEquals( "true", a.getProperties().get( ArtifactProperties.INCLUDES_DEPENDENCIES ) );
- assertEquals( "true", a.getProperties().get( ArtifactProperties.CONSTITUTES_BUILD_PATH ) );
-
- Map<String, String> props = new HashMap<String, String>();
- props.put( "someNonStandardProperty", "someNonStandardProperty" );
- a = new DefaultArtifact( "gid", "aid", "cls", "ext", "ver", props, type );
- assertEquals( "ext", a.getExtension() );
- assertEquals( "cls", a.getClassifier() );
- assertEquals( "typeLang", a.getProperties().get( ArtifactProperties.LANGUAGE ) );
- assertEquals( "typeId", a.getProperties().get( ArtifactProperties.TYPE ) );
- assertEquals( "true", a.getProperties().get( ArtifactProperties.INCLUDES_DEPENDENCIES ) );
- assertEquals( "true", a.getProperties().get( ArtifactProperties.CONSTITUTES_BUILD_PATH ) );
- assertEquals( "someNonStandardProperty", a.getProperties().get( "someNonStandardProperty" ) );
-
- props = new HashMap<String, String>();
- props.put( "someNonStandardProperty", "someNonStandardProperty" );
- props.put( ArtifactProperties.CONSTITUTES_BUILD_PATH, "rubbish" );
- props.put( ArtifactProperties.INCLUDES_DEPENDENCIES, "rubbish" );
- a = new DefaultArtifact( "gid", "aid", "cls", "ext", "ver", props, type );
- assertEquals( "ext", a.getExtension() );
- assertEquals( "cls", a.getClassifier() );
- assertEquals( "typeLang", a.getProperties().get( ArtifactProperties.LANGUAGE ) );
- assertEquals( "typeId", a.getProperties().get( ArtifactProperties.TYPE ) );
- assertEquals( "rubbish", a.getProperties().get( ArtifactProperties.INCLUDES_DEPENDENCIES ) );
- assertEquals( "rubbish", a.getProperties().get( ArtifactProperties.CONSTITUTES_BUILD_PATH ) );
- assertEquals( "someNonStandardProperty", a.getProperties().get( "someNonStandardProperty" ) );
- }
-
- @Test
- public void testPropertiesCopied()
- {
- Map<String, String> props = new HashMap<String, String>();
- props.put( "key", "value1" );
-
- Artifact a = new DefaultArtifact( "gid:aid:1", props );
- assertEquals( "value1", a.getProperty( "key", null ) );
- props.clear();
- assertEquals( "value1", a.getProperty( "key", null ) );
-
- props.put( "key", "value2" );
- a = a.setProperties( props );
- assertEquals( "value2", a.getProperty( "key", null ) );
- props.clear();
- assertEquals( "value2", a.getProperty( "key", null ) );
- }
-
- @Test
- public void testIsSnapshot()
- {
- Artifact a = new DefaultArtifact( "gid:aid:ext:cls:1.0" );
- assertFalse( a.getVersion(), a.isSnapshot() );
-
- a = new DefaultArtifact( "gid:aid:ext:cls:1.0-SNAPSHOT" );
- assertTrue( a.getVersion(), a.isSnapshot() );
-
- a = new DefaultArtifact( "gid:aid:ext:cls:1.0-20101116.150650-3" );
- assertTrue( a.getVersion(), a.isSnapshot() );
-
- a = new DefaultArtifact( "gid:aid:ext:cls:1.0-20101116x150650-3" );
- assertFalse( a.getVersion(), a.isSnapshot() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/graph/DependencyTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/graph/DependencyTest.java b/aether-api/src/test/java/org/eclipse/aether/graph/DependencyTest.java
deleted file mode 100644
index c96746d..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/graph/DependencyTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.aether.graph;
-
-/*
- * 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 java.util.Collections;
-
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.Exclusion;
-import org.junit.Test;
-
-/**
- */
-public class DependencyTest
-{
-
- @Test
- public void testSetScope()
- {
- Dependency d1 = new Dependency( new DefaultArtifact( "gid:aid:ver" ), "compile" );
-
- Dependency d2 = d1.setScope( null );
- assertNotSame( d2, d1 );
- assertEquals( "", d2.getScope() );
-
- Dependency d3 = d1.setScope( "test" );
- assertNotSame( d3, d1 );
- assertEquals( "test", d3.getScope() );
- }
-
- @Test
- public void testSetExclusions()
- {
- Dependency d1 =
- new Dependency( new DefaultArtifact( "gid:aid:ver" ), "compile", false,
- Collections.singleton( new Exclusion( "g", "a", "c", "e" ) ) );
-
- Dependency d2 = d1.setExclusions( null );
- assertNotSame( d2, d1 );
- assertEquals( 0, d2.getExclusions().size() );
-
- assertSame( d2, d2.setExclusions( null ) );
- assertSame( d2, d2.setExclusions( Collections.<Exclusion> emptyList() ) );
- assertSame( d2, d2.setExclusions( Collections.<Exclusion> emptySet() ) );
- assertSame( d1, d1.setExclusions( Arrays.asList( new Exclusion( "g", "a", "c", "e" ) ) ) );
-
- Dependency d3 =
- d1.setExclusions( Arrays.asList( new Exclusion( "g", "a", "c", "e" ), new Exclusion( "g", "a", "c", "f" ) ) );
- assertNotSame( d3, d1 );
- assertEquals( 2, d3.getExclusions().size() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationContextTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationContextTest.java b/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationContextTest.java
deleted file mode 100644
index 6d579a1..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationContextTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.aether.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.io.File;
-import java.util.Map;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystemSession;
-import org.junit.Test;
-
-public class AuthenticationContextTest
-{
-
- private RepositorySystemSession newSession()
- {
- return new DefaultRepositorySystemSession();
- }
-
- private RemoteRepository newRepo( Authentication auth, Proxy proxy )
- {
- return new RemoteRepository.Builder( "test", "default", "http://localhost" ) //
- .setAuthentication( auth ).setProxy( proxy ).build();
- }
-
- private Proxy newProxy( Authentication auth )
- {
- return new Proxy( Proxy.TYPE_HTTP, "localhost", 8080, auth );
- }
-
- private Authentication newAuth()
- {
- return new Authentication()
- {
- public void fill( AuthenticationContext context, String key, Map<String, String> data )
- {
- assertNotNull( context );
- assertNotNull( context.getSession() );
- assertNotNull( context.getRepository() );
- assertNull( "fill() should only be called once", context.get( "key" ) );
- context.put( "key", "value" );
- }
-
- public void digest( AuthenticationDigest digest )
- {
- fail( "AuthenticationContext should not call digest()" );
- }
- };
- }
-
- @Test
- public void testForRepository()
- {
- RepositorySystemSession session = newSession();
- RemoteRepository repo = newRepo( newAuth(), newProxy( newAuth() ) );
- AuthenticationContext context = AuthenticationContext.forRepository( session, repo );
- assertNotNull( context );
- assertSame( session, context.getSession() );
- assertSame( repo, context.getRepository() );
- assertNull( context.getProxy() );
- assertEquals( "value", context.get( "key" ) );
- assertEquals( "value", context.get( "key" ) );
- }
-
- @Test
- public void testForRepository_NoAuth()
- {
- RepositorySystemSession session = newSession();
- RemoteRepository repo = newRepo( null, newProxy( newAuth() ) );
- AuthenticationContext context = AuthenticationContext.forRepository( session, repo );
- assertNull( context );
- }
-
- @Test
- public void testForProxy()
- {
- RepositorySystemSession session = newSession();
- Proxy proxy = newProxy( newAuth() );
- RemoteRepository repo = newRepo( newAuth(), proxy );
- AuthenticationContext context = AuthenticationContext.forProxy( session, repo );
- assertNotNull( context );
- assertSame( session, context.getSession() );
- assertSame( repo, context.getRepository() );
- assertSame( proxy, context.getProxy() );
- assertEquals( "value", context.get( "key" ) );
- assertEquals( "value", context.get( "key" ) );
- }
-
- @Test
- public void testForProxy_NoProxy()
- {
- RepositorySystemSession session = newSession();
- Proxy proxy = null;
- RemoteRepository repo = newRepo( newAuth(), proxy );
- AuthenticationContext context = AuthenticationContext.forProxy( session, repo );
- assertNull( context );
- }
-
- @Test
- public void testForProxy_NoProxyAuth()
- {
- RepositorySystemSession session = newSession();
- Proxy proxy = newProxy( null );
- RemoteRepository repo = newRepo( newAuth(), proxy );
- AuthenticationContext context = AuthenticationContext.forProxy( session, repo );
- assertNull( context );
- }
-
- @Test
- public void testGet_StringVsChars()
- {
- AuthenticationContext context = AuthenticationContext.forRepository( newSession(), newRepo( newAuth(), null ) );
- context.put( "key", new char[] { 'v', 'a', 'l', '1' } );
- assertEquals( "val1", context.get( "key" ) );
- context.put( "key", "val2" );
- assertArrayEquals( new char[] { 'v', 'a', 'l', '2' }, context.get( "key", char[].class ) );
- }
-
- @Test
- public void testGet_StringVsFile()
- {
- AuthenticationContext context = AuthenticationContext.forRepository( newSession(), newRepo( newAuth(), null ) );
- context.put( "key", "val1" );
- assertEquals( new File( "val1" ), context.get( "key", File.class ) );
- context.put( "key", new File( "val2" ) );
- assertEquals( "val2", context.get( "key" ) );
- }
-
- @Test
- public void testPut_EraseCharArrays()
- {
- AuthenticationContext context = AuthenticationContext.forRepository( newSession(), newRepo( newAuth(), null ) );
- char[] secret = { 'v', 'a', 'l', 'u', 'e' };
- context.put( "key", secret );
- context.put( "key", secret.clone() );
- assertArrayEquals( new char[] { 0, 0, 0, 0, 0 }, secret );
- }
-
- @Test
- public void testClose_EraseCharArrays()
- {
- AuthenticationContext.close( null );
-
- AuthenticationContext context = AuthenticationContext.forRepository( newSession(), newRepo( newAuth(), null ) );
- char[] secret = { 'v', 'a', 'l', 'u', 'e' };
- context.put( "key", secret );
- AuthenticationContext.close( context );
- assertArrayEquals( new char[] { 0, 0, 0, 0, 0 }, secret );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationDigestTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationDigestTest.java b/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationDigestTest.java
deleted file mode 100644
index 387a3da..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/repository/AuthenticationDigestTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.eclipse.aether.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.Map;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystemSession;
-import org.junit.Test;
-
-public class AuthenticationDigestTest
-{
-
- private RepositorySystemSession newSession()
- {
- return new DefaultRepositorySystemSession();
- }
-
- private RemoteRepository newRepo( Authentication auth, Proxy proxy )
- {
- return new RemoteRepository.Builder( "test", "default", "http://localhost" ) //
- .setAuthentication( auth ).setProxy( proxy ).build();
- }
-
- private Proxy newProxy( Authentication auth )
- {
- return new Proxy( Proxy.TYPE_HTTP, "localhost", 8080, auth );
- }
-
- @Test
- public void testForRepository()
- {
- final RepositorySystemSession session = newSession();
- final RemoteRepository[] repos = { null };
-
- Authentication auth = new Authentication()
- {
- public void fill( AuthenticationContext context, String key, Map<String, String> data )
- {
- fail( "AuthenticationDigest should not call fill()" );
- }
-
- public void digest( AuthenticationDigest digest )
- {
- assertNotNull( digest );
- assertSame( session, digest.getSession() );
- assertNotNull( digest.getRepository() );
- assertNull( digest.getProxy() );
- assertNull( "digest() should only be called once", repos[0] );
- repos[0] = digest.getRepository();
-
- digest.update( (byte[]) null );
- digest.update( (char[]) null );
- digest.update( (String[]) null );
- digest.update( null, null );
- }
- };
-
- RemoteRepository repo = newRepo( auth, newProxy( null ) );
-
- String digest = AuthenticationDigest.forRepository( session, repo );
- assertSame( repo, repos[0] );
- assertNotNull( digest );
- assertTrue( digest.length() > 0 );
- }
-
- @Test
- public void testForRepository_NoAuth()
- {
- RemoteRepository repo = newRepo( null, null );
-
- String digest = AuthenticationDigest.forRepository( newSession(), repo );
- assertEquals( "", digest );
- }
-
- @Test
- public void testForProxy()
- {
- final RepositorySystemSession session = newSession();
- final Proxy[] proxies = { null };
-
- Authentication auth = new Authentication()
- {
- public void fill( AuthenticationContext context, String key, Map<String, String> data )
- {
- fail( "AuthenticationDigest should not call fill()" );
- }
-
- public void digest( AuthenticationDigest digest )
- {
- assertNotNull( digest );
- assertSame( session, digest.getSession() );
- assertNotNull( digest.getRepository() );
- assertNotNull( digest.getProxy() );
- assertNull( "digest() should only be called once", proxies[0] );
- proxies[0] = digest.getProxy();
-
- digest.update( (byte[]) null );
- digest.update( (char[]) null );
- digest.update( (String[]) null );
- digest.update( null, null );
- }
- };
-
- Proxy proxy = newProxy( auth );
-
- String digest = AuthenticationDigest.forProxy( session, newRepo( null, proxy ) );
- assertSame( proxy, proxies[0] );
- assertNotNull( digest );
- assertTrue( digest.length() > 0 );
- }
-
- @Test
- public void testForProxy_NoProxy()
- {
- RemoteRepository repo = newRepo( null, null );
-
- String digest = AuthenticationDigest.forProxy( newSession(), repo );
- assertEquals( "", digest );
- }
-
- @Test
- public void testForProxy_NoProxyAuth()
- {
- RemoteRepository repo = newRepo( null, newProxy( null ) );
-
- String digest = AuthenticationDigest.forProxy( newSession(), repo );
- assertEquals( "", digest );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryBuilderTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryBuilderTest.java b/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryBuilderTest.java
deleted file mode 100644
index a384705..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryBuilderTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.eclipse.aether.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.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.aether.repository.RemoteRepository.Builder;
-import org.junit.Before;
-import org.junit.Test;
-
-public class RemoteRepositoryBuilderTest
-{
-
- private RemoteRepository prototype;
-
- @Before
- public void init()
- {
- prototype = new Builder( "id", "type", "file:void" ).build();
- }
-
- @Test
- public void testReusePrototype()
- {
- Builder builder = new Builder( prototype );
- assertSame( prototype, builder.build() );
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void testPrototypeMandatory()
- {
- new Builder( null );
- }
-
- @Test
- public void testSetId()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setId( prototype.getId() ).build();
- assertSame( prototype, repo );
- repo = builder.setId( "new-id" ).build();
- assertEquals( "new-id", repo.getId() );
- }
-
- @Test
- public void testSetContentType()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setContentType( prototype.getContentType() ).build();
- assertSame( prototype, repo );
- repo = builder.setContentType( "new-type" ).build();
- assertEquals( "new-type", repo.getContentType() );
- }
-
- @Test
- public void testSetUrl()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setUrl( prototype.getUrl() ).build();
- assertSame( prototype, repo );
- repo = builder.setUrl( "file:new" ).build();
- assertEquals( "file:new", repo.getUrl() );
- }
-
- @Test
- public void testSetPolicy()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setPolicy( prototype.getPolicy( false ) ).build();
- assertSame( prototype, repo );
- RepositoryPolicy policy = new RepositoryPolicy( true, "never", "fail" );
- repo = builder.setPolicy( policy ).build();
- assertEquals( policy, repo.getPolicy( true ) );
- assertEquals( policy, repo.getPolicy( false ) );
- }
-
- @Test
- public void testSetReleasePolicy()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setReleasePolicy( prototype.getPolicy( false ) ).build();
- assertSame( prototype, repo );
- RepositoryPolicy policy = new RepositoryPolicy( true, "never", "fail" );
- repo = builder.setReleasePolicy( policy ).build();
- assertEquals( policy, repo.getPolicy( false ) );
- assertEquals( prototype.getPolicy( true ), repo.getPolicy( true ) );
- }
-
- @Test
- public void testSetSnapshotPolicy()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setSnapshotPolicy( prototype.getPolicy( true ) ).build();
- assertSame( prototype, repo );
- RepositoryPolicy policy = new RepositoryPolicy( true, "never", "fail" );
- repo = builder.setSnapshotPolicy( policy ).build();
- assertEquals( policy, repo.getPolicy( true ) );
- assertEquals( prototype.getPolicy( false ), repo.getPolicy( false ) );
- }
-
- @Test
- public void testSetProxy()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setProxy( prototype.getProxy() ).build();
- assertSame( prototype, repo );
- Proxy proxy = new Proxy( "http", "localhost", 8080 );
- repo = builder.setProxy( proxy ).build();
- assertEquals( proxy, repo.getProxy() );
- }
-
- @Test
- public void testSetAuthentication()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setAuthentication( prototype.getAuthentication() ).build();
- assertSame( prototype, repo );
- Authentication auth = new Authentication()
- {
- public void fill( AuthenticationContext context, String key, Map<String, String> data )
- {
- }
-
- public void digest( AuthenticationDigest digest )
- {
- }
- };
- repo = builder.setAuthentication( auth ).build();
- assertEquals( auth, repo.getAuthentication() );
- }
-
- @Test
- public void testSetMirroredRepositories()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setMirroredRepositories( prototype.getMirroredRepositories() ).build();
- assertSame( prototype, repo );
- List<RemoteRepository> mirrored = new ArrayList<RemoteRepository>( Arrays.asList( repo ) );
- repo = builder.setMirroredRepositories( mirrored ).build();
- assertEquals( mirrored, repo.getMirroredRepositories() );
- }
-
- @Test
- public void testAddMirroredRepository()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.addMirroredRepository( null ).build();
- assertSame( prototype, repo );
- repo = builder.addMirroredRepository( prototype ).build();
- assertEquals( Arrays.asList( prototype ), repo.getMirroredRepositories() );
- }
-
- @Test
- public void testSetRepositoryManager()
- {
- Builder builder = new Builder( prototype );
- RemoteRepository repo = builder.setRepositoryManager( prototype.isRepositoryManager() ).build();
- assertSame( prototype, repo );
- repo = builder.setRepositoryManager( !prototype.isRepositoryManager() ).build();
- assertEquals( !prototype.isRepositoryManager(), repo.isRepositoryManager() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryTest.java b/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryTest.java
deleted file mode 100644
index 97f0b3e..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/repository/RemoteRepositoryTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.aether.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.repository.RemoteRepository;
-import org.junit.Test;
-
-/**
- */
-public class RemoteRepositoryTest
-{
-
- @Test
- public void testGetProtocol()
- {
- RemoteRepository.Builder builder = new RemoteRepository.Builder( "id", "type", "" );
- RemoteRepository repo = builder.build();
- assertEquals( "", repo.getProtocol() );
-
- repo = builder.setUrl( "http://localhost" ).build();
- assertEquals( "http", repo.getProtocol() );
-
- repo = builder.setUrl( "HTTP://localhost" ).build();
- assertEquals( "HTTP", repo.getProtocol() );
-
- repo = builder.setUrl( "dav+http://www.sonatype.org/" ).build();
- assertEquals( "dav+http", repo.getProtocol() );
-
- repo = builder.setUrl( "dav:http://www.sonatype.org/" ).build();
- assertEquals( "dav:http", repo.getProtocol() );
-
- repo = builder.setUrl( "file:/path" ).build();
- assertEquals( "file", repo.getProtocol() );
-
- repo = builder.setUrl( "file:path" ).build();
- assertEquals( "file", repo.getProtocol() );
-
- repo = builder.setUrl( "file:C:\\dir" ).build();
- assertEquals( "file", repo.getProtocol() );
-
- repo = builder.setUrl( "file:C:/dir" ).build();
- assertEquals( "file", repo.getProtocol() );
- }
-
- @Test
- public void testGetHost()
- {
- RemoteRepository.Builder builder = new RemoteRepository.Builder( "id", "type", "" );
- RemoteRepository repo = builder.build();
- assertEquals( "", repo.getHost() );
-
- repo = builder.setUrl( "http://localhost" ).build();
- assertEquals( "localhost", repo.getHost() );
-
- repo = builder.setUrl( "http://localhost/" ).build();
- assertEquals( "localhost", repo.getHost() );
-
- repo = builder.setUrl( "http://localhost:1234/" ).build();
- assertEquals( "localhost", repo.getHost() );
-
- repo = builder.setUrl( "http://127.0.0.1" ).build();
- assertEquals( "127.0.0.1", repo.getHost() );
-
- repo = builder.setUrl( "http://127.0.0.1/" ).build();
- assertEquals( "127.0.0.1", repo.getHost() );
-
- repo = builder.setUrl( "http://user@localhost/path" ).build();
- assertEquals( "localhost", repo.getHost() );
-
- repo = builder.setUrl( "http://user:pass@localhost/path" ).build();
- assertEquals( "localhost", repo.getHost() );
-
- repo = builder.setUrl( "http://user:pass@localhost:1234/path" ).build();
- assertEquals( "localhost", repo.getHost() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/transfer/AbstractTransferListenerTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/transfer/AbstractTransferListenerTest.java b/aether-api/src/test/java/org/eclipse/aether/transfer/AbstractTransferListenerTest.java
deleted file mode 100644
index 87c1472..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/transfer/AbstractTransferListenerTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.aether.transfer;
-
-/*
- * 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.AbstractTransferListener;
-import org.eclipse.aether.transfer.TransferListener;
-import org.junit.Test;
-
-/**
- */
-public class AbstractTransferListenerTest
-{
-
- @Test
- public void testAllEventTypesHandled()
- throws Exception
- {
- for ( Method method : TransferListener.class.getMethods() )
- {
- assertNotNull( AbstractTransferListener.class.getDeclaredMethod( method.getName(),
- method.getParameterTypes() ) );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/test/java/org/eclipse/aether/transfer/TransferEventTest.java
----------------------------------------------------------------------
diff --git a/aether-api/src/test/java/org/eclipse/aether/transfer/TransferEventTest.java b/aether-api/src/test/java/org/eclipse/aether/transfer/TransferEventTest.java
deleted file mode 100644
index 0ce6249..0000000
--- a/aether-api/src/test/java/org/eclipse/aether/transfer/TransferEventTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.aether.transfer;
-
-/*
- * 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.nio.ByteBuffer;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.transfer.TransferEvent;
-import org.eclipse.aether.transfer.TransferResource;
-import org.junit.Test;
-
-/**
- */
-public class TransferEventTest
-{
-
- private static TransferResource res = new TransferResource( "file://nil", "void", null, null );
-
- private static RepositorySystemSession session = new DefaultRepositorySystemSession();
-
- @Test
- public void testByteArrayConversion()
- {
- byte[] buffer = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- int length = buffer.length - 2;
- int offset = 1;
-
- TransferEvent event = new TransferEvent.Builder( session, res ).setDataBuffer( buffer, offset, length ).build();
-
- ByteBuffer bb = event.getDataBuffer();
- byte[] dst = new byte[bb.remaining()];
- bb.get( dst );
-
- byte[] expected = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
- assertArrayEquals( expected, dst );
- }
-
- @Test
- public void testRepeatableReadingOfDataBuffer()
- {
- byte[] data = { 0, 1, 2, 3, 4, 5, 6, 7 };
- ByteBuffer buffer = ByteBuffer.wrap( data );
-
- TransferEvent event = new TransferEvent.Builder( session, res ).setDataBuffer( buffer ).build();
-
- assertEquals( 8, event.getDataLength() );
-
- ByteBuffer eventBuffer = event.getDataBuffer();
- assertNotNull( eventBuffer );
- assertEquals( 8, eventBuffer.remaining() );
-
- byte[] eventData = new byte[8];
- eventBuffer.get( eventData );
- assertArrayEquals( data, eventData );
- assertEquals( 0, eventBuffer.remaining() );
- assertEquals( 8, event.getDataLength() );
-
- eventBuffer = event.getDataBuffer();
- assertNotNull( eventBuffer );
- assertEquals( 8, eventBuffer.remaining() );
- eventBuffer.get( eventData );
- assertArrayEquals( data, eventData );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-connector-basic/pom.xml
----------------------------------------------------------------------
diff --git a/aether-connector-basic/pom.xml b/aether-connector-basic/pom.xml
deleted file mode 100644
index 578c0d6..0000000
--- a/aether-connector-basic/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>aether-connector-basic</artifactId>
-
- <name>Aether Connector Basic</name>
- <description>
- A repository connector implementation for repositories using URI-based layouts.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-util</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.sonatype.sisu</groupId>
- <artifactId>sisu-guice</artifactId>
- <classifier>no_aop</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-test-util</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>sisu-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ArtifactTransportListener.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ArtifactTransportListener.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ArtifactTransportListener.java
deleted file mode 100644
index f8a9b1c..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ArtifactTransportListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * 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.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.ArtifactTransfer;
-import org.eclipse.aether.spi.connector.transport.Transporter;
-import org.eclipse.aether.transfer.ArtifactNotFoundException;
-import org.eclipse.aether.transfer.ArtifactTransferException;
-import org.eclipse.aether.transfer.TransferEvent;
-
-final class ArtifactTransportListener
- extends TransferTransportListener<ArtifactTransfer>
-{
-
- private final RemoteRepository repository;
-
- public ArtifactTransportListener( ArtifactTransfer transfer, RemoteRepository repository,
- TransferEvent.Builder eventBuilder )
- {
- super( transfer, eventBuilder );
- this.repository = repository;
- }
-
- @Override
- public void transferFailed( Exception exception, int classification )
- {
- ArtifactTransferException e;
- if ( classification == Transporter.ERROR_NOT_FOUND )
- {
- e = new ArtifactNotFoundException( getTransfer().getArtifact(), repository );
- }
- else
- {
- e = new ArtifactTransferException( getTransfer().getArtifact(), repository, exception );
- }
- getTransfer().setException( e );
- super.transferFailed( e, classification );
- }
-
-}