diff options
author | Olivier Lamy <olamy@apache.org> | 2012-10-24 19:50:16 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-10-24 19:50:16 +0000 |
commit | 4ba8af2e0ed8cb7395678da0814ecc9c914c60cc (patch) | |
tree | fee1dcb1da529309dd1827f490116fb0654cdd7d /archiva-modules/plugins | |
parent | 7b95f6c33c0c96c23d135e8962998fbbf4cea590 (diff) | |
download | archiva-4ba8af2e0ed8cb7395678da0814ecc9c914c60cc.tar.gz archiva-4ba8af2e0ed8cb7395678da0814ecc9c914c60cc.zip |
transform this interface to use a bean request will ease future enhancements
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1401843 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins')
4 files changed, 17 insertions, 12 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index 142ba26b0..7351d8aa1 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -30,6 +30,7 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.SnapshotVersion; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.archiva.proxy.common.WagonFactoryException; +import org.apache.archiva.proxy.common.WagonFactoryRequest; import org.apache.archiva.xml.XMLException; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; @@ -236,9 +237,10 @@ public class RepositoryModelResolver // if it's a ntlm proxy we have to lookup the wagon light which support thats // wagon http client doesn't support that - wagon = ( networkProxy != null && networkProxy.isUseNtlm() ) ? wagonFactory.getWagon( - "wagon#" + protocol + "-ntlm" ) : wagonFactory.getWagon( "wagon#" + protocol ); - wagon = wagonFactory.getWagon( "wagon#" + protocol ); + wagon = ( networkProxy != null && networkProxy.isUseNtlm() ) + ? wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol + "-ntlm" ) ) + : wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol ) ); + wagon = wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol ) ); if ( wagon == null ) { throw new RuntimeException( "Unsupported remote repository protocol: " + protocol ); diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java index fc2488bbe..9a3a78cf6 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java @@ -36,6 +36,7 @@ import org.apache.archiva.metadata.repository.filter.AllFilter; import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest; import org.apache.archiva.proxy.common.WagonFactory; +import org.apache.archiva.proxy.common.WagonFactoryRequest; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; import org.apache.maven.wagon.Wagon; @@ -55,15 +56,15 @@ import java.util.List; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith ( ArchivaSpringJUnit4ClassRunner.class ) -@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) +@RunWith (ArchivaSpringJUnit4ClassRunner.class) +@ContextConfiguration (locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" }) public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest extends TestCase { private static final Filter<String> ALL = new AllFilter<String>(); @Inject - @Named ( value = "repositoryStorage#maven2" ) + @Named (value = "repositoryStorage#maven2") private Maven2RepositoryStorage storage; private static final String TEST_REPO_ID = "test"; @@ -166,7 +167,7 @@ public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest storage.setWagonFactory( wagonFactory ); Wagon wagon = new MockWagon(); - when( wagonFactory.getWagon( "wagon#http" ) ).thenReturn( wagon ); + when( wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#http" ) ) ).thenReturn( wagon ); } // Tests for MRM-1411 - START diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java index 292441d0c..af4ca7247 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java @@ -36,6 +36,7 @@ import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest; import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; import org.apache.archiva.proxy.common.WagonFactory; +import org.apache.archiva.proxy.common.WagonFactoryRequest; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; import org.apache.maven.wagon.Wagon; @@ -134,7 +135,7 @@ public class Maven2RepositoryMetadataResolverMRM1411Test storage.setWagonFactory( wagonFactory ); Wagon wagon = new MockWagon(); - when( wagonFactory.getWagon( "wagon#http" ) ).thenReturn( wagon ); + when( wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#http" ) ) ).thenReturn( wagon ); } // Tests for MRM-1411 - START diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java index e173e3e4c..0509b76df 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java @@ -38,6 +38,7 @@ import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; import org.apache.archiva.proxy.common.WagonFactory; +import org.apache.archiva.proxy.common.WagonFactoryRequest; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; import org.apache.maven.wagon.Wagon; @@ -60,15 +61,15 @@ import java.util.List; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith (ArchivaSpringJUnit4ClassRunner.class) -@ContextConfiguration (locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" }) +@RunWith ( ArchivaSpringJUnit4ClassRunner.class ) +@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class Maven2RepositoryMetadataResolverTest extends TestCase { private static final Filter<String> ALL = new AllFilter<String>(); @Inject - @Named (value = "repositoryStorage#maven2") + @Named ( value = "repositoryStorage#maven2" ) private Maven2RepositoryStorage storage; private static final String TEST_REPO_ID = "test"; @@ -139,7 +140,7 @@ public class Maven2RepositoryMetadataResolverTest storage.setWagonFactory( wagonFactory ); Wagon wagon = new MockWagon(); - when( wagonFactory.getWagon( "wagon#http" ) ).thenReturn( wagon ); + when( wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#http" ) ) ).thenReturn( wagon ); } @Test |