Package com.consol.citrus.ssh

Examples of com.consol.citrus.ssh.SshRequest


        expect(channel.getExitStatus()).andReturn(pExitStatus);
        expect(channel.isConnected()).andReturn(true);
    }

    private Message createMessage(String pCommand, String pInput) {
        SshRequest request = new SshRequest(pCommand,pInput);
        return new DefaultMessage(xstream.toXML(request));
    }
View Full Code Here


    public void send(Message message, TestContext context) {
        String correlationKey = getEndpointConfiguration().getCorrelator().getCorrelationKey(message);
        context.saveCorrelationKey(correlationKey, this);

        String payload = (String) message.getPayload();
        SshRequest request = (SshRequest) getEndpointConfiguration().getXmlMapper().fromXML(payload);

        if (getEndpointConfiguration().isStrictHostChecking()) {
            setKnownHosts();
        }

        String rUser = getRemoteUser(message);
        connect(rUser);
        ChannelExec channelExec = null;
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        ByteArrayOutputStream errStream = new ByteArrayOutputStream();
        int rc = 0;
        try {
            channelExec = openChannelExec();
            channelExec.setErrStream(errStream);
            channelExec.setOutputStream(outStream);
            channelExec.setCommand(request.getCommand());
            doConnect(channelExec);
            if (request.getStdin() != null) {
                sendStandardInput(channelExec, request.getStdin());
            }
            waitCommandToFinish(channelExec);
            rc = channelExec.getExitStatus();
        } finally {
            if (channelExec != null && channelExec.isConnected()) {
View Full Code Here

TOP

Related Classes of com.consol.citrus.ssh.SshRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.