Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshInputHandlerTests.java')
-rwxr-xr-xbundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshInputHandlerTests.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshInputHandlerTests.java b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshInputHandlerTests.java
new file mode 100755
index 000000000..e7ed407a0
--- /dev/null
+++ b/bundles/archived/org.eclipse.equinox.console.ssh.tests/src/org/eclipse/equinox/console/ssh/SshInputHandlerTests.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lazar Kirchev, SAP AG - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.console.ssh;
+
+import java.io.ByteArrayOutputStream;
+import java.io.StringBufferInputStream;
+
+import org.eclipse.equinox.console.common.ConsoleInputStream;
+import org.eclipse.equinox.console.common.ConsoleOutputStream;
+import org.eclipse.equinox.console.ssh.SshInputHandler;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+public class SshInputHandlerTests {
+
+ private static final long WAIT_TIME = 10000;
+
+ @Test
+ public void testHandler() throws Exception {
+ StringBufferInputStream input = new StringBufferInputStream("abcde");
+ ConsoleInputStream in = new ConsoleInputStream();
+ ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+ ConsoleOutputStream out = new ConsoleOutputStream(byteOut);
+ SshInputHandler handler = new SshInputHandler(input, in, out);
+ handler.start();
+
+ // wait for the accept thread to start execution
+ try {
+ Thread.sleep(WAIT_TIME);
+ } catch (InterruptedException ie) {
+ // do nothing
+ }
+
+ String res = byteOut.toString();
+ Assert.assertTrue("Wrong input. Expected abcde, read " + res, res.equals("abcde"));
+ }
+}

Back to the top