Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2009-03-19 00:11:01 +0000
committerslewis2009-03-19 00:11:01 +0000
commit8fa495f73d0af296ee45cab520f5dcedc7d25110 (patch)
treee7a5e202f32a7457d88418dc75dfc3d171150511 /tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src
parent0c853264982669c084c62a34dc04d0f3b4ff4458 (diff)
downloadorg.eclipse.ecf-8fa495f73d0af296ee45cab520f5dcedc7d25110.tar.gz
org.eclipse.ecf-8fa495f73d0af296ee45cab520f5dcedc7d25110.tar.xz
org.eclipse.ecf-8fa495f73d0af296ee45cab520f5dcedc7d25110.zip
Fixes for scp tests. Added System properties: username, password, and host...e.g. -Dusername=slewis, -Dpassword="password/passphrase" -Dhost=foo.blah.com
Diffstat (limited to 'tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src')
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java9
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java36
2 files changed, 34 insertions, 11 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java b/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java
index 47cc03600..7968a214e 100755
--- a/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java
@@ -31,9 +31,10 @@ public class SCPOutgoingTest extends ContainerAbstractTestCase {
private static final String TESTSRCFILE = "test.txt"; //$NON-NLS-1$
// URL (example: scp://slewis@ecf1.osuosl.org/test.txt
- private static final String TESTTARGETURL = System.getProperty("url"); //$NON-NLS-1$
+ String username = System.getProperty("username", "nobody"); //$NON-NLS-1$ //$NON-NLS-2$
+ String password = System.getProperty("password", "password"); //$NON-NLS-1$ //$NON-NLS-2$
- String password = System.getProperty("password"); //$NON-NLS-1$
+ String host = System.getProperty("host", "localhost"); //$NON-NLS-1$ //$NON-NLS-2$
protected ISendFileTransferContainerAdapter adapter = null;
protected IFileTransferListener senderTransferListener = null;
@@ -60,7 +61,9 @@ public class SCPOutgoingTest extends ContainerAbstractTestCase {
}
public void testSend() throws Exception {
- final IFileID targetID = FileIDFactory.getDefault().createFileID(adapter.getOutgoingNamespace(), new URL(TESTTARGETURL));
+ String targetURL = "scp://" + username + "@" + host + "/" + TESTSRCFILE; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ System.out.println("Sending to " + targetURL); //$NON-NLS-1$
+ final IFileID targetID = FileIDFactory.getDefault().createFileID(adapter.getOutgoingNamespace(), new URL(targetURL));
adapter.setConnectContextForAuthentication(ConnectContextFactory.createPasswordConnectContext(password));
adapter.sendOutgoingRequest(targetID, new File(TESTSRCFILE), senderTransferListener, null);
diff --git a/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java b/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java
index e7e251e76..2a32c0a23 100755
--- a/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java
@@ -25,7 +25,13 @@ import org.eclipse.ecf.tests.ContainerAbstractTestCase;
public class SCPRetrieveTest extends ContainerAbstractTestCase {
- private static final String TESTTARGETURL = System.getProperty("url"); //$NON-NLS-1$
+ private static final String TESTSRCFILE = "test.txt"; //$NON-NLS-1$
+
+ // URL (example: scp://slewis@ecf1.osuosl.org/test.txt
+ String username = System.getProperty("username", "nobody"); //$NON-NLS-1$ //$NON-NLS-2$
+ String password = System.getProperty("password", "password"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ String host = System.getProperty("host", "localhost"); //$NON-NLS-1$ //$NON-NLS-2$
IRetrieveFileTransferContainerAdapter adapter = null;
@@ -38,6 +44,9 @@ public class SCPRetrieveTest extends ContainerAbstractTestCase {
super.setUp();
final IContainer container = ContainerFactory.getDefault().createContainer();
adapter = (IRetrieveFileTransferContainerAdapter) container.getAdapter(IRetrieveFileTransferContainerAdapter.class);
+ receiveStartEvents = new ArrayList();
+ receiveDataEvents = new ArrayList();
+ receiveDoneEvents = new ArrayList();
}
/*
@@ -47,16 +56,20 @@ public class SCPRetrieveTest extends ContainerAbstractTestCase {
*/
protected void tearDown() throws Exception {
super.tearDown();
+ receiveStartEvents.clear();
+ receiveDataEvents.clear();
+ receiveDoneEvents.clear();
adapter = null;
}
- List receiveStartEvents = new ArrayList();
+ List receiveStartEvents;
- List receiveDataEvents = new ArrayList();
+ List receiveDataEvents;
- List receiveDoneEvents = new ArrayList();
+ List receiveDoneEvents;
public void testReceive() throws Exception {
+ final Object lock = new Object();
assertNotNull(adapter);
final IFileTransferListener listener = new IFileTransferListener() {
public void handleTransferEvent(IFileTransferEvent event) {
@@ -74,14 +87,21 @@ public class SCPRetrieveTest extends ContainerAbstractTestCase {
receiveDataEvents.add(event);
} else if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
receiveDoneEvents.add(event);
+ synchronized (lock) {
+ lock.notify();
+ }
}
}
};
- adapter.setConnectContextForAuthentication(ConnectContextFactory.createUsernamePasswordConnectContext(System.getProperty("username"), System.getProperty("password"))); //$NON-NLS-1$ //$NON-NLS-2$
- adapter.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(adapter.getRetrieveNamespace(), TESTTARGETURL), listener, null);
- // Wait for 5 seconds
- sleep(5000, "Starting 5 second wait", "Ending 5 second wait"); //$NON-NLS-1$ //$NON-NLS-2$
+ String targetURL = "scp://" + host + "/" + TESTSRCFILE; //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("Retrieving from " + targetURL + " with username=" + username); //$NON-NLS-1$ //$NON-NLS-2$
+ adapter.setConnectContextForAuthentication(ConnectContextFactory.createUsernamePasswordConnectContext(username, password));
+ adapter.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(adapter.getRetrieveNamespace(), targetURL), listener, null);
+
+ synchronized (lock) {
+ lock.wait(30000);
+ }
assertHasEvent(receiveStartEvents, IIncomingFileTransferReceiveStartEvent.class);
assertHasMoreThanEventCount(receiveDataEvents, IIncomingFileTransferReceiveDataEvent.class, 0);

Back to the top