tstSessionWorker.cc 958 Bytes
Newer Older
1 2 3 4 5 6
#include "gtest/gtest.h"

#include "rsmcore/sessioncontroller.hh"
#include "rsmcore/sessionworker.hh"

using namespace rsm;
7
TEST(RSM, DISABLED_SessionWorker)
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
{
  SessionWorker session("apollo");
  session.setLogVerbosity(SessionVerbosity::None);
  session.setPort(22);
  // session.setUser("jap");
  session.connect();          // 1) hand-shake with host
  session.verifyKnownHost();  // 2) verify host is known/acceptable
  session.authenticate();     // 3) process authentication

  session.requestExec("ls -la");
  QByteArray ls_la = session.readExecOutput();
  session.requestExec("ls modulefiles");
  QByteArray ls_mod = session.readExecOutput();

  std::cout << "ls -la output" << std::endl;
  std::cout << ls_la.data() << std::endl;

  std::cout << "ls modulefiles output" << std::endl;
  std::cout << ls_mod.data() << std::endl;

  session.requestExec("showq");
  std::cout << session.readExecOutput().data() << std::endl;

  session.disconnect();
}