ssh using java dsl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ssh using java dsl

mlybarger
I'm looking for an example of  using ssh request/reply using the java dsl.  I didn't find anything in the examples, or in the source test cases.  something like this:

<send endpoint="sshClient">
   <message>
    <payload><ssh-request xmlns="http://www.citrusframework.org/schema/ssh/message"> 
    <command>cat /tmp/foo</command>
    </ssh-request>
    </payload>
  </mesage>
</send>
<receive endpoint="sshClient">
  <message>
    <validate>
    <script type="groovy"> println receivedMessage assert root.stdout.text().contains('${DATA}') </script>    </validate>
  </message>
</receive>
</receive>
Reply | Threaded
Open this post in threaded view
|

Re: ssh using java dsl

Christoph Deppisch
Administrator
The Java DSL looks like this:

    send("sshClient")
       .payload("<ssh-request xmlns=\"http://www.citrusframework.org/schema/ssh/message\">" +  
              "<command>cat /tmp/foo</command>" +
           "</ssh-request>");

    receive("sshClient")
        .validateScript("println receivedMessage" + 
                "assert root.stdout.text().contains('${DATA}')");
Reply | Threaded
Open this post in threaded view
|

Re: ssh using java dsl

NikolaY


In the response on question the <stdin /> tag is omitted. My example is working. Maybe someone will need ...

send("sshClient").payload(
                "<ssh-request xmlns=\"http://www.citrusframework.org/schema/ssh/message\"><command>cd /usr/local/SubsTarless/logs; grep -c \"ERROR\" substarless.log</command><stdin/></ssh-request>");
        receive("sshClient").validateScript("assert root.stdout.text() == \"0\\n\" ");