Resources.FitNesseRoot.PlugIns.SshFixture.UserGuide.EndpointDefinition.PasswordAuthentication.wiki Maven / Gradle / Ivy
---
Test
---
!1 !-SshFixture-! password authentication
Password authentication is the simplest way to connect to ssh endpoints.
|import |
|com.github.gun88.fitnesse.fixture.ssh|
!2 Connection string
The only mandatory parameter is: host. If port is omitted, the default value (22) will be evaluated. !-SshFixture-! connection string has the following format:
{{{[username]/[password]@[host]:[port]}}}
!3 Connection string parts dump
|script |ssh client |
|add option|SESSION_CLASS|with value|com.github.gun88.fitnesse.fixture.ssh.session.DummySession|
|scenario |endpoint dump parts _|endpoint,username?,password?,host?,port?|
|endpoint |@endpoint |
|open connection |
|execute |dump-endpoint username |
|$username=|output |
|execute |dump-endpoint password |
|$password=|output |
|execute |dump-endpoint host |
|$host= |output |
|execute |dump-endpoint port |
|$port= |output |
|close connection |
|endpoint dump parts |
|endpoint |username?|password? |host? |port?|
|127.0.0.1 |null |null |127.0.0.1|22 |
|127.0.0.1:2222 |null |null |127.0.0.1|2222 |
|@127.0.0.1 | |null |127.0.0.1|22 |
|@127.0.0.1:2222 | |null |127.0.0.1|2222 |
|/@127.0.0.1 | | |127.0.0.1|22 |
|/@127.0.0.1:2222 | | |127.0.0.1|2222 |
|/[email protected] | |bar |127.0.0.1|22 |
|/[email protected]:2222 | |bar |127.0.0.1|2222 |
|/!\"£$%&/() = @127.0.0.1 | |!-!\"£$%&/() = -!|127.0.0.1|22 |
|/!\"£$%&/() = @127.0.0.1:2222 | |!-!\"£$%&/() = -!|127.0.0.1|2222 |
|foo!-@-!127.0.0.1 |foo |null |127.0.0.1|22 |
|foo!-@-!127.0.0.1:2222 |foo |null |127.0.0.1|2222 |
|foo/@127.0.0.1 |foo | |127.0.0.1|22 |
|foo/@127.0.0.1:2222 |foo | |127.0.0.1|2222 |
|foo/[email protected] |foo |bar |127.0.0.1|22 |
|foo/[email protected]:2222 |foo |bar |127.0.0.1|2222 |
|foo/!\"£$%&/() = @127.0.0.1 |foo |!-!\"£$%&/() = -!|127.0.0.1|22 |
|foo/!\"£$%&/() = @127.0.0.1:2222|foo |!-!\"£$%&/() = -!|127.0.0.1|2222 |
|my-host |null |null |my-host |22 |
|my-host:2222 |null |null |my-host |2222 |
|@my-host | |null |my-host |22 |
|@my-host:2222 | |null |my-host |2222 |
|/@my-host | | |my-host |22 |
|/@my-host:2222 | | |my-host |2222 |
|/bar@my-host | |bar |my-host |22 |
|/bar@my-host:2222 | |bar |my-host |2222 |
|/!\"£$%&/() = @my-host | |!-!\"£$%&/() = -!|my-host |22 |
|/!\"£$%&/() = @my-host:2222 | |!-!\"£$%&/() = -!|my-host |2222 |
|foo@my-host |foo |null |my-host |22 |
|foo@my-host:2222 |foo |null |my-host |2222 |
|foo/@my-host |foo | |my-host |22 |
|foo/@my-host:2222 |foo | |my-host |2222 |
|foo/bar@my-host |foo |bar |my-host |22 |
|foo/bar@my-host:2222 |foo |bar |my-host |2222 |
|foo/!\"£$%&/() = @my-host |foo |!-!\"£$%&/() = -!|my-host |22 |
|foo/!\"£$%&/() = @my-host:2222 |foo |!-!\"£$%&/() = -!|my-host |2222 |
!3 Where can be used
Connection string can be used in:
!4 Decision table header
|ssh client|foo/[email protected]|
|command |output? |
|echo 123 |123 |
!4 Script table header
|script |ssh client|foo/[email protected]|
|open connection |
|execute|echo 123 |
|check |output |123 |
|close connection |
!4 Script table body
|script |ssh client |
|endpoint|foo/[email protected]|
|open connection |
|execute |echo 123 |
|check |output|123 |
|close connection |
!4 Defaults
Connection string can be used to set default endpoint in VmOptions and PropertiesFile
!***> code
{{{!-
|import |
|com.github.gun88.fitnesse.fixture.ssh|
|script |ssh client |
|add option|SESSION_CLASS|with value|com.github.gun88.fitnesse.fixture.ssh.session.DummySession|
|scenario |endpoint dump parts _|endpoint,username?,password?,host?,port?|
|endpoint |@endpoint |
|open connection |
|execute |dump-endpoint username |
|$username=|output |
|execute |dump-endpoint password |
|$password=|output |
|execute |dump-endpoint host |
|$host= |output |
|execute |dump-endpoint port |
|$port= |output |
|close connection |
|endpoint dump parts |
|endpoint |username?|password? |host? |port?|
|127.0.0.1 |null |null |127.0.0.1|22 |
|127.0.0.1:2222 |null |null |127.0.0.1|2222 |
|@127.0.0.1 | |null |127.0.0.1|22 |
|@127.0.0.1:2222 | |null |127.0.0.1|2222 |
|/@127.0.0.1 | | |127.0.0.1|22 |
|/@127.0.0.1:2222 | | |127.0.0.1|2222 |
|/[email protected] | |bar |127.0.0.1|22 |
|/[email protected]:2222 | |bar |127.0.0.1|2222 |
|/!\"£$%&/() = @127.0.0.1 | |!-!\"£$%&/() = -!|127.0.0.1|22 |
|/!\"£$%&/() = @127.0.0.1:2222 | |!-!\"£$%&/() = -!|127.0.0.1|2222 |
|[email protected] |foo |null |127.0.0.1|22 |
|[email protected]:2222 |foo |null |127.0.0.1|2222 |
|foo/@127.0.0.1 |foo | |127.0.0.1|22 |
|foo/@127.0.0.1:2222 |foo | |127.0.0.1|2222 |
|foo/[email protected] |foo |bar |127.0.0.1|22 |
|foo/[email protected]:2222 |foo |bar |127.0.0.1|2222 |
|foo/!\"£$%&/() = @127.0.0.1 |foo |!-!\"£$%&/() = -!|127.0.0.1|22 |
|foo/!\"£$%&/() = @127.0.0.1:2222|foo |!-!\"£$%&/() = -!|127.0.0.1|2222 |
|my-host |null |null |my-host |22 |
|my-host:2222 |null |null |my-host |2222 |
|@my-host | |null |my-host |22 |
|@my-host:2222 | |null |my-host |2222 |
|/@my-host | | |my-host |22 |
|/@my-host:2222 | | |my-host |2222 |
|/bar@my-host | |bar |my-host |22 |
|/bar@my-host:2222 | |bar |my-host |2222 |
|/!\"£$%&/() = @my-host | |!-!\"£$%&/() = -!|my-host |22 |
|/!\"£$%&/() = @my-host:2222 | |!-!\"£$%&/() = -!|my-host |2222 |
|foo@my-host |foo |null |my-host |22 |
|foo@my-host:2222 |foo |null |my-host |2222 |
|foo/@my-host |foo | |my-host |22 |
|foo/@my-host:2222 |foo | |my-host |2222 |
|foo/bar@my-host |foo |bar |my-host |22 |
|foo/bar@my-host:2222 |foo |bar |my-host |2222 |
|foo/!\"£$%&/() = @my-host |foo |!-!\"£$%&/() = -!|my-host |22 |
|foo/!\"£$%&/() = @my-host:2222 |foo |!-!\"£$%&/() = -!|my-host |2222 |
|ssh client|foo/[email protected]|
|command |output? |
|echo 123 |123 |
|script |ssh client|foo/[email protected]|
|open connection |
|execute|echo 123 |
|check |output |123 |
|close connection |
|script |ssh client |
|endpoint|foo/[email protected]|
|open connection |
|execute |echo 123 |
|check |output|123 |
|close connection |
!define TEST_SYSTEM {slim}
!path ${jsch.jar.path}
!path ${sshFixture.jar.path}
-!}}}
Note: if !-SshFixture-! is not installed as a plugin, remember to set or replace properties: jsch.jar.path, sshFixture.jar.path; with actual paths.
Note: In this example the connection was built via username and password, that are set in plain text in table header. Click [[here][ code
{{{!-
|import |
|com.github.gun88.fitnesse.fixture.ssh|
|script |ssh client |
|add option|SESSION_CLASS|with value|com.github.gun88.fitnesse.fixture.ssh.session.DummySession|
|username |foo |
|password |!-X!\"£$%&/() = -! |
|host |my-host |
|port |2222 |
|open connection |
|execute |dump-endpoint |
|check |output |!-X!\"£$%&/() = -! |
|close connection |
|reset endpoint |
|host |my-host-2 |
|open connection |
|execute |dump-endpoint |
|check |output |my-host-2 |
|close connection |
|script |ssh client |
|username|foo |
|password|bar |
|host |ssh-fitnesse.dev|
|open connection |
|execute |echo 123 |
|check |output|123 |
|close connection |
|scenario|load endpoint |
|username|foo |
|password|bar |
|host |ssh-fitnesse.dev|
|script |ssh client|
|load endpoint |
|open connection |
|execute|echo 123 |
|check |output|123|
|close connection |
!define TEST_SYSTEM {slim}
!path ${jsch.jar.path}
!path ${sshFixture.jar.path}
-!}}}
Note: if !-SshFixture-! is not installed as a plugin, remember to set or replace properties: jsch.jar.path, sshFixture.jar.path; with actual paths.
Note: In this example the connection was built via username and password, that are set in plain text in table header. Click [[here][