aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-09-03 14:40:22 +0200
committerMartin Stockhammer <martin_s@apache.org>2019-09-03 14:40:22 +0200
commitebf95723a5399535ff8175121625e933d99a27c0 (patch)
tree044ba96be2dd0343e577eaeb740f773f711af113
parentc7fb08d2cb8b8fac9e36707e03369c5e83def7a6 (diff)
downloadarchiva-ebf95723a5399535ff8175121625e933d99a27c0.tar.gz
archiva-ebf95723a5399535ff8175121625e933d99a27c0.zip
Modifying NetworkProxy class. Adding tests.
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-api/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java (renamed from archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java)6
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java24
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-api/src/test/java/org/apache/archiva/proxy/model/NetworkProxyTest.java174
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/pom.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java9
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java4
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java21
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java2
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java2
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java2
-rw-r--r--pom.xml5
18 files changed, 225 insertions, 45 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml
index 1a1334f3b..eec69e783 100644
--- a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml
+++ b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml
@@ -49,11 +49,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-model</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-layer</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java
index 95c096a23..f01d23aa2 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java
+++ b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java
@@ -27,6 +27,12 @@ import org.apache.archiva.repository.RepositoryType;
import java.util.List;
import java.util.Map;
+/**
+ * A proxy registry is central access point for accessing a proxy. It gives access to the proxy handlers
+ * that are registered for the different repository types.
+ *
+ * @author Martin Stockhammer <martin_s@apache.org>
+ */
public interface ProxyRegistry {
/**
diff --git a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java
index 849a89384..a268fa7a1 100644
--- a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java
+++ b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java
@@ -20,6 +20,8 @@ package org.apache.archiva.proxy.model;
*/
import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Objects;
public class NetworkProxy
implements Serializable
@@ -50,7 +52,7 @@ public class NetworkProxy
/**
* The proxy password.
*/
- private String password;
+ private char[] password;
/**
* @since 1.4-M3
@@ -64,14 +66,14 @@ public class NetworkProxy
// no op
}
- public NetworkProxy( String id, String protocol, String host, int port, String username, String password )
+ public NetworkProxy(String id, String protocol, String host, int port, String username, char[] password )
{
this.id = id;
this.protocol = protocol;
this.host = host;
this.port = port;
this.username = username;
- this.password = password;
+ setPassword(password);
}
public String getId()
@@ -124,14 +126,17 @@ public class NetworkProxy
this.username = username;
}
- public String getPassword()
+ public char[] getPassword()
{
return password;
}
- public void setPassword( String password )
+ public void setPassword(char[] password )
{
- this.password = password;
+ if (this.password!=null) {
+ Arrays.fill(this.password, '0');
+ }
+ this.password = Arrays.copyOf(password, password.length);
}
public boolean isUseNtlm()
@@ -158,12 +163,7 @@ public class NetworkProxy
NetworkProxy that = (NetworkProxy) o;
- if ( id != null ? !id.equals( that.id ) : that.id != null )
- {
- return false;
- }
-
- return true;
+ return Objects.equals(id, that.id);
}
@Override
diff --git a/archiva-modules/archiva-base/archiva-proxy-api/src/test/java/org/apache/archiva/proxy/model/NetworkProxyTest.java b/archiva-modules/archiva-base/archiva-proxy-api/src/test/java/org/apache/archiva/proxy/model/NetworkProxyTest.java
new file mode 100644
index 000000000..f8a8ec91b
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-proxy-api/src/test/java/org/apache/archiva/proxy/model/NetworkProxyTest.java
@@ -0,0 +1,174 @@
+package org.apache.archiva.proxy.model;
+
+/*
+ * 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.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class NetworkProxyTest {
+
+ @Test
+ public void getId() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertNull(proxy.getId());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertEquals("test-proxy", proxy.getId());
+ }
+
+ @Test
+ public void setId() {
+ NetworkProxy proxy = new NetworkProxy();
+ proxy.setId("test-proxy1");
+ assertEquals("test-proxy1",proxy.getId());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ proxy.setId("test-proxy2");
+ assertEquals("test-proxy2", proxy.getId());
+ }
+
+ @Test
+ public void getProtocol() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertEquals("http", proxy.getProtocol());
+ proxy = new NetworkProxy("test-proxy", "https", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertEquals("https", proxy.getProtocol());
+
+ }
+
+ @Test
+ public void setProtocol() {
+ NetworkProxy proxy = new NetworkProxy();
+ proxy.setProtocol("https");
+ assertEquals("https", proxy.getProtocol());
+ proxy = new NetworkProxy("test-proxy", "https", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ proxy.setProtocol("http");
+ assertEquals("http", proxy.getProtocol());
+ }
+
+ @Test
+ public void getHost() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertNull(proxy.getHost());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertEquals("test.apache.org", proxy.getHost());
+
+ }
+
+ @Test
+ public void setHost() {
+ NetworkProxy proxy = new NetworkProxy();
+ proxy.setHost("test1.apache.org");
+ assertEquals("test1.apache.org",proxy.getHost());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ proxy.setHost("test2.apache.org");
+ assertEquals("test2.apache.org", proxy.getHost());
+ proxy.setHost("test3.apache.org");
+ assertEquals("test3.apache.org", proxy.getHost());
+ }
+
+ @Test
+ public void getPort() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertEquals(8080,proxy.getPort());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertEquals(80, proxy.getPort());
+ }
+
+ @Test
+ public void setPort() {
+ NetworkProxy proxy = new NetworkProxy();
+ proxy.setPort(8090);
+ assertEquals(8090,proxy.getPort());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ proxy.setPort(9090);
+ assertEquals(9090, proxy.getPort());
+ proxy.setPort(9091);
+ assertEquals(9091, proxy.getPort());
+ }
+
+ @Test
+ public void getUsername() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertNull(proxy.getUsername());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertEquals("testuser", proxy.getUsername());
+ }
+
+ @Test
+ public void setUsername() {
+ NetworkProxy proxy = new NetworkProxy();
+ proxy.setUsername("testuser1");
+ assertEquals("testuser1",proxy.getUsername());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ proxy.setUsername("testuser2");
+ assertEquals("testuser2", proxy.getUsername());
+ proxy.setUsername("testuser3");
+ assertEquals("testuser3", proxy.getUsername());
+ }
+
+ @Test
+ public void getPassword() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertNull(proxy.getPassword());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertEquals("xxxx", new String(proxy.getPassword()));
+ char[] testPwd = {'a', 'b', 'c', 'd'};
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", testPwd);
+ assertEquals("abcd", new String(proxy.getPassword()));
+ testPwd[0]='0';
+ assertEquals("abcd", new String(proxy.getPassword()));
+ }
+
+ @Test
+ public void setPassword() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertNull(proxy.getPassword());
+ proxy.setPassword("ucdx".toCharArray());
+ assertEquals("ucdx", new String(proxy.getPassword()));
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertEquals("xxxx", new String(proxy.getPassword()));
+ char[] testPwd = {'a', 'b', 'c', 'd'};
+ proxy.setPassword(testPwd);
+ assertEquals("abcd", new String(proxy.getPassword()));
+ testPwd[0]='0';
+ assertEquals("abcd", new String(proxy.getPassword()));
+ }
+
+ @Test
+ public void isUseNtlm() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertFalse(proxy.isUseNtlm());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertFalse(proxy.isUseNtlm());
+ }
+
+ @Test
+ public void setUseNtlm() {
+ NetworkProxy proxy = new NetworkProxy();
+ assertFalse(proxy.isUseNtlm());
+ proxy.setUseNtlm(true);
+ assertTrue(proxy.isUseNtlm());
+ proxy = new NetworkProxy("test-proxy", "http", "test.apache.org", 80, "testuser", "xxxx".toCharArray());
+ assertFalse(proxy.isUseNtlm());
+ proxy.setUseNtlm(true);
+ assertTrue(proxy.isUseNtlm());
+ }
+
+} \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml
index 92a535033..e4b2a063b 100644
--- a/archiva-modules/archiva-base/archiva-proxy/pom.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml
@@ -61,10 +61,6 @@
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-scanner</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
<artifactId>archiva-scheduler-repository-api</artifactId>
</dependency>
<dependency>
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java
index 6869c34bd..0a8a6785a 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java
@@ -36,10 +36,15 @@ import javax.inject.Inject;
import java.util.*;
import java.util.stream.Collectors;
+/**
+ * Default proxy registry implementation. Uses the archiva configuration for accessing and storing the
+ * proxy information.
+ *
+ */
@Service("proxyRegistry#default")
public class ArchivaProxyRegistry implements ProxyRegistry, ConfigurationListener {
- private final Logger log = LoggerFactory.getLogger(ArchivaProxyRegistry.class);
+ private static final Logger log = LoggerFactory.getLogger(ArchivaProxyRegistry.class);
@Inject
ArchivaConfiguration archivaConfiguration;
@@ -83,7 +88,7 @@ public class ArchivaProxyRegistry implements ProxyRegistry, ConfigurationListene
proxy.setHost(networkProxyConfig.getHost());
proxy.setPort(networkProxyConfig.getPort());
proxy.setUsername(networkProxyConfig.getUsername());
- proxy.setPassword(networkProxyConfig.getPassword());
+ proxy.setPassword(networkProxyConfig.getPassword().toCharArray());
proxy.setUseNtlm(networkProxyConfig.isUseNtlm());
this.networkProxyMap.put(key, proxy);
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java
index 1687bcab1..21a981791 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java
@@ -237,7 +237,7 @@ public abstract class DefaultRepositoryProxyHandler implements RepositoryProxyHa
np.setId(p.getId());
np.setUseNtlm(p.isUseNtlm());
np.setUsername(p.getUsername());
- np.setPassword(p.getPassword());
+ np.setPassword(p.getPassword() == null ? new char[0] : p.getPassword().toCharArray());
np.setProtocol(p.getProtocol());
np.setHost(p.getHost());
np.setPort(p.getPort());
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java
index 9e00e19ad..e34bc3a21 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java
@@ -316,7 +316,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager {
proxyInfo.setHost( networkProxy.getHost( ) );
proxyInfo.setPort( networkProxy.getPort( ) );
proxyInfo.setUserName( networkProxy.getUsername( ) );
- proxyInfo.setPassword( networkProxy.getPassword( ) );
+ proxyInfo.setPassword(new String(networkProxy.getPassword()));
}
AuthenticationInfo authenticationInfo = null;
if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials) )
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java
index aa5f27eff..73a890008 100644
--- a/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java
+++ b/archiva-modules/archiva-maven/archiva-maven-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java
@@ -330,7 +330,7 @@ public class MavenIndexManager implements ArchivaIndexManager {
proxyInfo.setHost( networkProxy.getHost( ) );
proxyInfo.setPort( networkProxy.getPort( ) );
proxyInfo.setUserName( networkProxy.getUsername( ) );
- proxyInfo.setPassword( networkProxy.getPassword( ) );
+ proxyInfo.setPassword( new String(networkProxy.getPassword( )) );
}
AuthenticationInfo authenticationInfo = null;
if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials ) )
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java
index 5066551f1..25dfcb6a0 100644
--- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java
@@ -87,7 +87,7 @@ public class MavenRepositoryProxyHandler extends DefaultRepositoryProxyHandler {
proxy.setHost(networkProxyDef.getHost());
proxy.setPort(networkProxyDef.getPort());
proxy.setUserName(networkProxyDef.getUsername());
- proxy.setPassword(networkProxyDef.getPassword());
+ proxy.setPassword(new String(networkProxyDef.getPassword()));
this.networkProxyMap.put(key, proxy);
}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
index 5b16e8806..98a6f2dcd 100644
--- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
@@ -190,7 +190,9 @@ public class HttpProxyTransferTest
public void tearDown()
throws Exception
{
- server.stop();
+ if (server!=null) {
+ server.stop();
+ }
}
@Test
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java
index b8bc9d305..c686e8df9 100644
--- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java
@@ -19,12 +19,7 @@ package org.apache.archiva.proxy;
* under the License.
*/
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.configuration.FileType;
-import org.apache.archiva.configuration.FileTypes;
-import org.apache.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.archiva.configuration.*;
import org.apache.archiva.redback.components.registry.Registry;
import org.apache.archiva.redback.components.registry.RegistryException;
import org.apache.archiva.redback.components.registry.RegistryListener;
@@ -36,11 +31,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
+import java.util.*;
/**
* MockConfiguration
@@ -84,6 +75,14 @@ public class MockConfiguration
return Collections.singletonList( fileType );
}
} );
+ ArchivaRuntimeConfiguration rt = new ArchivaRuntimeConfiguration();
+ List<String> checksums = new ArrayList<>();
+ checksums.add("MD5");
+ checksums.add("SHA1");
+ checksums.add("SHA256");
+ rt.setChecksumTypes(checksums);
+ configuration.setArchivaRuntimeConfiguration(rt);
+
}
@Override
diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java
index 036e67757..9b1a410b3 100644
--- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java
+++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java
@@ -427,7 +427,7 @@ public class RepositoryModelResolver
networkProxy.setHost( proxyConnector.getHost() );
networkProxy.setPort( proxyConnector.getPort() );
networkProxy.setUserName( proxyConnector.getUsername() );
- networkProxy.setPassword( proxyConnector.getPassword() );
+ networkProxy.setPassword( new String(proxyConnector.getPassword()) );
String msg = "Using network proxy " + networkProxy.getHost() + ":" + networkProxy.getPort()
+ " to connect to remote repository " + remoteRepository.getLocation();
diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java
index 98d99b256..119f0c0b9 100644
--- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java
+++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java
@@ -317,7 +317,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager {
proxyInfo.setHost( networkProxy.getHost( ) );
proxyInfo.setPort( networkProxy.getPort( ) );
proxyInfo.setUserName( networkProxy.getUsername( ) );
- proxyInfo.setPassword( networkProxy.getPassword( ) );
+ proxyInfo.setPassword(new String(networkProxy.getPassword()));
}
AuthenticationInfo authenticationInfo = null;
if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials) )
diff --git a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java
index c739cd27c..4db9756fc 100644
--- a/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java
+++ b/archiva-modules/archiva-maven/archiva-maven-scheduler/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java
@@ -165,7 +165,7 @@ public class DownloadRemoteIndexTask
proxyInfo.setHost( this.networkProxy.getHost() );
proxyInfo.setPort( this.networkProxy.getPort() );
proxyInfo.setUserName( this.networkProxy.getUsername() );
- proxyInfo.setPassword( this.networkProxy.getPassword() );
+ proxyInfo.setPassword( new String(this.networkProxy.getPassword()) );
}
AuthenticationInfo authenticationInfo = null;
if ( this.remoteRepository.getLoginCredentials()!=null && this.remoteRepository.getLoginCredentials() instanceof PasswordCredentials )
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java
index 9738b468e..1805821eb 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/mock/ArchivaIndexManagerMock.java
@@ -303,7 +303,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager {
proxyInfo.setHost( networkProxy.getHost( ) );
proxyInfo.setPort( networkProxy.getPort( ) );
proxyInfo.setUserName( networkProxy.getUsername( ) );
- proxyInfo.setPassword( networkProxy.getPassword( ) );
+ proxyInfo.setPassword(new String(networkProxy.getPassword()));
}
AuthenticationInfo authenticationInfo = null;
if ( remoteRepository.getLoginCredentials( ) != null && ( remoteRepository.getLoginCredentials( ) instanceof PasswordCredentials) )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
index bf13b34c0..53522ff99 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
@@ -167,7 +167,7 @@ public class DefaultRemoteRepositoriesService
proxyInfo.setHost(networkProxy.getHost());
proxyInfo.setPort(networkProxy.getPort());
proxyInfo.setUserName(networkProxy.getUsername());
- proxyInfo.setPassword(networkProxy.getPassword());
+ proxyInfo.setPassword(new String(networkProxy.getPassword()));
}
String url = StringUtils.stripEnd(remoteRepository.getUrl(), "/");
wagon.connect(new Repository(remoteRepository.getId(), url), proxyInfo);
diff --git a/pom.xml b/pom.xml
index dd1c38d96..a853c52f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,18 +68,21 @@
<redback.spring-utils.version>2.1</redback.spring-utils.version>
<redback.taskqueue.version>2.1</redback.taskqueue.version>
+ <!-- dependencies of maven modules -->
<jsoup.version>1.12.1</jsoup.version>
<rome.version>0.9</rome.version>
<cronutils.version>9.0.1</cronutils.version>
<spring.version>4.3.10.RELEASE</spring.version>
- <javax.jcr.version>2.0</javax.jcr.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
<lucene.version>4.10.4</lucene.version>
+ <!-- JCR modules -->
+ <javax.jcr.version>2.0</javax.jcr.version>
<jcr-oak.version>1.14.0</jcr-oak.version>
+ <!-- Jackrabbit classes are still used for webdav -->
<jackrabbit.version>2.15.4</jackrabbit.version>
<metrics-core.version>3.1.0</metrics-core.version>