Package org.jclouds.ssh

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


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

   @AfterGroups(groups = "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();
      }
   }

   @AfterGroups(groups = "live")
   @Override
View Full Code Here

         ssh.connect();
         ExecResponse uptime = ssh.exec("uptime");
         assert uptime.getOutput().indexOf("0 min") != -1 : "reboot didn't work: " + uptime;
      } finally {
         if (ssh != null)
            ssh.disconnect();
      }
   }

   @Test(enabled = false, dependsOnMethods = "testReboot")
   void testElasticIpAddress() throws InterruptedException, ExecutionException, TimeoutException, IOException {
View Full Code Here

         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
      } finally {
         if (ssh != null)
            ssh.disconnect();
      }
   }

   @AfterTest
   void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
View Full Code Here

         assert !output.getOutput().trim().equals("") : output;
         Predicate<String> scriptTester = retry(new ScriptTester(ssh, SCRIPT_END), 600, 10, SECONDS);
         scriptTester.apply(script);
      } finally {
         if (ssh != null)
            ssh.disconnect();
      }
   }

   public static class ScriptTester implements Predicate<String> {
      private final SshClient ssh;
View Full Code Here

         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
      } finally {
         if (ssh != null)
            ssh.disconnect();
      }
   }

   private RunningInstance blockUntilWeCanSshIntoInstance(RunningInstance instance) throws UnknownHostException {
      System.out.printf("%d: %s awaiting instance to run %n", System.currentTimeMillis(), instance.getId());
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

         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

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.