Package org.jclouds.ssh

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


         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 {
         if (ssh != null)
            ssh.disconnect();
      }
   }

   protected abstract SshClient getConnectionFor(HostAndPort socket);

View Full Code Here


         ExecResponse exec = client.exec("echo hello");
         System.out.println(exec);
         assertEquals(exec.getOutput().trim(), "hello");
      } finally {
         if (client != null)
            client.disconnect();
      }
   }

   @BeforeGroups(groups = { "integration", "live" })
   @Override
View Full Code Here

         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();
      }
   }

   @Test
   public void testListHardwareProfiles() {
View Full Code Here

         ExecResponse exec = api.exec("echo hello");
         System.out.println(exec);
         assertEquals(exec.getOutput().trim(), "hello");
      } finally {
         if (api != null)
            api.disconnect();
      }
   }

   @AfterGroups(groups = "live")
   protected void tearDownContext() {
View Full Code Here

         ExecResponse exec = api.exec("echo hello");
         System.out.println(exec);
         assertEquals(exec.getOutput().trim(), "hello");
      } finally {
         if (api != null)
            api.disconnect();
      }
   }

   @Test(dependsOnMethods = "testSsh")
   public void testDeleteMachine() {
View Full Code Here

         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();
      }
   }

   @Test
   public void testListHardwareProfiles() {
View Full Code Here

         assertEquals(response.getExitStatus(), 0);
         assertEquals(response.getError(), "");
         assertEquals(response.getOutput().trim(), "localhost".equals(sshHost) ? InetAddress.getLocalHost().getHostName()
               : sshHost);
      } finally {
         client.disconnect();
      }
   }

   @Test
   public void testExecInvalidCommand() throws IOException {
View Full Code Here

         ExecResponse response = client.exec("thisCommandDoesNotExist");
         assertNotEquals(response.getExitStatus(), 0);
         assertTrue(response.getOutput().contains("not found") || response.getError().contains("not found"),
               "stdout="+response.getOutput()+"; stderr="+response.getError());
      } finally {
         client.disconnect();
      }
   }

   // Added for issue #1016.
   @Test(invocationCount=100)
View Full Code Here

            assertEquals(response.getOutput().trim(), "localhost".equals(sshHost) ? InetAddress.getLocalHost().getHostName()
                     : sshHost);
            //System.out.println("completed (sequentially) "+i);
         }
      } finally {
         client.disconnect();
      }
   }
  
   // Added for issue #1016.
   // Note that some commands fail the first few attempt, but with default retries at 5 they do pass (for me locally).
View Full Code Here

            assertEquals(response.getOutput().trim(), "localhost".equals(sshHost) ? InetAddress.getLocalHost().getHostName()
                     : sshHost);
         }
      } finally {
         userExecutor.shutdownNow();
         client.disconnect();
      }
   }
  
   @Test
   public void testExecChannelTakesStdinAndNoEchoOfCharsInOuputAndOutlivesClient() throws IOException {
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.