tstSession.cc 913 Bytes
Newer Older
1
2
3
4
5
#include "gtest/gtest.h"

#include "rsmcore/sessionworker.hh"

using namespace rsm;
6
TEST(RSM, SessionWorker)
7
{
8
  SessionWorker session("apollo");
9
  session.setLogVerbosity(SessionWorker::Verbosity::None);
10
11
12
13
14
  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
15

16
  session.requestExec("ls -la");
17
  QByteArray ls_la = session.readExecOutput();
18
  session.requestExec("ls modulefiles");
19
20
21
22
23
24
25
26
27
28
29
  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;

30
31
  session.disconnect();
}