コード例 #1
0
 protected void doConnectViaSsh(Server server, LoginCredentials creds) throws IOException {
   SshClient ssh =
       Guice.createInjector(new SshjSshClientModule())
           .getInstance(SshClient.Factory.class)
           .create(HostAndPort.fromParts(server.getVnc().getIp(), 22), creds);
   try {
     ssh.connect();
     ExecResponse hello = ssh.exec("echo hello");
     assertEquals(hello.getOutput().trim(), "hello");
     System.err.println(ssh.exec("df -k").getOutput());
     System.err.println(ssh.exec("mount").getOutput());
     System.err.println(ssh.exec("uname -a").getOutput());
   } finally {
     if (ssh != null) ssh.disconnect();
   }
 }
コード例 #2
0
 protected LoginCredentials getSshCredentials(Server server) {
   return LoginCredentials.builder().user("toor").password(server.getVnc().getPassword()).build();
 }
コード例 #3
0
 protected void checkServerMatchesGet(Server newInfo) {
   assertEquals(newInfo.getUuid(), server.getUuid());
 }