You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2024/12/26 17:03:40 UTC
(maven-wagon) branch WAGON-638 created (now 6db61ee4)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch WAGON-638
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git
at 6db61ee4 [WAGON-638] Drop deprecated providers
This branch includes the following new commits:
new e63e8956 Less noise with javadoc plugin
new 5f2f49e6 We need Subversion client to be installed before running tests.
new 6db61ee4 [WAGON-638] Drop deprecated providers
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-wagon) 01/03: Less noise with javadoc plugin
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch WAGON-638
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git
commit e63e8956607f4cfd584f4d50160a759f78138f53
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Dec 26 16:34:27 2024 +0100
Less noise with javadoc plugin
---
pom.xml | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/pom.xml b/pom.xml
index ad697c35..6f14886b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -409,23 +409,6 @@ under the License.
<configuration>
<failOnError>false</failOnError>
<linksource>true</linksource>
- <links>
- <link>https://docs.oracle.com/javaee/1.4/api/</link>
- <link>http://commons.apache.org/collections/apidocs-COLLECTIONS_3_0/</link>
- <link>http://commons.apache.org/logging/apidocs/</link>
- <link>http://commons.apache.org/pool/apidocs/</link>
- <link>http://junit.sourceforge.net/javadoc/</link>
- <link>http://logging.apache.org/log4j/1.2/apidocs/</link>
- <link>http://jakarta.apache.org/regexp/apidocs/</link>
- <link>http://velocity.apache.org/engine/releases/velocity-1.5/apidocs/</link>
- <link>http://maven.apache.org/ref/current/maven-artifact/apidocs/</link>
- <link>http://maven.apache.org/ref/current/maven-artifact-manager/apidocs/</link>
- <link>http://maven.apache.org/ref/current/maven-model/apidocs/</link>
- <link>http://maven.apache.org/ref/current/maven-plugin-api/apidocs/</link>
- <link>http://maven.apache.org/ref/current/maven-project/apidocs/</link>
- <link>http://maven.apache.org/ref/current/maven-reporting/maven-reporting-api/apidocs/</link>
- <link>http://maven.apache.org/ref/current/maven-settings/apidocs/</link>
- </links>
<groups>
<group>
<title>API + Test</title>
(maven-wagon) 03/03: [WAGON-638] Drop deprecated providers
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch WAGON-638
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git
commit 6db61ee4db33be35a9c0ca932bd6551b993bebe1
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Dec 26 18:01:31 2024 +0100
[WAGON-638] Drop deprecated providers
---
pom.xml | 22 -
src/site/xdoc/index.xml | 11 -
wagon-providers/pom.xml | 13 -
wagon-providers/wagon-ftp/pom.xml | 61 --
.../maven/wagon/providers/ftp/FtpHttpWagon.java | 48 --
.../apache/maven/wagon/providers/ftp/FtpWagon.java | 674 ---------------------
.../maven/wagon/providers/ftp/FtpsWagon.java | 63 --
wagon-providers/wagon-ftp/src/site/apt/index.apt | 106 ----
wagon-providers/wagon-ftp/src/site/site.xml | 33 -
.../maven/wagon/providers/ftp/FtpWagonTest.java | 208 -------
.../maven/wagon/providers/ftp/FtpWagonTest.xml | 21 -
wagon-providers/wagon-http-lightweight/pom.xml | 67 --
.../wagon/providers/http/LightweightHttpWagon.java | 458 --------------
.../http/LightweightHttpWagonAuthenticator.java | 51 --
.../providers/http/LightweightHttpsWagon.java | 71 ---
.../wagon-http-lightweight/src/site/apt/index.apt | 49 --
.../wagon-http-lightweight/src/site/site.xml | 33 -
.../providers/http/LightweightHttpWagonTest.java | 168 -----
...tHttpWagonWithPreemptiveAuthenticationTest.java | 44 --
.../providers/http/LightweightHttpsWagonTest.java | 51 --
.../apache/maven/wagon/providers/http/TckTest.java | 33 -
.../test/resources/META-INF/plexus/components.xml | 38 --
.../src/test/resources/ssl/keystore | Bin 2246 -> 0 bytes
wagon-providers/wagon-ssh-common-test/pom.xml | 72 ---
.../ssh/AbstractEmbeddedScpWagonTest.java | 86 ---
.../ssh/AbstractEmbeddedScpWagonWithKeyTest.java | 144 -----
.../maven/wagon/providers/ssh/ScpCommand.java | 460 --------------
.../wagon/providers/ssh/ScpCommandFactory.java | 93 ---
.../maven/wagon/providers/ssh/ShellCommand.java | 146 -----
.../wagon/providers/ssh/SshServerEmbedded.java | 181 ------
.../apache/maven/wagon/providers/ssh/TestData.java | 72 ---
.../providers/ssh/TestPasswordAuthenticator.java | 71 ---
.../providers/ssh/TestPublickeyAuthenticator.java | 163 -----
.../ssh/knownhost/KnownHostsProviderTestCase.java | 108 ----
.../src/main/resources/ssh-keys/id_rsa | 27 -
.../src/main/resources/ssh-keys/id_rsa-passphrase | 30 -
.../main/resources/ssh-keys/id_rsa-passphrase.pub | 1 -
.../src/main/resources/ssh-keys/id_rsa.pub | 1 -
.../wagon-ssh-common-test/src/site/site.xml | 33 -
wagon-providers/wagon-ssh-common/pom.xml | 54 --
.../ssh/CommandExecutorStreamProcessor.java | 98 ---
.../apache/maven/wagon/providers/ssh/LSParser.java | 87 ---
.../maven/wagon/providers/ssh/ScpHelper.java | 298 ---------
.../apache/maven/wagon/providers/ssh/SshWagon.java | 34 --
.../interactive/ConsoleInteractiveUserInfo.java | 83 ---
.../ssh/interactive/InteractiveUserInfo.java | 38 --
.../ssh/interactive/NullInteractiveUserInfo.java | 70 ---
.../ssh/knownhost/AbstractKnownHostsProvider.java | 61 --
.../ssh/knownhost/FileKnownHostsProvider.java | 85 ---
.../ssh/knownhost/KnownHostChangedException.java | 30 -
.../providers/ssh/knownhost/KnownHostEntry.java | 112 ----
.../ssh/knownhost/KnownHostsProvider.java | 41 --
.../ssh/knownhost/NullKnownHostProvider.java | 31 -
.../ssh/knownhost/SingleKnownHostProvider.java | 40 --
.../ssh/knownhost/StreamKnownHostsProvider.java | 76 ---
.../ssh/knownhost/UnknownHostException.java | 30 -
wagon-providers/wagon-ssh-common/src/site/site.xml | 33 -
.../maven/wagon/providers/ssh/LSParserTest.java | 118 ----
.../ssh/knownhost/FileKnownHostsProviderTest.java | 62 --
.../src/test/resources/known_hosts | 2 -
.../src/test/resources/known_hosts_same | 2 -
wagon-providers/wagon-ssh-external/pom.xml | 117 ----
.../ssh/external/ScpExternalCommandExecutor.java | 38 --
.../providers/ssh/external/ScpExternalWagon.java | 436 -------------
.../wagon-ssh-external/src/site/apt/index.apt | 41 --
.../wagon-ssh-external/src/site/site.xml | 33 -
.../EmbeddedScpExternalWagonWithKeyTest.java | 92 ---
.../ssh/external/ScpExternalWagonTest.java | 98 ---
.../ScpWagonWithSshPrivateKeySearchTest.java | 62 --
.../ssh/external/SshCommandExecutorTest.java | 35 --
.../src/test/resources/dummy.txt | 1 -
.../src/test/resources/log4j.xml | 41 --
.../wagon-ssh-external/src/test/ssh-keys/id_rsa | 27 -
.../src/test/ssh-keys/id_rsa-passphrase | 30 -
wagon-providers/wagon-ssh/pom.xml | 182 ------
.../providers/ssh/jsch/AbstractJschWagon.java | 420 -------------
.../providers/ssh/jsch/ScpCommandExecutor.java | 37 --
.../maven/wagon/providers/ssh/jsch/ScpWagon.java | 374 ------------
.../maven/wagon/providers/ssh/jsch/SftpWagon.java | 446 --------------
.../wagon/providers/ssh/jsch/WagonUserInfo.java | 76 ---
.../interactive/PrompterUIKeyboardInteractive.java | 79 ---
.../UserInfoUIKeyboardInteractiveProxy.java | 93 ---
wagon-providers/wagon-ssh/src/site/apt/index.apt | 45 --
wagon-providers/wagon-ssh/src/site/site.xml | 33 -
.../wagon-ssh/src/site/xdoc/configuration.xml | 224 -------
.../providers/ssh/jsch/EmbeddedScpWagonTest.java | 83 ---
.../ssh/jsch/EmbeddedScpWagonWithKeyTest.java | 71 ---
.../providers/ssh/jsch/KnownHostsProviderTest.java | 30 -
.../wagon/providers/ssh/jsch/ScpWagonTest.java | 62 --
.../providers/ssh/jsch/ScpWagonWithProxyTest.java | 163 -----
.../jsch/ScpWagonWithSshPrivateKeySearchTest.java | 88 ---
.../wagon/providers/ssh/jsch/SftpWagonTest.java | 53 --
.../providers/ssh/jsch/SshCommandExecutorTest.java | 35 --
.../wagon-ssh/src/test/resources/dummy.txt | 1 -
.../wagon-ssh/src/test/resources/log4j.xml | 41 --
.../maven/wagon/providers/ssh/ScpWagonTest.xml | 36 --
.../ssh/ScpWagonWithSshPrivateKeySearchTest.xml | 36 --
.../maven/wagon/providers/ssh/SftpWagonTest.xml | 36 --
.../wagon/providers/ssh/SshCommandExecutorTest.xml | 36 --
wagon-providers/wagon-ssh/src/test/ssh-keys/id_rsa | 27 -
.../wagon-ssh/src/test/ssh-keys/id_rsa-passphrase | 30 -
wagon-providers/wagon-webdav-jackrabbit/pom.xml | 158 -----
.../org/apache/jackrabbit/webdav/MultiStatus.java | 189 ------
.../webdav/client/methods/XmlRequestEntity.java | 90 ---
.../wagon/providers/webdav/PathNavigator.java | 64 --
.../maven/wagon/providers/webdav/WebDavWagon.java | 310 ----------
.../main/resources/META-INF/plexus/components.xml | 63 --
.../wagon-webdav-jackrabbit/src/site/apt/index.apt | 48 --
.../wagon-webdav-jackrabbit/src/site/site.xml | 33 -
.../providers/webdav/HttpClientWagonTest.java | 198 ------
.../wagon/providers/webdav/PathNavigatorTest.java | 60 --
.../webdav/WebDavWagonPreemptiveTest.java | 44 --
.../wagon/providers/webdav/WebDavWagonTest.java | 475 ---------------
.../webdav/WebDavsWagonPreemptiveTest.java | 74 ---
.../wagon/providers/webdav/WebDavsWagonTest.java | 52 --
.../src/test/resources/log4j.xml | 36 --
.../src/test/resources/ssl/keystore | Bin 2246 -> 0 bytes
117 files changed, 11278 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6f14886b..a364e6a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -236,16 +236,6 @@ under the License.
<artifactId>wagon-provider-test</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-common-test</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-common</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -418,10 +408,6 @@ under the License.
<title>File Provider</title>
<packages>org.apache.maven.wagon.providers.file*</packages>
</group>
- <group>
- <title>FTP Provider</title>
- <packages>org.apache.maven.wagon.providers.ftp*</packages>
- </group>
<group>
<title>HTTP Providers</title>
<packages>org.apache.maven.wagon.providers.http*:org.apache.maven.wagon.shared.http*</packages>
@@ -430,14 +416,6 @@ under the License.
<title>SCM Provider</title>
<packages>org.apache.maven.wagon.providers.scm*</packages>
</group>
- <group>
- <title>SSH Providers</title>
- <packages>org.apache.maven.wagon.providers.ssh*</packages>
- </group>
- <group>
- <title>WebDAV Provider</title>
- <packages>org.apache.maven.wagon.providers.webdav*:org.apache.jackrabbit.webdav*</packages>
- </group>
<group>
<title>HTTP TCK</title>
<packages>org.apache.maven.wagon.tck.http*</packages>
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index ba34dc69..b234cd5e 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -40,10 +40,6 @@
<ul>
<li><a href="./wagon-providers/wagon-file/">File</a></li>
<li><a href="./wagon-providers/wagon-http/">HTTP</a></li>
- <li><a href="./wagon-providers/wagon-http-lightweight/">HTTP lightweight</a></li>
- <li><a href="./wagon-providers/wagon-ftp/">FTP</a></li>
- <li><a href="./wagon-providers/wagon-ssh/">SSH/SCP</a></li>
- <li><a href="./wagon-providers/wagon-webdav-jackrabbit/">WebDAV</a></li>
<li><a href="./wagon-providers/wagon-scm/">SCM</a> (in progress)</li>
</ul>
@@ -55,17 +51,10 @@
<area shape="rect" coords="329,37,425,70" alt="wagon-tck-http" href="./wagon-tcks/wagon-tck-http/" />
<area shape="rect" coords="159,68,226,100" alt="wagon-file" href="./wagon-providers/wagon-file/" />
<area shape="rect" coords="13,133,138,164" alt="wagon-http-shared" href="./wagon-providers/wagon-http-shared/" />
- <area shape="rect" coords="159,110,304,141" alt="wagon-http-lightweight" href="./wagon-providers/wagon-http-lightweight/" />
<area shape="rect" coords="159,151,226,183" alt="wagon-http" href="./wagon-providers/wagon-http/" />
- <area shape="rect" coords="159,193,257,225" alt="wagon-webdav-jackrabbit" href="./wagon-providers/wagon-webdav-jackrabbit/" />
- <area shape="rect" coords="159,234,226,266" alt="wagon-ftp" href="./wagon-providers/wagon-ftp/" />
- <area shape="rect" coords="12,298,134,330" alt="wagon-ssh-common" href="./wagon-providers/wagon-ssh-common/" />
- <area shape="rect" coords="159,276,282,308" alt="wagon-ssh-external" href="./wagon-providers/wagon-ssh-external/" />
- <area shape="rect" coords="159,317,226,349" alt="wagon-ssh" href="./wagon-providers/wagon-ssh/" />
<area shape="rect" coords="159,359,226,391" alt="wagon-scm" href="./wagon-providers/wagon-scm/" />
<area shape="rect" coords="0,61,315,397" alt="wagon-providers" href="./wagon-providers/" />
<area shape="rect" coords="339,150,528,183" alt="HttpComponents" href="http://hc.apache.org/" />
- <area shape="rect" coords="340,193,455,225" alt="Jackrabbit" href="http://jackrabbit.apache.org/" />
<area shape="rect" coords="340,234,480,266" alt="Commons Net" href="http://commons.apache.org/net/" />
<area shape="rect" coords="340,318,405,350" alt="jsch" href="http://www.jcraft.com/jsch/" />
<area shape="rect" coords="340,358,493,391" alt="maven-scm-api" href="/scm/maven-scm-api/" />
diff --git a/wagon-providers/pom.xml b/wagon-providers/pom.xml
index ede43cca..887876c6 100644
--- a/wagon-providers/pom.xml
+++ b/wagon-providers/pom.xml
@@ -33,16 +33,9 @@ under the License.
<modules>
<module>wagon-file</module>
- <module>wagon-ftp</module>
<module>wagon-http</module>
<module>wagon-http-shared</module>
- <module>wagon-http-lightweight</module>
<module>wagon-scm</module>
- <module>wagon-ssh-external</module>
- <module>wagon-ssh-common</module>
- <module>wagon-ssh-common-test</module>
- <module>wagon-ssh</module>
- <module>wagon-webdav-jackrabbit</module>
</modules>
<dependencyManagement>
@@ -64,12 +57,6 @@ under the License.
<artifactId>httpcore</artifactId>
<version>4.4.16</version>
</dependency>
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- <version>0.8.0</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</dependencyManagement>
diff --git a/wagon-providers/wagon-ftp/pom.xml b/wagon-providers/wagon-ftp/pom.xml
deleted file mode 100644
index 11fc24cd..00000000
--- a/wagon-providers/wagon-ftp/pom.xml
+++ /dev/null
@@ -1,61 +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.wagon</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>4.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>wagon-ftp</artifactId>
- <name>Apache Maven Wagon :: Providers :: FTP Provider</name>
- <description>Wagon provider that gets and puts artifacts from and to remote server using FTP protocol</description>
-
- <dependencies>
- <dependency>
- <groupId>commons-net</groupId>
- <artifactId>commons-net</artifactId>
- <version>3.9.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ftpserver</groupId>
- <artifactId>ftpserver-core</artifactId>
- <version>1.1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpHttpWagon.java b/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpHttpWagon.java
deleted file mode 100644
index e2067fac..00000000
--- a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpHttpWagon.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ftp;
-
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPHTTPClient;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * FtpHttpWagon
- *
- *
- * @plexus.component role="org.apache.maven.wagon.Wagon"
- * role-hint="ftph"
- * instantiation-strategy="per-lookup"
- */
-public class FtpHttpWagon extends FtpWagon {
-
- private static final Logger LOG = LoggerFactory.getLogger(FtpHttpWagon.class);
-
- @Override
- protected FTPClient createClient() {
- ProxyInfo proxyInfo = getProxyInfo();
-
- LOG.debug("Creating FTP over HTTP proxy client. Proxy Host: [{}].", proxyInfo.getHost());
-
- return new FTPHTTPClient(
- proxyInfo.getHost(), proxyInfo.getPort(), proxyInfo.getUserName(), proxyInfo.getPassword());
- }
-}
diff --git a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java b/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java
deleted file mode 100644
index 7fd651d4..00000000
--- a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java
+++ /dev/null
@@ -1,674 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ftp;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.net.ProtocolCommandEvent;
-import org.apache.commons.net.ProtocolCommandListener;
-import org.apache.commons.net.ftp.FTP;
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPFile;
-import org.apache.commons.net.ftp.FTPReply;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.InputData;
-import org.apache.maven.wagon.OutputData;
-import org.apache.maven.wagon.PathUtils;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.StreamWagon;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * FtpWagon
- *
- *
- * @plexus.component role="org.apache.maven.wagon.Wagon"
- * role-hint="ftp"
- * instantiation-strategy="per-lookup"
- */
-public class FtpWagon extends StreamWagon {
- private FTPClient ftp;
-
- /**
- * @plexus.configuration default-value="true"
- */
- private boolean passiveMode = true;
-
- /**
- * @plexus.configuration default-value="ISO-8859-1"
- */
- private String controlEncoding = FTP.DEFAULT_CONTROL_ENCODING;
-
- public boolean isPassiveMode() {
- return passiveMode;
- }
-
- public void setPassiveMode(boolean passiveMode) {
- this.passiveMode = passiveMode;
- }
-
- @Override
- protected void openConnectionInternal() throws ConnectionException, AuthenticationException {
- AuthenticationInfo authInfo = getAuthenticationInfo();
-
- if (authInfo == null) {
- throw new NullPointerException("authenticationInfo cannot be null");
- }
-
- if (authInfo.getUserName() == null) {
- authInfo.setUserName(System.getProperty("user.name"));
- }
-
- String username = authInfo.getUserName();
-
- String password = authInfo.getPassword();
-
- if (username == null) {
- throw new AuthenticationException(
- "Username not specified for repository " + getRepository().getId());
- }
- if (password == null) {
- throw new AuthenticationException(
- "Password not specified for repository " + getRepository().getId());
- }
-
- String host = getRepository().getHost();
-
- ftp = createClient();
- ftp.setDefaultTimeout(getTimeout());
- ftp.setDataTimeout(getTimeout());
- ftp.setControlEncoding(getControlEncoding());
-
- ftp.addProtocolCommandListener(new PrintCommandListener(this));
-
- try {
- if (getRepository().getPort() != WagonConstants.UNKNOWN_PORT) {
- ftp.connect(host, getRepository().getPort());
- } else {
- ftp.connect(host);
- }
-
- // After connection attempt, you should check the reply code to
- // verify
- // success.
- int reply = ftp.getReplyCode();
-
- if (!FTPReply.isPositiveCompletion(reply)) {
- ftp.disconnect();
-
- throw new AuthenticationException("FTP server refused connection.");
- }
- } catch (IOException e) {
- if (ftp.isConnected()) {
- try {
- fireSessionError(e);
-
- ftp.disconnect();
- } catch (IOException f) {
- // do nothing
- }
- }
-
- throw new AuthenticationException("Could not connect to server.", e);
- }
-
- try {
- if (!ftp.login(username, password)) {
- throw new AuthenticationException("Cannot login to remote system");
- }
-
- fireSessionDebug("Remote system is " + ftp.getSystemName());
-
- // Set to binary mode.
- ftp.setFileType(FTP.BINARY_FILE_TYPE);
- ftp.setListHiddenFiles(true);
-
- // Use passive mode as default because most of us are
- // behind firewalls these days.
- if (isPassiveMode()) {
- ftp.enterLocalPassiveMode();
- }
- } catch (IOException e) {
- throw new ConnectionException("Cannot login to remote system", e);
- }
- }
-
- protected FTPClient createClient() {
- return new FTPClient();
- }
-
- @Override
- protected void firePutCompleted(Resource resource, File file) {
- try {
- // TODO [BP]: verify the order is correct
- ftp.completePendingCommand();
-
- RepositoryPermissions permissions = repository.getPermissions();
-
- if (permissions != null && permissions.getGroup() != null) {
- // ignore failures
- ftp.sendSiteCommand("CHGRP " + permissions.getGroup() + " " + resource.getName());
- }
-
- if (permissions != null && permissions.getFileMode() != null) {
- // ignore failures
- ftp.sendSiteCommand("CHMOD " + permissions.getFileMode() + " " + resource.getName());
- }
- } catch (IOException e) {
- // TODO: handle
- // michal I am not sure what error means in that context
- // I think that we will be able to recover or simply we will fail later on
- }
-
- super.firePutCompleted(resource, file);
- }
-
- @Override
- protected void fireGetCompleted(Resource resource, File localFile) {
- try {
- ftp.completePendingCommand();
- } catch (IOException e) {
- // TODO: handle
- // michal I am not sure what error means in that context
- // actually I am not even sure why we have to invoke that command
- // I think that we will be able to recover or simply we will fail later on
- }
- super.fireGetCompleted(resource, localFile);
- }
-
- @Override
- public void closeConnection() throws ConnectionException {
- if (ftp != null && ftp.isConnected()) {
- try {
- // This is a NPE rethink shutting down the streams
- ftp.disconnect();
- } catch (IOException e) {
- throw new ConnectionException("Failed to close connection to FTP repository", e);
- }
- }
- }
-
- @Override
- public void fillOutputData(OutputData outputData) throws TransferFailedException {
- OutputStream os;
-
- Resource resource = outputData.getResource();
-
- RepositoryPermissions permissions = repository.getPermissions();
-
- try {
- if (!ftp.changeWorkingDirectory(getRepository().getBasedir())) {
- throw new TransferFailedException(
- "Required directory: '" + getRepository().getBasedir() + "' " + "is missing");
- }
-
- String[] dirs = PathUtils.dirnames(resource.getName());
-
- for (String dir : dirs) {
- boolean dirChanged = ftp.changeWorkingDirectory(dir);
-
- if (!dirChanged) {
- // first, try to create it
- boolean success = ftp.makeDirectory(dir);
-
- if (success) {
- if (permissions != null && permissions.getGroup() != null) {
- // ignore failures
- ftp.sendSiteCommand("CHGRP " + permissions.getGroup() + " " + dir);
- }
-
- if (permissions != null && permissions.getDirectoryMode() != null) {
- // ignore failures
- ftp.sendSiteCommand("CHMOD " + permissions.getDirectoryMode() + " " + dir);
- }
-
- dirChanged = ftp.changeWorkingDirectory(dir);
- }
- }
-
- if (!dirChanged) {
- throw new TransferFailedException("Unable to create directory " + dir);
- }
- }
-
- // we come back to original basedir so
- // FTP wagon is ready for next requests
- if (!ftp.changeWorkingDirectory(getRepository().getBasedir())) {
- throw new TransferFailedException("Unable to return to the base directory");
- }
-
- os = ftp.storeFileStream(resource.getName());
-
- if (os == null) {
- String msg = "Cannot transfer resource: '" + resource
- + "'. Output stream is null. FTP Server response: " + ftp.getReplyString();
-
- throw new TransferFailedException(msg);
- }
-
- fireTransferDebug("resource = " + resource);
-
- } catch (IOException e) {
- throw new TransferFailedException("Error transferring over FTP", e);
- }
-
- outputData.setOutputStream(os);
- }
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- @Override
- public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException {
- InputStream is;
-
- Resource resource = inputData.getResource();
-
- try {
- ftpChangeDirectory(resource);
-
- String filename = PathUtils.filename(resource.getName());
- FTPFile[] ftpFiles = ftp.listFiles(filename);
-
- if (ftpFiles == null || ftpFiles.length <= 0) {
- throw new ResourceDoesNotExistException("Could not find file: '" + resource + "'");
- }
-
- long contentLength = ftpFiles[0].getSize();
-
- // @todo check how it works! javadoc of common login says:
- // Returns the file timestamp. This usually the last modification time.
- //
- Calendar timestamp = ftpFiles[0].getTimestamp();
- long lastModified = timestamp != null ? timestamp.getTimeInMillis() : 0;
-
- resource.setContentLength(contentLength);
-
- resource.setLastModified(lastModified);
-
- is = ftp.retrieveFileStream(filename);
- } catch (IOException e) {
- throw new TransferFailedException("Error transferring file via FTP", e);
- }
-
- inputData.setInputStream(is);
- }
-
- private void ftpChangeDirectory(Resource resource)
- throws IOException, TransferFailedException, ResourceDoesNotExistException {
- if (!ftp.changeWorkingDirectory(getRepository().getBasedir())) {
- throw new ResourceDoesNotExistException(
- "Required directory: '" + getRepository().getBasedir() + "' " + "is missing");
- }
-
- String[] dirs = PathUtils.dirnames(resource.getName());
-
- for (String dir : dirs) {
- boolean dirChanged = ftp.changeWorkingDirectory(dir);
-
- if (!dirChanged) {
- String msg = "Resource " + resource + " not found. Directory " + dir + " does not exist";
-
- throw new ResourceDoesNotExistException(msg);
- }
- }
- }
-
- /**
- *
- */
- public class PrintCommandListener implements ProtocolCommandListener {
- private FtpWagon wagon;
-
- public PrintCommandListener(FtpWagon wagon) {
- this.wagon = wagon;
- }
-
- @Override
- public void protocolCommandSent(ProtocolCommandEvent event) {
- wagon.fireSessionDebug("Command sent: " + event.getMessage());
- }
-
- @Override
- public void protocolReplyReceived(ProtocolCommandEvent event) {
- wagon.fireSessionDebug("Reply received: " + event.getMessage());
- }
- }
-
- @Override
- protected void fireSessionDebug(String msg) {
- super.fireSessionDebug(msg);
- }
-
- @Override
- public List<String> getFileList(String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- Resource resource = new Resource(destinationDirectory);
-
- try {
- ftpChangeDirectory(resource);
-
- String filename = PathUtils.filename(resource.getName());
- FTPFile[] ftpFiles = ftp.listFiles(filename);
-
- if (ftpFiles == null || ftpFiles.length <= 0) {
- throw new ResourceDoesNotExistException("Could not find file: '" + resource + "'");
- }
-
- List<String> ret = new ArrayList<>();
- for (FTPFile file : ftpFiles) {
- String name = file.getName();
-
- if (file.isDirectory() && !name.endsWith("/")) {
- name += "/";
- }
-
- ret.add(name);
- }
-
- return ret;
- } catch (IOException e) {
- throw new TransferFailedException("Error transferring file via FTP", e);
- }
- }
-
- @Override
- public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
- Resource resource = new Resource(resourceName);
-
- try {
- ftpChangeDirectory(resource);
-
- String filename = PathUtils.filename(resource.getName());
- int status = ftp.stat(filename);
-
- return ((status == FTPReply.FILE_STATUS)
- || (status == FTPReply.DIRECTORY_STATUS)
- || (status == FTPReply.FILE_STATUS_OK) // not in the RFC but used by some FTP servers
- || (status == FTPReply.COMMAND_OK) // not in the RFC but used by some FTP servers
- || (status == FTPReply.SYSTEM_STATUS));
- } catch (IOException e) {
- throw new TransferFailedException("Error transferring file via FTP", e);
- } catch (ResourceDoesNotExistException e) {
- return false;
- }
- }
-
- @Override
- public boolean supportsDirectoryCopy() {
- return true;
- }
-
- @Override
- public void putDirectory(File sourceDirectory, String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
-
- // Change to root.
- try {
- if (!ftp.changeWorkingDirectory(getRepository().getBasedir())) {
- RepositoryPermissions permissions = getRepository().getPermissions();
- if (!makeFtpDirectoryRecursive(getRepository().getBasedir(), permissions)) {
- throw new TransferFailedException(
- "Required directory: '" + getRepository().getBasedir() + "' " + "could not get created");
- }
-
- // try it again sam ...
- if (!ftp.changeWorkingDirectory(getRepository().getBasedir())) {
- throw new TransferFailedException("Required directory: '"
- + getRepository().getBasedir() + "' " + "is missing and could not get created");
- }
- }
- } catch (IOException e) {
- throw new TransferFailedException(
- "Cannot change to root path " + getRepository().getBasedir(), e);
- }
-
- fireTransferDebug(
- "Recursively uploading directory " + sourceDirectory.getAbsolutePath() + " as " + destinationDirectory);
- ftpRecursivePut(sourceDirectory, destinationDirectory);
- }
-
- private void ftpRecursivePut(File sourceFile, String fileName) throws TransferFailedException {
- final RepositoryPermissions permissions = repository.getPermissions();
-
- fireTransferDebug("processing = " + sourceFile.getAbsolutePath() + " as " + fileName);
-
- if (sourceFile.isDirectory()) {
- if (!fileName.equals(".")) {
- try {
- // change directory if it already exists.
- if (!ftp.changeWorkingDirectory(fileName)) {
- // first, try to create it
- if (makeFtpDirectoryRecursive(fileName, permissions)) {
- if (!ftp.changeWorkingDirectory(fileName)) {
- throw new TransferFailedException("Unable to change cwd on ftp server to " + fileName
- + " when processing " + sourceFile.getAbsolutePath());
- }
- } else {
- throw new TransferFailedException("Unable to create directory " + fileName
- + " when processing " + sourceFile.getAbsolutePath());
- }
- }
- } catch (IOException e) {
- throw new TransferFailedException(
- "IOException caught while processing path at " + sourceFile.getAbsolutePath(), e);
- }
- }
-
- File[] files = sourceFile.listFiles();
- if (files != null && files.length > 0) {
- fireTransferDebug("listing children of = " + sourceFile.getAbsolutePath() + " found " + files.length);
-
- // Directories first, then files. Let's go deep early.
- for (File file : files) {
- if (file.isDirectory()) {
- ftpRecursivePut(file, file.getName());
- }
- }
- for (File file : files) {
- if (!file.isDirectory()) {
- ftpRecursivePut(file, file.getName());
- }
- }
- }
-
- // Step back up a directory once we're done with the contents of this one.
- try {
- ftp.changeToParentDirectory();
- } catch (IOException e) {
- throw new TransferFailedException(
- "IOException caught while attempting to step up to parent directory"
- + " after successfully processing "
- + sourceFile.getAbsolutePath(),
- e);
- }
- } else {
- // Oh how I hope and pray, in denial, but today I am still just a file.
-
- FileInputStream sourceFileStream = null;
- try {
- sourceFileStream = new FileInputStream(sourceFile);
-
- // It's a file. Upload it in the current directory.
- if (ftp.storeFile(fileName, sourceFileStream)) {
- if (permissions != null) {
- // Process permissions; note that if we get errors or exceptions here, they are ignored.
- // This appears to be a conscious decision, based on other parts of this code.
- String group = permissions.getGroup();
- if (group != null) {
- try {
- ftp.sendSiteCommand("CHGRP " + permissions.getGroup());
- } catch (IOException e) {
- // ignore
- }
- }
- String mode = permissions.getFileMode();
- if (mode != null) {
- try {
- ftp.sendSiteCommand("CHMOD " + permissions.getDirectoryMode());
- } catch (IOException e) {
- // ignore
- }
- }
- }
- } else {
- String msg = "Cannot transfer resource: '" + sourceFile.getAbsolutePath()
- + "' FTP Server response: " + ftp.getReplyString();
- throw new TransferFailedException(msg);
- }
-
- sourceFileStream.close();
- sourceFileStream = null;
- } catch (IOException e) {
- throw new TransferFailedException(
- "IOException caught while attempting to upload " + sourceFile.getAbsolutePath(), e);
- } finally {
- IOUtils.closeQuietly(sourceFileStream);
- }
- }
-
- fireTransferDebug("completed = " + sourceFile.getAbsolutePath());
- }
-
- /**
- * Set the permissions (if given) for the underlying folder.
- * Note: Since the FTP SITE command might be server dependent, we cannot
- * rely on the functionality available on each FTP server!
- * So we can only try and hope it works (and catch away all Exceptions).
- *
- * @param permissions group and directory permissions
- */
- private void setPermissions(RepositoryPermissions permissions) {
- if (permissions != null) {
- // Process permissions; note that if we get errors or exceptions here, they are ignored.
- // This appears to be a conscious decision, based on other parts of this code.
- String group = permissions.getGroup();
- if (group != null) {
- try {
- ftp.sendSiteCommand("CHGRP " + permissions.getGroup());
- } catch (IOException e) {
- // ignore
- }
- }
- String mode = permissions.getDirectoryMode();
- if (mode != null) {
- try {
- ftp.sendSiteCommand("CHMOD " + permissions.getDirectoryMode());
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Recursively create directories.
- *
- * @param fileName the path to create (might be nested)
- * @param permissions
- * @return ok
- * @throws IOException
- */
- private boolean makeFtpDirectoryRecursive(String fileName, RepositoryPermissions permissions) throws IOException {
- if (fileName == null
- || fileName.length() == 0
- || fileName.replace('/', '_').trim().length() == 0) // if a string is '/', '//' or similar
- {
- return false;
- }
-
- int slashPos = fileName.indexOf("/");
- String oldPwd = null;
- boolean ok = true;
-
- if (slashPos == 0) {
- // this is an absolute directory
- oldPwd = ftp.printWorkingDirectory();
-
- // start with the root
- ftp.changeWorkingDirectory("/");
- fileName = fileName.substring(1);
-
- // look up the next path separator
- slashPos = fileName.indexOf("/");
- }
-
- if (slashPos >= 0 && slashPos < (fileName.length() - 1)) // not only a slash at the end, like in 'newDir/'
- {
- if (oldPwd == null) {
- oldPwd = ftp.printWorkingDirectory();
- }
-
- String nextDir = fileName.substring(0, slashPos);
-
- boolean changedDir = false;
- // we only create the nextDir if it doesn't yet exist
- if (!ftp.changeWorkingDirectory(nextDir)) {
- ok &= ftp.makeDirectory(nextDir);
- } else {
- changedDir = true;
- }
-
- if (ok) {
- // set the permissions for the freshly created directory
- setPermissions(permissions);
-
- if (!changedDir) {
- ftp.changeWorkingDirectory(nextDir);
- }
-
- // now create the deeper directories
- final String remainingDirs = fileName.substring(slashPos + 1);
- ok &= makeFtpDirectoryRecursive(remainingDirs, permissions);
- }
- } else {
- ok = ftp.makeDirectory(fileName);
- }
-
- if (oldPwd != null) {
- // change back to the old working directory
- ftp.changeWorkingDirectory(oldPwd);
- }
-
- return ok;
- }
-
- public String getControlEncoding() {
- return controlEncoding;
- }
-
- public void setControlEncoding(String controlEncoding) {
- this.controlEncoding = controlEncoding;
- }
-}
diff --git a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpsWagon.java b/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpsWagon.java
deleted file mode 100644
index cb878518..00000000
--- a/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpsWagon.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ftp;
-
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPSClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * FtpsWagon
- *
- *
- * @plexus.component role="org.apache.maven.wagon.Wagon"
- * role-hint="ftps"
- * instantiation-strategy="per-lookup"
- */
-public class FtpsWagon extends FtpWagon {
- private static final Logger LOG = LoggerFactory.getLogger(FtpsWagon.class);
-
- /**
- * @plexus.configuration default-value="TLS"
- */
- private String securityProtocol = "TLS";
-
- /**
- * @plexus.configuration default-value="false"
- */
- private boolean implicit = false;
-
- /**
- * @plexus.configuration default-value="true"
- */
- private boolean endpointChecking = true;
-
- @Override
- protected FTPClient createClient() {
- LOG.debug(
- "Creating secure FTP client. Protocol: [{}], implicit mode: [{}], endpoint checking: [{}].",
- securityProtocol,
- implicit,
- endpointChecking);
- FTPSClient client = new FTPSClient(securityProtocol, implicit);
- client.setEndpointCheckingEnabled(endpointChecking);
- return client;
- }
-}
diff --git a/wagon-providers/wagon-ftp/src/site/apt/index.apt b/wagon-providers/wagon-ftp/src/site/apt/index.apt
deleted file mode 100644
index fe31c1c1..00000000
--- a/wagon-providers/wagon-ftp/src/site/apt/index.apt
+++ /dev/null
@@ -1,106 +0,0 @@
- ------
- Maven Wagon FTP
- ------
- Carlos Sanchez
- ------
- 2006-06-04
- ------
-
- ~~ 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.
-
- ~~ NOTE: For help with the syntax of this file, see:
- ~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Deprecation Notice
-
- This Wagon provider is deprecated and will be removed in version 4.0.0.
-
-Maven Wagon FTP
-
- This component is an implementation of Wagon provider for FTP access.
- It uses {{{http://jakarta.apache.org/commons/net/}commons-net}} as lower level layer.
-
- It enables Maven to use remote repositories stored in FTP servers. It doesn't allow deployment of directories.
-
-
-Features
-
- * Get files from FTP Server
-
- * Deploy files to FTP server
-
-Configuration
-
- * <<<passiveMode>>> default: <<true>>
-
- * <<<controlEncoding>>> default: <<"ISO-8859-1">>,
- set from <<<org.apache.commons.net.ftp.FTP.DEFAULT_CONTROL_ENCODING>>>
-
- * <<<securityProtocol>>> default: <<TLS>>, FTPS security protocol, TLS or SSL
-
- * <<<implicit>>> default: <<false>>
-
- * <<<endpointChecking>>> default: <<true>>
-
-Sample Configuration
-
-* pom.xml
-
----------------------------------------------
-<project>
- ...
- <distributionManagement>
- ...
- <site>
- <id>ftp.server.id</id>
- <!--<url>ftp://ftp.example.com</url>-->
- <url>ftps://secure.example.com</url>
- </site>
- </distributionManagement>
- ...
- <build>
- <extensions>
- <extension>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ftp</artifactId>
- </extension>
- </extensions>
- ...
- </build>
- ...
-</project>
----------------------------------------------
-
-* settings.xml
-
----------------------------------------------
-<settings>
- ...
- <servers>
- ...
- <server>
- <id>ftp.server.id</id>
- <username>username</username>
- <password>password</password>
- <configuration>
- <endpointChecking>false</endpointChecking>
- </configuration>
- </server>
- </servers>
-<settings>
----------------------------------------------
diff --git a/wagon-providers/wagon-ftp/src/site/site.xml b/wagon-providers/wagon-ftp/src/site/site.xml
deleted file mode 100644
index 464cc165..00000000
--- a/wagon-providers/wagon-ftp/src/site/site.xml
+++ /dev/null
@@ -1,33 +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/DECORATION/1.3.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
- <body>
- <breadcrumbs>
- <item name="FTP" href="./index.html" />
- </breadcrumbs>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
diff --git a/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java b/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
deleted file mode 100644
index f206d20f..00000000
--- a/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ftp;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.ftpserver.FtpServer;
-import org.apache.ftpserver.FtpServerFactory;
-import org.apache.ftpserver.ftplet.Authority;
-import org.apache.ftpserver.ftplet.UserManager;
-import org.apache.ftpserver.listener.Listener;
-import org.apache.ftpserver.listener.ListenerFactory;
-import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
-import org.apache.ftpserver.usermanager.impl.BaseUser;
-import org.apache.ftpserver.usermanager.impl.WritePermission;
-import org.apache.maven.wagon.FileTestUtils;
-import org.apache.maven.wagon.StreamingWagonTestCase;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class FtpWagonTest extends StreamingWagonTestCase {
- private FtpServer server;
-
- private int testRepositoryPort;
-
- protected String getProtocol() {
- return "ftp";
- }
-
- protected int getTestRepositoryPort() {
- return testRepositoryPort;
- }
-
- protected void setupWagonTestingFixtures() throws Exception {
- File ftpHomeDir = getRepositoryDirectory();
- if (!ftpHomeDir.exists()) {
- ftpHomeDir.mkdirs();
- }
-
- if (server == null) {
- FtpServerFactory serverFactory = new FtpServerFactory();
-
- ListenerFactory factory = new ListenerFactory();
-
- // set the port of the listener
- factory.setPort(0);
-
- // replace the default listener
- Listener defaultListener = factory.createListener();
- serverFactory.addListener("default", defaultListener);
-
- PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
- UserManager um = userManagerFactory.createUserManager();
-
- BaseUser user = new BaseUser();
- user.setName("admin");
- user.setPassword("admin");
-
- List<Authority> authorities = new ArrayList<>();
- authorities.add(new WritePermission());
-
- user.setAuthorities(authorities);
-
- user.setHomeDirectory(ftpHomeDir.getAbsolutePath());
-
- um.save(user);
-
- serverFactory.setUserManager(um);
-
- server = serverFactory.createServer();
-
- // start the server
- server.start();
-
- testRepositoryPort = defaultListener.getPort();
- }
- }
-
- protected void createDirectory(Wagon wagon, String resourceToCreate, String dirName) throws Exception {
- super.createDirectory(wagon, resourceToCreate, dirName);
-
- getRepositoryDirectory().mkdirs();
- }
-
- protected void tearDownWagonTestingFixtures() throws Exception {
- server.stop();
- server = null;
- }
-
- protected String getTestRepositoryUrl() {
- return "ftp://localhost:" + getTestRepositoryPort();
- }
-
- public AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = new AuthenticationInfo();
-
- authInfo.setUserName("admin");
-
- authInfo.setPassword("admin");
-
- return authInfo;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- File file = new File(getRepositoryDirectory(), resource.getName());
-
- // granularity for FTP is minutes
- return (file.lastModified() / 60000) * 60000;
- }
-
- private File getRepositoryDirectory() {
- return getTestFile("target/test-output/local-repository");
- }
-
- public void testNoPassword() throws Exception {
- AuthenticationInfo authenticationInfo = new AuthenticationInfo();
- authenticationInfo.setUserName("me");
- try {
- getWagon().connect(new Repository("id", getTestRepositoryUrl()), authenticationInfo);
- fail();
- } catch (AuthenticationException e) {
- assertTrue(true);
- }
- }
-
- public void testDefaultUserName() throws Exception {
- AuthenticationInfo authenticationInfo = new AuthenticationInfo();
- authenticationInfo.setPassword("secret");
- try {
- getWagon().connect(new Repository("id", getTestRepositoryUrl()), authenticationInfo);
- fail();
- } catch (AuthenticationException e) {
- assertEquals(System.getProperty("user.name"), authenticationInfo.getUserName());
- }
- }
-
- /**
- * This is a unit test to show WAGON-265
- */
- public void testPutDirectoryCreation() throws Exception {
- setupWagonTestingFixtures();
-
- setupRepositories();
-
- Wagon wagon = getWagon();
-
- if (wagon.supportsDirectoryCopy()) {
- // do the cleanup first
- File destDir = new File(getRepositoryDirectory(), "dirExists");
- FileUtils.deleteDirectory(destDir);
- destDir.mkdirs();
- destDir = new File(destDir, "not_yet_existing/also_not");
-
- File sourceDir = new File(getRepositoryDirectory(), "testDirectory");
-
- FileUtils.deleteDirectory(sourceDir);
- sourceDir.mkdir();
-
- File testRes = new File(sourceDir, "test-resource-1.txt");
- testRes.createNewFile();
-
- // This is the difference to our normal use case:
- // the directory specified in the repo string doesn't yet exist!
-
- testRepository.setUrl(testRepository.getUrl() + "/dirExists/not_yet_existing/also_not");
-
- wagon.connect(testRepository, getAuthInfo());
-
- wagon.putDirectory(sourceDir, "testDirectory");
-
- destFile = FileTestUtils.createUniqueFile(getName(), getName());
-
- destFile.deleteOnExit();
-
- wagon.get("testDirectory/test-resource-1.txt", destFile);
-
- wagon.disconnect();
- }
-
- tearDownWagonTestingFixtures();
- }
-}
diff --git a/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml b/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
deleted file mode 100644
index 8a476645..00000000
--- a/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
- ~ 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.
- -->
-
-<plexus>
-</plexus>
diff --git a/wagon-providers/wagon-http-lightweight/pom.xml b/wagon-providers/wagon-http-lightweight/pom.xml
deleted file mode 100644
index bca99bbd..00000000
--- a/wagon-providers/wagon-http-lightweight/pom.xml
+++ /dev/null
@@ -1,67 +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.wagon</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>4.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>wagon-http-lightweight</artifactId>
- <name>Apache Maven Wagon :: Providers :: Lightweight HTTP Provider</name>
- <description>Wagon provider that gets and puts artifacts through http using standard Java library</description>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>wagon-http-shared</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- used fo the TCK -->
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-tck-http</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty.aggregate</groupId>
- <artifactId>jetty-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
deleted file mode 100644
index 67e298bd..00000000
--- a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.http;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.PasswordAuthentication;
-import java.net.Proxy;
-import java.net.Proxy.Type;
-import java.net.SocketAddress;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.zip.DeflaterInputStream;
-import java.util.zip.GZIPInputStream;
-
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.InputData;
-import org.apache.maven.wagon.OutputData;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.StreamWagon;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.apache.maven.wagon.resource.Resource;
-import org.apache.maven.wagon.shared.http.EncodingUtil;
-import org.codehaus.plexus.util.Base64;
-
-import static java.lang.Integer.parseInt;
-import static org.apache.maven.wagon.shared.http.HttpMessageUtils.UNKNOWN_STATUS_CODE;
-import static org.apache.maven.wagon.shared.http.HttpMessageUtils.formatAuthorizationMessage;
-import static org.apache.maven.wagon.shared.http.HttpMessageUtils.formatResourceDoesNotExistMessage;
-import static org.apache.maven.wagon.shared.http.HttpMessageUtils.formatTransferFailedMessage;
-
-/**
- * LightweightHttpWagon, using JDK's HttpURLConnection.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- * @plexus.component role="org.apache.maven.wagon.Wagon" role-hint="http" instantiation-strategy="per-lookup"
- * @see HttpURLConnection
- */
-public class LightweightHttpWagon extends StreamWagon {
- private boolean preemptiveAuthentication;
-
- private HttpURLConnection putConnection;
-
- private Proxy proxy = Proxy.NO_PROXY;
-
- private static final Pattern IOEXCEPTION_MESSAGE_PATTERN =
- Pattern.compile("Server returned HTTP response code: " + "(\\d\\d\\d) for URL: (.*)");
-
- public static final int MAX_REDIRECTS = 10;
-
- /**
- * Whether to use any proxy cache or not.
- *
- * @plexus.configuration default="false"
- */
- private boolean useCache;
-
- /**
- * @plexus.configuration
- */
- private Properties httpHeaders;
-
- /**
- * @plexus.requirement
- */
- private volatile LightweightHttpWagonAuthenticator authenticator;
-
- /**
- * Builds a complete URL string from the repository URL and the relative path of the resource passed.
- *
- * @param resource the resource to extract the relative path from.
- * @return the complete URL
- */
- private String buildUrl(Resource resource) {
- return EncodingUtil.encodeURLToString(getRepository().getUrl(), resource.getName());
- }
-
- public void fillInputData(InputData inputData)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- Resource resource = inputData.getResource();
-
- String visitingUrl = buildUrl(resource);
-
- List<String> visitedUrls = new ArrayList<>();
-
- for (int redirectCount = 0; redirectCount < MAX_REDIRECTS; redirectCount++) {
- if (visitedUrls.contains(visitingUrl)) {
- // TODO add a test for this message
- throw new TransferFailedException("Cyclic http redirect detected. Aborting! " + visitingUrl);
- }
- visitedUrls.add(visitingUrl);
-
- URL url = null;
- try {
- url = new URL(visitingUrl);
- } catch (MalformedURLException e) {
- // TODO add test for this
- throw new ResourceDoesNotExistException("Invalid repository URL: " + e.getMessage(), e);
- }
-
- HttpURLConnection urlConnection = null;
-
- try {
- urlConnection = (HttpURLConnection) url.openConnection(this.proxy);
- } catch (IOException e) {
- // TODO: add test for this
- String message = formatTransferFailedMessage(visitingUrl, UNKNOWN_STATUS_CODE, null, getProxyInfo());
- // TODO include e.getMessage appended to main message?
- throw new TransferFailedException(message, e);
- }
-
- try {
-
- urlConnection.setRequestProperty("Accept-Encoding", "gzip,deflate");
- if (!useCache) {
- urlConnection.setRequestProperty("Pragma", "no-cache");
- }
-
- addHeaders(urlConnection);
-
- // TODO: handle all response codes
- int responseCode = urlConnection.getResponseCode();
- String reasonPhrase = urlConnection.getResponseMessage();
-
- // TODO Move 401/407 to AuthenticationException after WAGON-587
- if (responseCode == HttpURLConnection.HTTP_FORBIDDEN
- || responseCode == HttpURLConnection.HTTP_UNAUTHORIZED
- || responseCode == HttpURLConnection.HTTP_PROXY_AUTH) {
- throw new AuthorizationException(
- formatAuthorizationMessage(buildUrl(resource), responseCode, reasonPhrase, getProxyInfo()));
- }
- if (responseCode == HttpURLConnection.HTTP_MOVED_PERM
- || responseCode == HttpURLConnection.HTTP_MOVED_TEMP) {
- visitingUrl = urlConnection.getHeaderField("Location");
- continue;
- }
-
- InputStream is = urlConnection.getInputStream();
- String contentEncoding = urlConnection.getHeaderField("Content-Encoding");
- boolean isGZipped = contentEncoding != null && "gzip".equalsIgnoreCase(contentEncoding);
- if (isGZipped) {
- is = new GZIPInputStream(is);
- }
- boolean isDeflated = contentEncoding != null && "deflate".equalsIgnoreCase(contentEncoding);
- if (isDeflated) {
- is = new DeflaterInputStream(is);
- }
- inputData.setInputStream(is);
- resource.setLastModified(urlConnection.getLastModified());
- resource.setContentLength(urlConnection.getContentLength());
- break;
-
- } catch (FileNotFoundException e) {
- // this could be 404 Not Found or 410 Gone - we don't have access to which it was.
- // TODO: 2019-10-03 url used should list all visited/redirected urls, not just the original
- throw new ResourceDoesNotExistException(
- formatResourceDoesNotExistMessage(
- buildUrl(resource), UNKNOWN_STATUS_CODE, null, getProxyInfo()),
- e);
- } catch (IOException originalIOException) {
- throw convertHttpUrlConnectionException(originalIOException, urlConnection, buildUrl(resource));
- }
- }
- }
-
- private void addHeaders(HttpURLConnection urlConnection) {
- if (httpHeaders != null) {
- for (Object header : httpHeaders.keySet()) {
- urlConnection.setRequestProperty((String) header, httpHeaders.getProperty((String) header));
- }
- }
- setAuthorization(urlConnection);
- }
-
- private void setAuthorization(HttpURLConnection urlConnection) {
- if (preemptiveAuthentication && authenticationInfo != null && authenticationInfo.getUserName() != null) {
- String credentials = authenticationInfo.getUserName() + ":" + authenticationInfo.getPassword();
- String encoded = new String(Base64.encodeBase64(credentials.getBytes()));
- urlConnection.setRequestProperty("Authorization", "Basic " + encoded);
- }
- }
-
- public void fillOutputData(OutputData outputData) throws TransferFailedException {
- Resource resource = outputData.getResource();
- try {
- URL url = new URL(buildUrl(resource));
- putConnection = (HttpURLConnection) url.openConnection(this.proxy);
-
- addHeaders(putConnection);
-
- putConnection.setRequestMethod("PUT");
- putConnection.setDoOutput(true);
- outputData.setOutputStream(putConnection.getOutputStream());
- } catch (IOException e) {
- throw new TransferFailedException("Error transferring file: " + e.getMessage(), e);
- }
- }
-
- protected void finishPutTransfer(Resource resource, InputStream input, OutputStream output)
- throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException {
- try {
- String reasonPhrase = putConnection.getResponseMessage();
- int statusCode = putConnection.getResponseCode();
-
- switch (statusCode) {
- // Success Codes
- case HttpURLConnection.HTTP_OK: // 200
- case HttpURLConnection.HTTP_CREATED: // 201
- case HttpURLConnection.HTTP_ACCEPTED: // 202
- case HttpURLConnection.HTTP_NO_CONTENT: // 204
- break;
-
- // TODO Move 401/407 to AuthenticationException after WAGON-587
- case HttpURLConnection.HTTP_FORBIDDEN:
- case HttpURLConnection.HTTP_UNAUTHORIZED:
- case HttpURLConnection.HTTP_PROXY_AUTH:
- throw new AuthorizationException(
- formatAuthorizationMessage(buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
-
- case HttpURLConnection.HTTP_NOT_FOUND:
- case HttpURLConnection.HTTP_GONE:
- throw new ResourceDoesNotExistException(formatResourceDoesNotExistMessage(
- buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
-
- // add more entries here
- default:
- throw new TransferFailedException(
- formatTransferFailedMessage(buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
- }
- } catch (IOException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
- throw convertHttpUrlConnectionException(e, putConnection, buildUrl(resource));
- }
- }
-
- protected void openConnectionInternal() throws ConnectionException, AuthenticationException {
- final ProxyInfo proxyInfo = getProxyInfo("http", getRepository().getHost());
- if (proxyInfo != null) {
- this.proxy = getProxy(proxyInfo);
- this.proxyInfo = proxyInfo;
- }
- authenticator.setWagon(this);
-
- boolean usePreemptiveAuthentication = Boolean.getBoolean("maven.wagon.http.preemptiveAuthentication")
- || Boolean.parseBoolean(repository.getParameter("preemptiveAuthentication"))
- || this.preemptiveAuthentication;
-
- setPreemptiveAuthentication(usePreemptiveAuthentication);
- }
-
- @SuppressWarnings("deprecation")
- public PasswordAuthentication requestProxyAuthentication() {
- if (proxyInfo != null && proxyInfo.getUserName() != null) {
- String password = "";
- if (proxyInfo.getPassword() != null) {
- password = proxyInfo.getPassword();
- }
- return new PasswordAuthentication(proxyInfo.getUserName(), password.toCharArray());
- }
- return null;
- }
-
- public PasswordAuthentication requestServerAuthentication() {
- if (authenticationInfo != null && authenticationInfo.getUserName() != null) {
- String password = "";
- if (authenticationInfo.getPassword() != null) {
- password = authenticationInfo.getPassword();
- }
- return new PasswordAuthentication(authenticationInfo.getUserName(), password.toCharArray());
- }
- return null;
- }
-
- private Proxy getProxy(ProxyInfo proxyInfo) {
- return new Proxy(getProxyType(proxyInfo), getSocketAddress(proxyInfo));
- }
-
- private Type getProxyType(ProxyInfo proxyInfo) {
- if (ProxyInfo.PROXY_SOCKS4.equals(proxyInfo.getType()) || ProxyInfo.PROXY_SOCKS5.equals(proxyInfo.getType())) {
- return Type.SOCKS;
- } else {
- return Type.HTTP;
- }
- }
-
- public SocketAddress getSocketAddress(ProxyInfo proxyInfo) {
- return InetSocketAddress.createUnresolved(proxyInfo.getHost(), proxyInfo.getPort());
- }
-
- public void closeConnection() throws ConnectionException {
- // FIXME WAGON-375 use persistent connection feature provided by the jdk
- if (putConnection != null) {
- putConnection.disconnect();
- }
- authenticator.resetWagon();
- }
-
- public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
- HttpURLConnection headConnection;
-
- try {
- Resource resource = new Resource(resourceName);
- URL url = new URL(buildUrl(resource));
- headConnection = (HttpURLConnection) url.openConnection(this.proxy);
-
- addHeaders(headConnection);
-
- headConnection.setRequestMethod("HEAD");
-
- int statusCode = headConnection.getResponseCode();
- String reasonPhrase = headConnection.getResponseMessage();
-
- switch (statusCode) {
- case HttpURLConnection.HTTP_OK:
- return true;
-
- case HttpURLConnection.HTTP_NOT_FOUND:
- case HttpURLConnection.HTTP_GONE:
- return false;
-
- // TODO Move 401/407 to AuthenticationException after WAGON-587
- case HttpURLConnection.HTTP_FORBIDDEN:
- case HttpURLConnection.HTTP_UNAUTHORIZED:
- case HttpURLConnection.HTTP_PROXY_AUTH:
- throw new AuthorizationException(
- formatAuthorizationMessage(buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
-
- default:
- throw new TransferFailedException(
- formatTransferFailedMessage(buildUrl(resource), statusCode, reasonPhrase, getProxyInfo()));
- }
- } catch (IOException e) {
- throw new TransferFailedException("Error transferring file: " + e.getMessage(), e);
- }
- }
-
- public boolean isUseCache() {
- return useCache;
- }
-
- public void setUseCache(boolean useCache) {
- this.useCache = useCache;
- }
-
- public Properties getHttpHeaders() {
- return httpHeaders;
- }
-
- public void setHttpHeaders(Properties httpHeaders) {
- this.httpHeaders = httpHeaders;
- }
-
- void setSystemProperty(String key, String value) {
- if (value != null) {
- System.setProperty(key, value);
- } else {
- System.getProperties().remove(key);
- }
- }
-
- public void setPreemptiveAuthentication(boolean preemptiveAuthentication) {
- this.preemptiveAuthentication = preemptiveAuthentication;
- }
-
- public LightweightHttpWagonAuthenticator getAuthenticator() {
- return authenticator;
- }
-
- public void setAuthenticator(LightweightHttpWagonAuthenticator authenticator) {
- this.authenticator = authenticator;
- }
-
- /**
- * Convert the IOException that is thrown for most transfer errors that HttpURLConnection encounters to the
- * equivalent {@link TransferFailedException}.
- * <p>
- * Details are extracted from the error stream if possible, either directly or indirectly by way of supporting
- * accessors. The returned exception will include the passed IOException as a cause and a message that is as
- * descriptive as possible.
- *
- * @param originalIOException an IOException thrown from an HttpURLConnection operation
- * @param urlConnection instance that triggered the IOException
- * @param url originating url that triggered the IOException
- * @return exception that is representative of the original cause
- */
- private TransferFailedException convertHttpUrlConnectionException(
- IOException originalIOException, HttpURLConnection urlConnection, String url) {
- // javadoc of HttpUrlConnection, HTTP transfer errors throw IOException
- // In that case, one may attempt to get the status code and reason phrase
- // from the errorstream. We do this, but by way of the following code path
- // getResponseCode()/getResponseMessage() - calls -> getHeaderFields()
- // getHeaderFields() - calls -> getErrorStream()
- try {
- // call getResponseMessage first since impl calls getResponseCode as part of that anyways
- String errorResponseMessage = urlConnection.getResponseMessage(); // may be null
- int errorResponseCode = urlConnection.getResponseCode(); // may be -1 if the code cannot be discerned
- String message = formatTransferFailedMessage(url, errorResponseCode, errorResponseMessage, getProxyInfo());
- return new TransferFailedException(message, originalIOException);
-
- } catch (IOException errorStreamException) {
- // there was a problem using the standard methods, need to fall back to other options
- }
-
- // Attempt to parse the status code and URL which can be included in an IOException message
- // https://github.com/AdoptOpenJDK/openjdk-jdk11/blame/999dbd4192d0f819cb5224f26e9e7fa75ca6f289/src/java
- // .base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java#L1911L1913
- String ioMsg = originalIOException.getMessage();
- if (ioMsg != null) {
- Matcher matcher = IOEXCEPTION_MESSAGE_PATTERN.matcher(ioMsg);
- if (matcher.matches()) {
- String codeStr = matcher.group(1);
- String urlStr = matcher.group(2);
-
- int code = UNKNOWN_STATUS_CODE;
- try {
- code = parseInt(codeStr);
- } catch (NumberFormatException nfe) {
- // if here there is a regex problem
- }
-
- String message = formatTransferFailedMessage(urlStr, code, null, getProxyInfo());
- return new TransferFailedException(message, originalIOException);
- }
- }
-
- String message = formatTransferFailedMessage(url, UNKNOWN_STATUS_CODE, null, getProxyInfo());
- return new TransferFailedException(message, originalIOException);
- }
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonAuthenticator.java b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonAuthenticator.java
deleted file mode 100644
index 52609041..00000000
--- a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonAuthenticator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.http;
-
-import java.net.Authenticator;
-import java.net.PasswordAuthentication;
-
-/**
- * @author <a href="mailto:nicolas.deloof@cloudbees.com">Nicolas De loof</a>
- * @plexus.component role="org.apache.maven.wagon.providers.http.LightweightHttpWagonAuthenticator"
- */
-public class LightweightHttpWagonAuthenticator extends Authenticator {
- ThreadLocal<LightweightHttpWagon> localWagon = new ThreadLocal<>();
-
- protected PasswordAuthentication getPasswordAuthentication() {
- LightweightHttpWagon wagon = localWagon.get();
- if (wagon != null) {
- if (getRequestorType() == RequestorType.PROXY) {
- return wagon.requestProxyAuthentication();
- } else {
- return wagon.requestServerAuthentication();
- }
- }
- return null;
- }
-
- public void setWagon(LightweightHttpWagon wagon) {
- localWagon.set(wagon);
- Authenticator.setDefault(this);
- }
-
- public void resetWagon() {
- localWagon.remove();
- }
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagon.java b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagon.java
deleted file mode 100644
index 4661b161..00000000
--- a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagon.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.http;
-
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-
-/**
- * LightweightHttpsWagon, using JDK's HttpURLConnection.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- *
- * @plexus.component role="org.apache.maven.wagon.Wagon"
- * role-hint="https"
- * instantiation-strategy="per-lookup"
- */
-public class LightweightHttpsWagon extends LightweightHttpWagon {
- private String previousHttpsProxyHost;
-
- private String previousHttpsProxyPort;
-
- private String previousHttpsProxyExclusions;
-
- public LightweightHttpsWagon() {
- super();
- }
-
- public void openConnection() throws ConnectionException, AuthenticationException {
- previousHttpsProxyHost = System.getProperty("https.proxyHost");
- previousHttpsProxyPort = System.getProperty("https.proxyPort");
- previousHttpsProxyExclusions = System.getProperty("https.nonProxyHosts");
-
- final ProxyInfo proxyInfo = getProxyInfo("https", getRepository().getHost());
- if (proxyInfo != null) {
- setSystemProperty("https.proxyHost", proxyInfo.getHost());
- setSystemProperty("https.proxyPort", String.valueOf(proxyInfo.getPort()));
- setSystemProperty("https.nonProxyHosts", proxyInfo.getNonProxyHosts());
- } else {
- setSystemProperty("https.proxyHost", null);
- setSystemProperty("https.proxyPort", null);
- }
-
- super.openConnection();
- }
-
- public void closeConnection() throws ConnectionException {
- super.closeConnection();
-
- setSystemProperty("https.proxyHost", previousHttpsProxyHost);
- setSystemProperty("https.proxyPort", previousHttpsProxyPort);
- setSystemProperty("https.nonProxyHosts", previousHttpsProxyExclusions);
- }
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/site/apt/index.apt b/wagon-providers/wagon-http-lightweight/src/site/apt/index.apt
deleted file mode 100644
index 975f2dc2..00000000
--- a/wagon-providers/wagon-http-lightweight/src/site/apt/index.apt
+++ /dev/null
@@ -1,49 +0,0 @@
- ------
- Maven Wagon HTTP lightweight
- ------
- Carlos Sanchez
- ------
- 2011-09-20
- ------
-
- ~~ 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.
-
- ~~ NOTE: For help with the syntax of this file, see:
- ~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Deprecation Notice
-
- This Wagon provider is deprecated and will be removed in version 4.0.0.
-
-Maven Wagon HTTP lightweight
-
- This component is an implementation of Wagon provider for HTTP access.
- It uses standard JDK classes as lower lever layer.
-
- It enables Maven to use remote repositories stored in HTTP servers.
-
-
-Features
-
- * Get files from HTTP/HTTPS Server
-
- * Put files to HTTP/HTTPS Server
-
-Known Limitation
-
- The main limitation is that you can't download data that doesn't fit entirely into memory.
diff --git a/wagon-providers/wagon-http-lightweight/src/site/site.xml b/wagon-providers/wagon-http-lightweight/src/site/site.xml
deleted file mode 100644
index 70aa028f..00000000
--- a/wagon-providers/wagon-http-lightweight/src/site/site.xml
+++ /dev/null
@@ -1,33 +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/DECORATION/1.3.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
- <body>
- <breadcrumbs>
- <item name="Lightweight HTTP" href="./index.html" />
- </breadcrumbs>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
diff --git a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java b/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
deleted file mode 100644
index 0cb908cd..00000000
--- a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.http;
-
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.StreamingWagon;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.WagonException;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.http.HttpWagonTestCase;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class LightweightHttpWagonTest extends HttpWagonTestCase {
- protected String getProtocol() {
- return "http";
- }
-
- protected String getTestRepositoryUrl() {
- return getProtocol() + "://localhost:" + getTestRepositoryPort() + "/";
- }
-
- protected void setHttpConfiguration(StreamingWagon wagon, Properties headers, Properties params) {
- ((LightweightHttpWagon) wagon).setHttpHeaders(headers);
- }
-
- @Override
- protected boolean supportPreemptiveAuthenticationGet() {
- return false;
- }
-
- @Override
- protected boolean supportPreemptiveAuthenticationPut() {
- return false;
- }
-
- @Override
- protected boolean supportProxyPreemptiveAuthentication() {
- return false;
- }
-
- @Override
- protected void verifyWagonExceptionMessage(Exception e, int forStatusCode, String forUrl, String forReasonPhrase) {
-
- // HttpUrlConnection prevents direct API access to the response code or reasonPhrase for any
- // status code >= 400. So all we can do is check WagonException wraps the HttpUrlConnection
- // thrown IOException / FileNotFoundException as a cause, if cause is not null
-
- assertNotNull(e);
- try {
- assertTrue("only verify instances of WagonException", e instanceof WagonException);
-
- String assertMessageForBadMessage = "exception message not described properly: ";
- switch (forStatusCode) {
- case HttpServletResponse.SC_GONE:
- case HttpServletResponse.SC_NOT_FOUND:
- assertTrue(
- "404 or 410 should throw ResourceDoesNotExistException",
- e instanceof ResourceDoesNotExistException);
-
- if (e.getCause() != null) {
- assertTrue(
- "ResourceDoesNotExistException should have the expected cause",
- e.getCause() instanceof FileNotFoundException);
- // the status code and reason phrase cannot always be learned due to implementation limitations
- // which means the message may not include them
- assertEquals(assertMessageForBadMessage, "resource missing at " + forUrl, e.getMessage());
- } else {
- assertEquals(
- assertMessageForBadMessage,
- "resource missing at " + forUrl + ", status: " + forStatusCode + " " + forReasonPhrase,
- e.getMessage());
- }
-
- break;
-
- case HttpServletResponse.SC_FORBIDDEN:
- assertTrue("403 Forbidden throws AuthorizationException", e instanceof AuthorizationException);
-
- assertEquals(
- assertMessageForBadMessage,
- "authorization failed for " + forUrl + ", status: 403"
- + ((forReasonPhrase == null || forReasonPhrase.isEmpty())
- ? " Forbidden"
- : (" " + forReasonPhrase)),
- e.getMessage());
- break;
-
- case HttpServletResponse.SC_UNAUTHORIZED:
- assertTrue("401 Unauthorized throws AuthorizationException", e instanceof AuthorizationException);
-
- assertEquals(
- assertMessageForBadMessage,
- "authentication failed for " + forUrl + ", status: 401"
- + ((forReasonPhrase == null || forReasonPhrase.isEmpty())
- ? " Unauthorized"
- : (" " + forReasonPhrase)),
- e.getMessage());
- break;
-
- default:
- assertTrue(
- "general exception must be TransferFailedException", e instanceof TransferFailedException);
- assertTrue(
- "expected status code for transfer failures should be >= 400, but none of "
- + " the already handled codes",
- forStatusCode >= HttpServletResponse.SC_BAD_REQUEST);
-
- if (e.getCause() != null) {
- assertTrue(
- "TransferFailedException should have the original cause for diagnosis",
- e.getCause() instanceof IOException);
- }
-
- // the status code and reason phrase cannot always be learned due to implementation limitations
- // so the message may not include them, but the implementation should use a consistent format
- assertTrue(
- "message should always include url",
- e.getMessage().startsWith("transfer failed for " + forUrl));
-
- if (e.getMessage().length() > ("transfer failed for " + forUrl).length()) {
- assertTrue(
- "message should include url and status code",
- e.getMessage()
- .startsWith("transfer failed for " + forUrl + ", status: " + forStatusCode));
- }
-
- if (e.getMessage().length()
- > ("transfer failed for " + forUrl + ", status: " + forStatusCode).length()) {
- assertEquals(
- "message should include url and status code and reason phrase",
- "transfer failed for " + forUrl + ", status: " + forStatusCode + " " + forReasonPhrase,
- e.getMessage());
- }
-
- break;
- }
-
- } catch (AssertionError assertionError) {
- logger.error("Exception which failed assertions: ", e);
- throw assertionError;
- }
- }
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonWithPreemptiveAuthenticationTest.java b/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonWithPreemptiveAuthenticationTest.java
deleted file mode 100644
index 8256e81f..00000000
--- a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonWithPreemptiveAuthenticationTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.http;
-
-import org.apache.maven.wagon.Wagon;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class LightweightHttpWagonWithPreemptiveAuthenticationTest extends LightweightHttpWagonTest {
- @Override
- protected Wagon getWagon() throws Exception {
- LightweightHttpWagon wagon = (LightweightHttpWagon) super.getWagon();
- wagon.setPreemptiveAuthentication(true);
- return wagon;
- }
-
- @Override
- protected boolean supportPreemptiveAuthenticationGet() {
- return true;
- }
-
- @Override
- protected boolean supportPreemptiveAuthenticationPut() {
- return true;
- }
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java b/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java
deleted file mode 100644
index 64fcfc4c..00000000
--- a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.http;
-
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-
-public class LightweightHttpsWagonTest extends LightweightHttpWagonTest {
- protected String getProtocol() {
- return "https";
- }
-
- protected ServerConnector addConnector(Server server) {
- System.setProperty(
- "javax.net.ssl.trustStore",
- getTestFile("src/test/resources/ssl/keystore").getAbsolutePath());
-
- SslContextFactory sslContextFactory = new SslContextFactory();
- sslContextFactory.setKeyStorePath(getTestPath("src/test/resources/ssl/keystore"));
- sslContextFactory.setKeyStorePassword("wagonhttp");
- sslContextFactory.setKeyManagerPassword("wagonhttp");
- sslContextFactory.setTrustStorePath(getTestPath("src/test/resources/ssl/keystore"));
- sslContextFactory.setTrustStorePassword("wagonhttp");
-
- ServerConnector serverConnector = new ServerConnector(server, sslContextFactory);
- server.addConnector(serverConnector);
- return serverConnector;
- }
-
- @Override
- protected boolean assertOnTransferProgress() {
- return false;
- }
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/TckTest.java b/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/TckTest.java
deleted file mode 100644
index b39fbd31..00000000
--- a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/TckTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.http;
-
-import org.apache.maven.wagon.tck.http.GetWagonTests;
-import org.apache.maven.wagon.tck.http.HttpsGetWagonTests;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * This test will runn the TCK suite on wagon-http-lightweight
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({GetWagonTests.class, HttpsGetWagonTests.class})
-public class TckTest {
- // no op
-}
diff --git a/wagon-providers/wagon-http-lightweight/src/test/resources/META-INF/plexus/components.xml b/wagon-providers/wagon-http-lightweight/src/test/resources/META-INF/plexus/components.xml
deleted file mode 100644
index 8c4cc2fe..00000000
--- a/wagon-providers/wagon-http-lightweight/src/test/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,38 +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.
--->
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.tck.http.WagonTestCaseConfigurator</role>
- <implementation>org.apache.maven.wagon.tck.http.WagonTestCaseConfigurator</implementation>
- <configuration>
- <wagonHint>http</wagonHint>
- <useCaseConfigs>
- <highLatencyLowTimeout>
- <unsupported/>
- </highLatencyLowTimeout>
- <inifiniteLatencyTimeout>
- <unsupported/>
- </inifiniteLatencyTimeout>
- </useCaseConfigs>
- </configuration>
- </component>
- </components>
-</component-set>
diff --git a/wagon-providers/wagon-http-lightweight/src/test/resources/ssl/keystore b/wagon-providers/wagon-http-lightweight/src/test/resources/ssl/keystore
deleted file mode 100644
index 33dcfac5..00000000
Binary files a/wagon-providers/wagon-http-lightweight/src/test/resources/ssl/keystore and /dev/null differ
diff --git a/wagon-providers/wagon-ssh-common-test/pom.xml b/wagon-providers/wagon-ssh-common-test/pom.xml
deleted file mode 100644
index b0daf02c..00000000
--- a/wagon-providers/wagon-ssh-common-test/pom.xml
+++ /dev/null
@@ -1,72 +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.wagon</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>4.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>wagon-ssh-common-test</artifactId>
- <name>Apache Maven Wagon :: Providers :: SSH Common Tests</name>
-
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-provider-test</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>2.0.22</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractEmbeddedScpWagonTest.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractEmbeddedScpWagonTest.java
deleted file mode 100644
index b8128850..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractEmbeddedScpWagonTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.File;
-import java.util.Arrays;
-
-import org.apache.maven.wagon.StreamingWagonTestCase;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public abstract class AbstractEmbeddedScpWagonTest extends StreamingWagonTestCase {
-
- SshServerEmbedded sshServer;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- String sshKeyResource = "ssh-keys/id_rsa";
-
- sshServer = new SshServerEmbedded(getProtocol(), Arrays.asList(sshKeyResource), false);
-
- sshServer.start();
- System.out.println("sshd on port " + sshServer.getPort());
- }
-
- @Override
- @SuppressWarnings("checkstyle:linelength")
- protected void tearDownWagonTestingFixtures() throws Exception {
-
- for (TestPasswordAuthenticator.PasswordAuthenticatorRequest request :
- sshServer.passwordAuthenticator.requests) {
- assertEquals(TestData.getUserName(), request.getUsername());
- assertEquals(TestData.getUserPassword(), request.getPassword());
- }
- sshServer.stop();
- }
-
- protected abstract String getProtocol();
-
- protected int getTestRepositoryPort() {
- return sshServer.getPort();
- }
-
- public String getTestRepositoryUrl() {
- return TestData.getTestRepositoryUrl(sshServer.getPort());
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = super.getAuthInfo();
-
- authInfo.setUserName(TestData.getUserName());
- authInfo.setPassword(TestData.getUserPassword());
-
- return authInfo;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- return new File(repository.getBasedir(), resource.getName()).lastModified();
- }
-
- @Override
- protected abstract boolean supportsGetIfNewer();
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractEmbeddedScpWagonWithKeyTest.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractEmbeddedScpWagonWithKeyTest.java
deleted file mode 100644
index 6bd0fdee..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/AbstractEmbeddedScpWagonWithKeyTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.maven.wagon.StreamingWagonTestCase;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public abstract class AbstractEmbeddedScpWagonWithKeyTest extends StreamingWagonTestCase {
-
- SshServerEmbedded sshServerEmbedded;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- String sshKeyResource = "ssh-keys/id_rsa.pub";
-
- sshServerEmbedded = new SshServerEmbedded(getProtocol(), Arrays.asList(sshKeyResource), true);
-
- sshServerEmbedded.start();
- System.out.println("sshd on port " + sshServerEmbedded.getPort());
- }
-
- @Override
- protected void tearDownWagonTestingFixtures() throws Exception {
-
- sshServerEmbedded.stop();
- }
-
- protected abstract String getProtocol();
-
- protected int getTestRepositoryPort() {
- return sshServerEmbedded.getPort();
- }
-
- public String getTestRepositoryUrl() {
- return TestData.getTestRepositoryUrl(sshServerEmbedded.getPort());
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = super.getAuthInfo();
- // user : guest/guest123 - passphrase : toto01
- authInfo.setUserName("guest");
- // authInfo.setPassword( TestData.getUserPassword() );
- authInfo.setPrivateKey(new File("src/test/ssh-keys/id_rsa").getPath());
-
- return authInfo;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- return new File(repository.getBasedir(), resource.getName()).lastModified();
- }
-
- public void testConnect() throws Exception {
- getWagon().connect(new Repository("foo", getTestRepositoryUrl()), getAuthInfo());
- assertTrue(true);
- }
-
- @Override
- protected boolean supportsGetIfNewer() {
- return false;
- }
-
- public void testWithSpaces() throws Exception {
- String dir = "foo test";
- File spaceDirectory = new File(TestData.getRepoPath(), dir);
- if (spaceDirectory.exists()) {
- FileUtils.deleteDirectory(spaceDirectory);
- }
- spaceDirectory.mkdirs();
-
- String subDir = "foo bar";
- File sub = new File(spaceDirectory, subDir);
- if (sub.exists()) {
- FileUtils.deleteDirectory(sub);
- }
- sub.mkdirs();
-
- File dummy = new File("src/test/resources/dummy.txt");
- FileUtils.copyFileToDirectory(dummy, sub);
-
- String url = getTestRepositoryUrl() + "/" + dir;
- Repository repo = new Repository("foo", url);
- Wagon wagon = getWagon();
- wagon.connect(repo, getAuthInfo());
- List<String> files = wagon.getFileList(subDir);
- assertNotNull(files);
- assertEquals(1, files.size());
- assertTrue(files.contains("dummy.txt"));
-
- wagon.put(new File("src/test/resources/dummy.txt"), subDir + "/newdummy.txt");
-
- files = wagon.getFileList(subDir);
- assertNotNull(files);
- assertEquals(2, files.size());
- assertTrue(files.contains("dummy.txt"));
- assertTrue(files.contains("newdummy.txt"));
-
- File sourceWithSpace = new File("target/directory with spaces");
- if (sourceWithSpace.exists()) {
- FileUtils.deleteDirectory(sourceWithSpace);
- }
- File resources = new File("src/test/resources");
-
- FileUtils.copyDirectory(resources, sourceWithSpace);
-
- wagon.putDirectory(sourceWithSpace, "target with spaces");
-
- files = wagon.getFileList("target with spaces");
-
- assertNotNull(files);
- assertTrue(files.contains("dummy.txt"));
- assertFalse(files.contains("newdummy.txt"));
- assertTrue(files.contains("log4j.xml"));
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ScpCommand.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ScpCommand.java
deleted file mode 100644
index 4142e293..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ScpCommand.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-
-import org.apache.sshd.common.util.DirectoryScanner;
-import org.apache.sshd.server.Command;
-import org.apache.sshd.server.Environment;
-import org.apache.sshd.server.ExitCallback;
-import org.apache.sshd.server.FileSystemAware;
-import org.apache.sshd.server.FileSystemView;
-import org.apache.sshd.server.SshFile;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This commands provide SCP support on both server and client side.
- * Permissions and preservation of access / modification times on files
- * are not supported.
- * olamy : copy of a class from mina for changing return codes in case of file not found 1 warning instead of 2
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class ScpCommand implements Command, Runnable, FileSystemAware {
-
- protected static final Logger LOG = LoggerFactory.getLogger(ScpCommand.class);
-
- protected static final int OK = 0;
-
- protected static final int WARNING = 1;
-
- protected static final int ERROR = 2;
-
- protected String name;
-
- protected boolean optR;
-
- protected boolean optT;
-
- protected boolean optF;
-
- protected boolean optV;
-
- protected boolean optD;
-
- protected boolean optP;
-
- protected FileSystemView root;
-
- protected String path;
-
- protected InputStream in;
-
- protected OutputStream out;
-
- protected OutputStream err;
-
- protected ExitCallback callback;
-
- protected IOException error;
-
- public ScpCommand(String[] args) {
- name = Arrays.asList(args).toString();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Executing command {}", name);
- }
- path = ".";
- for (int i = 1; i < args.length; i++) {
- if (args[i].charAt(0) == '-') {
- for (int j = 1; j < args[i].length(); j++) {
- switch (args[i].charAt(j)) {
- case 'f':
- optF = true;
- break;
- case 'p':
- optP = true;
- break;
- case 'r':
- optR = true;
- break;
- case 't':
- optT = true;
- break;
- case 'v':
- optV = true;
- break;
- case 'd':
- optD = true;
- break;
- default:
- // error = new IOException("Unsupported option: " +
- // args[i].charAt(j));
- // return;
- }
- }
- } else if (i == args.length - 1) {
- path = args[args.length - 1];
- }
- }
- if (!optF && !optT) {
- error = new IOException("Either -f or -t option should be set");
- }
- }
-
- public void setInputStream(InputStream in) {
- this.in = in;
- }
-
- public void setOutputStream(OutputStream out) {
- this.out = out;
- }
-
- public void setErrorStream(OutputStream err) {
- this.err = err;
- }
-
- public void setExitCallback(ExitCallback callback) {
- this.callback = callback;
- }
-
- public void start(Environment env) throws IOException {
- if (error != null) {
- throw error;
- }
- new Thread(this, "ScpCommand: " + name).start();
- }
-
- public void destroy() {}
-
- public void run() {
- int exitValue = OK;
- String exitMessage = null;
-
- try {
- if (optT) {
- ack();
- for (; ; ) {
- String line;
- boolean isDir = false;
- int c = readAck(true);
- switch (c) {
- case -1:
- return;
- case 'D':
- isDir = true;
- case 'C':
- line = ((char) c) + readLine();
- break;
- case 'E':
- readLine();
- return;
- default:
- // a real ack that has been acted upon already
- continue;
- }
-
- if (optR && isDir) {
- writeDir(line, root.getFile(path));
- } else {
- writeFile(line, root.getFile(path));
- }
- }
- } else if (optF) {
- String pattern = path;
- int idx = pattern.indexOf('*');
- if (idx >= 0) {
- String basedir = "";
- int lastSep = pattern.substring(0, idx).lastIndexOf('/');
- if (lastSep >= 0) {
- basedir = pattern.substring(0, lastSep);
- pattern = pattern.substring(lastSep + 1);
- }
- String[] included = new DirectoryScanner(basedir, pattern).scan();
- for (String path : included) {
- SshFile file = root.getFile(basedir + "/" + path);
- if (file.isFile()) {
- readFile(file);
- } else if (file.isDirectory()) {
- if (!optR) {
- out.write(WARNING);
- out.write((path + " not a regular file\n").getBytes());
- } else {
- readDir(file);
- }
- } else {
- out.write(WARNING);
- out.write((path + " unknown file type\n").getBytes());
- }
- }
- } else {
- String basedir = "";
- int lastSep = pattern.lastIndexOf('/');
- if (lastSep >= 0) {
- basedir = pattern.substring(0, lastSep);
- pattern = pattern.substring(lastSep + 1);
- }
- SshFile file = root.getFile(basedir + "/" + pattern);
- if (!file.doesExist()) {
- exitValue = WARNING;
- throw new IOException(file + ": no such file or directory");
- }
- if (file.isFile()) {
- readFile(file);
- } else if (file.isDirectory()) {
- if (!optR) {
- throw new IOException(file + " not a regular file");
- } else {
- readDir(file);
- }
- } else {
- throw new IOException(file + ": unknown file type");
- }
- }
- } else {
- throw new IOException("Unsupported mode");
- }
- } catch (IOException e) {
- try {
- exitValue = (exitValue != OK ? exitValue : ERROR);
- exitMessage = e.getMessage();
- out.write(exitValue);
- out.write(exitMessage.getBytes());
- out.write('\n');
- out.flush();
- } catch (IOException e2) {
- // Ignore
- }
- LOG.info("Error in scp command", e);
- } finally {
- if (callback != null) {
- callback.onExit(exitValue, exitMessage);
- }
- }
- }
-
- protected void writeDir(String header, SshFile path) throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Writing dir {}", path);
- }
- if (!header.startsWith("D")) {
- throw new IOException("Expected a D message but got '" + header + "'");
- }
-
- String perms = header.substring(1, 5);
- int length = Integer.parseInt(header.substring(6, header.indexOf(' ', 6)));
- String name = header.substring(header.indexOf(' ', 6) + 1);
-
- if (length != 0) {
- throw new IOException("Expected 0 length for directory but got " + length);
- }
- SshFile file;
- if (path.doesExist() && path.isDirectory()) {
- file = root.getFile(path, name);
- } else if (!path.doesExist()
- && path.getParentFile().doesExist()
- && path.getParentFile().isDirectory()) {
- file = path;
- } else {
- throw new IOException("Can not write to " + path);
- }
- if (!(file.doesExist() && file.isDirectory()) && !file.mkdir()) {
- throw new IOException("Could not create directory " + file);
- }
-
- ack();
-
- for (; ; ) {
- header = readLine();
- if (header.startsWith("C")) {
- writeFile(header, file);
- } else if (header.startsWith("D")) {
- writeDir(header, file);
- } else if (header.equals("E")) {
- ack();
- break;
- } else {
- throw new IOException("Unexpected message: '" + header + "'");
- }
- }
- }
-
- protected void writeFile(String header, SshFile path) throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Writing file {}", path);
- }
- if (!header.startsWith("C")) {
- throw new IOException("Expected a C message but got '" + header + "'");
- }
-
- String perms = header.substring(1, 5);
- long length = Long.parseLong(header.substring(6, header.indexOf(' ', 6)));
- String name = header.substring(header.indexOf(' ', 6) + 1);
-
- SshFile file;
- if (path.doesExist() && path.isDirectory()) {
- file = root.getFile(path, name);
- } else if (path.doesExist() && path.isFile()) {
- file = path;
- } else if (!path.doesExist()
- && path.getParentFile().doesExist()
- && path.getParentFile().isDirectory()) {
- file = path;
- } else {
- throw new IOException("Can not write to " + path);
- }
- if (file.doesExist() && file.isDirectory()) {
- throw new IOException("File is a directory: " + file);
- } else if (file.doesExist() && !file.isWritable()) {
- throw new IOException("Can not write to file: " + file);
- }
- OutputStream os = file.createOutputStream(0);
- try {
- ack();
-
- byte[] buffer = new byte[8 * 1024];
- while (length > 0) {
- int len = (int) Math.min(length, buffer.length);
- len = in.read(buffer, 0, len);
- if (len <= 0) {
- throw new IOException("End of stream reached");
- }
- os.write(buffer, 0, len);
- length -= len;
- }
- } finally {
- os.close();
- }
-
- ack();
- readAck(false);
- }
-
- protected String readLine() throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- for (; ; ) {
- int c = in.read();
- if (c == '\n') {
- return baos.toString();
- } else if (c == -1) {
- throw new IOException("End of stream");
- } else {
- baos.write(c);
- }
- }
- }
-
- protected void readFile(SshFile path) throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Reading file {}", path);
- }
- StringBuilder buf = new StringBuilder();
- buf.append("C");
- buf.append("0644"); // what about perms
- buf.append(" ");
- buf.append(path.getSize()); // length
- buf.append(" ");
- buf.append(path.getName());
- buf.append("\n");
- out.write(buf.toString().getBytes());
- out.flush();
- readAck(false);
-
- InputStream is = path.createInputStream(0);
- try {
- byte[] buffer = new byte[8 * 1024];
- for (; ; ) {
- int len = is.read(buffer, 0, buffer.length);
- if (len == -1) {
- break;
- }
- out.write(buffer, 0, len);
- }
- } finally {
- is.close();
- }
- ack();
- readAck(false);
- }
-
- protected void readDir(SshFile path) throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Reading directory {}", path);
- }
- StringBuilder buf = new StringBuilder();
- buf.append("D");
- buf.append("0755"); // what about perms
- buf.append(" ");
- buf.append("0"); // length
- buf.append(" ");
- buf.append(path.getName());
- buf.append("\n");
- out.write(buf.toString().getBytes());
- out.flush();
- readAck(false);
-
- for (SshFile child : path.listSshFiles()) {
- if (child.isFile()) {
- readFile(child);
- } else if (child.isDirectory()) {
- readDir(child);
- }
- }
-
- out.write("E\n".getBytes());
- out.flush();
- readAck(false);
- }
-
- protected void ack() throws IOException {
- out.write(0);
- out.flush();
- }
-
- protected int readAck(boolean canEof) throws IOException {
- int c = in.read();
- switch (c) {
- case -1:
- if (!canEof) {
- throw new EOFException();
- }
- break;
- case OK:
- break;
- case WARNING:
- LOG.warn("Received warning: " + readLine());
- break;
- case ERROR:
- throw new IOException("Received nack: " + readLine());
- default:
- break;
- }
- return c;
- }
-
- public void setFileSystemView(FileSystemView view) {
- this.root = view;
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ScpCommandFactory.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ScpCommandFactory.java
deleted file mode 100644
index 02f022d9..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ScpCommandFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.sshd.server.Command;
-import org.apache.sshd.server.CommandFactory;
-
-/**
- * This <code>CommandFactory</code> can be used as a standalone command factory
- * or can be used to augment another <code>CommandFactory</code> and provides
- * <code>SCP</code> support.
- *
- * @see ScpCommand
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class ScpCommandFactory implements CommandFactory {
-
- private CommandFactory delegate;
-
- public ScpCommandFactory() {}
-
- public ScpCommandFactory(CommandFactory delegate) {
- this.delegate = delegate;
- }
-
- /**
- * Parses a command string and verifies that the basic syntax is
- * correct. If parsing fails the responsibility is delegated to
- * the configured {@link org.apache.sshd.server.CommandFactory} instance; if one exist.
- *
- * @param command command to parse
- * @return configured {@link org.apache.sshd.server.Command} instance
- * @throws IllegalArgumentException
- */
- public Command createCommand(String command) {
- try {
- return new ScpCommand(splitCommandString(command));
- } catch (IllegalArgumentException iae) {
- if (delegate != null) {
- return delegate.createCommand(command);
- }
- throw iae;
- }
- }
-
- private String[] splitCommandString(String command) {
- if (!command.trim().startsWith("scp")) {
- throw new IllegalArgumentException("Unknown command, does not begin with 'scp'");
- }
-
- String[] args = command.split(" ");
- List<String> parts = new ArrayList<>();
- parts.add(args[0]);
- for (int i = 1; i < args.length; i++) {
- if (!args[i].trim().startsWith("-")) {
- parts.add(concatenateWithSpace(args, i));
- break;
- } else {
- parts.add(args[i]);
- }
- }
- return parts.toArray(new String[parts.size()]);
- }
-
- private String concatenateWithSpace(String[] args, int from) {
- StringBuilder sb = new StringBuilder();
-
- for (int i = from; i < args.length; i++) {
- sb.append(args[i] + " ");
- }
- return sb.toString().trim();
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ShellCommand.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ShellCommand.java
deleted file mode 100644
index c91e5767..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/ShellCommand.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.sshd.server.Command;
-import org.apache.sshd.server.Environment;
-import org.apache.sshd.server.ExitCallback;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-
-/**
- * @author Olivier Lamy
- */
-public class ShellCommand implements Command {
- protected static final int OK = 0;
-
- protected static final int WARNING = 1;
-
- protected static final int ERROR = 2;
-
- private InputStream in;
-
- private OutputStream out;
-
- private OutputStream err;
-
- private ExitCallback callback;
-
- private Thread thread;
-
- private String commandLine;
-
- public ShellCommand(String commandLine) {
- this.commandLine = commandLine;
- }
-
- public void setInputStream(InputStream in) {
- this.in = in;
- }
-
- public void setOutputStream(OutputStream out) {
- this.out = out;
- }
-
- public void setErrorStream(OutputStream err) {
- this.err = err;
- }
-
- public void setExitCallback(ExitCallback callback) {
- this.callback = callback;
- }
-
- public void start(Environment env) throws IOException {
- File tmpFile = File.createTempFile("wagon", "test-sh");
- tmpFile.deleteOnExit();
- int exitValue = 0;
- CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
- CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
- try {
-
- // hackhish defaut commandline tools not support ; or && so write a file with the script
- // and "/bin/sh -e " + tmpFile.getPath();
- FileUtils.fileWrite(tmpFile, commandLine);
-
- Commandline cl = new Commandline();
- cl.setExecutable("/bin/sh");
- // cl.createArg().setValue( "-e" );
- // cl.createArg().setValue( tmpFile.getPath() );
- cl.createArg().setFile(tmpFile);
-
- exitValue = CommandLineUtils.executeCommandLine(cl, stdout, stderr);
- System.out.println("exit value " + exitValue);
- /*
- if ( exitValue == 0 )
- {
- out.write( stdout.getOutput().getBytes() );
- out.write( '\n' );
- out.flush();
-
- }
- else
- {
- out.write( stderr.getOutput().getBytes() );
- out.write( '\n' );
- out.flush();
-
- }*/
-
- } catch (Exception e) {
- exitValue = ERROR;
- e.printStackTrace();
- } finally {
- deleteQuietly(tmpFile);
- if (exitValue != 0) {
- err.write(stderr.getOutput().getBytes());
- err.write('\n');
- err.flush();
- callback.onExit(exitValue, stderr.getOutput());
- } else {
- out.write(stdout.getOutput().getBytes());
- out.write('\n');
- out.flush();
- callback.onExit(exitValue, stdout.getOutput());
- }
- }
- /*
- out.write( exitValue );
- out.write( '\n' );
-
- */
- out.flush();
- }
-
- public void destroy() {}
-
- private void deleteQuietly(File f) {
-
- try {
- f.delete();
- } catch (Exception e) {
- // ignore
- }
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/SshServerEmbedded.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/SshServerEmbedded.java
deleted file mode 100644
index b0334cc3..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/SshServerEmbedded.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.mina.core.session.IoSession;
-import org.apache.sshd.SshServer;
-import org.apache.sshd.common.Session;
-import org.apache.sshd.common.session.AbstractSession;
-import org.apache.sshd.server.Command;
-import org.apache.sshd.server.CommandFactory;
-import org.apache.sshd.server.FileSystemFactory;
-import org.apache.sshd.server.FileSystemView;
-import org.apache.sshd.server.PasswordAuthenticator;
-import org.apache.sshd.server.SshFile;
-import org.apache.sshd.server.auth.UserAuthPassword;
-import org.apache.sshd.server.auth.UserAuthPublicKey;
-import org.apache.sshd.server.filesystem.NativeSshFile;
-import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider;
-import org.apache.sshd.server.session.SessionFactory;
-import org.apache.sshd.server.shell.ProcessShellFactory;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * @author Olivier Lamy
- */
-public class SshServerEmbedded {
- private String wagonProtocol;
-
- private int port;
-
- private SshServer sshd;
-
- private List<String> sshKeysResources = new ArrayList<>();
-
- private TestPublickeyAuthenticator publickeyAuthenticator;
-
- TestPasswordAuthenticator passwordAuthenticator = new TestPasswordAuthenticator();
-
- private boolean keyAuthz;
-
- /**
- * @param wagonProtocol scp scpexe
- * @param sshKeysResources paths in the classlaoder with ssh keys
- */
- public SshServerEmbedded(String wagonProtocol, List<String> sshKeysResources, boolean keyAuthz) {
- this.wagonProtocol = wagonProtocol;
-
- this.sshKeysResources = sshKeysResources;
-
- this.sshd = SshServer.setUpDefaultServer();
-
- // this.sshd.setKeyExchangeFactories( );
-
- this.keyAuthz = keyAuthz;
-
- publickeyAuthenticator = new TestPublickeyAuthenticator(this.keyAuthz);
- }
-
- /**
- * @return random port used
- */
- public int start() throws IOException {
- sshd.setPort(0);
-
- sshd.setUserAuthFactories(Arrays.asList(new UserAuthPublicKey.Factory(), new UserAuthPassword.Factory()));
-
- sshd.setPublickeyAuthenticator(this.publickeyAuthenticator);
-
- sshd.setPasswordAuthenticator(this.passwordAuthenticator);
-
- sshd.setUserAuthFactories(Arrays.asList(new UserAuthPublicKey.Factory(), new UserAuthPassword.Factory()));
-
- // ResourceKeyPairProvider resourceKeyPairProvider =
- // new ResourceKeyPairProvider( sshKeysResources.toArray( new String[sshKeysResources.size()] ) );
-
- File path = new File("target/keys");
- path.mkdirs();
- path = new File(path, "simple.key");
- path.delete();
-
- PEMGeneratorHostKeyProvider provider = new PEMGeneratorHostKeyProvider();
- provider.setAlgorithm("RSA");
- provider.setKeySize(1024);
- provider.setPath(path.getPath());
-
- sshd.setKeyPairProvider(provider);
- SessionFactory sessionFactory = new SessionFactory() {
- @Override
- protected AbstractSession doCreateSession(IoSession ioSession) throws Exception {
- return super.doCreateSession(ioSession);
- }
- };
- sshd.setSessionFactory(sessionFactory);
-
- // sshd.setFileSystemFactory( );
-
- final ProcessShellFactory processShellFactory = new ProcessShellFactory(new String[] {"/bin/sh", "-i", "-l"});
- sshd.setShellFactory(processShellFactory);
-
- CommandFactory delegateCommandFactory = new CommandFactory() {
- public Command createCommand(String command) {
- return new ShellCommand(command);
- }
- };
-
- ScpCommandFactory commandFactory = new ScpCommandFactory(delegateCommandFactory);
- sshd.setCommandFactory(commandFactory);
-
- FileSystemFactory fileSystemFactory = new FileSystemFactory() {
- public FileSystemView createFileSystemView(Session session) throws IOException {
- return new FileSystemView() {
- public SshFile getFile(String file) {
- file = file.replace("\\", "");
- file = file.replace("\"", "");
- File f = new File(FileUtils.normalize(file));
-
- return new SshServerEmbedded.TestSshFile(
- f.getAbsolutePath(), f, System.getProperty("user.name"));
- }
-
- public SshFile getFile(SshFile baseDir, String file) {
- file = file.replace("\\", "");
- file = file.replace("\"", "");
- File f = new File(FileUtils.normalize(file));
- return new SshServerEmbedded.TestSshFile(
- f.getAbsolutePath(), f, System.getProperty("user.name"));
- }
- };
- }
- };
- sshd.setNioWorkers(0);
- // sshd.setScheduledExecutorService( );
- sshd.setFileSystemFactory(fileSystemFactory);
- sshd.start();
- this.port = sshd.getPort();
- return this.port;
- }
-
- public void stop() throws InterruptedException {
- sshd.stop(Boolean.getBoolean("sshd.stopImmediatly"));
- }
-
- public int getPort() {
- return port;
- }
-
- public PasswordAuthenticator getPasswordAuthenticator() {
- return passwordAuthenticator;
- }
- /**
- *
- */
- public static class TestSshFile extends NativeSshFile {
- public TestSshFile(String fileName, File file, String userName) {
-
- super(FileUtils.normalize(fileName), file, userName);
- }
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestData.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestData.java
deleted file mode 100644
index 72bd9302..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestData.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * @author <a href="michal@codehaus.org">Michal Maczka</a>
- *
- */
-public class TestData {
- public static String getTempDirectory() {
- return System.getProperty("java.io.tmpdir", "target");
- }
-
- public static String getTestRepositoryUrl(int port) {
- return "scp://" + getHostname() + ":" + port + getRepoPath();
- }
-
- public static String getTestRepositoryUrl() {
- return "scp://" + getHostname() + getRepoPath();
- }
-
- public static String getRepoPath() {
- return getTempDirectory() + "/wagon-ssh-test/" + getUserName();
- }
-
- public static String getUserName() {
- return System.getProperty("test.user", System.getProperty("user.name"));
- }
-
- public static String getUserPassword() {
- return "comeonFrance!:-)";
- }
-
- public static File getPrivateKey() {
- return new File(System.getProperty("sshKeysPath", "src/test/ssh-keys"), "id_rsa");
- }
-
- public static String getHostname() {
- return System.getProperty("test.host", "localhost");
- }
-
- public static String getHostKey() {
- try {
- return FileUtils.fileRead(new File(System.getProperty("sshKeysPath"), "id_rsa.pub").getPath())
- .substring("ssh-rsa".length())
- .trim();
- } catch (IOException e) {
- return null;
- }
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestPasswordAuthenticator.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestPasswordAuthenticator.java
deleted file mode 100644
index b25f64f4..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestPasswordAuthenticator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.sshd.server.PasswordAuthenticator;
-import org.apache.sshd.server.session.ServerSession;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * @author Olivier Lamy
- */
-public class TestPasswordAuthenticator implements PasswordAuthenticator {
- List<PasswordAuthenticatorRequest> requests = new ArrayList<>();
-
- public boolean authenticate(String username, String password, ServerSession session) {
- requests.add(new PasswordAuthenticatorRequest(username, password));
- return StringUtils.equals(username, TestData.getUserName())
- && StringUtils.equals(password, TestData.getUserPassword());
- }
-
- /**
- *
- */
- public static class PasswordAuthenticatorRequest {
- private String username;
-
- private String password;
-
- public PasswordAuthenticatorRequest(String username, String password) {
- this.username = username;
- this.password = password;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("PasswordAuthenticatorRequest");
- sb.append("{username='").append(username).append('\'');
- sb.append(", password='").append(password).append('\'');
- sb.append('}');
- return sb.toString();
- }
-
- public String getUsername() {
- return username;
- }
-
- public String getPassword() {
- return password;
- }
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestPublickeyAuthenticator.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestPublickeyAuthenticator.java
deleted file mode 100644
index e77bef72..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/TestPublickeyAuthenticator.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import javax.crypto.Cipher;
-
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.security.KeyFactory;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.DSAPublicKeySpec;
-import java.security.spec.RSAPublicKeySpec;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.mina.util.Base64;
-import org.apache.sshd.server.PublickeyAuthenticator;
-import org.apache.sshd.server.session.ServerSession;
-import org.codehaus.plexus.util.IOUtil;
-
-/**
- * @author Olivier Lamy
- */
-public class TestPublickeyAuthenticator implements PublickeyAuthenticator {
- private List<PublickeyAuthenticatorRequest> publickeyAuthenticatorRequests = new ArrayList<>();
-
- private boolean keyAuthz;
-
- public TestPublickeyAuthenticator(boolean keyAuthz) {
- this.keyAuthz = keyAuthz;
- }
-
- public boolean authenticate(String username, PublicKey key, ServerSession session) {
- if (!keyAuthz) {
- return false;
- }
- InputStream in = null;
- try {
- in = Thread.currentThread().getContextClassLoader().getResourceAsStream("ssh-keys/id_rsa.pub");
- PublicKey publicKey = decodePublicKey(IOUtil.toString(in));
- in.close();
- in = null;
-
- publickeyAuthenticatorRequests.add(new PublickeyAuthenticatorRequest(username, key));
-
- return ((RSAPublicKey) publicKey).getModulus().equals(((RSAPublicKey) publicKey).getModulus());
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage(), e);
- } finally {
- IOUtil.close(in);
- }
- }
-
- public static byte[] decrypt(byte[] text, PrivateKey key) throws Exception {
- byte[] dectyptedText = null;
- Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
- cipher.init(Cipher.DECRYPT_MODE, key);
- dectyptedText = cipher.doFinal(text);
- return dectyptedText;
- }
-
- /**
- *
- */
- public static class PublickeyAuthenticatorRequest {
- private String username;
-
- private PublicKey publicKey;
-
- public PublickeyAuthenticatorRequest(String username, PublicKey publicKey) {
- this.username = username;
- this.publicKey = publicKey;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("PublickeyAuthenticatorRequest");
- sb.append("{username='").append(username).append('\'');
- sb.append(", publicKey=").append(publicKey);
- sb.append('}');
- return sb.toString();
- }
- }
-
- private byte[] bytes;
-
- private int pos;
-
- public PublicKey decodePublicKey(String keyLine) throws Exception {
- bytes = null;
- pos = 0;
-
- for (String part : keyLine.split(" ")) {
- if (part.startsWith("AAAA")) {
- bytes = Base64.decodeBase64(part.getBytes());
- break;
- }
- }
- if (bytes == null) {
- throw new IllegalArgumentException("no Base64 part to decode");
- }
-
- String type = decodeType();
- if (type.equals("ssh-rsa")) {
- BigInteger e = decodeBigInt();
- BigInteger m = decodeBigInt();
- RSAPublicKeySpec spec = new RSAPublicKeySpec(m, e);
- return KeyFactory.getInstance("RSA").generatePublic(spec);
- } else if (type.equals("ssh-dss")) {
- BigInteger p = decodeBigInt();
- BigInteger q = decodeBigInt();
- BigInteger g = decodeBigInt();
- BigInteger y = decodeBigInt();
- DSAPublicKeySpec spec = new DSAPublicKeySpec(y, p, q, g);
- return KeyFactory.getInstance("DSA").generatePublic(spec);
- } else {
- throw new IllegalArgumentException("unknown type " + type);
- }
- }
-
- private String decodeType() {
- int len = decodeInt();
- String type = new String(bytes, pos, len);
- pos += len;
- return type;
- }
-
- private int decodeInt() {
- // CHECKSTYLE_OFF: MagicNumber
- return ((bytes[pos++] & 0xFF) << 24)
- | ((bytes[pos++] & 0xFF) << 16)
- | ((bytes[pos++] & 0xFF) << 8)
- | (bytes[pos++] & 0xFF);
- // CHECKSTYLE_ON: MagicNumber
- }
-
- private BigInteger decodeBigInt() {
- int len = decodeInt();
- byte[] bigIntBytes = new byte[len];
- System.arraycopy(bytes, pos, bigIntBytes, 0, len);
- pos += len;
- return new BigInteger(bigIntBytes);
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProviderTestCase.java b/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProviderTestCase.java
deleted file mode 100644
index 8616a187..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProviderTestCase.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.providers.ssh.SshWagon;
-import org.apache.maven.wagon.providers.ssh.TestData;
-import org.apache.maven.wagon.repository.Repository;
-import org.codehaus.plexus.PlexusTestCase;
-
-/**
- *
- */
-public class KnownHostsProviderTestCase extends PlexusTestCase {
- protected KnownHostsProvider okHostsProvider;
-
- protected KnownHostsProvider failHostsProvider;
-
- protected KnownHostsProvider changedHostsProvider;
-
- private SshWagon wagon;
-
- private Repository source;
-
- private static final String CORRECT_KEY = TestData.getHostKey();
-
- private static final String CHANGED_KEY =
- "AAAAB3NzaC1yc2EAAAABIwAAAQEA8VLKkfHl2CNqW+m0603z07dyweWzzdVGQlMPUX4z1264E7M/h+6lPKiOo+u49CL7eQVA+FtW"
- + "TZoJ3oBAMABcKnHx41TnSpQUkbdR6rzyC6IG1lXiVtEjG2w7DUnxpCtVo5PaQuJobwoXv5NNL3vx03THPgcDJquLPWvGnDWhnXoEh"
- + "3/6c7rprwT+PrjZ6LIT35ZCUGajoehhF151oNbFMQHllfR6EAiZIP0z0nIVI+Jiv6g+XZapumVPVYjdOfxvLKQope1H9HJamT3bDI"
- + "m8mkebUB10DzQJYxFt4/0wiNH3L4jsIFn+CiW1/IQm5yyff1CUO87OqVbtp9BlaXZNmw==";
-
- /**
- * tests what happens if the remote host has a different key than the one
- * we expect
- *
- * @throws Exception on error
- */
- public void testIncorrectKey() throws Exception {
- wagon.setKnownHostsProvider(failHostsProvider);
-
- try {
- wagon.connect(source);
-
- fail("Should not have successfully connected - host is not known");
- } catch (UnknownHostException e) {
- // ok
- }
- }
-
- /**
- * tests what happens if the remote host has changed since being recorded.
- *
- * @throws Exception on error
- */
- public void testChangedKey() throws Exception {
- wagon.setKnownHostsProvider(changedHostsProvider);
-
- try {
- wagon.connect(source);
-
- fail("Should not have successfully connected - host is changed");
- } catch (KnownHostChangedException e) {
- // ok
- }
- }
-
- /**
- * tests what happens if the remote host has the expected key
- *
- * @throws Exception on error
- */
- public void testCorrectKey() throws Exception {
- wagon.setKnownHostsProvider(okHostsProvider);
-
- wagon.connect(source);
-
- assertTrue(true);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- source = new Repository("test", "scp://" + TestData.getUserName() + "@" + TestData.getHostname() + "/tmp/foo");
-
- wagon = (SshWagon) lookup(Wagon.ROLE, "scp");
- wagon.setInteractive(false);
-
- this.okHostsProvider = new SingleKnownHostProvider(TestData.getHostname(), CORRECT_KEY);
- this.failHostsProvider = new SingleKnownHostProvider("beaver.codehaus.org", CORRECT_KEY);
- this.changedHostsProvider = new SingleKnownHostProvider(TestData.getHostname(), CHANGED_KEY);
- }
-}
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa b/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa
deleted file mode 100644
index 77e67c78..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAwWiNxXz9+12suPsElsR5w4S4+W3Omsfl0y6nPx5YPYIWP1tu
-AmwXbmtHFIc7PVKTTCgXgrA39wXQ2yXFcvtENhMVRdKvLsxOp0Go8SXGjFbtudBN
-/r+vIjG0uWXlpngx/QIovULIBt1unwoS3QHy7UQM134zaNteSZ/Xch/YFG3JS6p/
-BiCoSa5Z3ziV0SSwQb65iWxjd6BHtHUSpS91oIGcaPuHoXkW4yY0pyOmQxG6H6V5
-bGp7/+HhIsvdoip790aYfHd8IAFH0zlErA2PsOucrPz2+9ZWp/WGrPwnzo0EImnx
-Y5fKCvAlI+oyKfQSWpPmay267KiP+eRIwC0u5wIDAQABAoIBACF6R4/3or7v6AXc
-7V5rg+gkASCrsSd5kn6LhMeYKQ38hn1RBinFLAkg6JzVC5wBvx1fkzI77nQDvbMx
-Rowwkg4KH5SGc2xWUQcChou3TjbclSmktNtzsozora+pw6adB4oT5ZldBeKqUYuV
-4s3+mF4ZeV+TqLJtxlRYJqLKgEyIp05H2u0GstcquK5pEiwjINc7TvdhgSWRlU8F
-WO94h0i0sWyCVGpMkVSJjqKk+npHEs5Go/AIdu8w02B5BpZ7rUmsf41+phGt0gs9
-wKZXxifE6RWIjzmDzqJGsIME08z8xqi+H1zsBECTOt8uGNKhPcefZ/2/GzByRJ3y
-y2zT4gECgYEA5TTF2ApoBlZgxrz9bzIs5lyX+g+dZKuE6w2bQeL5Kn896ZUmWcma
-mvhwMcT/OIXs4mRMoYWOf/hemnx1zgQpyW+j8SPc0Qh5EYuzIaeS/yH4Kqi+jRGP
-mCANGLd5Lc0jUuomJDDTAtBB/36FNDq3c9Iphl+elUtQo9ahkAfHZ9cCgYEA2AR/
-WCjRjLIBB+o5sYQhBOCLWN7l6VWdGjNtrOdelMLBH3ulfykWjIBPZS4/NoL58OLa
-DqJWOwtPOULC8gU32zXP8Md+bJ58Nm+biGLjtzQSenJVajq6GneKIHh10vgDEMeA
-o8lwnzomfJwqUVNjPqYWQQ6mDc9ByGMAy4ErT3ECgYAmGaWhielM1GL15kiCiWap
-TE7/BEV3jINlxzc9tosQo2IZR+++ESMgC5gqzcJXFPwRjfanCtprL1AaggHbIxoH
-IAWyefGk1bG6VuyJ9Z8bxfvIq5AxRvAFq55Bs43zLRxoFgANGAibeR7fZ5qg2fnQ
-yOiaK57i1kgrU+w7Uu+0tQKBgHBtXs3GaNGeL1UsPZy7VOgR6dR2Jhjb+ykQzSsp
-PBuWhSbalpbpDphPi4Lwn+vCHU2W88CcEt8mErSNn6KQvrJzfmclnRHxJlq6matR
-NI08J8XczcG9EPEHeDdQGpqThBzuiHA2PkxQ2okOSiQLj2Ki1IBFnH0hem5NwLMp
-5h2xAoGBAJcWmlm8L8g7+f381xGnujkhBWK4MVKI1aIZGEq9UuaEMjm9J+I9Ili4
-S8dAcjX6OlpcAKf8nJEHOpSjCYrL8X/lRNdevLrrzsTXS6j8AgncmScyXlJMQb8J
-wXfHWW+UWsTeZF46Pkir0eGGmWQCWq7mRoB9QmlTcJ8ESiejxDfc
------END RSA PRIVATE KEY-----
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa-passphrase b/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa-passphrase
deleted file mode 100644
index bac86e5c..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa-passphrase
+++ /dev/null
@@ -1,30 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: AES-128-CBC,2F7CC6A20D25FED61F12C23469AC49DD
-
-ym47UX+S/eES57kPEAiC+8/LPYSIPPK0zzy8fp+rtnMaKvAgfoBScw5gV4u8d6nI
-cl9FSq+IYLrUZs3ojopWY7c1sCj/PD5TSxaHo9ZQWv+wRATNbwcF0aKcmJn0BOEQ
-f1AyPlMW4HIVm7N2+reUj0H6D7fJhdmyxvNj//DbIFYnR+arOgjfMsRmBpX7hBjG
-XOWG8GxIvFLmGHFn6zwmLq3FO4ojkab2bYjvoAathmdlHx1TZotcOdJmRxskCRL8
-4g1KTclZkth+jxhNecPbAQTcT2CLNphtv1lmitnsRfztIitUKo297m1qk5Qc/uYB
-ZAd5FXUxu8e6jZ5NgwYLPQveZhmLjCXBcejwFXhJPWjld+XYHtnEJm5cevZtSUhj
-E+1/jXrfsJF65uMH2mZYqLL+i8EllUS3wxP6xUoK6NwQfnrfIaFfDwwT6q8+vqmo
-wDmfg144Eu4ARoU1QMnQuFBxMShU/9HXBlyVhVsPBmfu27y9+cX9+aN3A9+1h3TB
-qfMOYMwDxOB+8hbbC5NbMr3jDGwS4IxR+kEaKV7XRKYs2Bi7aefWbEumdEuu3zKQ
-bgfi//Ias7FfwB9UbFY6RCJlnjihxCj0lwkVcj8LpK9AjxALQYmcRhCFfEvpMHC7
-HP1bGjIzmtHppvvK7Q5eKpjVWFG36Jh8IefpAywJbpJ7HBN2gFfsop3zQHo33LLp
-2I//Dz5n2iw+S5z8fPOOrZAZIZZpkxDepYXHsVEZ3lXQCxzAyx44RCMRlAEvAdFK
-XjlhO4VMUtfZ3JzOhni5qgUX61Z0+0oeh4pf+zxDH+UVNJmwPX4zWkDWyEWVO7Uj
-bIIZ/GU4obm5pTsX/0C/m3nFS1ZJKaE9A5/XaCTrF+LVhgj/cWKC3mfLRi86ohp9
-vU1vz+ASNJEenPavh0j12B+mz+MLQVk+fWk3EGIURwHHg1Cq0I/dmA8iIcvBTVQl
-nGKEwbGsLNbYE4YgxNuHPwJQ7nC414464kwCwt8myAOITUYi2pxePE5ZBo8b9Eyy
-s2vj5sXqj6tcbrmsBWGeTyH9WRwpFLy3Tbx8ntayuFd5fq0xc+3G74O8UgZP2Feo
-5EnPH+2kcU8E5+Lo9J4NzA3jblonKwCkR+13WgGuPJaLnSVQZn0m1sHll2UF2d6X
-/yCx+Knf8q7IU7lyK2JfpvGuNLfBfTCMFoOXgZvFo9MDUAgLluWXlH3BfekDtRlJ
-S2/x6tCrRwrtj9M+1ZNFU5Tr0gr6MtbVvIKtiP92XPmTGt8Z/8oLqcA5ioh+0sV1
-eolIGseUN5RRKfOfUqa3w0w6h0HRs26eG6x5gsdIZgT5yIEW2/tAQVyZTMRB/LYp
-8G1tCmpS+LQl/P1WcYIuALk0fqDYreAwFbqwKziTI+Grx7ir5nmGRdg4FTir4sbR
-FWOHWzJMjOaktTesiQQOip6o7lUy5Iy7mkeVRfWF9HYthlC8X9Em7S8gO8cjz7LY
-WxHmUuBX62Giw6Cxb+qxIIoNNWn134ncMtgBi3y+QqUpnGYtohnfQWlxtFzreoRY
-3CW0re+xpuFy8jAeIyA2hT8vyhLD0JA0hcdXTK+C+Rx12rtcBtQ6vaY73DpKggb4
------END RSA PRIVATE KEY-----
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa-passphrase.pub b/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa-passphrase.pub
deleted file mode 100644
index b0b30074..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa-passphrase.pub
+++ /dev/null
@@ -1 +0,0 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyGiWZ51dqd43eF0epQshEZAW0U7IpRh/lMjMJQ5PImcee6xKpj0jGdLxjatUZANtK3sfInwak/CiFaq+PthqxnyHgrFGxoNUEi9OPOLNfgLX80Kod1daavLoEfrrOs3JDYHqxfhZJ7ZGk13x8wvQYBO2p4BZ4JYDcfPvGTbx9KMbOCNOvw4BmVxDV/IRYXGDsYnhbAsybxtncL/7EuHumQ/gHCYXTFl/xE8yL3ZkgWlX+r/QUekSMxb3XK1Zw4r7Hbvkq/B+DeJE0nQ8jbDNQo1SpHbof1DHVY5L2DZlwQt5B8lvc1aevdFJxx9QdjPEKHjBwIjcuqFFyTqTcshZl guest@bashae
diff --git a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa.pub b/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa.pub
deleted file mode 100644
index c6f648d9..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/main/resources/ssh-keys/id_rsa.pub
+++ /dev/null
@@ -1 +0,0 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBaI3FfP37Xay4+wSWxHnDhLj5bc6ax+XTLqc/Hlg9ghY/W24CbBdua0cUhzs9UpNMKBeCsDf3BdDbJcVy+0Q2ExVF0q8uzE6nQajxJcaMVu250E3+v68iMbS5ZeWmeDH9Aii9QsgG3W6fChLdAfLtRAzXfjNo215Jn9dyH9gUbclLqn8GIKhJrlnfOJXRJLBBvrmJbGN3oEe0dRKlL3WggZxo+4eheRbjJjSnI6ZDEbofpXlsanv/4eEiy92iKnv3Rph8d3wgAUfTOUSsDY+w65ys/Pb71lan9Yas/CfOjQQiafFjl8oK8CUj6jIp9BJak+ZrLbrsqI/55EjALS7n guest@bashae
\ No newline at end of file
diff --git a/wagon-providers/wagon-ssh-common-test/src/site/site.xml b/wagon-providers/wagon-ssh-common-test/src/site/site.xml
deleted file mode 100644
index d7505f2b..00000000
--- a/wagon-providers/wagon-ssh-common-test/src/site/site.xml
+++ /dev/null
@@ -1,33 +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/DECORATION/1.3.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
- <body>
- <breadcrumbs>
- <item name="SSH Common Test" href="./index.html" />
- </breadcrumbs>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
diff --git a/wagon-providers/wagon-ssh-common/pom.xml b/wagon-providers/wagon-ssh-common/pom.xml
deleted file mode 100644
index a2312f8f..00000000
--- a/wagon-providers/wagon-ssh-common/pom.xml
+++ /dev/null
@@ -1,54 +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.wagon</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>4.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>wagon-ssh-common</artifactId>
- <name>Apache Maven Wagon :: Providers :: SSH Common Library</name>
-
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-interactivity-api</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java
deleted file mode 100644
index 94f8d431..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/CommandExecutorStreamProcessor.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-/*
- * 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.BufferedReader;
-import java.io.IOException;
-
-import org.apache.maven.wagon.Streams;
-
-/**
- * CommandExecutorStreamProcessor
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class CommandExecutorStreamProcessor {
- private CommandExecutorStreamProcessor() {
- // shoo!
- }
-
- public static Streams processStreams(BufferedReader stderrReader, BufferedReader stdoutReader) throws IOException {
- Streams streams = new Streams();
- while (true) {
- String line = stdoutReader.readLine();
-
- if (line == null) {
- break;
- }
-
- streams.setOut(streams.getOut() + line + "\n");
- }
-
- // drain the output stream.
- // TODO: we'll save this for the 1.0-alpha-8 line, so we can test it more. the -q arg in the
- // unzip command should keep us until then...
- // int avail = in.available();
- // byte[] trashcan = new byte[1024];
- //
- // while( ( avail = in.available() ) > 0 )
- // {
- // in.read( trashcan, 0, avail );
- // }
-
- // drain stderr next, if stream size is more than the allowed buffer size
- // ( ie jsch has a hardcoded 32K size), the remote shell may be blocked. See WAGON-431
- while (true) {
- String line = stderrReader.readLine();
-
- if (line == null) {
- break;
- }
-
- // TODO: I think we need to deal with exit codes instead, but IIRC there are some cases of errors that
- // don't have exit codes ignore this error. TODO: output a warning
- if (!line.startsWith("Could not chdir to home directory")
- && !line.endsWith("ttyname: Operation not supported")) {
- streams.setErr(streams.getErr() + line + "\n");
- }
- }
-
- return streams;
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/LSParser.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/LSParser.java
deleted file mode 100644
index 1c194aea..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/LSParser.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.maven.wagon.TransferFailedException;
-
-/**
- * Parser for the output of <code>ls</code> command from any ssh server on any OS.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class LSParser {
- /**
- * output samples see LSParserTest:
- * <ul></ul>
- * <li>osx "-rw-r--r-- 1 joakim joakim 1194 Dec 11 09:25 pom.xml"</li>
- * <li>osx fr : "-rw-r--r-- 1 olamy staff 19 21 sep 00:34 more-resources.dat"</li>
- * <li>cygwin : "drwxr-xr-x+ 5 joakim None 0 Dec 11 10:30 pom.xml"</li>
- * <li>linux : "-rw-r--r-- 1 joakim joakim 1194 2006-12-11 09:25 pom.xml"</li>
- * </ul>
- */
- private static final Pattern PATTERN = Pattern.compile(".+\\s+[0-9]+\\s+.+\\s+.+\\s+[0-9]+\\s+"
- // 2006-12-11
- + "([0-9]{4}-[0-9]{2}-[0-9]{2}"
- // Dec 11
- + "|.+\\s+[0-9]+"
- // 21 sep
- + "|.+\\s+.+)"
- // 09:25 pom.xml
- + "\\s+[0-9:]+\\s+(.+?)");
-
- /**
- * Parse a raw "ls -FlA", and obtain the list of files.
- *
- * @param rawLS the raw LS to parse.
- * @return the list of files found.
- * @throws TransferFailedException
- * @todo use ls -1a and do away with the method all together
- */
- public List<String> parseFiles(String rawLS) throws TransferFailedException {
- List<String> ret = new ArrayList<>();
- try {
- BufferedReader br = new BufferedReader(new StringReader(rawLS));
-
- String line = br.readLine();
-
- while (line != null) {
- line = line.trim();
-
- Matcher m = PATTERN.matcher(line);
- if (m.matches()) {
- ret.add(m.group(2));
- }
- line = br.readLine();
- }
- } catch (IOException e) {
- throw new TransferFailedException("Error parsing file listing.", e);
- }
-
- return ret;
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/ScpHelper.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/ScpHelper.java
deleted file mode 100644
index 7d691cbc..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/ScpHelper.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.maven.wagon.CommandExecutionException;
-import org.apache.maven.wagon.CommandExecutor;
-import org.apache.maven.wagon.PathUtils;
-import org.apache.maven.wagon.PermissionModeUtils;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.Streams;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.apache.maven.wagon.resource.Resource;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * Scp helper for general algorithms on ssh server.
- * See {@link #putDirectory(Wagon, File, String) putDirectory(...)} for more info on bulk directory upload.
- */
-public class ScpHelper {
- public static final char PATH_SEPARATOR = '/';
-
- public static final int DEFAULT_SSH_PORT = 22;
-
- private final CommandExecutor executor;
-
- public ScpHelper(CommandExecutor executor) {
- this.executor = executor;
- }
-
- public static String getResourceDirectory(String resourceName) {
- String dir = PathUtils.dirname(resourceName);
- dir = StringUtils.replace(dir, "\\", "/");
- return dir;
- }
-
- public static String getResourceFilename(String r) {
- String filename;
- if (r.lastIndexOf(PATH_SEPARATOR) > 0) {
- filename = r.substring(r.lastIndexOf(PATH_SEPARATOR) + 1);
- } else {
- filename = r;
- }
- return filename;
- }
-
- public static Resource getResource(String resourceName) {
- String r = StringUtils.replace(resourceName, "\\", "/");
- return new Resource(r);
- }
-
- public static File getPrivateKey(AuthenticationInfo authenticationInfo) throws FileNotFoundException {
- // If user don't define a password, he want to use a private key
- File privateKey = null;
- if (authenticationInfo.getPassword() == null) {
-
- if (authenticationInfo.getPrivateKey() != null) {
- privateKey = new File(authenticationInfo.getPrivateKey());
- if (!privateKey.exists()) {
- throw new FileNotFoundException("Private key '" + privateKey + "' not found");
- }
- } else {
- privateKey = findPrivateKey();
- }
-
- if (privateKey != null && privateKey.exists()) {
- if (authenticationInfo.getPassphrase() == null) {
- authenticationInfo.setPassphrase("");
- }
- }
- }
- return privateKey;
- }
-
- private static File findPrivateKey() {
- String privateKeyDirectory = System.getProperty("wagon.privateKeyDirectory");
-
- if (privateKeyDirectory == null) {
- privateKeyDirectory = System.getProperty("user.home");
- }
-
- File privateKey = new File(privateKeyDirectory, ".ssh/id_dsa");
-
- if (!privateKey.exists()) {
- privateKey = new File(privateKeyDirectory, ".ssh/id_rsa");
- if (!privateKey.exists()) {
- privateKey = null;
- }
- }
-
- return privateKey;
- }
-
- public static void createZip(List<String> files, File zipName, File basedir) throws IOException {
- ZipOutputStream zos = null;
- try {
- zos = new ZipOutputStream(new FileOutputStream(zipName));
-
- for (String file : files) {
- file = file.replace('\\', '/');
-
- writeZipEntry(zos, new File(basedir, file), file);
- }
-
- zos.close();
- zos = null;
- } finally {
- IOUtil.close(zos);
- }
- }
-
- private static void writeZipEntry(ZipOutputStream jar, File source, String entryName) throws IOException {
- byte[] buffer = new byte[1024];
-
- int bytesRead;
-
- FileInputStream is = new FileInputStream(source);
-
- try {
- ZipEntry entry = new ZipEntry(entryName);
-
- jar.putNextEntry(entry);
-
- while ((bytesRead = is.read(buffer)) != -1) {
- jar.write(buffer, 0, bytesRead);
- }
- } finally {
- is.close();
- }
- }
-
- protected static String getPath(String basedir, String dir) {
- String path;
- path = basedir;
- if (!basedir.endsWith("/") && !dir.startsWith("/")) {
- path += "/";
- }
- path += dir;
- return path;
- }
-
- /**
- * Put a whole directory content, by transferring a unique zip file and uncompressing it
- * on the target ssh server with <code>unzip</code> command.
- */
- public void putDirectory(Wagon wagon, File sourceDirectory, String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- Repository repository = wagon.getRepository();
-
- String basedir = repository.getBasedir();
-
- String destDir = StringUtils.replace(destinationDirectory, "\\", "/");
-
- String path = getPath(basedir, destDir);
- try {
- if (repository.getPermissions() != null) {
- String dirPerms = repository.getPermissions().getDirectoryMode();
-
- if (dirPerms != null) {
- String umaskCmd = "umask " + PermissionModeUtils.getUserMaskFor(dirPerms);
- executor.executeCommand(umaskCmd);
- }
- }
-
- // String mkdirCmd = "mkdir -p " + path;
- String mkdirCmd = "mkdir -p \"" + path + "\"";
-
- executor.executeCommand(mkdirCmd);
- } catch (CommandExecutionException e) {
- throw new TransferFailedException("Error performing commands for file transfer", e);
- }
-
- File zipFile;
- try {
- zipFile = File.createTempFile("wagon", ".zip");
- zipFile.deleteOnExit();
-
- List<String> files = FileUtils.getFileNames(sourceDirectory, "**/**", "", false);
-
- createZip(files, zipFile, sourceDirectory);
- } catch (IOException e) {
- throw new TransferFailedException("Unable to create ZIP archive of directory", e);
- }
-
- wagon.put(zipFile, getPath(destDir, zipFile.getName()));
-
- try {
- // executor.executeCommand(
- // "cd " + path + "; unzip -q -o " + zipFile.getName() + "; rm -f " + zipFile.getName() );
- executor.executeCommand("cd \"" + path + "\"; unzip -q -o \"" + zipFile.getName() + "\"; rm -f \""
- + zipFile.getName() + "\"");
-
- zipFile.delete();
-
- RepositoryPermissions permissions = repository.getPermissions();
-
- if (permissions != null && permissions.getGroup() != null) {
- // executor.executeCommand( "chgrp -Rf " + permissions.getGroup() + " " + path );
- executor.executeCommand("chgrp -Rf " + permissions.getGroup() + " \"" + path + "\"");
- }
-
- if (permissions != null && permissions.getFileMode() != null) {
- // executor.executeCommand( "chmod -Rf " + permissions.getFileMode() + " " + path );
- executor.executeCommand("chmod -Rf " + permissions.getFileMode() + " \"" + path + "\"");
- }
- } catch (CommandExecutionException e) {
- throw new TransferFailedException("Error performing commands for file transfer", e);
- }
- }
-
- public List<String> getFileList(String destinationDirectory, Repository repository)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- try {
- String path = getPath(repository.getBasedir(), destinationDirectory);
- // Streams streams = executor.executeCommand( "ls -FlA " + path, false );
- Streams streams = executor.executeCommand("ls -FlA \"" + path + "\"", false);
-
- return new LSParser().parseFiles(streams.getOut());
- } catch (CommandExecutionException e) {
- if (e.getMessage().trim().endsWith("No such file or directory")) {
- throw new ResourceDoesNotExistException(e.getMessage().trim(), e);
- } else if (e.getMessage().trim().endsWith("Not a directory")) {
- throw new ResourceDoesNotExistException(e.getMessage().trim(), e);
- } else {
- throw new TransferFailedException("Error performing file listing.", e);
- }
- }
- }
-
- public boolean resourceExists(String resourceName, Repository repository)
- throws TransferFailedException, AuthorizationException {
- try {
- String path = getPath(repository.getBasedir(), resourceName);
- // executor.executeCommand( "ls " + path, false );
- executor.executeCommand("ls \"" + path + "\"");
-
- // Parsing of output not really needed. As a failed ls results in a
- // CommandExectionException on the 'ls' command.
-
- return true;
- } catch (CommandExecutionException e) {
- // Error? Then the 'ls' command failed. No such file found.
- return false;
- }
- }
-
- public void createRemoteDirectories(String path, RepositoryPermissions permissions)
- throws CommandExecutionException {
- String umaskCmd = null;
- if (permissions != null) {
- String dirPerms = permissions.getDirectoryMode();
-
- if (dirPerms != null) {
- umaskCmd = "umask " + PermissionModeUtils.getUserMaskFor(dirPerms);
- }
- }
-
- // String mkdirCmd = "mkdir -p " + path;
- String mkdirCmd = "mkdir -p \"" + path + "\"";
-
- if (umaskCmd != null) {
- mkdirCmd = umaskCmd + "; " + mkdirCmd;
- }
-
- executor.executeCommand(mkdirCmd);
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/SshWagon.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/SshWagon.java
deleted file mode 100644
index e9cefe2d..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/SshWagon.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
-
-/**
- * SshWagon - identifier for 100% java implementations of Ssh.
- *
- * NOTE: External or native ssh implementations cannot use this interface.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public interface SshWagon extends Wagon {
- void setKnownHostsProvider(KnownHostsProvider knownHostsProvider);
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/ConsoleInteractiveUserInfo.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/ConsoleInteractiveUserInfo.java
deleted file mode 100644
index ee1f3a99..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/ConsoleInteractiveUserInfo.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.interactive;
-
-import java.util.Arrays;
-
-import org.codehaus.plexus.components.interactivity.Prompter;
-import org.codehaus.plexus.components.interactivity.PrompterException;
-
-/**
- * Shows messages to System.out, and ask replies using an InputHandler
- *
- * @author Juan F. Codagnone
- * @since Sep 12, 2005
- *
- * @plexus.component role="org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo"
- * instantiation-strategy="per-lookup"
- */
-public class ConsoleInteractiveUserInfo implements InteractiveUserInfo {
- /**
- * @plexus.requirement role-hint="default"
- */
- private volatile Prompter prompter;
-
- public ConsoleInteractiveUserInfo() {}
-
- public ConsoleInteractiveUserInfo(Prompter prompter) {
- this.prompter = prompter;
- }
-
- /**
- * @see InteractiveUserInfo#promptYesNo(String)
- */
- public boolean promptYesNo(String message) {
- String ret;
- try {
- ret = prompter.prompt(message, Arrays.asList("yes", "no"));
- } catch (PrompterException e) {
- // no op
- ret = null;
- }
- return "yes".equalsIgnoreCase(ret);
- }
-
- /**
- * @see InteractiveUserInfo#showMessage(String)
- */
- public void showMessage(String message) {
- try {
- prompter.showMessage(message);
- } catch (PrompterException e) {
- // no op
- }
- }
-
- public String promptPassword(String message) {
- try {
- return prompter.promptForPassword(message);
- } catch (PrompterException e) {
- return null;
- }
- }
-
- public String promptPassphrase(String message) {
- return promptPassword(message);
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/InteractiveUserInfo.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/InteractiveUserInfo.java
deleted file mode 100644
index 7d42c012..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/InteractiveUserInfo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.interactive;
-
-/**
- * Interactive part for <code>UserInfo</code>
- *
- * @author Juan F. Codagnone
- * @see com.jcraft.jsch.UserInfo
- * @since Sep 12, 2005
- */
-public interface InteractiveUserInfo {
- String ROLE = InteractiveUserInfo.class.getName();
-
- boolean promptYesNo(String message);
-
- void showMessage(String message);
-
- String promptPassword(String message);
-
- String promptPassphrase(String message);
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/NullInteractiveUserInfo.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/NullInteractiveUserInfo.java
deleted file mode 100644
index a3c97d41..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/interactive/NullInteractiveUserInfo.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.interactive;
-
-/**
- * Dummy Implementation for <code>InteractiveUserInfo</code>, nice for
- * non-Interactive environments
- *
- * @author Juan F. Codagnone
- * @see org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo
- * @since Sep 12, 2005
- */
-public class NullInteractiveUserInfo implements InteractiveUserInfo {
- private final boolean promptYesNoResult;
-
- /**
- * @see #NullInteractiveUserInfo(boolean)
- */
- public NullInteractiveUserInfo() {
- this(false); // the safest value
- }
-
- /**
- * Creates a <code>NullInteractiveUserInfo</code> with a hardcoded
- * prompYesNo result
- *
- * @param promptYesNoResult the hardcoded result
- */
- public NullInteractiveUserInfo(final boolean promptYesNoResult) {
- this.promptYesNoResult = promptYesNoResult;
- }
-
- /**
- * @see InteractiveUserInfo#promptYesNo(java.lang.String)
- */
- public boolean promptYesNo(final String message) {
- return promptYesNoResult;
- }
-
- /**
- * @see InteractiveUserInfo#showMessage(java.lang.String)
- */
- public void showMessage(final String message) {
- // nothing to do
- }
-
- public String promptPassword(String message) {
- return null;
- }
-
- public String promptPassphrase(String message) {
- return null;
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
deleted file mode 100644
index 00e5a017..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/AbstractKnownHostsProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Common base for known hosts providers.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- *
- */
-public abstract class AbstractKnownHostsProvider implements KnownHostsProvider {
- /**
- * Valid values are ask, yes, no.
- *
- * @plexus.configuration default-value="ask"
- */
- private String hostKeyChecking = "ask";
-
- /**
- * the known hosts, in the openssh format
- */
- protected String contents;
-
- protected Set<KnownHostEntry> knownHosts = new HashSet<>();
-
- public void setHostKeyChecking(String hostKeyChecking) {
- this.hostKeyChecking = hostKeyChecking;
- }
-
- public String getHostKeyChecking() {
- return hostKeyChecking;
- }
-
- public String getContents() {
- return contents;
- }
-
- public void storeKnownHosts(String contents) throws IOException {}
-
- public void addKnownHost(KnownHostEntry knownHost) throws IOException {}
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java
deleted file mode 100644
index 3c757814..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Set;
-
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * Provides known hosts from a file
- *
- * @author Juan F. Codagnone
- * @since Sep 12, 2005
- *
- * @plexus.component role="org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider"
- * role-hint="file"
- * instantiation-strategy="per-lookup"
- */
-public class FileKnownHostsProvider extends StreamKnownHostsProvider {
- private final File file;
-
- /**
- * Creates the FileKnownHostsProvider.
- *
- * @param file the file that holds the known hosts, in the openssh format
- * @throws IOException
- */
- public FileKnownHostsProvider(File file) throws IOException {
- super(file.exists() ? (InputStream) new FileInputStream(file) : new ByteArrayInputStream("".getBytes()));
- this.file = file;
- }
-
- /**
- * Creates a FileKnownHostsProvider using as file openssh knwon_host
- *
- * @throws IOException
- * @see #FileKnownHostsProvider(File)
- */
- public FileKnownHostsProvider() throws IOException {
- this(new File(System.getProperty("user.home"), ".ssh/known_hosts"));
- }
-
- public void storeKnownHosts(String contents) throws IOException {
- Set<KnownHostEntry> hosts = this.loadKnownHosts(contents);
-
- if (!this.knownHosts.equals(hosts)) {
- file.getParentFile().mkdirs();
- FileUtils.fileWrite(file.getAbsolutePath(), contents);
- this.knownHosts = hosts;
- }
- }
-
- public void addKnownHost(KnownHostEntry knownHostEntry) throws IOException {
- if (!this.knownHosts.contains(knownHostEntry)) {
- String knownHost = knownHostEntry.getHostName() + " " + knownHostEntry.getKeyType() + " "
- + knownHostEntry.getKeyValue() + "\n";
- FileUtils.fileAppend(file.getAbsolutePath(), knownHost);
- }
- }
-
- public File getFile() {
- return file;
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostChangedException.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostChangedException.java
deleted file mode 100644
index 3040d8fd..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostChangedException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import org.apache.maven.wagon.authentication.AuthenticationException;
-
-/**
- * Exception related to known_host check failures.
- */
-public class KnownHostChangedException extends AuthenticationException {
- public KnownHostChangedException(String host, Throwable cause) {
- super("The host key was different to that in the known_hosts configuration for host: " + host, cause);
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostEntry.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostEntry.java
deleted file mode 100644
index c186bb24..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostEntry.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-/**
- *
- */
-public class KnownHostEntry {
-
- private String hostName;
-
- private String keyType;
-
- private String keyValue;
-
- public KnownHostEntry() {}
-
- public KnownHostEntry(String hostName, String keyType, String keyValue) {
- this.hostName = hostName;
- this.keyType = keyType;
- this.keyValue = keyValue;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public String getKeyType() {
- return keyType;
- }
-
- public void setKeyType(String keyType) {
- this.keyType = keyType;
- }
-
- public String getKeyValue() {
- return keyValue;
- }
-
- public void setKeyValue(String keyValue) {
- this.keyValue = keyValue;
- }
-
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((hostName == null) ? 0 : hostName.hashCode());
- result = prime * result + ((keyType == null) ? 0 : keyType.hashCode());
- result = prime * result + ((keyValue == null) ? 0 : keyValue.hashCode());
- return result;
- }
-
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
- return false;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- KnownHostEntry other = (KnownHostEntry) obj;
- if (hostName == null) {
- if (other.hostName != null) {
- return false;
- }
- } else if (!hostName.equals(other.hostName)) {
- return false;
- }
-
- if (keyType == null) {
- if (other.keyType != null) {
- return false;
- }
- } else if (!keyType.equals(other.keyType)) {
- return false;
- }
-
- if (keyValue == null) {
- if (other.keyValue != null) {
- return false;
- }
- } else if (!keyValue.equals(other.keyValue)) {
- return false;
- }
- return true;
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
deleted file mode 100644
index 67bf9d1c..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import java.io.IOException;
-
-/**
- * Provides a way to add Known Hosts fingerprints to the JSch transport
- *
- * @author Juan F. Codagnone
- * @since Sep 12, 2005
- */
-public interface KnownHostsProvider {
- String ROLE = KnownHostsProvider.class.getName();
-
- void storeKnownHosts(String contents) throws IOException;
-
- void addKnownHost(KnownHostEntry knownHost) throws IOException;
-
- void setHostKeyChecking(String hostKeyChecking);
-
- String getHostKeyChecking();
-
- String getContents();
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java
deleted file mode 100644
index 46248510..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-/**
- * Dummy <code>KnownHostsProvider</code>
- *
- * @author Juan F. Codagnone
- * @since Sep 12, 2005
- *
- * @plexus.component role="org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider"
- * role-hint="null"
- * instantiation-strategy="per-lookup"
- */
-public final class NullKnownHostProvider extends AbstractKnownHostsProvider {}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java
deleted file mode 100644
index 229b4e05..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-/**
- * Simple <code>KnownHostsProvider</code> with known wired values
- *
- * @plexus.component role="org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider"
- * role-hint="single"
- * instantiation-strategy="per-lookup"
- *
- * @author Juan F. Codagnone
- * @since Sep 12, 2005
- */
-public class SingleKnownHostProvider extends AbstractKnownHostsProvider {
- public SingleKnownHostProvider() {}
-
- /**
- * Creates the SingleKnownHostProvider.
- */
- public SingleKnownHostProvider(String host, String key) {
- this.contents = host + " ssh-rsa " + key + "\n";
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java
deleted file mode 100644
index 4706c454..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringOutputStream;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * Provides known hosts from a file
- *
- * @author Juan F. Codagnone
- * @since Sep 12, 2005
- */
-public class StreamKnownHostsProvider extends AbstractKnownHostsProvider {
-
- public StreamKnownHostsProvider(InputStream stream) throws IOException {
- try {
- StringOutputStream stringOutputStream = new StringOutputStream();
- IOUtil.copy(stream, stringOutputStream);
-
- stream.close();
- stream = null;
-
- this.contents = stringOutputStream.toString();
-
- this.knownHosts = this.loadKnownHosts(this.contents);
- } finally {
- IOUtil.close(stream);
- }
- }
-
- protected Set<KnownHostEntry> loadKnownHosts(String contents) throws IOException {
- Set<KnownHostEntry> hosts = new HashSet<>();
-
- BufferedReader br = new BufferedReader(new StringReader(contents));
-
- String line;
-
- do {
- line = br.readLine();
- if (line != null) {
- String tokens[] = StringUtils.split(line);
- if (tokens.length == 3) {
- hosts.add(new KnownHostEntry(tokens[0], tokens[1], tokens[2]));
- }
- }
-
- } while (line != null);
-
- return hosts;
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/UnknownHostException.java b/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/UnknownHostException.java
deleted file mode 100644
index 0c55eaf6..00000000
--- a/wagon-providers/wagon-ssh-common/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/UnknownHostException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import org.apache.maven.wagon.authentication.AuthenticationException;
-
-/**
- * Exception related to known_host check failures.
- */
-public class UnknownHostException extends AuthenticationException {
- public UnknownHostException(String host, Throwable cause) {
- super("The host was not known and was not accepted by the configuration: " + host, cause);
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/site/site.xml b/wagon-providers/wagon-ssh-common/src/site/site.xml
deleted file mode 100644
index 66b967a5..00000000
--- a/wagon-providers/wagon-ssh-common/src/site/site.xml
+++ /dev/null
@@ -1,33 +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/DECORATION/1.3.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
- <body>
- <breadcrumbs>
- <item name="SSH Common" href="./index.html" />
- </breadcrumbs>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
diff --git a/wagon-providers/wagon-ssh-common/src/test/java/org/apache/maven/wagon/providers/ssh/LSParserTest.java b/wagon-providers/wagon-ssh-common/src/test/java/org/apache/maven/wagon/providers/ssh/LSParserTest.java
deleted file mode 100644
index 2f4541bc..00000000
--- a/wagon-providers/wagon-ssh-common/src/test/java/org/apache/maven/wagon/providers/ssh/LSParserTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh;
-
-import java.util.List;
-
-import junit.framework.TestCase;
-import org.apache.maven.wagon.TransferFailedException;
-
-public class LSParserTest extends TestCase {
- public void testParseLinux() throws TransferFailedException {
- String rawLS = "total 32\n" + "drwxr-xr-x 5 joakim joakim 4096 2006-12-11 10:30 .\n"
- + "drwxr-xr-x 14 joakim joakim 4096 2006-12-11 10:30 ..\n"
- + "-rw-r--r-- 1 joakim joakim 320 2006-12-09 18:46 .classpath\n"
- + "-rw-r--r-- 1 joakim joakim 1194 2006-12-11 09:25 pom.xml\n"
- + "-rw-r--r-- 1 joakim joakim 662 2006-12-09 18:46 .project\n"
- + "drwxr-xr-x 4 joakim joakim 4096 2006-11-21 12:26 src\n"
- + "drwxr-xr-x 4 joakim joakim 4096 2006-11-21 12:26 spaced out\n"
- + "drwxr-xr-x 7 joakim joakim 4096 2006-12-11 10:31 .svn\n"
- + "drwxr-xr-x 3 joakim joakim 4096 2006-12-11 08:39 target\n";
-
- LSParser parser = new LSParser();
- List<String> files = parser.parseFiles(rawLS);
- assertNotNull(files);
- assertEquals(9, files.size());
- assertTrue(files.contains("pom.xml"));
- assertTrue(files.contains("spaced out"));
- }
-
- public void testParseOSX() throws TransferFailedException {
- String rawLS = "total 32\n" + "drwxr-xr-x 5 joakim joakim 238 Dec 11 10:30 .\n"
- + "drwxr-xr-x 14 joakim joakim 518 Dec 11 10:30 ..\n"
- + "-rw-r--r-- 1 joakim joakim 320 May 9 2006 .classpath\n"
- + "-rw-r--r-- 1 joakim joakim 1194 Dec 11 09:25 pom.xml\n"
- + "-rw-r--r-- 1 joakim joakim 662 May 9 2006 .project\n"
- + "drwxr-xr-x 4 joakim joakim 204 Dec 11 12:26 src\n"
- + "drwxr-xr-x 4 joakim joakim 204 Dec 11 12:26 spaced out\n"
- + "drwxr-xr-x 7 joakim joakim 476 Dec 11 10:31 .svn\n"
- + "drwxr-xr-x 3 joakim joakim 238 Dec 11 08:39 target\n";
-
- LSParser parser = new LSParser();
- List<String> files = parser.parseFiles(rawLS);
- assertNotNull(files);
- assertEquals(9, files.size());
- assertTrue(files.contains("pom.xml"));
- assertTrue(files.contains("spaced out"));
- }
-
- public void testParseOSXFrLocale() throws TransferFailedException {
- String rawLS = "total 40\n" + "-rw-r--r-- 1 olamy staff 11 21 sep 00:34 .index.txt\n"
- + "-rw-r--r-- 1 olamy staff 19 21 sep 00:34 more-resources.dat\n"
- + "-rw-r--r-- 1 olamy staff 20 21 sep 00:34 test-resource b.txt\n"
- + "-rw-r--r-- 1 olamy staff 18 21 sep 00:34 test-resource.pom\n"
- + "-rw-r--r-- 1 olamy staff 18 21 sep 00:34 test-resource.txt\n";
-
- LSParser parser = new LSParser();
- List<String> files = parser.parseFiles(rawLS);
- assertNotNull(files);
- assertEquals(5, files.size());
- assertTrue(files.contains("more-resources.dat"));
- assertTrue(files.contains(".index.txt"));
- }
-
- public void testParseCygwin() throws TransferFailedException {
- String rawLS = "total 32\n" + "drwxr-xr-x+ 5 joakim None 0 Dec 11 10:30 .\n"
- + "drwxr-xr-x+ 14 joakim None 0 Dec 11 10:30 ..\n"
- + "-rw-r--r--+ 1 joakim None 320 May 9 2006 .classpath\n"
- + "-rw-r--r--+ 1 joakim None 1194 Dec 11 09:25 pom.xml\n"
- + "-rw-r--r--+ 1 joakim None 662 May 9 2006 .project\n"
- + "drwxr-xr-x+ 4 joakim None 0 Dec 11 12:26 src\n"
- + "drwxr-xr-x+ 4 joakim None 0 Dec 11 12:26 spaced out\n"
- + "drwxr-xr-x+ 7 joakim None 0 Dec 11 10:31 .svn\n"
- + "drwxr-xr-x+ 3 joakim None 0 Dec 11 08:39 target\n";
-
- LSParser parser = new LSParser();
- List<String> files = parser.parseFiles(rawLS);
- assertNotNull(files);
- assertEquals(9, files.size());
- assertTrue(files.contains("pom.xml"));
- assertTrue(files.contains("spaced out"));
- }
-
- /**
- * Snicoll, Jvanzyl, and Tom reported problems with wagon-ssh.getFileList().
- * Just adding a real-world example of the ls to see if it is a problem.
- * - Joakime
- */
- public void testParsePeopleApacheStaging() throws TransferFailedException {
- String rawLS = "total 6\n"
- + "drwxr-xr-x 3 snicoll snicoll 512 Feb 7 11:04 .\n"
- + "drwxr-xr-x 3 snicoll snicoll 512 Feb 7 11:04 ..\n"
- + "drwxr-xr-x 3 snicoll snicoll 512 Feb 7 11:04 org\n"
- + "drwxr-xr-x 3 snicoll snicoll 512 Feb 7 11:04 spaced out\n";
-
- LSParser parser = new LSParser();
- List<String> files = parser.parseFiles(rawLS);
- assertNotNull(files);
- assertEquals(4, files.size());
- assertTrue(files.contains("org"));
- assertTrue(files.contains("spaced out"));
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProviderTest.java b/wagon-providers/wagon-ssh-common/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProviderTest.java
deleted file mode 100644
index f1b919b0..00000000
--- a/wagon-providers/wagon-ssh-common/src/test/java/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProviderTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.knownhost;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-import org.codehaus.plexus.util.FileUtils;
-
-public class FileKnownHostsProviderTest extends TestCase {
- private File basedir = new File(System.getProperty("basedir", "."));
-
- private File testKnownHostsFile;
-
- private FileKnownHostsProvider provider;
-
- public void setUp() throws Exception {
- File readonlyKnownHostFile = new File(basedir, "src/test/resources/known_hosts");
- testKnownHostsFile = new File(basedir, "target/known_hosts");
- testKnownHostsFile.delete();
- FileUtils.copyFile(readonlyKnownHostFile, testKnownHostsFile);
- testKnownHostsFile.setLastModified(testKnownHostsFile.lastModified() - 60 * 1000);
-
- provider = new FileKnownHostsProvider(testKnownHostsFile);
- }
-
- public void testStoreKnownHostsNoChange() throws Exception {
- long timestamp = this.testKnownHostsFile.lastModified();
- // file with the same contents, but with entries swapped
- File sameKnownHostFile = new File(basedir, "src/test/resources/known_hosts_same");
- String contents = FileUtils.fileRead(sameKnownHostFile);
-
- provider.storeKnownHosts(contents);
- assertEquals("known_hosts file is rewritten", timestamp, testKnownHostsFile.lastModified());
- }
-
- public void testStoreKnownHostsWithChange() throws Exception {
- long timestamp = this.testKnownHostsFile.lastModified();
- File sameKnownHostFile = new File(basedir, "src/test/resources/known_hosts_same");
- String contents = FileUtils.fileRead(sameKnownHostFile);
- contents += "1 2 3";
-
- provider.storeKnownHosts(contents);
- assertTrue("known_hosts file is not rewritten", timestamp != testKnownHostsFile.lastModified());
- }
-}
diff --git a/wagon-providers/wagon-ssh-common/src/test/resources/known_hosts b/wagon-providers/wagon-ssh-common/src/test/resources/known_hosts
deleted file mode 100644
index 94501fa8..00000000
--- a/wagon-providers/wagon-ssh-common/src/test/resources/known_hosts
+++ /dev/null
@@ -1,2 +0,0 @@
-server,192.168.0.10 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtnWEbH/WTZG2aAl9gX8HtMqXidzQXgluARIOijWigbvA4/3N4fnNmckXBUHR32iqHQM/ySIRhc9EVDanDy0JyKdm738PwP0DbWGqiIDTtukbju4DAtXtOx3LgIqHc0PD+cquO9Ut/68o6/GdBgN18nVOMt+8Q9Vr1VSFqfHoLEx04NI+4BbGaGKQOFU25VJ3KtM0zkoyDfu0/MDusVoFIDVb0KtfxZVEDRmEFnySpFHOBdSdODsunftYccCNTNdsh+58jSqChUUlP3B0bTykm7o52CrXCMWCsLzH6dDkN7GUQwLvjPG04gedeZg6tEN8vTInRmHQrp0TTW7JGNjXgw==
-192.168.0.11 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtnWEbH/WTZG2aAl9gX8HtMqXidzQXgluARIOijWigbvA4/3N4fnNmckXBUHR32iqHQM/ySIRhc9EVDanDy0JyKdm738PwP0DbWGqiIDTtukbju4DAtXtOx3LgIqHc0PD+cquO9Ut/68o6/GdBgN18nVOMt+8Q9Vr1VSFqfHoLEx04NI+4BbGaGKQOFU25VJ3KtM0zkoyDfu0/MDusVoFIDVb0KtfxZVEDRmEFnySpFHOBdSdODsunftYccCNTNdsh+58jSqChUUlP3B0bTykm7o52CrXCMWCsLzH6dDkN7GUQwLvjPG04gedeZg6tEN8vTInRmHQrp0TTW7JGNjXgw==
diff --git a/wagon-providers/wagon-ssh-common/src/test/resources/known_hosts_same b/wagon-providers/wagon-ssh-common/src/test/resources/known_hosts_same
deleted file mode 100644
index 8eec884f..00000000
--- a/wagon-providers/wagon-ssh-common/src/test/resources/known_hosts_same
+++ /dev/null
@@ -1,2 +0,0 @@
-192.168.0.11 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtnWEbH/WTZG2aAl9gX8HtMqXidzQXgluARIOijWigbvA4/3N4fnNmckXBUHR32iqHQM/ySIRhc9EVDanDy0JyKdm738PwP0DbWGqiIDTtukbju4DAtXtOx3LgIqHc0PD+cquO9Ut/68o6/GdBgN18nVOMt+8Q9Vr1VSFqfHoLEx04NI+4BbGaGKQOFU25VJ3KtM0zkoyDfu0/MDusVoFIDVb0KtfxZVEDRmEFnySpFHOBdSdODsunftYccCNTNdsh+58jSqChUUlP3B0bTykm7o52CrXCMWCsLzH6dDkN7GUQwLvjPG04gedeZg6tEN8vTInRmHQrp0TTW7JGNjXgw==
-server,192.168.0.10 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtnWEbH/WTZG2aAl9gX8HtMqXidzQXgluARIOijWigbvA4/3N4fnNmckXBUHR32iqHQM/ySIRhc9EVDanDy0JyKdm738PwP0DbWGqiIDTtukbju4DAtXtOx3LgIqHc0PD+cquO9Ut/68o6/GdBgN18nVOMt+8Q9Vr1VSFqfHoLEx04NI+4BbGaGKQOFU25VJ3KtM0zkoyDfu0/MDusVoFIDVb0KtfxZVEDRmEFnySpFHOBdSdODsunftYccCNTNdsh+58jSqChUUlP3B0bTykm7o52CrXCMWCsLzH6dDkN7GUQwLvjPG04gedeZg6tEN8vTInRmHQrp0TTW7JGNjXgw==
diff --git a/wagon-providers/wagon-ssh-external/pom.xml b/wagon-providers/wagon-ssh-external/pom.xml
deleted file mode 100644
index c833bc1a..00000000
--- a/wagon-providers/wagon-ssh-external/pom.xml
+++ /dev/null
@@ -1,117 +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.wagon</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>4.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>wagon-ssh-external</artifactId>
- <name>Apache Maven Wagon :: Providers :: SSH External Provider</name>
- <description>Wagon provider that gets and puts artifacts using SSH protocol with a preinstalled SSH client</description>
-
- <properties>
- <sshd.stopImmediatly>false</sshd.stopImmediatly>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-common-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <profile>
- <id>no-ssh-tests</id>
- <activation>
- <property>
- <name>!ssh-tests</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- Tests that require an ssh server on localhost -->
- <excludes>
- <exclude>**/SshCommandExecutorTest.*</exclude>
- <exclude>**/Scp*Test.*</exclude>
- <exclude>**/EmbeddedScp*WagonWithKeyTest.*</exclude>
- </excludes>
- <systemPropertyVariables>
- <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
- <test.user>olamy</test.user>
- <sshd.stopImmediatly>${sshd.stopImmediatly}</sshd.stopImmediatly>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>ssh-embedded</id>
- <activation>
- <property>
- <name>ssh-embedded</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- Tests that require an ssh server on localhost -->
- <excludes>
- <exclude>**/SshCommandExecutorTest.*</exclude>
- <exclude>**/Scp*Test.*</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalCommandExecutor.java b/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalCommandExecutor.java
deleted file mode 100644
index 0d3567e5..00000000
--- a/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalCommandExecutor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.external;
-
-/**
- * ScpExternalCommandExecutor - bridge class for plexus:descriptor
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- *
- * @todo is this even needed anymore?
- *
- * @plexus.component role="org.apache.maven.wagon.CommandExecutor"
- * role-hint="scpexe"
- * instantiation-strategy="per-lookup"
- */
-public class ScpExternalCommandExecutor extends ScpExternalWagon {
-
- public ScpExternalCommandExecutor() {
- super();
- }
-}
diff --git a/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java b/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
deleted file mode 100644
index 0ab0cd29..00000000
--- a/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.external;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.maven.wagon.AbstractWagon;
-import org.apache.maven.wagon.CommandExecutionException;
-import org.apache.maven.wagon.CommandExecutor;
-import org.apache.maven.wagon.PathUtils;
-import org.apache.maven.wagon.PermissionModeUtils;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.Streams;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.providers.ssh.ScpHelper;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.apache.maven.wagon.resource.Resource;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.cli.CommandLineException;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-
-/**
- * SCP deployer using "external" scp program. To allow for
- * ssh-agent type behavior, until we can construct a Java SSH Agent and interface for JSch.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @todo [BP] add compression flag
- * @plexus.component role="org.apache.maven.wagon.Wagon"
- * role-hint="scpexe"
- * instantiation-strategy="per-lookup"
- */
-public class ScpExternalWagon extends AbstractWagon implements CommandExecutor {
- /**
- * The external SCP command to use - default is <code>scp</code>.
- *
- * @component.configuration default="scp"
- */
- private String scpExecutable = "scp";
-
- /**
- * The external SSH command to use - default is <code>ssh</code>.
- *
- * @component.configuration default="ssh"
- */
- private String sshExecutable = "ssh";
-
- /**
- * Arguments to pass to the SCP command.
- *
- * @component.configuration
- */
- private String scpArgs;
-
- /**
- * Arguments to pass to the SSH command.
- *
- * @component.configuration
- */
- private String sshArgs;
-
- private ScpHelper sshTool = new ScpHelper(this);
-
- private static final int SSH_FATAL_EXIT_CODE = 255;
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- protected void openConnectionInternal() throws AuthenticationException {
- if (authenticationInfo == null) {
- authenticationInfo = new AuthenticationInfo();
- }
- }
-
- public void closeConnection() {
- // nothing to disconnect
- }
-
- public boolean getIfNewer(String resourceName, File destination, long timestamp)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- fireSessionDebug("getIfNewer in SCP wagon is not supported - performing an unconditional get");
- get(resourceName, destination);
- return true;
- }
-
- /**
- * @return The hostname of the remote server prefixed with the username, which comes either from the repository URL
- * or from the authenticationInfo.
- */
- private String buildRemoteHost() {
- String username = this.getRepository().getUsername();
- if (username == null) {
- username = authenticationInfo.getUserName();
- }
-
- if (username == null) {
- return getRepository().getHost();
- } else {
- return username + "@" + getRepository().getHost();
- }
- }
-
- public void executeCommand(String command) throws CommandExecutionException {
- fireTransferDebug("Executing command: " + command);
-
- executeCommand(command, false);
- }
-
- public Streams executeCommand(String command, boolean ignoreFailures) throws CommandExecutionException {
- boolean putty = isPuTTY();
-
- File privateKey;
- try {
- privateKey = ScpHelper.getPrivateKey(authenticationInfo);
- } catch (FileNotFoundException e) {
- throw new CommandExecutionException(e.getMessage(), e);
- }
- Commandline cl = createBaseCommandLine(putty, sshExecutable, privateKey);
-
- int port =
- repository.getPort() == WagonConstants.UNKNOWN_PORT ? ScpHelper.DEFAULT_SSH_PORT : repository.getPort();
- if (port != ScpHelper.DEFAULT_SSH_PORT) {
- if (putty) {
- cl.createArg().setLine("-P " + port);
- } else {
- cl.createArg().setLine("-p " + port);
- }
- }
-
- if (sshArgs != null) {
- cl.createArg().setLine(sshArgs);
- }
-
- String remoteHost = this.buildRemoteHost();
-
- cl.createArg().setValue(remoteHost);
-
- cl.createArg().setValue(command);
-
- fireSessionDebug("Executing command: " + cl.toString());
-
- try {
- CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
- CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
- int exitCode = CommandLineUtils.executeCommandLine(cl, out, err);
- Streams streams = new Streams();
- streams.setOut(out.getOutput());
- streams.setErr(err.getOutput());
- fireSessionDebug(streams.getOut());
- fireSessionDebug(streams.getErr());
- if (exitCode != 0) {
- if (!ignoreFailures || exitCode == SSH_FATAL_EXIT_CODE) {
- throw new CommandExecutionException("Exit code " + exitCode + " - " + err.getOutput());
- }
- }
- return streams;
- } catch (CommandLineException e) {
- throw new CommandExecutionException("Error executing command line", e);
- }
- }
-
- protected boolean isPuTTY() {
- String exe = sshExecutable.toLowerCase(Locale.ENGLISH);
- return exe.contains("plink") || exe.contains("klink");
- }
-
- private Commandline createBaseCommandLine(boolean putty, String executable, File privateKey) {
- Commandline cl = new Commandline();
-
- cl.setExecutable(executable);
-
- if (privateKey != null) {
- cl.createArg().setValue("-i");
- cl.createArg().setFile(privateKey);
- }
-
- String password = authenticationInfo.getPassword();
- if (putty && password != null) {
- cl.createArg().setValue("-pw");
- cl.createArg().setValue(password);
- }
-
- // should check interactive flag, but scpexe never works in interactive mode right now due to i/o streams
- if (putty) {
- cl.createArg().setValue("-batch");
- } else {
- cl.createArg().setValue("-o");
- cl.createArg().setValue("BatchMode yes");
- }
- return cl;
- }
-
- private void executeScpCommand(Resource resource, File localFile, boolean put)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- boolean putty = isPuTTYSCP();
-
- File privateKey;
- try {
- privateKey = ScpHelper.getPrivateKey(authenticationInfo);
- } catch (FileNotFoundException e) {
- fireSessionConnectionRefused();
-
- throw new AuthorizationException(e.getMessage());
- }
- Commandline cl = createBaseCommandLine(putty, scpExecutable, privateKey);
-
- cl.setWorkingDirectory(localFile.getParentFile().getAbsolutePath());
-
- int port =
- repository.getPort() == WagonConstants.UNKNOWN_PORT ? ScpHelper.DEFAULT_SSH_PORT : repository.getPort();
- if (port != ScpHelper.DEFAULT_SSH_PORT) {
- cl.createArg().setLine("-P " + port);
- }
-
- if (scpArgs != null) {
- cl.createArg().setLine(scpArgs);
- }
-
- String resourceName = normalizeResource(resource);
- String remoteFile = getRepository().getBasedir() + "/" + resourceName;
-
- remoteFile = StringUtils.replace(remoteFile, " ", "\\ ");
-
- String qualifiedRemoteFile = this.buildRemoteHost() + ":" + remoteFile;
- if (put) {
- cl.createArg().setValue(localFile.getName());
- cl.createArg().setValue(qualifiedRemoteFile);
- } else {
- cl.createArg().setValue(qualifiedRemoteFile);
- cl.createArg().setValue(localFile.getName());
- }
-
- fireSessionDebug("Executing command: " + cl.toString());
-
- try {
- CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
- int exitCode = CommandLineUtils.executeCommandLine(cl, null, err);
- if (exitCode != 0) {
- if (!put && err.getOutput().trim().toLowerCase(Locale.ENGLISH).contains("no such file or directory")) {
- throw new ResourceDoesNotExistException(err.getOutput());
- } else {
- TransferFailedException e =
- new TransferFailedException("Exit code: " + exitCode + " - " + err.getOutput());
-
- fireTransferError(resource, e, put ? TransferEvent.REQUEST_PUT : TransferEvent.REQUEST_GET);
-
- throw e;
- }
- }
- } catch (CommandLineException e) {
- fireTransferError(resource, e, put ? TransferEvent.REQUEST_PUT : TransferEvent.REQUEST_GET);
-
- throw new TransferFailedException("Error executing command line", e);
- }
- }
-
- boolean isPuTTYSCP() {
- String exe = scpExecutable.toLowerCase(Locale.ENGLISH);
- return exe.contains("pscp") || exe.contains("kscp");
- }
-
- private String normalizeResource(Resource resource) {
- return StringUtils.replace(resource.getName(), "\\", "/");
- }
-
- public void put(File source, String destination)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- Resource resource = new Resource(destination);
-
- firePutInitiated(resource, source);
-
- if (!source.exists()) {
- throw new ResourceDoesNotExistException("Specified source file does not exist: " + source);
- }
-
- String basedir = getRepository().getBasedir();
-
- String resourceName = StringUtils.replace(destination, "\\", "/");
-
- String dir = PathUtils.dirname(resourceName);
-
- dir = StringUtils.replace(dir, "\\", "/");
-
- String umaskCmd = null;
- if (getRepository().getPermissions() != null) {
- String dirPerms = getRepository().getPermissions().getDirectoryMode();
-
- if (dirPerms != null) {
- umaskCmd = "umask " + PermissionModeUtils.getUserMaskFor(dirPerms);
- }
- }
-
- String mkdirCmd = "mkdir -p " + basedir + "/" + dir + "\n";
-
- if (umaskCmd != null) {
- mkdirCmd = umaskCmd + "; " + mkdirCmd;
- }
-
- try {
- executeCommand(mkdirCmd);
- } catch (CommandExecutionException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- throw new TransferFailedException("Error executing command for transfer", e);
- }
-
- resource.setContentLength(source.length());
-
- resource.setLastModified(source.lastModified());
-
- firePutStarted(resource, source);
-
- executeScpCommand(resource, source, true);
-
- postProcessListeners(resource, source, TransferEvent.REQUEST_PUT);
-
- try {
- RepositoryPermissions permissions = getRepository().getPermissions();
-
- if (permissions != null && permissions.getGroup() != null) {
- executeCommand("chgrp -f " + permissions.getGroup() + " " + basedir + "/" + resourceName + "\n", true);
- }
-
- if (permissions != null && permissions.getFileMode() != null) {
- executeCommand(
- "chmod -f " + permissions.getFileMode() + " " + basedir + "/" + resourceName + "\n", true);
- }
- } catch (CommandExecutionException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- throw new TransferFailedException("Error executing command for transfer", e);
- }
- firePutCompleted(resource, source);
- }
-
- public void get(String resourceName, File destination)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- String path = StringUtils.replace(resourceName, "\\", "/");
-
- Resource resource = new Resource(path);
-
- fireGetInitiated(resource, destination);
-
- createParentDirectories(destination);
-
- fireGetStarted(resource, destination);
-
- executeScpCommand(resource, destination, false);
-
- postProcessListeners(resource, destination, TransferEvent.REQUEST_GET);
-
- fireGetCompleted(resource, destination);
- }
-
- //
- // these parameters are user specific, so should not be read from the repository itself.
- // They can be configured by plexus, or directly on the instantiated object.
- // Alternatively, we may later accept a generic parameters argument to connect, or some other configure(Properties)
- // method on a Wagon.
- //
-
- public List<String> getFileList(String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- return sshTool.getFileList(destinationDirectory, repository);
- }
-
- public void putDirectory(File sourceDirectory, String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- sshTool.putDirectory(this, sourceDirectory, destinationDirectory);
- }
-
- public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
- return sshTool.resourceExists(resourceName, repository);
- }
-
- public boolean supportsDirectoryCopy() {
- return true;
- }
-
- public String getScpExecutable() {
- return scpExecutable;
- }
-
- public void setScpExecutable(String scpExecutable) {
- this.scpExecutable = scpExecutable;
- }
-
- public String getSshExecutable() {
- return sshExecutable;
- }
-
- public void setSshExecutable(String sshExecutable) {
- this.sshExecutable = sshExecutable;
- }
-
- public String getScpArgs() {
- return scpArgs;
- }
-
- public void setScpArgs(String scpArgs) {
- this.scpArgs = scpArgs;
- }
-
- public String getSshArgs() {
- return sshArgs;
- }
-
- public void setSshArgs(String sshArgs) {
- this.sshArgs = sshArgs;
- }
-}
diff --git a/wagon-providers/wagon-ssh-external/src/site/apt/index.apt b/wagon-providers/wagon-ssh-external/src/site/apt/index.apt
deleted file mode 100644
index 1e37e6ef..00000000
--- a/wagon-providers/wagon-ssh-external/src/site/apt/index.apt
+++ /dev/null
@@ -1,41 +0,0 @@
- ------
- Maven Wagon SSH External
- ------
- Carlos Sanchez
- ------
- 2006-04-16
- ------
-
- ~~ 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.
-
- ~~ NOTE: For help with the syntax of this file, see:
- ~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Maven Wagon SSH External
-
- This component is an implementation of Wagon provider for SSH servers access.
-
- It enables Maven to deploy artifacts and sites to SSH servers.
- it uses an external SSH program that has to be already installed in the system.
-
- Getting files from SSH servers is not fully tested.
-
-
-Features
-
- * Deploy files and directories to SSH servers
diff --git a/wagon-providers/wagon-ssh-external/src/site/site.xml b/wagon-providers/wagon-ssh-external/src/site/site.xml
deleted file mode 100644
index 6a382dfd..00000000
--- a/wagon-providers/wagon-ssh-external/src/site/site.xml
+++ /dev/null
@@ -1,33 +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/DECORATION/1.3.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
- <body>
- <breadcrumbs>
- <item name="SSH External" href="./index.html" />
- </breadcrumbs>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
diff --git a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/EmbeddedScpExternalWagonWithKeyTest.java b/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/EmbeddedScpExternalWagonWithKeyTest.java
deleted file mode 100644
index 678bc42f..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/EmbeddedScpExternalWagonWithKeyTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.external;
-
-import java.io.File;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.wagon.Streams;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.AbstractEmbeddedScpWagonWithKeyTest;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class EmbeddedScpExternalWagonWithKeyTest extends AbstractEmbeddedScpWagonWithKeyTest {
-
- @Override
- protected Wagon getWagon() throws Exception {
- ScpExternalWagon scpWagon = (ScpExternalWagon) super.getWagon();
- scpWagon.setInteractive(false);
- File dummyKnowHostsFile = new File("target/dummy_knowhost");
- if (dummyKnowHostsFile.exists()) {
- dummyKnowHostsFile.delete();
- }
- scpWagon.setScpArgs(
- "-o StrictHostKeyChecking=no -o UserKnownHostsFile=" + dummyKnowHostsFile.getCanonicalPath());
- scpWagon.setSshArgs(
- "-o StrictHostKeyChecking=no -o UserKnownHostsFile=" + dummyKnowHostsFile.getCanonicalPath());
- dummyKnowHostsFile.deleteOnExit();
- return scpWagon;
- }
-
- protected String getProtocol() {
- return "scpexe";
- }
-
- protected AuthenticationInfo getAuthInfo() {
- try {
- AuthenticationInfo authInfo = super.getAuthInfo();
- // user : guest/guest123 - passphrase : toto01
- authInfo.setUserName("guest");
- File sshKeysTarget = new File("target/ssh-keys");
- FileUtils.copyDirectory(new File("src/test/ssh-keys"), sshKeysTarget);
- // ssh keys need to 700 permissions
- // to prevent WARNING: UNPROTECTED PRIVATE KEY FILE!
- Commandline commandline = new Commandline("chmod");
- commandline.createArg().setValue("-R");
- commandline.createArg().setValue("700");
- commandline.createArg().setValue(sshKeysTarget.getCanonicalPath());
- CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
- CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
- int exitCode = CommandLineUtils.executeCommandLine(commandline, out, err);
- Streams streams = new Streams();
- streams.setOut(out.getOutput());
- streams.setErr(err.getOutput());
- if (exitCode != 0) {
- throw new RuntimeException("fail to chmod exit code " + exitCode + ", error" + streams.getErr()
- + ", out " + streams.getOut());
- }
-
- authInfo.setPrivateKey(new File(sshKeysTarget, "id_rsa").getCanonicalPath());
-
- return authInfo;
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- public void testFailedGetToStream() throws Exception {
- // ignore this test as it need a stream wagon
- }
-}
diff --git a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java b/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java
deleted file mode 100644
index 8020374d..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.external;
-
-import java.io.File;
-
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.WagonTestCase;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.TestData;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class ScpExternalWagonTest extends WagonTestCase {
- protected int getExpectedContentLengthOnGet(int expectedSize) {
- return WagonConstants.UNKNOWN_LENGTH;
- }
-
- protected boolean supportsGetIfNewer() {
- return false;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- return 0;
- }
-
- protected String getProtocol() {
- return "scpexe";
- }
-
- public String getTestRepositoryUrl() {
- return TestData.getTestRepositoryUrl();
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = new AuthenticationInfo();
-
- String userName = TestData.getUserName();
-
- authInfo.setUserName(userName);
-
- File privateKey = TestData.getPrivateKey();
-
- if (privateKey.exists()) {
- authInfo.setPrivateKey(privateKey.getAbsolutePath());
-
- authInfo.setPassphrase("");
- }
-
- return authInfo;
- }
-
- public void testIsPuTTY() throws Exception {
- ScpExternalWagon wagon = (ScpExternalWagon) getWagon();
-
- wagon.setSshExecutable("c:\\program files\\PuTTY\\plink.exe");
- assertTrue(wagon.isPuTTY());
- wagon.setSshExecutable("plink");
- assertTrue(wagon.isPuTTY());
- wagon.setSshExecutable("PLINK");
- assertTrue(wagon.isPuTTY());
- wagon.setSshExecutable("PlInK");
- assertTrue(wagon.isPuTTY());
- wagon.setSshExecutable("ssh");
- assertFalse(wagon.isPuTTY());
-
- wagon.setScpExecutable("c:\\program files\\PuTTY\\pscp.exe");
- assertTrue(wagon.isPuTTYSCP());
- wagon.setScpExecutable("pscp");
- assertTrue(wagon.isPuTTYSCP());
- wagon.setScpExecutable("PSCP");
- assertTrue(wagon.isPuTTYSCP());
- wagon.setScpExecutable("PsCp");
- assertTrue(wagon.isPuTTYSCP());
- wagon.setScpExecutable("scp");
- assertFalse(wagon.isPuTTYSCP());
- }
-}
diff --git a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpWagonWithSshPrivateKeySearchTest.java b/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpWagonWithSshPrivateKeySearchTest.java
deleted file mode 100644
index 93f39883..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpWagonWithSshPrivateKeySearchTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.external;
-
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.WagonTestCase;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.TestData;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class ScpWagonWithSshPrivateKeySearchTest extends WagonTestCase {
- protected boolean supportsGetIfNewer() {
- return false;
- }
-
- protected int getExpectedContentLengthOnGet(int expectedSize) {
- return WagonConstants.UNKNOWN_LENGTH;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- return 0;
- }
-
- protected String getProtocol() {
- return "scpexe";
- }
-
- public String getTestRepositoryUrl() {
- return TestData.getTestRepositoryUrl();
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = super.getAuthInfo();
-
- authInfo.setUserName(TestData.getUserName());
-
- authInfo.setPassphrase("");
-
- return authInfo;
- }
-}
diff --git a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/SshCommandExecutorTest.java b/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/SshCommandExecutorTest.java
deleted file mode 100644
index 1654d36d..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/SshCommandExecutorTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.external;
-
-import org.apache.maven.wagon.CommandExecutorTestCase;
-import org.apache.maven.wagon.repository.Repository;
-
-/**
- * Test the command executor.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- *
- */
-public class SshCommandExecutorTest extends CommandExecutorTestCase {
-
- protected Repository getTestRepository() {
- return new Repository("test", "scpexe://localhost/");
- }
-}
diff --git a/wagon-providers/wagon-ssh-external/src/test/resources/dummy.txt b/wagon-providers/wagon-ssh-external/src/test/resources/dummy.txt
deleted file mode 100644
index e45b8165..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/resources/dummy.txt
+++ /dev/null
@@ -1 +0,0 @@
-dummy file with fake content.
\ No newline at end of file
diff --git a/wagon-providers/wagon-ssh-external/src/test/resources/log4j.xml b/wagon-providers/wagon-ssh-external/src/test/resources/log4j.xml
deleted file mode 100644
index 824015bc..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,41 +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.
- -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
- </layout>
- </appender>
- <logger name="org.apache.sshd.server">
- <level value="INFO"/>
- </logger>
-
-
-
- <root>
- <priority value ="info" />
- <appender-ref ref="console" />
- </root>
-
-</log4j:configuration>
diff --git a/wagon-providers/wagon-ssh-external/src/test/ssh-keys/id_rsa b/wagon-providers/wagon-ssh-external/src/test/ssh-keys/id_rsa
deleted file mode 100644
index 77e67c78..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/ssh-keys/id_rsa
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAwWiNxXz9+12suPsElsR5w4S4+W3Omsfl0y6nPx5YPYIWP1tu
-AmwXbmtHFIc7PVKTTCgXgrA39wXQ2yXFcvtENhMVRdKvLsxOp0Go8SXGjFbtudBN
-/r+vIjG0uWXlpngx/QIovULIBt1unwoS3QHy7UQM134zaNteSZ/Xch/YFG3JS6p/
-BiCoSa5Z3ziV0SSwQb65iWxjd6BHtHUSpS91oIGcaPuHoXkW4yY0pyOmQxG6H6V5
-bGp7/+HhIsvdoip790aYfHd8IAFH0zlErA2PsOucrPz2+9ZWp/WGrPwnzo0EImnx
-Y5fKCvAlI+oyKfQSWpPmay267KiP+eRIwC0u5wIDAQABAoIBACF6R4/3or7v6AXc
-7V5rg+gkASCrsSd5kn6LhMeYKQ38hn1RBinFLAkg6JzVC5wBvx1fkzI77nQDvbMx
-Rowwkg4KH5SGc2xWUQcChou3TjbclSmktNtzsozora+pw6adB4oT5ZldBeKqUYuV
-4s3+mF4ZeV+TqLJtxlRYJqLKgEyIp05H2u0GstcquK5pEiwjINc7TvdhgSWRlU8F
-WO94h0i0sWyCVGpMkVSJjqKk+npHEs5Go/AIdu8w02B5BpZ7rUmsf41+phGt0gs9
-wKZXxifE6RWIjzmDzqJGsIME08z8xqi+H1zsBECTOt8uGNKhPcefZ/2/GzByRJ3y
-y2zT4gECgYEA5TTF2ApoBlZgxrz9bzIs5lyX+g+dZKuE6w2bQeL5Kn896ZUmWcma
-mvhwMcT/OIXs4mRMoYWOf/hemnx1zgQpyW+j8SPc0Qh5EYuzIaeS/yH4Kqi+jRGP
-mCANGLd5Lc0jUuomJDDTAtBB/36FNDq3c9Iphl+elUtQo9ahkAfHZ9cCgYEA2AR/
-WCjRjLIBB+o5sYQhBOCLWN7l6VWdGjNtrOdelMLBH3ulfykWjIBPZS4/NoL58OLa
-DqJWOwtPOULC8gU32zXP8Md+bJ58Nm+biGLjtzQSenJVajq6GneKIHh10vgDEMeA
-o8lwnzomfJwqUVNjPqYWQQ6mDc9ByGMAy4ErT3ECgYAmGaWhielM1GL15kiCiWap
-TE7/BEV3jINlxzc9tosQo2IZR+++ESMgC5gqzcJXFPwRjfanCtprL1AaggHbIxoH
-IAWyefGk1bG6VuyJ9Z8bxfvIq5AxRvAFq55Bs43zLRxoFgANGAibeR7fZ5qg2fnQ
-yOiaK57i1kgrU+w7Uu+0tQKBgHBtXs3GaNGeL1UsPZy7VOgR6dR2Jhjb+ykQzSsp
-PBuWhSbalpbpDphPi4Lwn+vCHU2W88CcEt8mErSNn6KQvrJzfmclnRHxJlq6matR
-NI08J8XczcG9EPEHeDdQGpqThBzuiHA2PkxQ2okOSiQLj2Ki1IBFnH0hem5NwLMp
-5h2xAoGBAJcWmlm8L8g7+f381xGnujkhBWK4MVKI1aIZGEq9UuaEMjm9J+I9Ili4
-S8dAcjX6OlpcAKf8nJEHOpSjCYrL8X/lRNdevLrrzsTXS6j8AgncmScyXlJMQb8J
-wXfHWW+UWsTeZF46Pkir0eGGmWQCWq7mRoB9QmlTcJ8ESiejxDfc
------END RSA PRIVATE KEY-----
diff --git a/wagon-providers/wagon-ssh-external/src/test/ssh-keys/id_rsa-passphrase b/wagon-providers/wagon-ssh-external/src/test/ssh-keys/id_rsa-passphrase
deleted file mode 100644
index bac86e5c..00000000
--- a/wagon-providers/wagon-ssh-external/src/test/ssh-keys/id_rsa-passphrase
+++ /dev/null
@@ -1,30 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: AES-128-CBC,2F7CC6A20D25FED61F12C23469AC49DD
-
-ym47UX+S/eES57kPEAiC+8/LPYSIPPK0zzy8fp+rtnMaKvAgfoBScw5gV4u8d6nI
-cl9FSq+IYLrUZs3ojopWY7c1sCj/PD5TSxaHo9ZQWv+wRATNbwcF0aKcmJn0BOEQ
-f1AyPlMW4HIVm7N2+reUj0H6D7fJhdmyxvNj//DbIFYnR+arOgjfMsRmBpX7hBjG
-XOWG8GxIvFLmGHFn6zwmLq3FO4ojkab2bYjvoAathmdlHx1TZotcOdJmRxskCRL8
-4g1KTclZkth+jxhNecPbAQTcT2CLNphtv1lmitnsRfztIitUKo297m1qk5Qc/uYB
-ZAd5FXUxu8e6jZ5NgwYLPQveZhmLjCXBcejwFXhJPWjld+XYHtnEJm5cevZtSUhj
-E+1/jXrfsJF65uMH2mZYqLL+i8EllUS3wxP6xUoK6NwQfnrfIaFfDwwT6q8+vqmo
-wDmfg144Eu4ARoU1QMnQuFBxMShU/9HXBlyVhVsPBmfu27y9+cX9+aN3A9+1h3TB
-qfMOYMwDxOB+8hbbC5NbMr3jDGwS4IxR+kEaKV7XRKYs2Bi7aefWbEumdEuu3zKQ
-bgfi//Ias7FfwB9UbFY6RCJlnjihxCj0lwkVcj8LpK9AjxALQYmcRhCFfEvpMHC7
-HP1bGjIzmtHppvvK7Q5eKpjVWFG36Jh8IefpAywJbpJ7HBN2gFfsop3zQHo33LLp
-2I//Dz5n2iw+S5z8fPOOrZAZIZZpkxDepYXHsVEZ3lXQCxzAyx44RCMRlAEvAdFK
-XjlhO4VMUtfZ3JzOhni5qgUX61Z0+0oeh4pf+zxDH+UVNJmwPX4zWkDWyEWVO7Uj
-bIIZ/GU4obm5pTsX/0C/m3nFS1ZJKaE9A5/XaCTrF+LVhgj/cWKC3mfLRi86ohp9
-vU1vz+ASNJEenPavh0j12B+mz+MLQVk+fWk3EGIURwHHg1Cq0I/dmA8iIcvBTVQl
-nGKEwbGsLNbYE4YgxNuHPwJQ7nC414464kwCwt8myAOITUYi2pxePE5ZBo8b9Eyy
-s2vj5sXqj6tcbrmsBWGeTyH9WRwpFLy3Tbx8ntayuFd5fq0xc+3G74O8UgZP2Feo
-5EnPH+2kcU8E5+Lo9J4NzA3jblonKwCkR+13WgGuPJaLnSVQZn0m1sHll2UF2d6X
-/yCx+Knf8q7IU7lyK2JfpvGuNLfBfTCMFoOXgZvFo9MDUAgLluWXlH3BfekDtRlJ
-S2/x6tCrRwrtj9M+1ZNFU5Tr0gr6MtbVvIKtiP92XPmTGt8Z/8oLqcA5ioh+0sV1
-eolIGseUN5RRKfOfUqa3w0w6h0HRs26eG6x5gsdIZgT5yIEW2/tAQVyZTMRB/LYp
-8G1tCmpS+LQl/P1WcYIuALk0fqDYreAwFbqwKziTI+Grx7ir5nmGRdg4FTir4sbR
-FWOHWzJMjOaktTesiQQOip6o7lUy5Iy7mkeVRfWF9HYthlC8X9Em7S8gO8cjz7LY
-WxHmUuBX62Giw6Cxb+qxIIoNNWn134ncMtgBi3y+QqUpnGYtohnfQWlxtFzreoRY
-3CW0re+xpuFy8jAeIyA2hT8vyhLD0JA0hcdXTK+C+Rx12rtcBtQ6vaY73DpKggb4
------END RSA PRIVATE KEY-----
diff --git a/wagon-providers/wagon-ssh/pom.xml b/wagon-providers/wagon-ssh/pom.xml
deleted file mode 100644
index 27afd63c..00000000
--- a/wagon-providers/wagon-ssh/pom.xml
+++ /dev/null
@@ -1,182 +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.wagon</groupId>
- <artifactId>wagon-providers</artifactId>
- <version>4.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>wagon-ssh</artifactId>
- <name>Apache Maven Wagon :: Providers :: SSH Provider</name>
-
- <properties>
- <sshd.stopImmediatly>false</sshd.stopImmediatly>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.55</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch.agentproxy.connector-factory</artifactId>
- <version>0.0.9</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch.agentproxy.jsch</artifactId>
- <version>0.0.9</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-interactivity-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-common-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty.aggregate</groupId>
- <artifactId>jetty-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>no-ssh-tests</id>
- <activation>
- <property>
- <name>!ssh-tests</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- Tests that currently doesn't work with embedded ssh server -->
- <excludes>
- <exclude>**/SftpWagonTest.*</exclude>
- <exclude>**/SshCommandExecutorTest.*</exclude>
- <exclude>**/KnownHostsProviderTest.*</exclude>
- <exclude>**/ScpWagon*Test.*</exclude>
- <exclude>**/Embedded*Test.*</exclude>
- </excludes>
- <systemPropertyVariables>
- <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
- <test.user>olamy</test.user>
- <sshd.stopImmediatly>${sshd.stopImmediatly}</sshd.stopImmediatly>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>windauze</id>
- <activation>
- <os>
- <family>windows</family>
- </os>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- Tests that currently doesn't work with embedded ssh server and embedded as won't work on a windauze env -->
- <excludes>
- <exclude>**/SftpWagonTest.*</exclude>
- <exclude>**/SshCommandExecutorTest.*</exclude>
- <exclude>**/KnownHostsProviderTest.*</exclude>
- <exclude>**/ScpWagon*Test.*</exclude>
- <exclude>**/Embedded*Test.*</exclude>
- </excludes>
- <systemPropertyVariables>
- <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
- <test.user>olamy</test.user>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>ssh-embedded</id>
- <activation>
- <property>
- <name>ssh-embedded</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- Tests that currently doesn't work with embedded ssh server -->
- <excludes>
- <exclude>**/SftpWagonTest.*</exclude>
- <exclude>**/SshCommandExecutorTest.*</exclude>
- <exclude>**/KnownHostsProviderTest.*</exclude>
- <exclude>**/ScpWagon*Test.*</exclude>
- </excludes>
- <systemPropertyVariables>
- <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
- <test.user>olamy</test.user>
- <sshd.stopImmediatly>${sshd.stopImmediatly}</sshd.stopImmediatly>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java
deleted file mode 100644
index 825e1d75..00000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/AbstractJschWagon.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.Properties;
-
-import com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.HostKey;
-import com.jcraft.jsch.HostKeyRepository;
-import com.jcraft.jsch.IdentityRepository;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Proxy;
-import com.jcraft.jsch.ProxyHTTP;
-import com.jcraft.jsch.ProxySOCKS5;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UIKeyboardInteractive;
-import com.jcraft.jsch.UserInfo;
-import com.jcraft.jsch.agentproxy.AgentProxyException;
-import com.jcraft.jsch.agentproxy.Connector;
-import com.jcraft.jsch.agentproxy.ConnectorFactory;
-import com.jcraft.jsch.agentproxy.RemoteIdentityRepository;
-import org.apache.maven.wagon.CommandExecutionException;
-import org.apache.maven.wagon.CommandExecutor;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.StreamWagon;
-import org.apache.maven.wagon.Streams;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.providers.ssh.CommandExecutorStreamProcessor;
-import org.apache.maven.wagon.providers.ssh.ScpHelper;
-import org.apache.maven.wagon.providers.ssh.SshWagon;
-import org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo;
-import org.apache.maven.wagon.providers.ssh.interactive.NullInteractiveUserInfo;
-import org.apache.maven.wagon.providers.ssh.jsch.interactive.UserInfoUIKeyboardInteractiveProxy;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostChangedException;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostEntry;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
-import org.apache.maven.wagon.providers.ssh.knownhost.UnknownHostException;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.apache.maven.wagon.resource.Resource;
-import org.codehaus.plexus.util.IOUtil;
-
-/**
- * AbstractJschWagon
- */
-public abstract class AbstractJschWagon extends StreamWagon implements SshWagon, CommandExecutor {
- protected ScpHelper sshTool = new ScpHelper(this);
-
- protected Session session;
-
- private String strictHostKeyChecking;
-
- /**
- * @plexus.requirement role-hint="file"
- */
- private volatile KnownHostsProvider knownHostsProvider;
-
- /**
- * @plexus.requirement
- */
- private volatile InteractiveUserInfo interactiveUserInfo;
-
- /**
- * @plexus.configuration
- */
- private volatile String preferredAuthentications;
-
- /**
- * @plexus.requirement
- */
- private volatile UIKeyboardInteractive uIKeyboardInteractive;
-
- private static final int SOCKS5_PROXY_PORT = 1080;
-
- protected static final String EXEC_CHANNEL = "exec";
-
- public void openConnectionInternal() throws AuthenticationException {
- if (authenticationInfo == null) {
- authenticationInfo = new AuthenticationInfo();
- }
-
- if (!interactive) {
- uIKeyboardInteractive = null;
- setInteractiveUserInfo(new NullInteractiveUserInfo());
- }
-
- JSch sch = new JSch();
-
- File privateKey;
- try {
- privateKey = ScpHelper.getPrivateKey(authenticationInfo);
- } catch (FileNotFoundException e) {
- throw new AuthenticationException(e.getMessage());
- }
-
- // can only pick one method of authentication
- if (privateKey != null && privateKey.exists()) {
- fireSessionDebug("Using private key: " + privateKey);
- try {
- sch.addIdentity(privateKey.getAbsolutePath(), authenticationInfo.getPassphrase());
- } catch (JSchException e) {
- throw new AuthenticationException("Cannot connect. Reason: " + e.getMessage(), e);
- }
- } else {
- try {
- Connector connector = ConnectorFactory.getDefault().createConnector();
- if (connector != null) {
- IdentityRepository repo = new RemoteIdentityRepository(connector);
- sch.setIdentityRepository(repo);
- }
- } catch (AgentProxyException e) {
- fireSessionDebug("Unable to connect to agent: " + e.toString());
- }
- }
-
- String host = getRepository().getHost();
- int port =
- repository.getPort() == WagonConstants.UNKNOWN_PORT ? ScpHelper.DEFAULT_SSH_PORT : repository.getPort();
- try {
- String userName = authenticationInfo.getUserName();
- if (userName == null) {
- userName = System.getProperty("user.name");
- }
- session = sch.getSession(userName, host, port);
- session.setTimeout(getTimeout());
- } catch (JSchException e) {
- throw new AuthenticationException("Cannot connect. Reason: " + e.getMessage(), e);
- }
-
- Proxy proxy = null;
- ProxyInfo proxyInfo =
- getProxyInfo(ProxyInfo.PROXY_SOCKS5, getRepository().getHost());
- if (proxyInfo != null && proxyInfo.getHost() != null) {
- proxy = new ProxySOCKS5(proxyInfo.getHost(), proxyInfo.getPort());
- ((ProxySOCKS5) proxy).setUserPasswd(proxyInfo.getUserName(), proxyInfo.getPassword());
- } else {
- proxyInfo = getProxyInfo(ProxyInfo.PROXY_HTTP, getRepository().getHost());
- if (proxyInfo != null && proxyInfo.getHost() != null) {
- proxy = new ProxyHTTP(proxyInfo.getHost(), proxyInfo.getPort());
- ((ProxyHTTP) proxy).setUserPasswd(proxyInfo.getUserName(), proxyInfo.getPassword());
- } else {
- // Backwards compatibility
- proxyInfo = getProxyInfo(
- getRepository().getProtocol(), getRepository().getHost());
- if (proxyInfo != null && proxyInfo.getHost() != null) {
- // if port == 1080 we will use SOCKS5 Proxy, otherwise will use HTTP Proxy
- if (proxyInfo.getPort() == SOCKS5_PROXY_PORT) {
- proxy = new ProxySOCKS5(proxyInfo.getHost(), proxyInfo.getPort());
- ((ProxySOCKS5) proxy).setUserPasswd(proxyInfo.getUserName(), proxyInfo.getPassword());
- } else {
- proxy = new ProxyHTTP(proxyInfo.getHost(), proxyInfo.getPort());
- ((ProxyHTTP) proxy).setUserPasswd(proxyInfo.getUserName(), proxyInfo.getPassword());
- }
- }
- }
- }
- session.setProxy(proxy);
-
- // username and password will be given via UserInfo interface.
- UserInfo ui = new WagonUserInfo(authenticationInfo, getInteractiveUserInfo());
-
- if (uIKeyboardInteractive != null) {
- ui = new UserInfoUIKeyboardInteractiveProxy(ui, uIKeyboardInteractive);
- }
-
- Properties config = new Properties();
- if (getKnownHostsProvider() != null) {
- try {
- String contents = getKnownHostsProvider().getContents();
- if (contents != null) {
- sch.setKnownHosts(new ByteArrayInputStream(contents.getBytes()));
- }
- } catch (JSchException e) {
- // continue without known_hosts
- }
- if (strictHostKeyChecking == null) {
- strictHostKeyChecking = getKnownHostsProvider().getHostKeyChecking();
- }
- config.setProperty("StrictHostKeyChecking", strictHostKeyChecking);
- }
-
- if (preferredAuthentications != null) {
- config.setProperty("PreferredAuthentications", preferredAuthentications);
- }
-
- config.setProperty("BatchMode", interactive ? "no" : "yes");
-
- session.setConfig(config);
-
- session.setUserInfo(ui);
-
- try {
- session.connect();
- } catch (JSchException e) {
- if (e.getMessage().startsWith("UnknownHostKey:") || e.getMessage().startsWith("reject HostKey:")) {
- throw new UnknownHostException(host, e);
- } else if (e.getMessage().contains("HostKey has been changed")) {
- throw new KnownHostChangedException(host, e);
- } else {
- throw new AuthenticationException("Cannot connect. Reason: " + e.getMessage(), e);
- }
- }
-
- if (getKnownHostsProvider() != null) {
- HostKeyRepository hkr = sch.getHostKeyRepository();
-
- HostKey[] hk = hkr.getHostKey(host, null);
- try {
- if (hk != null) {
- for (HostKey hostKey : hk) {
- KnownHostEntry knownHostEntry =
- new KnownHostEntry(hostKey.getHost(), hostKey.getType(), hostKey.getKey());
- getKnownHostsProvider().addKnownHost(knownHostEntry);
- }
- }
- } catch (IOException e) {
- closeConnection();
-
- throw new AuthenticationException(
- "Connection aborted - failed to write to known_hosts. Reason: " + e.getMessage(), e);
- }
- }
- }
-
- public void closeConnection() {
- if (session != null) {
- session.disconnect();
- session = null;
- }
- }
-
- public Streams executeCommand(String command, boolean ignoreStdErr, boolean ignoreNoneZeroExitCode)
- throws CommandExecutionException {
- ChannelExec channel = null;
- BufferedReader stdoutReader = null;
- BufferedReader stderrReader = null;
- Streams streams = null;
- try {
- channel = (ChannelExec) session.openChannel(EXEC_CHANNEL);
-
- fireSessionDebug("Executing: " + command);
- channel.setCommand(command + "\n");
-
- stdoutReader = new BufferedReader(new InputStreamReader(channel.getInputStream()));
- stderrReader = new BufferedReader(new InputStreamReader(channel.getErrStream()));
-
- channel.connect();
-
- streams = CommandExecutorStreamProcessor.processStreams(stderrReader, stdoutReader);
-
- stdoutReader.close();
- stdoutReader = null;
-
- stderrReader.close();
- stderrReader = null;
-
- int exitCode = channel.getExitStatus();
-
- if (streams.getErr().length() > 0 && !ignoreStdErr) {
- throw new CommandExecutionException("Exit code: " + exitCode + " - " + streams.getErr());
- }
-
- if (exitCode != 0 && !ignoreNoneZeroExitCode) {
- throw new CommandExecutionException("Exit code: " + exitCode + " - " + streams.getErr());
- }
-
- return streams;
- } catch (IOException e) {
- throw new CommandExecutionException("Cannot execute remote command: " + command, e);
- } catch (JSchException e) {
- throw new CommandExecutionException("Cannot execute remote command: " + command, e);
- } finally {
- if (streams != null) {
- fireSessionDebug("Stdout results:" + streams.getOut());
- fireSessionDebug("Stderr results:" + streams.getErr());
- }
-
- IOUtil.close(stdoutReader);
- IOUtil.close(stderrReader);
- if (channel != null) {
- channel.disconnect();
- }
- }
- }
-
- protected void handleGetException(Resource resource, Exception e) throws TransferFailedException {
- fireTransferError(resource, e, TransferEvent.REQUEST_GET);
-
- String msg = "Error occurred while downloading '" + resource + "' from the remote repository:" + getRepository()
- + ": " + e.getMessage();
-
- throw new TransferFailedException(msg, e);
- }
-
- public List<String> getFileList(String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- return sshTool.getFileList(destinationDirectory, repository);
- }
-
- public void putDirectory(File sourceDirectory, String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- sshTool.putDirectory(this, sourceDirectory, destinationDirectory);
- }
-
- public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
- return sshTool.resourceExists(resourceName, repository);
- }
-
- public boolean supportsDirectoryCopy() {
- return true;
- }
-
- public void executeCommand(String command) throws CommandExecutionException {
- fireTransferDebug("Executing command: " + command);
-
- // backward compatible with wagon 2.10
- executeCommand(command, false, true);
- }
-
- public Streams executeCommand(String command, boolean ignoreFailures) throws CommandExecutionException {
- fireTransferDebug("Executing command: " + command);
-
- // backward compatible with wagon 2.10
- return executeCommand(command, ignoreFailures, true);
- }
-
- public InteractiveUserInfo getInteractiveUserInfo() {
- return this.interactiveUserInfo;
- }
-
- public KnownHostsProvider getKnownHostsProvider() {
- return this.knownHostsProvider;
- }
-
- public void setInteractiveUserInfo(InteractiveUserInfo interactiveUserInfo) {
- this.interactiveUserInfo = interactiveUserInfo;
- }
-
- public void setKnownHostsProvider(KnownHostsProvider knownHostsProvider) {
- this.knownHostsProvider = knownHostsProvider;
- }
-
- public void setUIKeyboardInteractive(UIKeyboardInteractive uIKeyboardInteractive) {
- this.uIKeyboardInteractive = uIKeyboardInteractive;
- }
-
- public String getPreferredAuthentications() {
- return preferredAuthentications;
- }
-
- public void setPreferredAuthentications(String preferredAuthentications) {
- this.preferredAuthentications = preferredAuthentications;
- }
-
- public String getStrictHostKeyChecking() {
- return strictHostKeyChecking;
- }
-
- public void setStrictHostKeyChecking(String strictHostKeyChecking) {
- this.strictHostKeyChecking = strictHostKeyChecking;
- }
-
- /** {@inheritDoc} */
- // This method will be removed as soon as JSch issue #122 is resolved
- @Override
- protected void transfer(Resource resource, InputStream input, OutputStream output, int requestType, long maxSize)
- throws IOException {
- byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
-
- TransferEvent transferEvent = new TransferEvent(this, resource, TransferEvent.TRANSFER_PROGRESS, requestType);
- transferEvent.setTimestamp(System.currentTimeMillis());
-
- long remaining = maxSize;
- while (remaining > 0L) {
- // let's safely cast to int because the min value will be lower than the buffer size.
- int n = input.read(buffer, 0, (int) Math.min(buffer.length, remaining));
-
- if (n == -1) {
- break;
- }
-
- fireTransferProgress(transferEvent, buffer, n);
-
- output.write(buffer, 0, n);
-
- remaining -= n;
- }
- output.flush();
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpCommandExecutor.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpCommandExecutor.java
deleted file mode 100644
index f0757e7a..00000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpCommandExecutor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-/**
- * ScpCommandExecutor - bridge class for plexus:descriptor
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- *
- * @todo is this even needed anymore?
- *
- * @plexus.component role="org.apache.maven.wagon.CommandExecutor"
- * role-hint="scp"
- * instantiation-strategy="per-lookup"
- */
-public class ScpCommandExecutor extends ScpWagon {
- public ScpCommandExecutor() {
- super();
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java
deleted file mode 100644
index 978f225e..00000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.JSchException;
-import org.apache.maven.wagon.CommandExecutionException;
-import org.apache.maven.wagon.InputData;
-import org.apache.maven.wagon.OutputData;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.providers.ssh.ScpHelper;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * SCP protocol wagon.
- * <p/>
- * Note that this implementation is <i>not</i> thread-safe, and multiple channels can not be used on the session at
- * the same time.
- * <p/>
- * See <a href="http://blogs.sun.com/janp/entry/how_the_scp_protocol_works">
- * http://blogs.sun.com/janp/entry/how_the_scp_protocol_works</a>
- * for information on how the SCP protocol works.
- *
- *
- * @todo [BP] add compression flag
- * @plexus.component role="org.apache.maven.wagon.Wagon"
- * role-hint="scp"
- * instantiation-strategy="per-lookup"
- */
-public class ScpWagon extends AbstractJschWagon {
- private static final char COPY_START_CHAR = 'C';
-
- private static final char ACK_SEPARATOR = ' ';
-
- private static final String END_OF_FILES_MSG = "E\n";
-
- private static final int LINE_BUFFER_SIZE = 8192;
-
- private static final byte LF = '\n';
-
- private ChannelExec channel;
-
- private InputStream channelInputStream;
-
- private OutputStream channelOutputStream;
-
- private void setFileGroup(RepositoryPermissions permissions, String basedir, Resource resource)
- throws CommandExecutionException {
- if (permissions != null && permissions.getGroup() != null) {
- // executeCommand( "chgrp -f " + permissions.getGroup() + " " + getPath( basedir, resource.getName() ) );
- executeCommand("chgrp -f " + permissions.getGroup() + " \"" + getPath(basedir, resource.getName()) + "\"");
- }
- }
-
- protected void cleanupPutTransfer(Resource resource) {
- if (channel != null) {
- channel.disconnect();
- channel = null;
- }
- }
-
- protected void finishPutTransfer(Resource resource, InputStream input, OutputStream output)
- throws TransferFailedException {
- try {
- sendEom(output);
-
- checkAck(channelInputStream);
-
- // This came from SCPClient in Ganymede SSH2. It is sent after all files.
- output.write(END_OF_FILES_MSG.getBytes());
- output.flush();
- } catch (IOException e) {
- handleIOException(resource, e);
- }
-
- String basedir = getRepository().getBasedir();
- try {
- setFileGroup(getRepository().getPermissions(), basedir, resource);
- } catch (CommandExecutionException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- throw new TransferFailedException(e.getMessage(), e);
- }
- }
-
- private void checkAck(InputStream in) throws IOException {
- int code = in.read();
- if (code == -1) {
- throw new IOException("Unexpected end of data");
- } else if (code == 1) {
- String line = readLine(in);
-
- throw new IOException("SCP terminated with error: '" + line + "'");
- } else if (code == 2) {
- throw new IOException("SCP terminated with error (code: " + code + ")");
- } else if (code != 0) {
- throw new IOException("SCP terminated with unknown error code");
- }
- }
-
- protected void finishGetTransfer(Resource resource, InputStream input, OutputStream output)
- throws TransferFailedException {
- try {
- checkAck(input);
-
- sendEom(channelOutputStream);
- } catch (IOException e) {
- handleGetException(resource, e);
- }
- }
-
- protected void cleanupGetTransfer(Resource resource) {
- if (channel != null) {
- channel.disconnect();
- }
- }
-
- @Deprecated
- protected void getTransfer(
- Resource resource, OutputStream output, InputStream input, boolean closeInput, int maxSize)
- throws TransferFailedException {
- super.getTransfer(resource, output, input, closeInput, (int) resource.getContentLength());
- }
-
- protected void getTransfer(
- Resource resource, OutputStream output, InputStream input, boolean closeInput, long maxSize)
- throws TransferFailedException {
- super.getTransfer(resource, output, input, closeInput, resource.getContentLength());
- }
-
- protected String readLine(InputStream in) throws IOException {
- StringBuilder sb = new StringBuilder();
-
- while (true) {
- if (sb.length() > LINE_BUFFER_SIZE) {
- throw new IOException("Remote server sent a too long line");
- }
-
- int c = in.read();
-
- if (c < 0) {
- throw new IOException("Remote connection terminated unexpectedly.");
- }
-
- if (c == LF) {
- break;
- }
-
- sb.append((char) c);
- }
- return sb.toString();
- }
-
- protected static void sendEom(OutputStream out) throws IOException {
- out.write(0);
-
- out.flush();
- }
-
- public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException {
- Resource resource = inputData.getResource();
-
- String path = getPath(getRepository().getBasedir(), resource.getName());
- // String cmd = "scp -p -f " + path;
- String cmd = "scp -p -f \"" + path + "\"";
-
- fireTransferDebug("Executing command: " + cmd);
-
- try {
- channel = (ChannelExec) session.openChannel(EXEC_CHANNEL);
-
- channel.setCommand(cmd);
-
- // get I/O streams for remote scp
- channelOutputStream = channel.getOutputStream();
-
- InputStream in = channel.getInputStream();
- inputData.setInputStream(in);
-
- channel.connect();
-
- sendEom(channelOutputStream);
-
- int exitCode = in.read();
-
- if (exitCode == 'T') {
- String line = readLine(in);
-
- String[] times = line.split(" ");
-
- resource.setLastModified(Long.valueOf(times[0]).longValue() * 1000);
-
- sendEom(channelOutputStream);
-
- exitCode = in.read();
- }
-
- String line = readLine(in);
-
- if (exitCode != COPY_START_CHAR) {
- if (exitCode == 1
- && (line.contains("No such file or directory")
- || line.indexOf("no such file or directory") != 1)) {
- throw new ResourceDoesNotExistException(line);
- } else {
- throw new IOException("Exit code: " + exitCode + " - " + line);
- }
- }
-
- if (line == null) {
- throw new EOFException("Unexpected end of data");
- }
-
- String perms = line.substring(0, 4);
- fireTransferDebug("Remote file permissions: " + perms);
-
- if (line.charAt(4) != ACK_SEPARATOR && line.charAt(5) != ACK_SEPARATOR) {
- throw new IOException("Invalid transfer header: " + line);
- }
-
- int index = line.indexOf(ACK_SEPARATOR, 5);
- if (index < 0) {
- throw new IOException("Invalid transfer header: " + line);
- }
-
- long filesize = Long.parseLong(line.substring(5, index));
- fireTransferDebug("Remote file size: " + filesize);
-
- resource.setContentLength(filesize);
-
- String filename = line.substring(index + 1);
- fireTransferDebug("Remote filename: " + filename);
-
- sendEom(channelOutputStream);
- } catch (JSchException e) {
- handleGetException(resource, e);
- } catch (IOException e) {
- handleGetException(resource, e);
- }
- }
-
- public void fillOutputData(OutputData outputData) throws TransferFailedException {
- Resource resource = outputData.getResource();
-
- String basedir = getRepository().getBasedir();
-
- String path = getPath(basedir, resource.getName());
-
- String dir = ScpHelper.getResourceDirectory(resource.getName());
-
- try {
- sshTool.createRemoteDirectories(
- getPath(basedir, dir), getRepository().getPermissions());
- } catch (CommandExecutionException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- throw new TransferFailedException(e.getMessage(), e);
- }
-
- String octalMode = getOctalMode(getRepository().getPermissions());
-
- // exec 'scp -p -t rfile' remotely
- String command = "scp";
- if (octalMode != null) {
- command += " -p";
- }
- command += " -t \"" + path + "\"";
-
- fireTransferDebug("Executing command: " + command);
-
- String resourceName = resource.getName();
-
- OutputStream out = null;
- try {
- channel = (ChannelExec) session.openChannel(EXEC_CHANNEL);
-
- channel.setCommand(command);
-
- // get I/O streams for remote scp
- out = channel.getOutputStream();
- outputData.setOutputStream(out);
-
- channelInputStream = channel.getInputStream();
-
- channel.connect();
-
- checkAck(channelInputStream);
-
- // send "C0644 filesize filename", where filename should not include '/'
- long filesize = resource.getContentLength();
-
- String mode = octalMode == null ? "0644" : octalMode;
- command = "C" + mode + " " + filesize + " ";
-
- if (resourceName.lastIndexOf(ScpHelper.PATH_SEPARATOR) > 0) {
- command += resourceName.substring(resourceName.lastIndexOf(ScpHelper.PATH_SEPARATOR) + 1);
- } else {
- command += resourceName;
- }
-
- command += "\n";
-
- out.write(command.getBytes());
-
- out.flush();
-
- checkAck(channelInputStream);
- } catch (JSchException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- String msg = "Error occurred while deploying '" + resourceName + "' to remote repository: "
- + getRepository().getUrl() + ": " + e.getMessage();
-
- throw new TransferFailedException(msg, e);
- } catch (IOException e) {
- handleIOException(resource, e);
- }
- }
-
- private void handleIOException(Resource resource, IOException e) throws TransferFailedException {
- if (e.getMessage().contains("set mode: Operation not permitted")) {
- fireTransferDebug(e.getMessage());
- } else {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- String msg = "Error occurred while deploying '" + resource.getName() + "' to remote repository: "
- + getRepository().getUrl() + ": " + e.getMessage();
-
- throw new TransferFailedException(msg, e);
- }
- }
-
- public String getOctalMode(RepositoryPermissions permissions) {
- String mode = null;
- if (permissions != null && permissions.getFileMode() != null) {
- if (permissions.getFileMode().matches("[0-9]{3,4}")) {
- mode = permissions.getFileMode();
-
- if (mode.length() == 3) {
- mode = "0" + mode;
- }
- } else {
- // TODO: calculate?
- // TODO: as warning
- fireSessionDebug("Not using non-octal permissions: " + permissions.getFileMode());
- }
- }
- return mode;
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/SftpWagon.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/SftpWagon.java
deleted file mode 100644
index a9ec7064..00000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/SftpWagon.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.jcraft.jsch.ChannelSftp;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.SftpATTRS;
-import com.jcraft.jsch.SftpException;
-import org.apache.maven.wagon.InputData;
-import org.apache.maven.wagon.OutputData;
-import org.apache.maven.wagon.PathUtils;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authorization.AuthorizationException;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.providers.ssh.ScpHelper;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * SFTP protocol wagon.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- *
- * @todo [BP] add compression flag
- * @todo see if SftpProgressMonitor allows us to do streaming (without it, we can't do checksums as the input stream is lost)
- *
- * @plexus.component role="org.apache.maven.wagon.Wagon"
- * role-hint="sftp"
- * instantiation-strategy="per-lookup"
- */
-public class SftpWagon extends AbstractJschWagon {
- private static final String SFTP_CHANNEL = "sftp";
-
- private static final int S_IFDIR = 0x4000;
-
- private static final long MILLIS_PER_SEC = 1000L;
-
- private ChannelSftp channel;
-
- public void closeConnection() {
- if (channel != null) {
- channel.disconnect();
- }
- super.closeConnection();
- }
-
- public void openConnectionInternal() throws AuthenticationException {
- super.openConnectionInternal();
-
- try {
- channel = (ChannelSftp) session.openChannel(SFTP_CHANNEL);
-
- channel.connect();
- } catch (JSchException e) {
- throw new AuthenticationException(
- "Error connecting to remote repository: " + getRepository().getUrl(), e);
- }
- }
-
- private void returnToParentDirectory(Resource resource) {
- try {
- String dir = ScpHelper.getResourceDirectory(resource.getName());
- String[] dirs = PathUtils.dirnames(dir);
- for (String d : dirs) {
- channel.cd("..");
- }
- } catch (SftpException e) {
- fireTransferDebug("Error returning to parent directory: " + e.getMessage());
- }
- }
-
- private void putFile(File source, Resource resource, RepositoryPermissions permissions)
- throws SftpException, TransferFailedException {
- resource.setContentLength(source.length());
-
- resource.setLastModified(source.lastModified());
-
- String filename = ScpHelper.getResourceFilename(resource.getName());
-
- firePutStarted(resource, source);
-
- channel.put(source.getAbsolutePath(), filename);
-
- postProcessListeners(resource, source, TransferEvent.REQUEST_PUT);
-
- if (permissions != null && permissions.getGroup() != null) {
- setGroup(filename, permissions);
- }
-
- if (permissions != null && permissions.getFileMode() != null) {
- setFileMode(filename, permissions);
- }
-
- firePutCompleted(resource, source);
- }
-
- private void setGroup(String filename, RepositoryPermissions permissions) {
- try {
- int group = Integer.valueOf(permissions.getGroup()).intValue();
- channel.chgrp(group, filename);
- } catch (NumberFormatException e) {
- // TODO: warning level
- fireTransferDebug("Not setting group: must be a numerical GID for SFTP");
- } catch (SftpException e) {
- fireTransferDebug("Not setting group: " + e.getMessage());
- }
- }
-
- private void setFileMode(String filename, RepositoryPermissions permissions) {
- try {
- int mode = getOctalMode(permissions.getFileMode());
- channel.chmod(mode, filename);
- } catch (NumberFormatException e) {
- // TODO: warning level
- fireTransferDebug("Not setting mode: must be a numerical mode for SFTP");
- } catch (SftpException e) {
- fireTransferDebug("Not setting mode: " + e.getMessage());
- }
- }
-
- private void mkdirs(String resourceName, int mode) throws SftpException, TransferFailedException {
- String[] dirs = PathUtils.dirnames(resourceName);
- for (String dir : dirs) {
- mkdir(dir, mode);
-
- channel.cd(dir);
- }
- }
-
- private void mkdir(String dir, int mode) throws TransferFailedException, SftpException {
- try {
- SftpATTRS attrs = channel.stat(dir);
- if ((attrs.getPermissions() & S_IFDIR) == 0) {
- throw new TransferFailedException("Remote path is not a directory: " + dir);
- }
- } catch (SftpException e) {
- // doesn't exist, make it and try again
- channel.mkdir(dir);
- if (mode != -1) {
- try {
- channel.chmod(mode, dir);
- } catch (SftpException e1) {
- // for some extrange reason we recive this exception,
- // even when chmod success
- }
- }
- }
- }
-
- private SftpATTRS changeToRepositoryDirectory(String dir, String filename)
- throws ResourceDoesNotExistException, SftpException {
- // This must be called first to ensure that if the file doesn't exist it throws an exception
- SftpATTRS attrs;
- try {
- channel.cd(repository.getBasedir());
-
- if (dir.length() > 0) {
- channel.cd(dir);
- }
-
- if (filename.length() == 0) {
- filename = ".";
- }
-
- attrs = channel.stat(filename);
- } catch (SftpException e) {
- if (e.toString().trim().endsWith("No such file")) {
- throw new ResourceDoesNotExistException(e.toString(), e);
- } else if (e.toString().trim().contains("Can't change directory")) {
- throw new ResourceDoesNotExistException(e.toString(), e);
- } else {
- throw e;
- }
- }
- return attrs;
- }
-
- public void putDirectory(File sourceDirectory, String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- final RepositoryPermissions permissions = repository.getPermissions();
-
- try {
- channel.cd("/");
-
- String basedir = getRepository().getBasedir();
- int directoryMode = getDirectoryMode(permissions);
-
- mkdirs(basedir + "/", directoryMode);
-
- fireTransferDebug("Recursively uploading directory " + sourceDirectory.getAbsolutePath() + " as "
- + destinationDirectory);
-
- mkdirs(destinationDirectory, directoryMode);
- ftpRecursivePut(sourceDirectory, null, ScpHelper.getResourceFilename(destinationDirectory), directoryMode);
- } catch (SftpException e) {
- String msg = "Error occurred while deploying '" + sourceDirectory.getAbsolutePath() + "' "
- + "to remote repository: " + getRepository().getUrl() + ": " + e.getMessage();
-
- throw new TransferFailedException(msg, e);
- }
- }
-
- private void ftpRecursivePut(File sourceFile, String prefix, String fileName, int directoryMode)
- throws TransferFailedException, SftpException {
- final RepositoryPermissions permissions = repository.getPermissions();
-
- if (sourceFile.isDirectory()) {
- // ScpHelper.getResourceFilename( destinationDirectory ) - could return empty string
- if (!fileName.equals(".") && !fileName.equals("")) {
- prefix = getFileName(prefix, fileName);
- mkdir(fileName, directoryMode);
- channel.cd(fileName);
- }
-
- File[] files = sourceFile.listFiles();
- if (files != null && files.length > 0) {
- // Directories first, then files. Let's go deep early.
- for (File file : files) {
- if (file.isDirectory()) {
- ftpRecursivePut(file, prefix, file.getName(), directoryMode);
- }
- }
- for (File file : files) {
- if (!file.isDirectory()) {
- ftpRecursivePut(file, prefix, file.getName(), directoryMode);
- }
- }
- }
-
- channel.cd("..");
- } else {
- Resource resource = ScpHelper.getResource(getFileName(prefix, fileName));
-
- firePutInitiated(resource, sourceFile);
-
- putFile(sourceFile, resource, permissions);
- }
- }
-
- private String getFileName(String prefix, String fileName) {
- if (prefix != null) {
- prefix = prefix + "/" + fileName;
- } else {
- prefix = fileName;
- }
- return prefix;
- }
-
- public List<String> getFileList(String destinationDirectory)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- if (destinationDirectory.length() == 0) {
- destinationDirectory = ".";
- }
-
- String filename = ScpHelper.getResourceFilename(destinationDirectory);
-
- String dir = ScpHelper.getResourceDirectory(destinationDirectory);
-
- // we already setuped the root directory. Ignore beginning /
- if (dir.length() > 0 && dir.charAt(0) == ScpHelper.PATH_SEPARATOR) {
- dir = dir.substring(1);
- }
-
- try {
- SftpATTRS attrs = changeToRepositoryDirectory(dir, filename);
- if ((attrs.getPermissions() & S_IFDIR) == 0) {
- throw new TransferFailedException("Remote path is not a directory:" + dir);
- }
-
- @SuppressWarnings("unchecked")
- List<ChannelSftp.LsEntry> fileList = channel.ls(filename);
- List<String> files = new ArrayList<>(fileList.size());
- for (ChannelSftp.LsEntry entry : fileList) {
- String name = entry.getFilename();
- if (entry.getAttrs().isDir()) {
- if (!name.equals(".") && !name.equals("..")) {
- if (!name.endsWith("/")) {
- name += "/";
- }
- files.add(name);
- }
- } else {
- files.add(name);
- }
- }
- return files;
- } catch (SftpException e) {
- String msg = "Error occurred while listing '" + destinationDirectory + "' " + "on remote repository: "
- + getRepository().getUrl() + ": " + e.getMessage();
-
- throw new TransferFailedException(msg, e);
- }
- }
-
- public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
- String filename = ScpHelper.getResourceFilename(resourceName);
-
- String dir = ScpHelper.getResourceDirectory(resourceName);
-
- // we already setuped the root directory. Ignore beginning /
- if (dir.length() > 0 && dir.charAt(0) == ScpHelper.PATH_SEPARATOR) {
- dir = dir.substring(1);
- }
-
- try {
- changeToRepositoryDirectory(dir, filename);
-
- return true;
- } catch (ResourceDoesNotExistException e) {
- return false;
- } catch (SftpException e) {
- String msg = "Error occurred while looking for '" + resourceName + "' " + "on remote repository: "
- + getRepository().getUrl() + ": " + e.getMessage();
-
- throw new TransferFailedException(msg, e);
- }
- }
-
- protected void cleanupGetTransfer(Resource resource) {
- returnToParentDirectory(resource);
- }
-
- protected void cleanupPutTransfer(Resource resource) {
- returnToParentDirectory(resource);
- }
-
- protected void finishPutTransfer(Resource resource, InputStream input, OutputStream output)
- throws TransferFailedException {
- RepositoryPermissions permissions = getRepository().getPermissions();
-
- String filename = ScpHelper.getResourceFilename(resource.getName());
- if (permissions != null && permissions.getGroup() != null) {
- setGroup(filename, permissions);
- }
-
- if (permissions != null && permissions.getFileMode() != null) {
- setFileMode(filename, permissions);
- }
- }
-
- public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException {
- Resource resource = inputData.getResource();
-
- String filename = ScpHelper.getResourceFilename(resource.getName());
-
- String dir = ScpHelper.getResourceDirectory(resource.getName());
-
- // we already setuped the root directory. Ignore beginning /
- if (dir.length() > 0 && dir.charAt(0) == ScpHelper.PATH_SEPARATOR) {
- dir = dir.substring(1);
- }
-
- try {
- SftpATTRS attrs = changeToRepositoryDirectory(dir, filename);
-
- long lastModified = attrs.getMTime() * MILLIS_PER_SEC;
- resource.setContentLength(attrs.getSize());
-
- resource.setLastModified(lastModified);
-
- inputData.setInputStream(channel.get(filename));
- } catch (SftpException e) {
- handleGetException(resource, e);
- }
- }
-
- public void fillOutputData(OutputData outputData) throws TransferFailedException {
- int directoryMode = getDirectoryMode(getRepository().getPermissions());
-
- Resource resource = outputData.getResource();
-
- try {
- channel.cd("/");
-
- String basedir = getRepository().getBasedir();
- mkdirs(basedir + "/", directoryMode);
-
- mkdirs(resource.getName(), directoryMode);
-
- String filename = ScpHelper.getResourceFilename(resource.getName());
- outputData.setOutputStream(channel.put(filename));
- } catch (TransferFailedException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- throw e;
- } catch (SftpException e) {
- fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
-
- String msg = "Error occurred while deploying '" + resource.getName() + "' " + "to remote repository: "
- + getRepository().getUrl() + ": " + e.getMessage();
-
- throw new TransferFailedException(msg, e);
- }
- }
-
- /**
- * @param permissions repository's permissions
- * @return the directory mode for the repository or <code>-1</code> if it
- * wasn't set
- */
- public int getDirectoryMode(RepositoryPermissions permissions) {
- int ret = -1;
-
- if (permissions != null) {
- ret = getOctalMode(permissions.getDirectoryMode());
- }
-
- return ret;
- }
-
- public int getOctalMode(String mode) {
- int ret;
- try {
- ret = Integer.valueOf(mode, 8).intValue();
- } catch (NumberFormatException e) {
- // TODO: warning level
- fireTransferDebug("the file mode must be a numerical mode for SFTP");
- ret = -1;
- }
- return ret;
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/WagonUserInfo.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/WagonUserInfo.java
deleted file mode 100644
index d56791d8..00000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/WagonUserInfo.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import com.jcraft.jsch.UserInfo;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo;
-
-/**
- * WagonUserInfo
- *
- *
- */
-class WagonUserInfo implements UserInfo {
- private final InteractiveUserInfo userInfo;
-
- private String password;
-
- private String passphrase;
-
- WagonUserInfo(AuthenticationInfo authInfo, InteractiveUserInfo userInfo) {
- this.userInfo = userInfo;
-
- this.password = authInfo.getPassword();
-
- this.passphrase = authInfo.getPassphrase();
- }
-
- public String getPassphrase() {
- return passphrase;
- }
-
- public String getPassword() {
- return password;
- }
-
- public boolean promptPassphrase(String message) {
- if (passphrase == null && userInfo != null) {
- passphrase = userInfo.promptPassphrase(message);
- }
- return passphrase != null;
- }
-
- public boolean promptPassword(String message) {
- if (password == null && userInfo != null) {
- password = userInfo.promptPassword(message);
- }
- return password != null;
- }
-
- public boolean promptYesNo(String message) {
- return userInfo != null && userInfo.promptYesNo(message);
- }
-
- public void showMessage(String message) {
- if (userInfo != null) {
- userInfo.showMessage(message);
- }
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/interactive/PrompterUIKeyboardInteractive.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/interactive/PrompterUIKeyboardInteractive.java
deleted file mode 100644
index 5bdd2e20..00000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/interactive/PrompterUIKeyboardInteractive.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch.interactive;
-
-import com.jcraft.jsch.UIKeyboardInteractive;
-import org.codehaus.plexus.components.interactivity.Prompter;
-import org.codehaus.plexus.components.interactivity.PrompterException;
-
-/**
- * UIKeyboardInteractive that use plexus-prompter.
- *
- * <code>UIKeyboardInteractive</code> are usefull when you don't use user with
- * password authentication with a server that use keyboard-interactive and
- * doesn't allow password method <code>PasswordAuthentication no</code>.
- *
- * @author <a href="mailto:juam at users.sourceforge.net">Juan F. Codagnone</a>
- * @since Sep 22, 2005
- *
- * @plexus.component role="com.jcraft.jsch.UIKeyboardInteractive"
- */
-public class PrompterUIKeyboardInteractive implements UIKeyboardInteractive {
- /**
- * @plexus.requirement role-hint="default"
- */
- private volatile Prompter prompter;
-
- public PrompterUIKeyboardInteractive() {}
-
- public PrompterUIKeyboardInteractive(Prompter promper) {
- this.prompter = promper;
- }
-
- /**
- * @see UIKeyboardInteractive#promptKeyboardInteractive(String,String,
- *String,String[],boolean[])
- */
- public String[] promptKeyboardInteractive(
- String destination, String name, String instruction, String[] prompt, boolean[] echo) {
-
- if (prompt.length != echo.length) {
- // jcsh is buggy?
- throw new IllegalArgumentException("prompt and echo size arrays are different!");
- }
- String[] ret = new String[prompt.length];
-
- try {
-
- for (int i = 0; i < ret.length; i++) {
- if (echo[i]) {
- ret[i] = prompter.prompt(prompt[i]);
- } else {
- ret[i] = prompter.promptForPassword(prompt[i]);
- }
- }
- } catch (PrompterException e) {
- // TODO: log
- // the user canceled?
- ret = null;
- }
-
- return ret;
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/interactive/UserInfoUIKeyboardInteractiveProxy.java b/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/interactive/UserInfoUIKeyboardInteractiveProxy.java
deleted file mode 100644
index 06413074..00000000
--- a/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/interactive/UserInfoUIKeyboardInteractiveProxy.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch.interactive;
-
-import com.jcraft.jsch.UIKeyboardInteractive;
-import com.jcraft.jsch.UserInfo;
-
-/**
- * A proxy that let you merge a <code>UserInfo</code> and a
- * <code>UIKeyboardInteractive</code>
- *
- * @author Juan F. Codagnone
- * @since Sep 22, 2005
- */
-public class UserInfoUIKeyboardInteractiveProxy implements UserInfo, UIKeyboardInteractive {
- private final UIKeyboardInteractive interactive;
-
- private final UserInfo userInfo;
-
- public UserInfoUIKeyboardInteractiveProxy(UserInfo userInfo, UIKeyboardInteractive interactive) {
- this.userInfo = userInfo;
- this.interactive = interactive;
- }
-
- /**
- * @see com.jcraft.jsch.UIKeyboardInteractive#promptKeyboardInteractive(String,String,String,String[],boolean[])
- */
- public String[] promptKeyboardInteractive(
- String destination, String name, String instruction, String[] prompt, boolean[] echo) {
- if (userInfo.getPassword() != null && prompt != null && prompt.length != 0) {
- prompt[0] = "Keyboard interactive required, supplied password is ignored\n" + prompt[0];
- }
- return interactive.promptKeyboardInteractive(destination, name, instruction, prompt, echo);
- }
-
- /**
- * @see com.jcraft.jsch.UserInfo#getPassphrase()
- */
- public String getPassphrase() {
- return userInfo.getPassphrase();
- }
-
- /**
- * @see com.jcraft.jsch.UserInfo#getPassword()
- */
- public String getPassword() {
- return userInfo.getPassword();
- }
-
- /**
- * @see com.jcraft.jsch.UserInfo#promptPassword(String)
- */
- public boolean promptPassword(String arg0) {
- return userInfo.promptPassword(arg0);
- }
-
- /**
- * @see com.jcraft.jsch.UserInfo#promptPassphrase(String)
- */
- public boolean promptPassphrase(String arg0) {
- return userInfo.promptPassphrase(arg0);
- }
-
- /**
- * @see com.jcraft.jsch.UserInfo#promptYesNo(String)
- */
- public boolean promptYesNo(String arg0) {
- return userInfo.promptYesNo(arg0);
- }
-
- /**
- * @see com.jcraft.jsch.UserInfo#showMessage(String)
- */
- public void showMessage(String arg0) {
- userInfo.showMessage(arg0);
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/site/apt/index.apt b/wagon-providers/wagon-ssh/src/site/apt/index.apt
deleted file mode 100644
index 99dcc2af..00000000
--- a/wagon-providers/wagon-ssh/src/site/apt/index.apt
+++ /dev/null
@@ -1,45 +0,0 @@
- ------
- Maven Wagon SSH
- ------
- Carlos Sanchez
- ------
- 2006-06-04
- ------
-
- ~~ 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.
-
- ~~ NOTE: For help with the syntax of this file, see:
- ~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Deprecation Notice
-
- This Wagon provider is deprecated and will be removed in version 4.0.0.
-
-Maven Wagon SSH
-
- This component is an implementation of Wagon provider for SCP and SFTP access.
-
- It enables Maven to deploy artifacts and sites to SSH servers.
- It uses {{{http://www.jcraft.com/jsch/}JSch - Java Secure Channel}} as lower level layer.
-
- Getting files from SSH servers is not fully tested.
-
-
-Features
-
- * Deploy files and directories to SSH servers
diff --git a/wagon-providers/wagon-ssh/src/site/site.xml b/wagon-providers/wagon-ssh/src/site/site.xml
deleted file mode 100644
index 2ebb3d14..00000000
--- a/wagon-providers/wagon-ssh/src/site/site.xml
+++ /dev/null
@@ -1,33 +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/DECORATION/1.3.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
- <body>
- <breadcrumbs>
- <item name="SSH" href="./index.html" />
- </breadcrumbs>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
diff --git a/wagon-providers/wagon-ssh/src/site/xdoc/configuration.xml b/wagon-providers/wagon-ssh/src/site/xdoc/configuration.xml
deleted file mode 100644
index 778cf246..00000000
--- a/wagon-providers/wagon-ssh/src/site/xdoc/configuration.xml
+++ /dev/null
@@ -1,224 +0,0 @@
-<!--
- ~ 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.
- -->
-
-<document>
- <properties>
- <title>Wagon SSH provider configuration</title>
- <author email="michal.maczka@dimatics.com">Michal Maczka</author>
- </properties>
- <body>
- <section name="Configuration">
- <p>This wagon can be configured in some ways:
- <table>
- <tr>
- <th>What? / Interface</th>
- <th>Default Value</th>
- <th>Why?</th>
- </tr>
- <tr>
- <td>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/KnownHostsProvider.html">Known Hosts Provider</a>
- </td>
- <td>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">
- FileKnownHostsProvider</a>
- with fallback to
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">
- NullKnownHostProvider</a>
- </td>
- <td>provides known hosts keys, needed to check the hosts
- identity. This is an important thing!
- <p>Some implementations:
- <ul>
- <li>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">
- NullKnownHostProvider</a>:
- Don't provide anything
- </li>
- <li>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProvider.html">
- SingleKnownHostProvider</a>:
- One host key can be setuped
- </li>
- <li>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">
- FileKnownHostProvider</a>:
- Load known hosts keys from a openssh's <code>~/.ssh/known_hosts</code>
- like stream
- </li>
- <li>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.html">
- StreamKnownHostProvider</a>:
- Load known hosts keys from <code>~/.ssh/known_hosts</code> (you can
- set another location)
- </li>
-
- </ul>
- </p>
- </td>
- </tr>
- <tr>
- <td>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/HostCheckingEnum.html">Host Checking</a>
- </td>
- <td>Ask (type safe enum)</td>
- <td>The policy with the hosts keys:
- <ul>
- <li>
- <strong>Yes:</strong>
- Check host keys. If the incoming
- key is not available in the Known Hosts Provider
- fails
- </li>
- <li>
- <strong>Ask:</strong>
- If the incoming key is not
- available in the Known Hosts Provider it ask the user
- if the fingerprint is trusted
- </li>
- <li>
- <strong>No:</strong>
- don't check host keys at all.
- pretty unsafe!!
- </li>
-
- </ul>
- </td>
- </tr>
- <tr>
- <td>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.html">Interactive User Info</a>
- </td>
- <td>
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">
- ConsoleInteractiveUserInfo</a>
- </td>
- <td>If the user choose
- <em>Ask</em>
- as
- <em>Host Checking</em>
- , this
- bean is used to interact with the user
- <p>Some implementations:
- <ul>
- <li>
- <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullInteractiveUserInfo.html">
- NullInteractiveUserInfo</a>
- </li>
- <li>
- <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">
- ConsoleInteractiveUserInfo</a>
- </li>
- </ul>
- </p>
-
- </td>
- </tr>
- </table>
- </p>
- </section>
- <section name="Configuration">
- <p>This wagon can be configured in some ways:
- <table>
- <tr>
- <th>What? / Interface</th>
- <th>Default Value</th>
- <th>Why?</th>
- </tr>
- <tr>
- <td><a
- href="apidocs/org/apache/maven/wagon/providers/ssh/KnownHostsProvider.html">Known Hosts Provider </a></td>
- <td><a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">FileKnownHostsProvider</a>
- with fallback to
- <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">NullKnownHostProvider</a></td>
- <td>provides known hosts keys, needed to check the hosts
- identity. This is an important thing!
- <p>Some implementations:
- <ul>
- <li> <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullKnownHostsProvider.html">NullKnownHostProvider</a>: Don't provide anything</li>
- <li> <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/SingleKnownHostsProvider.html">SingleKnownHostProvider</a>: One host key can be setuped</li>
- <li> <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/FileKnownHostsProvider.html">FileKnownHostProvider</a>:
- Load known hosts keys from a openssh's <code>~/.ssh/known_hosts</code>
- like stream</li>
- <li> <a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/StreamKnownHostsProvider.html">StreamKnownHostProvider</a>:
- Load known hosts keys from <code>~/.ssh/known_hosts</code> (you can
- set another location)</li>
-
- </ul>
- </p>
- </td>
- </tr>
- <tr>
- <td><a
- href="apidocs/org/apache/maven/wagon/providers/ssh/HostCheckingEnum.html">Host Checking</a></td>
- <td>Ask (type safe enum)</td>
- <td>The policy with the hosts keys:
- <ul>
- <li><strong>Yes:</strong> Check host keys. If the incoming
- key is not available in the Known Hosts Provider
- fails</li>
- <li><strong>Ask:</strong> If the incoming key is not
- available in the Known Hosts Provider it ask the user
- if the fingerprint is trusted</li>
- <li><strong>No:</strong> don't check host keys at all.
- pretty unsafe!!</li>
-
- </ul>
- </td>
- </tr>
- <tr>
- <td><a
- href="apidocs/org/apache/maven/wagon/providers/ssh/InteractiveUserInfo.html">Interactive User Info</a></td>
- <td><a
- href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">ConsoleInteractiveUserInfo</a></td>
- <td>If the user choose <em>Ask</em> as <em>Host Checking</em>, this
- bean is used to interact with the user
- <p>Some implementations:
- <ul>
- <li> <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/NullInteractiveUserInfo.html">NullInteractiveUserInfo</a> </li>
- <li> <a href="apidocs/org/apache/maven/wagon/providers/ssh/knownhost/ConsoleInteractiveUserInfo.html">ConsoleInteractiveUserInfo</a> </li>
- </ul>
- </p>
-
- </td>
- </tr>
-
- </table>
- <strong>TODO</strong>
- Autogenerate some of this information with a xdoclet2 plugin?
- </p>
- </section>
- </body>
-</document>
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/EmbeddedScpWagonTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/EmbeddedScpWagonTest.java
deleted file mode 100644
index 8b745503..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/EmbeddedScpWagonTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-/*
- * 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.IOException;
-
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.providers.ssh.AbstractEmbeddedScpWagonTest;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostEntry;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class EmbeddedScpWagonTest extends AbstractEmbeddedScpWagonTest {
-
- @Override
- protected Wagon getWagon() throws Exception {
- ScpWagon scpWagon = (ScpWagon) super.getWagon();
- scpWagon.setInteractive(false);
- scpWagon.setKnownHostsProvider(new KnownHostsProvider() {
- public void storeKnownHosts(String contents) throws IOException {}
-
- public void addKnownHost(KnownHostEntry knownHost) throws IOException {}
-
- public void setHostKeyChecking(String hostKeyChecking) {}
-
- public String getHostKeyChecking() {
- return "no";
- }
-
- public String getContents() {
- return null;
- }
- });
- return scpWagon;
- }
-
- protected String getProtocol() {
- return "scp";
- }
-
- @Override
- protected boolean supportsGetIfNewer() {
- return false;
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/EmbeddedScpWagonWithKeyTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/EmbeddedScpWagonWithKeyTest.java
deleted file mode 100644
index a0f4e771..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/EmbeddedScpWagonWithKeyTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.AbstractEmbeddedScpWagonWithKeyTest;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostEntry;
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class EmbeddedScpWagonWithKeyTest extends AbstractEmbeddedScpWagonWithKeyTest {
-
- @Override
- protected Wagon getWagon() throws Exception {
- ScpWagon scpWagon = (ScpWagon) super.getWagon();
- scpWagon.setInteractive(false);
- scpWagon.setKnownHostsProvider(new KnownHostsProvider() {
- public void storeKnownHosts(String contents) throws IOException {}
-
- public void addKnownHost(KnownHostEntry knownHost) throws IOException {}
-
- public void setHostKeyChecking(String hostKeyChecking) {}
-
- public String getHostKeyChecking() {
- return "no";
- }
-
- public String getContents() {
- return null;
- }
- });
- return scpWagon;
- }
-
- protected String getProtocol() {
- return "scp";
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = super.getAuthInfo();
- // user : guest/guest123 - passphrase : toto01
- authInfo.setUserName("guest");
- // authInfo.setPassword( TestData.getUserPassword() );
- authInfo.setPrivateKey(new File("src/test/ssh-keys/id_rsa").getPath());
-
- return authInfo;
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/KnownHostsProviderTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/KnownHostsProviderTest.java
deleted file mode 100644
index f75c5bb5..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/KnownHostsProviderTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProviderTestCase;
-
-/**
- * Generic Unit test for <code>KnownHostsProvider</code>
- *
- * @author Juan F. Codagnone
- * @see org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider
- * @since Sep 12, 2005
- */
-public class KnownHostsProviderTest extends KnownHostsProviderTestCase {}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonTest.java
deleted file mode 100644
index ff8ca82c..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import java.io.File;
-
-import org.apache.maven.wagon.StreamingWagonTestCase;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.TestData;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class ScpWagonTest extends StreamingWagonTestCase {
-
- protected String getProtocol() {
- return "scp";
- }
-
- public String getTestRepositoryUrl() {
- return TestData.getTestRepositoryUrl();
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = super.getAuthInfo();
-
- authInfo.setUserName(TestData.getUserName());
-
- File privateKey = TestData.getPrivateKey();
-
- if (privateKey.exists()) {
- authInfo.setPrivateKey(privateKey.getAbsolutePath());
-
- authInfo.setPassphrase("");
- }
-
- return authInfo;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- return new File(repository.getBasedir(), resource.getName()).lastModified();
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java
deleted file mode 100644
index aed55deb..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketTimeoutException;
-import java.util.Random;
-
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.apache.maven.wagon.repository.Repository;
-import org.codehaus.plexus.PlexusTestCase;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.handler.AbstractHandler;
-
-public class ScpWagonWithProxyTest extends PlexusTestCase {
- private boolean handled;
-
- public void testHttpProxy() throws Exception {
- handled = false;
- Handler handler = new AbstractHandler() {
- public void handle(
- String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- assertEquals("CONNECT", request.getMethod());
-
- handled = true;
- baseRequest.setHandled(true);
- }
- };
-
- Server server = new Server();
- ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(new HttpConfiguration()));
- server.addConnector(connector);
- server.setHandler(handler);
- server.start();
-
- int port = connector.getLocalPort();
- ProxyInfo proxyInfo = new ProxyInfo();
- proxyInfo.setHost("localhost");
- proxyInfo.setPort(port);
- proxyInfo.setType("http");
- proxyInfo.setNonProxyHosts(null);
-
- Wagon wagon = (Wagon) lookup(Wagon.ROLE, "scp");
- try {
- wagon.connect(new Repository("id", "scp://localhost/tmp"), proxyInfo);
- fail();
- } catch (AuthenticationException e) {
- assertTrue(handled);
- } finally {
- wagon.disconnect();
- server.stop();
- }
- }
-
- public void testSocksProxy() throws Exception {
- handled = false;
-
- int port = (Math.abs(new Random().nextInt()) % 2048) + 1024;
-
- SocksServer s = new SocksServer(port);
- Thread t = new Thread(s);
- t.setDaemon(true);
- t.start();
-
- ProxyInfo proxyInfo = new ProxyInfo();
- proxyInfo.setHost("localhost");
- proxyInfo.setPort(port);
- proxyInfo.setType("socks_5");
- proxyInfo.setNonProxyHosts(null);
-
- Wagon wagon = (Wagon) lookup(Wagon.ROLE, "scp");
- try {
- wagon.connect(new Repository("id", "scp://localhost/tmp"), proxyInfo);
- fail();
- } catch (AuthenticationException e) {
- assertTrue(handled);
- } finally {
- wagon.disconnect();
- t.interrupt();
- }
- }
-
- private final class SocksServer implements Runnable {
-
- private final int port;
-
- private String userAgent;
-
- private SocksServer(int port) {
- this.port = port;
- }
-
- public void run() {
- ServerSocket ssock = null;
- try {
- try {
- ssock = new ServerSocket(port);
- ssock.setSoTimeout(2000);
- } catch (IOException e) {
- return;
- }
-
- while (!Thread.currentThread().isInterrupted()) {
- Socket sock = null;
- try {
- try {
- sock = ssock.accept();
- } catch (SocketTimeoutException e) {
- continue;
- }
-
- handled = true;
- } catch (IOException e) {
- } finally {
- if (sock != null) {
- try {
- sock.close();
- } catch (IOException e) {
- }
- }
- }
- }
- } finally {
- if (ssock != null) {
- try {
- ssock.close();
- } catch (IOException e) {
- }
- }
- }
- }
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithSshPrivateKeySearchTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithSshPrivateKeySearchTest.java
deleted file mode 100644
index 8fdad517..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithSshPrivateKeySearchTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import java.io.File;
-
-import org.apache.maven.wagon.StreamingWagonTestCase;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.TestData;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class ScpWagonWithSshPrivateKeySearchTest extends StreamingWagonTestCase {
- protected String getProtocol() {
- return "scp";
- }
-
- public String getTestRepositoryUrl() {
- return TestData.getTestRepositoryUrl(0);
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = super.getAuthInfo();
-
- authInfo.setUserName(TestData.getUserName());
-
- authInfo.setPassphrase("");
-
- return authInfo;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- return new File(repository.getBasedir(), resource.getName()).lastModified();
- }
-
- public void testMissingPrivateKey() throws Exception {
- File file = File.createTempFile("wagon", "tmp");
- file.delete();
-
- AuthenticationInfo authInfo = new AuthenticationInfo();
- authInfo.setPrivateKey(file.getAbsolutePath());
-
- try {
- getWagon().connect(new Repository(), authInfo);
- fail();
- } catch (AuthenticationException e) {
- assertTrue(true);
- }
- }
-
- public void testBadPrivateKey() throws Exception {
- File file = File.createTempFile("wagon", "tmp");
- file.deleteOnExit();
-
- AuthenticationInfo authInfo = new AuthenticationInfo();
- authInfo.setPrivateKey(file.getAbsolutePath());
-
- try {
- getWagon().connect(new Repository(), authInfo);
- fail();
- } catch (AuthenticationException e) {
- assertTrue(true);
- } finally {
- file.delete();
- }
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/SftpWagonTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/SftpWagonTest.java
deleted file mode 100644
index ca9ff4d6..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/SftpWagonTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import java.io.File;
-
-import org.apache.maven.wagon.StreamingWagonTestCase;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.providers.ssh.TestData;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- *
- */
-public class SftpWagonTest extends StreamingWagonTestCase {
- protected String getProtocol() {
- return "sftp";
- }
-
- public String getTestRepositoryUrl() {
- return TestData.getTestRepositoryUrl(0);
- }
-
- protected AuthenticationInfo getAuthInfo() {
- AuthenticationInfo authInfo = super.getAuthInfo();
-
- authInfo.setUserName(TestData.getUserName());
-
- return authInfo;
- }
-
- protected long getExpectedLastModifiedOnGet(Repository repository, Resource resource) {
- return new File(repository.getBasedir(), resource.getName()).lastModified();
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/SshCommandExecutorTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/SshCommandExecutorTest.java
deleted file mode 100644
index 86161e5b..00000000
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/SshCommandExecutorTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.wagon.providers.ssh.jsch;
-
-import org.apache.maven.wagon.CommandExecutorTestCase;
-import org.apache.maven.wagon.repository.Repository;
-
-/**
- * Test the command executor.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- *
- */
-public class SshCommandExecutorTest extends CommandExecutorTestCase {
-
- protected Repository getTestRepository() {
- return new Repository("test", "scp://localhost/");
- }
-}
diff --git a/wagon-providers/wagon-ssh/src/test/resources/dummy.txt b/wagon-providers/wagon-ssh/src/test/resources/dummy.txt
deleted file mode 100644
index e45b8165..00000000
--- a/wagon-providers/wagon-ssh/src/test/resources/dummy.txt
+++ /dev/null
@@ -1 +0,0 @@
-dummy file with fake content.
\ No newline at end of file
diff --git a/wagon-providers/wagon-ssh/src/test/resources/log4j.xml b/wagon-providers/wagon-ssh/src/test/resources/log4j.xml
deleted file mode 100644
index 824015bc..00000000
--- a/wagon-providers/wagon-ssh/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,41 +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.
- -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
- </layout>
- </appender>
- <logger name="org.apache.sshd.server">
- <level value="INFO"/>
- </logger>
-
-
-
- <root>
- <priority value ="info" />
- <appender-ref ref="console" />
- </root>
-
-</log4j:configuration>
diff --git a/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml b/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml
deleted file mode 100644
index 0550ecbe..00000000
--- a/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonTest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
- ~ 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.
- -->
-
-<component-set>
- <components>
- <component>
- <role>org.apache.maven.wagon.providers.ssh.interactive.InteractiveUserInfo</role>
- <implementation>org.apache.maven.wagon.providers.ssh.interactive.NullInteractiveUserInfo</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- <component>
- <role>org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider</role>
- <implementation>org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- <configuration>
- <hostKeyChecking>no</hostKeyChecking>
- </configuration>
- </component>
- </components>
-</component-set>
diff --git a/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml b/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml
deleted file mode 100644
index 0550ecbe..00000000
--- a/wagon-providers/wagon-ssh/src/test/resources/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
- ~ 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.
... 2161 lines suppressed ...
(maven-wagon) 02/03: We need Subversion client to be installed before running tests.
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch WAGON-638
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git
commit 5f2f49e6886ec541d8314b124a6477c29c93d7ef
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Dec 26 13:00:05 2024 +0100
We need Subversion client to be installed before running tests.
---
.github/workflows/maven-verify.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml
index 932827cf..d021860d 100644
--- a/.github/workflows/maven-verify.yml
+++ b/.github/workflows/maven-verify.yml
@@ -25,3 +25,5 @@ jobs:
build:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
+ with:
+ install-subversion: true