Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.ExecChannel


         executor.setErrStream(new ByteArrayOutputStream());
         InputStream inputStream = executor.getInputStream();
         InputStream errStream = executor.getErrStream();
         OutputStream outStream = executor.getOutputStream();
         executor.connect();
         return new ExecChannel(outStream, inputStream, errStream,
                  new Supplier<Integer>() {

                     @Override
                     public Integer get() {
                        int exitStatus = executor.getExitStatus();
View Full Code Here


            }

            @Override
            public ExecChannel execChannel(String command) {
               if (command.equals("hostname")) {
                  return new ExecChannel(new ByteArrayOutputStream(), new ByteArrayInputStream(sshHost.getBytes()),
                           new ByteArrayInputStream(new byte[] {}), Suppliers.ofInstance(0), new Closeable() {

                              @Override
                              public void close() {
View Full Code Here

   }
  
   @Test
   public void testExecChannelTakesStdinAndNoEchoOfCharsInOuputAndOutlivesClient() throws IOException {
      SshClient client = setupClient();
      ExecChannel response = client.execChannel("cat <<EOF");
      client.disconnect();
      assertEquals(response.getExitStatus().get(), null);
      try {
         PrintStream printStream = new PrintStream(response.getInput());
         printStream.append("foo\n");
         printStream.append("EOF\n");
         printStream.close();
         assertEquals(Strings2.toStringAndClose(response.getError()), "");
         assertEquals(Strings2.toStringAndClose(response.getOutput()), "");
      } finally {
         Closeables2.closeQuietly(response);
      }
      assertEquals(response.getExitStatus().get(), Integer.valueOf(0));
   }
View Full Code Here

      @Override
      public ExecChannel create() throws Exception {
         session = SessionChannel.class.cast(acquire(noPTYConnection()));
         output = session.exec(command);
         return new ExecChannel(output.getOutputStream(), output.getInputStream(), output.getErrorStream(),
                  new Supplier<Integer>() {

                     @Override
                     public Integer get() {
                        return output.getExitStatus();
View Full Code Here

      @Override
      public ExecChannel create() throws Exception {
         session = SessionChannel.class.cast(acquire(noPTYConnection()));
         output = session.exec(command);
         return new ExecChannel(output.getOutputStream(), output.getInputStream(), output.getErrorStream(),
                  new Supplier<Integer>() {

                     @Override
                     public Integer get() {
                        return output.getExitStatus();
View Full Code Here

         executor.setErrStream(new ByteArrayOutputStream());
         InputStream inputStream = executor.getInputStream();
         InputStream errStream = executor.getErrStream();
         OutputStream outStream = executor.getOutputStream();
         executor.connect();
         return new ExecChannel(outStream, inputStream, errStream,
                  new Supplier<Integer>() {

                     @Override
                     public Integer get() {
                        int exitStatus = executor.getExitStatus();
View Full Code Here

         executor.setErrStream(new ByteArrayOutputStream());
         InputStream inputStream = executor.getInputStream();
         InputStream errStream = executor.getErrStream();
         OutputStream outStream = executor.getOutputStream();
         executor.connect();
         return new ExecChannel(outStream, inputStream, errStream,
                  new Supplier<Integer>() {

                     @Override
                     public Integer get() {
                        int exitStatus = executor.getExitStatus();
View Full Code Here

            }
           
            @Override
            public ExecChannel execChannel(String command) {
               if (command.equals("hostname")) {
                  return new ExecChannel(new ByteArrayOutputStream(), new ByteArrayInputStream(sshHost.getBytes()),
                           new ByteArrayInputStream(new byte[] {}), Suppliers.ofInstance(0), new Closeable() {

                              @Override
                              public void close() {
View Full Code Here

               : sshHost);
   }

   public void testExecChannelTakesStdinAndNoEchoOfCharsInOuputAndOutlivesClient() throws IOException {
      SshClient client = setupClient();
      ExecChannel response = client.execChannel("cat <<EOF");
      client.disconnect();
      assertEquals(response.getExitStatus().get(), null);
      try {
         PrintStream printStream = new PrintStream(response.getInput());
         printStream.append("foo\n");
         printStream.append("EOF\n");
         printStream.close();
         assertEquals(Strings2.toStringAndClose(response.getError()), "");
         assertEquals(Strings2.toStringAndClose(response.getOutput()), "");
      } finally {
         Closeables2.closeQuietly(response);
      }
      assertEquals(response.getExitStatus().get(), Integer.valueOf(0));
   }
View Full Code Here

      @Override
      public ExecChannel create() throws Exception {
         session = SessionChannel.class.cast(acquire(noPTYConnection()));
         output = session.exec(command);
         return new ExecChannel(output.getOutputStream(), output.getInputStream(), output.getErrorStream(),
                  new Supplier<Integer>() {

                     @Override
                     public Integer get() {
                        return output.getExitStatus();
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.ExecChannel

Copyright © 2018 www.massapicom. 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.