summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-10-25 09:43:27 +0000
committerOlivier Lamy <olamy@apache.org>2012-10-25 09:43:27 +0000
commit8146f7ea370f2d2010d331e2944e86f259d705ea (patch)
tree987bfcc79b0fccf9faa53efd57f8e2be0bfee842 /archiva-modules
parent5f42d3dcac2229031a1276c69fc0d34e8ae4dbf7 (diff)
downloadarchiva-8146f7ea370f2d2010d331e2944e86f259d705ea.tar.gz
archiva-8146f7ea370f2d2010d331e2944e86f259d705ea.zip
fix unit test
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1402054 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java34
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java7
-rw-r--r--archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java8
3 files changed, 46 insertions, 3 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java
index ea6c5efa0..13ffce6d0 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java
@@ -99,4 +99,38 @@ public class WagonFactoryRequest
this.userAgent = userAgent;
return this;
}
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( !( o instanceof WagonFactoryRequest ) )
+ {
+ return false;
+ }
+
+ WagonFactoryRequest that = (WagonFactoryRequest) o;
+
+ if ( protocol != null ? !protocol.equals( that.protocol ) : that.protocol != null )
+ {
+ return false;
+ }
+ if ( userAgent != null ? !userAgent.equals( that.userAgent ) : that.userAgent != null )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = protocol != null ? protocol.hashCode() : 0;
+ result = 31 * result + ( userAgent != null ? userAgent.hashCode() : 0 );
+ return result;
+ }
}
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 934cb33f6..545312762 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
@@ -242,8 +242,11 @@ public class RepositoryModelResolver
new WagonFactoryRequest( "wagon#" + protocol + "-ntlm", remoteRepository.getExtraHeaders() ) )
: wagonFactory.getWagon(
new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ) );
- wagon = wagonFactory.getWagon(
- new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ) );
+ if ( wagon == null )
+ {
+ wagon = wagonFactory.getWagon(
+ new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ) );
+ }
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/Maven2RepositoryMetadataResolverMRM1411Test.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java
index af4ca7247..a03e70291 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
@@ -51,6 +51,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import static org.mockito.Mockito.mock;
@@ -135,7 +136,8 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
storage.setWagonFactory( wagonFactory );
Wagon wagon = new MockWagon();
- when( wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#http" ) ) ).thenReturn( wagon );
+ when( wagonFactory.getWagon(
+ new WagonFactoryRequest( "wagon#http", new HashMap<String, String>() ) ) ).thenReturn( wagon );
}
// Tests for MRM-1411 - START
@@ -244,9 +246,13 @@ public class Maven2RepositoryMetadataResolverMRM1411Test
public void testGetProjectVersionMetadataWithParentSnapshotVersion()
throws Exception
{
+
copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-module-a",
"target/test-repository/com/example/test/test-snapshot-artifact-module-a" );
+ //copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-root",
+ // "target/test-repository/com/example/test/test-snapshot-artifact-root" );
+
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(
new ReadMetadataRequest( TEST_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
"1.1-SNAPSHOT" ) );