Author: tpalsulich
Date: Mon Dec 29 20:53:18 2014
New Revision: 1648427
URL: http://svn.apache.org/r1648427
Log:
OODT-762. Migrate protocol/sftp test resources.
Added:
oodt/trunk/protocol/sftp/src/test/java/
oodt/trunk/protocol/sftp/src/test/java/org/
oodt/trunk/protocol/sftp/src/test/java/org/apache/
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java
oodt/trunk/protocol/sftp/src/test/resources/
oodt/trunk/protocol/sftp/src/test/resources/authorization.xml
oodt/trunk/protocol/sftp/src/test/resources/platform.xml
oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.key
oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.pub
oodt/trunk/protocol/sftp/src/test/resources/server.xml
oodt/trunk/protocol/sftp/src/test/resources/sshTestDir/
oodt/trunk/protocol/sftp/src/test/resources/sshTestDir/sshTestFile
Removed:
oodt/trunk/protocol/sftp/src/test/org/
oodt/trunk/protocol/sftp/src/testdata/
Added:
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java?rev=1648427&view=auto
==============================================================================
---
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java
(added)
+++
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/DummyAuthenticationProvider.java
Mon Dec 29 20:53:18 2014
@@ -0,0 +1,71 @@
+/*
+ * 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.oodt.cas.protocol.sftp;
+
+//JDK imports
+import java.io.File;
+import java.io.IOException;
+
+//Apache imports
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+//SshTools imports
+import com.sshtools.daemon.platform.NativeAuthenticationProvider;
+import com.sshtools.daemon.platform.PasswordChangeException;
+
+/**
+ * This authentication provider provides no authentication at all, and just
lets
+ * anybody in so you should never use it!
+ *
+ * It is really just for testing.
+ */
+public class DummyAuthenticationProvider extends NativeAuthenticationProvider {
+
+ Log log = LogFactory.getLog(DummyAuthenticationProvider.class);
+
+ public DummyAuthenticationProvider() {
+ log.error("DummyAuthenticationProvider is in use. This is only
for testing.");
+ }
+
+ @Override
+ public boolean changePassword(String username, String oldpassword,
+ String newpassword) {
+ return false;
+ }
+
+ @Override
+ public String getHomeDirectory(String username) throws IOException {
+ return new File("src/test/resources").getAbsolutePath();
+ }
+
+ @Override
+ public void logoffUser() throws IOException {
+
+ }
+
+ @Override
+ public boolean logonUser(String username, String password)
+ throws PasswordChangeException, IOException {
+ return true;
+ }
+
+ @Override
+ public boolean logonUser(String username) throws IOException {
+ return true;
+ }
+}
Added:
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java?rev=1648427&view=auto
==============================================================================
---
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java
(added)
+++
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/TestJschSftpProtocol.java
Mon Dec 29 20:53:18 2014
@@ -0,0 +1,290 @@
+/*
+ * 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.oodt.cas.protocol.sftp;
+
+//JUnit imports
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+//JAVAX imports
+import javax.xml.parsers.ParserConfigurationException;
+
+//OODT imports
+import org.apache.commons.io.FileUtils;
+import org.apache.mina.util.AvailablePortFinder;
+import org.apache.oodt.cas.protocol.ProtocolFile;
+import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
+import org.apache.oodt.cas.protocol.sftp.auth.HostKeyAuthentication;
+import org.apache.oodt.cas.protocol.util.ProtocolFileFilter;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.xml.sax.SAXException;
+
+//SshTools imports
+import com.sshtools.daemon.SshDaemon;
+import com.sshtools.daemon.configuration.PlatformConfiguration;
+import com.sshtools.daemon.configuration.ServerConfiguration;
+import com.sshtools.daemon.configuration.XmlServerConfigurationContext;
+import com.sshtools.j2ssh.configuration.ConfigurationException;
+import com.sshtools.j2ssh.configuration.ConfigurationLoader;
+
+//JUnit imports
+import junit.framework.TestCase;
+import org.mockito.*;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+
+/**
+ * Test class for {@link JschSftpProtocol}.
+ *
+ * @author bfoster
+ */
+public class TestJschSftpProtocol extends TestCase {
+
+ static TestXmlServerConfigurationContext context;
+ static final Logger LOG =
Logger.getLogger(TestJschSftpProtocol.class.getName());
+ static Thread thread;
+ File publicKeysDir;
+
+ @Override
+ public void setUp() {
+ try {
+ publicKeysDir = new File("src/test/resources/publicKeys");
+ publicKeysDir.mkdirs();
+ FileUtils.forceDeleteOnExit(publicKeysDir);
+ FileUtils.copyFile(new
File("src/test/resources/authorization.xml"), new
File("src/test/resources/publicKeys/authorization.xml"));
+ FileUtils.copyFile(new
File("src/test/resources/server.xml"), new
File("src/test/resources/publicKeys/server.xml"));
+ FileUtils.copyFile(new
File("src/test/resources/platform.xml"), new
File("src/test/resources/publicKeys/platform.xml"));
+ ConfigurationLoader.initialize(true, context = new
TestXmlServerConfigurationContext());
+ } catch (Exception e) {
+ fail("Failed to initialize server configuration");
+ }
+
+ (thread = new Thread(new Runnable() {
+ public void run() {
+ try {
+ SshDaemon.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ })).start();
+ }
+
+ @Override
+ public void tearDown() throws IOException {
+ FileUtils.forceDelete(publicKeysDir);
+ SshDaemon.stop("");
+ }
+
+ public void testCDandPWDandLS() throws IOException, ProtocolException {
+ int port = context.getPort();
+ File pubKeyFile = createPubKeyForPort(port);
+ JschSftpProtocol sftpProtocol = spy(new JschSftpProtocol(port));
+ Mockito.doAnswer(new Answer() {
+ public Object answer(InvocationOnMock invocation) {
+ return null;
+ }}).when(sftpProtocol).connect("localhost", new
HostKeyAuthentication("bfoster", "",
+ pubKeyFile.getAbsoluteFile().getAbsolutePath()));
+
+ sftpProtocol.connect("localhost", new HostKeyAuthentication("bfoster",
"",
+ pubKeyFile.getAbsoluteFile().getAbsolutePath()));
+ ProtocolFile homeDir = sftpProtocol.pwd();
+ ProtocolFile testDir = new ProtocolFile(homeDir, "sshTestDir",
true);
+ sftpProtocol.cd(testDir);
+
+ Mockito.when(sftpProtocol.pwd()).thenReturn(new ProtocolFile(homeDir,
"sshTestDir", true));
+
+
+ assertEquals(testDir, sftpProtocol.pwd());
+ List<ProtocolFile> lsResults = new ArrayList<ProtocolFile>(
+ sftpProtocol.ls(new ProtocolFileFilter() {
+ public boolean accept(ProtocolFile file) {
+ return file.getName().equals("sshTestFile");
+ }
+ }));
+ assertEquals(1, lsResults.size());
+ ProtocolFile testFile = lsResults.get(0);
+ ProtocolFile testnew = new ProtocolFile(testDir, "sshTestFile", false);
+ assertEquals(new ProtocolFile(null,
testDir.getPath()+"/sshTestFile", false), testFile);
+ }
+
+ public void testGET() throws ProtocolException, IOException {
+ int port = context.getPort();
+ File pubKeyFile = createPubKeyForPort(port);
+ //JschSftpProtocol sftpProtocol = new JschSftpProtocol(port);
+ JschSftpProtocol mockc = mock(JschSftpProtocol.class);
+
+ Mockito.doAnswer(new Answer() {
+ public Object answer(InvocationOnMock invocation) {
+ return null;
+ }}).when(mockc).connect("localhost", new
HostKeyAuthentication("bfoster", "",
+ pubKeyFile.getAbsoluteFile().getAbsolutePath()));
+ mockc.connect("localhost", new HostKeyAuthentication("bfoster", "",
+
pubKeyFile.getAbsoluteFile().getAbsolutePath()));
+
+
+ File bogusFile = File.createTempFile("bogus", "bogus");
+ final File tmpFile = new File(bogusFile.getParentFile(),
"TestJschSftpProtocol");
+ bogusFile.delete();
+ tmpFile.mkdirs();
+ mockc.cd(new ProtocolFile("sshTestDir", true));
+ File testDownloadFile = new File(tmpFile, "testDownloadFile");
+
+ Mockito.doAnswer(new Answer(){
+ public Object answer(InvocationOnMock invocationOnMock) throws
IOException {
+
+ PrintWriter writer = new
PrintWriter(tmpFile+"/testDownloadFile", "UTF-8");
+
writer.print(readFile("src/test/resources/sshTestDir/sshTestFile"));
+ writer.close();
+
+ return null;
+ }
+ }).when(mockc).get(new ProtocolFile("sshTestFile", false),
testDownloadFile);
+
+
+ mockc.get(new ProtocolFile("sshTestFile", false), testDownloadFile);
+
+ assertTrue(FileUtils.contentEquals(new
File("src/test/resources/sshTestDir/sshTestFile"), testDownloadFile));
+
+ FileUtils.forceDelete(tmpFile);
+ }
+
+ public String readFile(String path){
+ BufferedReader buffReader = null;
+ try{
+ buffReader = new BufferedReader (new FileReader(path));
+ String line = buffReader.readLine();
+ StringBuilder build = new StringBuilder();
+ while(line != null){
+ build.append(line);
+ build.append("\n");
+ System.out.println(line);
+ line = buffReader.readLine();
+
+
+ }
+ String str = build.toString();
+ return str;
+ }catch(IOException ioe){
+ ioe.printStackTrace();
+ }finally{
+ try{
+ buffReader.close();
+ }catch(IOException ioe1){
+ //Leave It
+ }
+
+ }
+ return path;
+ }
+
+ private static class TestServerConfiguration extends
ServerConfiguration {
+
+ int commandPort = AvailablePortFinder.getNextAvailable(12222);
+ int port = AvailablePortFinder.getNextAvailable(2022);
+
+ public TestServerConfiguration(InputStream is) throws
SAXException,
+ ParserConfigurationException, IOException {
+ super(is);
+ }
+
+ @Override
+ public int getCommandPort() {
+ return commandPort;
+ }
+
+ @Override
+ public int getPort() {
+ return port;
+ }
+ }
+
+ private static class TestXmlServerConfigurationContext extends
XmlServerConfigurationContext {
+
+ private TestServerConfiguration serverConfig;
+ private PlatformConfiguration platformConfig;
+
+ public TestXmlServerConfigurationContext() {
+ super();
+ }
+
+ @Override
+ public void initialize() throws ConfigurationException {
+ try {
+ serverConfig = new
TestServerConfiguration(ConfigurationLoader.loadFile("src/test/resources/publicKeys/server.xml"));
+ } catch (Exception e) {
+ throw new ConfigurationException(e.getMessage());
+ }
+ try {
+ platformConfig = new
PlatformConfiguration(ConfigurationLoader.loadFile("src/test/resources/publicKeys/platform.xml"))
{};
+ } catch (Exception e) {
+ throw new ConfigurationException(e.getMessage());
+ }
+ }
+
+ @Override
+ public boolean isConfigurationAvailable(@SuppressWarnings("rawtypes")
Class cls) {
+ try {
+ getConfiguration(cls);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Override
+ public Object getConfiguration(@SuppressWarnings("rawtypes") Class cls)
throws ConfigurationException {
+ if (ServerConfiguration.class.equals(cls)) {
+ return serverConfig;
+ } else if (PlatformConfiguration.class.equals(cls)) {
+ return platformConfig;
+ } else {
+ throw new ConfigurationException(cls.getName()
+ + " configuration not available");
+ }
+ }
+
+ public int getPort() {
+ return serverConfig.getPort();
+ }
+ }
+
+ private File createPubKeyForPort(int port) throws IOException {
+ PrintStream ps = null;
+ BufferedReader br = null;
+ try {
+ File publicKeyFile = new File(publicKeysDir,
"sample-dsa.pub");
+ br = new BufferedReader(new FileReader(new
File("src/test/resources/sample-dsa.pub").getAbsoluteFile()));
+ ps = new PrintStream(new
FileOutputStream(publicKeyFile));
+ String nextLine = null;
+ while ((nextLine = br.readLine()) != null) {
+ ps.println(nextLine.replace("2022",
Integer.toString(port)));
+ }
+ return publicKeyFile;
+ } catch (IOException e) {
+ throw e;
+ } finally {
+ try { ps.close(); } catch (Exception ingore) {}
+ try { br.close(); } catch (Exception ingore) {}
+ }
+ }
+}
Added:
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java?rev=1648427&view=auto
==============================================================================
---
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java
(added)
+++
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/UnsupportedShellProcessProvider.java
Mon Dec 29 20:53:18 2014
@@ -0,0 +1,114 @@
+/*
+ * 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.oodt.cas.protocol.sftp;
+
+//JDK imports
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Map;
+
+//SshTools imports
+import com.sshtools.daemon.platform.NativeProcessProvider;
+import com.sshtools.j2ssh.io.DynamicBuffer;
+
+/**
+ * This is a shell provider that prints a message saying that we don't support
+ * shell access, and then closes the connection.
+ */
+public final class UnsupportedShellProcessProvider extends
+ NativeProcessProvider {
+
+ private static final String MESSAGE = "This server does not provide
shell access, only SFTP. Goodbye.\n";
+
+ private DynamicBuffer stdin = new DynamicBuffer();
+ private DynamicBuffer stderr = new DynamicBuffer();
+ private DynamicBuffer stdout = new DynamicBuffer();
+
+ @Override
+ public boolean createProcess(final String command, final Map
environment)
+ throws IOException {
+ return true;
+ }
+
+ @Override
+ public String getDefaultTerminalProvider() {
+ return "UnsupportedShell";
+ }
+
+ @Override
+ public void kill() {
+ try {
+ stdin.getInputStream().close();
+ stdin.getOutputStream().close();
+ } catch (Exception ex) {
+ }
+ try {
+ stdout.getInputStream().close();
+ stdout.getOutputStream().close();
+ } catch (Exception ex1) {
+ }
+ try {
+ stderr.getInputStream().close();
+ stderr.getOutputStream().close();
+ } catch (Exception ex2) {
+ }
+ }
+
+ @Override
+ public void start() throws IOException {
+ stdin.getOutputStream().write(MESSAGE.getBytes());
+ }
+
+ @Override
+ public boolean stillActive() {
+ try {
+ return stdin.getInputStream().available() > 0;
+ } catch (IOException ex) {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean supportsPseudoTerminal(final String term) {
+ return true;
+ }
+
+ @Override
+ public boolean allocatePseudoTerminal(final String term, final int cols,
+ final int rows, final int width, final int height,
final String modes) {
+ return true;
+ }
+
+ @Override
+ public int waitForExitCode() {
+ return 0;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ return stdin.getInputStream();
+ }
+
+ public OutputStream getOutputStream() throws IOException {
+ return stdout.getOutputStream();
+ }
+
+ public InputStream getStderrInputStream() {
+ return stderr.getInputStream();
+ }
+
+}
Added:
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java?rev=1648427&view=auto
==============================================================================
---
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java
(added)
+++
oodt/trunk/protocol/sftp/src/test/java/org/apache/oodt/cas/protocol/sftp/auth/TestHostKeyAuthentication.java
Mon Dec 29 20:53:18 2014
@@ -0,0 +1,36 @@
+/*
+ * 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.oodt.cas.protocol.sftp.auth;
+
+//JUnit imports
+import junit.framework.TestCase;
+
+/**
+ * Test class for {@link HostKeyAuthentication}.
+ *
+ * @author bfoster
+ */
+public class TestHostKeyAuthentication extends TestCase {
+
+ public void testInitialState() {
+ HostKeyAuthentication auth = new HostKeyAuthentication("user",
"pass", "file");
+ assertEquals("user", auth.getUser());
+ assertEquals("pass", auth.getPass());
+ assertEquals("file", auth.getHostKeyFile());
+ }
+
+}
Added: oodt/trunk/protocol/sftp/src/test/resources/authorization.xml
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/resources/authorization.xml?rev=1648427&view=auto
==============================================================================
--- oodt/trunk/protocol/sftp/src/test/resources/authorization.xml (added)
+++ oodt/trunk/protocol/sftp/src/test/resources/authorization.xml Mon Dec 29
20:53:18 2014
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<!-- Sshtools User Authorization File -->
+<AuthorizedKeys>
+ <!-- Enter authorized public key elements here -->
+ <Key>sample-dsa.pub</Key>
+
+</AuthorizedKeys>
Added: oodt/trunk/protocol/sftp/src/test/resources/platform.xml
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/resources/platform.xml?rev=1648427&view=auto
==============================================================================
--- oodt/trunk/protocol/sftp/src/test/resources/platform.xml (added)
+++ oodt/trunk/protocol/sftp/src/test/resources/platform.xml Mon Dec 29
20:53:18 2014
@@ -0,0 +1,35 @@
+<?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.
+-->
+<!--
+Platform configuration file - Determines the behaviour of platform specific
services
+-->
+<PlatformConfiguration>
+ <!-- The process provider for executing and redirecting a process -->
+
<NativeProcessProvider>org.apache.oodt.cas.protocol.sftp.UnsupportedShellProcessProvider</NativeProcessProvider>
+ <!-- The authentication provider for authenticating users and obtaining
user information -->
+ <!--
+ WARNING: the dummy provider here doesn't ask for any passwords
so obviously it's
+ extremely insecure. You should only use it for testing.
+ -->
+
<NativeAuthenticationProvider>org.apache.oodt.cas.protocol.sftp.DummyAuthenticationProvider</NativeAuthenticationProvider>
+ <!-- The file system provider for SFTP -->
+
<NativeFileSystemProvider>com.sshtools.daemon.vfs.VirtualFileSystem</NativeFileSystemProvider>
+ <!-- Native settings which may be used by the process or authentication
provider -->
+ <!-- Add native settings here -->
+ <!-- <NativeSetting Name="AuthenticateOnDomain" Value="."/> -->
+</PlatformConfiguration>
Added: oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.key
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.key?rev=1648427&view=auto
==============================================================================
--- oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.key (added)
+++ oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.key Mon Dec 29
20:53:18 2014
@@ -0,0 +1,12 @@
+-----BEGIN DSA PRIVATE KEY-----
+MIIBvAIBAAKBgQD/dvNwGfLUx8hRXmJRN/zEvlrUVgOPuYao0JQfcdwz4Zqi/kDq
++4I/GsGphw8v/pI0g0N5jHiiGQ+apVoSOXoYgrW6YNKHIpmBvM1zVQWA33bAqq/+
++k+9Bugp8xvAA5AXUrPdRKQiKYC5ECYX/lIDZCSgty6QrQSnhmAECdm6mQIVAO/1
+X4nkLhL4jwhOGMUmuTVOQxwJAoGBAMi/2mkZc1Aj7FQCJsv/j/Th9eYLYJ1JaeFm
+iYhfkggMfoKyfWlEEjll56UThZL+ZyC2WVUUWDuTrt77zVPUGxEFM2gwL9judLaq
+lV+rOFrwf5LcaQnSoNHWrkf2MUy+juinZFHN/2eI+mQXv0/07IQjbCDAH0U1rr97
+Qxw9Saa3AoGAVMOH1a6meQj4pzZZ9BEkFVVQAuC+DBqxZND2flxIMnO/Z9si1Znw
+0z0ClXXY5vpk1DQJ2FI60aufqYgg/2UhQNjTp37DKL6sk4aK25wwXLWbuaf6b9Ah
+IFwU+g5xSm0j12P40AqaNIhLoCv2FPXSHvnJDsZw3r703ITUB+hwlEwCFQCjIrDI
+YOzgRFkXJwfZCKVpo3L1JA==
+-----END DSA PRIVATE KEY-----
\ No newline at end of file
Added: oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.pub
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.pub?rev=1648427&view=auto
==============================================================================
--- oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.pub (added)
+++ oodt/trunk/protocol/sftp/src/test/resources/sample-dsa.pub Mon Dec 29
20:53:18 2014
@@ -0,0 +1 @@
+[localhost]:2022 ssh-dss
AAAAB3NzaC1kc3MAAACBAP9283AZ8tTHyFFeYlE3/MS+WtRWA4+5hqjQlB9x3DPhmqL+QOr7gj8awamHDy/+kjSDQ3mMeKIZD5qlWhI5ehiCtbpg0ocimYG8zXNVBYDfdsCqr/76T70G6CnzG8ADkBdSs91EpCIpgLkQJhf+UgNkJKC3LpCtBKeGYAQJ2bqZAAAAFQDv9V+J5C4S+I8IThjFJrk1TkMcCQAAAIEAyL/aaRlzUCPsVAImy/+P9OH15gtgnUlp4WaJiF+SCAx+grJ9aUQSOWXnpROFkv5nILZZVRRYO5Ou3vvNU9QbEQUzaDAv2O50tqqVX6s4WvB/ktxpCdKg0dauR/YxTL6O6KdkUc3/Z4j6ZBe/T/TshCNsIMAfRTWuv3tDHD1JprcAAACAVMOH1a6meQj4pzZZ9BEkFVVQAuC+DBqxZND2flxIMnO/Z9si1Znw0z0ClXXY5vpk1DQJ2FI60aufqYgg/2UhQNjTp37DKL6sk4aK25wwXLWbuaf6b9AhIFwU+g5xSm0j12P40AqaNIhLoCv2FPXSHvnJDsZw3r703ITUB+hwlEw=
Added: oodt/trunk/protocol/sftp/src/test/resources/server.xml
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/resources/server.xml?rev=1648427&view=auto
==============================================================================
--- oodt/trunk/protocol/sftp/src/test/resources/server.xml (added)
+++ oodt/trunk/protocol/sftp/src/test/resources/server.xml Mon Dec 29 20:53:18
2014
@@ -0,0 +1,28 @@
+<?xml version="1.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.
+-->
+<ServerConfiguration>
+ <!-- this key needs generating by the provided keygen tool -->
+ <ServerHostKey PrivateKeyFile="src/test/resources/sample-dsa.key"/>
+ <!-- Port>2023</Port -->
+ <!-- UserConfigDirectory>src/test/resources</UserConfigDirectory -->
+ <!-- add other authentication methods as desired -->
+ <AllowedAuthentication>password</AllowedAuthentication>
+ <AllowedAuthentication>keyboard-interactive</AllowedAuthentication>
+ <!-- You can specify more subsystems, or even a replacement SFTP
subsystem -->
+ <Subsystem Name="sftp" Type="class"
Provider="com.sshtools.daemon.sftp.SftpSubsystemServer" />
+</ServerConfiguration>
Added: oodt/trunk/protocol/sftp/src/test/resources/sshTestDir/sshTestFile
URL:
http://svn.apache.org/viewvc/oodt/trunk/protocol/sftp/src/test/resources/sshTestDir/sshTestFile?rev=1648427&view=auto
==============================================================================
--- oodt/trunk/protocol/sftp/src/test/resources/sshTestDir/sshTestFile (added)
+++ oodt/trunk/protocol/sftp/src/test/resources/sshTestDir/sshTestFile Mon Dec
29 20:53:18 2014
@@ -0,0 +1,18 @@
+# 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.
+
+This is a
+test
+File