Package org.jclouds.ssh

Examples of org.jclouds.ssh.SshClient.connect()


   }

   protected void doCheckJavaIsInstalledViaSsh(NodeMetadata node, String taskName) throws IOException {
      SshClient ssh = view.utils().sshForNode().apply(node);
      try {
         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
         ExecResponse exec = ssh.exec("java -version");
         assert exec.getError().indexOf("OpenJDK") != -1 || exec.getOutput().indexOf("OpenJDK") != -1 : exec
               + "\n"
View Full Code Here


   }

   protected void doCheckJavaIsInstalledViaSsh(NodeMetadata node, String taskName) throws IOException {
      SshClient ssh = view.utils().sshForNode().apply(node);
      try {
         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
         ExecResponse exec = ssh.exec("java -version");
         assert exec.getError().indexOf("OpenJDK") != -1 || exec.getOutput().indexOf("OpenJDK") != -1 : exec
               + "\n"
View Full Code Here

   }

   protected void doCheckJavaIsInstalledViaSsh(NodeMetadata node, String taskName) throws IOException {
      SshClient ssh = view.utils().sshForNode().apply(node);
      try {
         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
         ExecResponse exec = ssh.exec("java -version");
         assert exec.getError().indexOf("OpenJDK") != -1 || exec.getOutput().indexOf("OpenJDK") != -1 : exec
               + "\n"
View Full Code Here

                  .privateKey(Files.toString(new File(sshKeyFile), Charsets.UTF_8)).build());
         } else {
            connection = factory.create(HostAndPort.fromParts(sshHost, port),
                  LoginCredentials.builder().user(sshUser).password(sshPass).build());
         }
         connection.connect();
         return connection;
      }
   }

   public void testPutAndGet() throws IOException {
View Full Code Here

   }

   protected void doCheckJavaIsInstalledViaSsh(NodeMetadata node, String taskName) throws IOException {
      SshClient ssh = view.utils().sshForNode().apply(node);
      try {
         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
         ExecResponse exec = ssh.exec("java -version");
         assert exec.getError().indexOf("OpenJDK") != -1 || exec.getOutput().indexOf("OpenJDK") != -1 : exec
               + "\n"
View Full Code Here

   }

   protected void doCheckJavaIsInstalledViaSsh(NodeMetadata node, String taskName) throws IOException {
      SshClient ssh = view.utils().sshForNode().apply(node);
      try {
         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
         ExecResponse exec = ssh.exec("java -version");
         assert exec.getError().indexOf("OpenJDK") != -1 || exec.getOutput().indexOf("OpenJDK") != -1 : exec
               + "\n"
View Full Code Here

   }

   protected void doConnectViaSsh(VirtualGuest guest, LoginCredentials creds) {
      SshClient ssh = sshFactory.create(HostAndPort.fromParts(guest.getPrimaryIpAddress(), 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());
View Full Code Here

      assert socketTester.apply(socket);
      System.out.printf("%d: %s ssh service started%n", System.currentTimeMillis(), socket);

      SshClient ssh = getConnectionFor(socket);
      try {
         ssh.connect();
         System.out.printf("%d: %s ssh ssh made%n", System.currentTimeMillis(), socket);
         System.out.println(ssh.exec("df -h"));
         System.out.println(ssh.exec("ls -al /dev/sd*"));
         System.out.println(ssh.exec("echo '$Ep455l0ud!2'|sudo -S fdisk -l"));
      } finally {
View Full Code Here

  
   protected void checkSSH(HostAndPort socket) {
      socketTester.apply(socket);
      SshClient client = sshFactory.create(socket, loginCredentials);
      try {
         client.connect();
         ExecResponse exec = client.exec("echo hello");
         System.out.println(exec);
         assertEquals(exec.getOutput().trim(), "hello");
      } finally {
         if (client != null)
View Full Code Here

   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());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.