Package org.iosgi.outpost

Examples of org.iosgi.outpost.Client


      p.waitForCompletion(-1);
      Thread.sleep(3000);
      IConsole c = s.getConsole();
      String opt = "microcore home=hda1\n";
      send(opt, c.getKeyboard());
      Client oc = this.getOutpost(s, vbox);
      File deployDir = new File("i-osgi");
      deploy(oc, deployDir);
      launch(oc, deployDir, nid);
      oc.close();
    } catch (Exception e) {
      throw new IOException("failed to create VM", e);
    } finally {
      disconnect(vboxMgr);
    }
View Full Code Here


  Client getOutpost(ISession session, IVirtualBox vbox) throws Exception {
    Set<InetAddress> addresses = this.getVMInetAddresses(session, vbox);
    while (true) {
      for (InetAddress addr : addresses) {
        Client oc = new Client(addr.getHostAddress(), this.getClass()
            .getClassLoader());
        try {
          oc.connect(1, TimeUnit.SECONDS);
        } catch (ConnectException ce) {
          LOGGER.debug("connection attempt failed", ce);
        }
        return oc;
      }
View Full Code Here

    server.shutdown();
  }

  @Test
  public void test() throws Exception {
    Client c = new Client("localhost");
    c.connect(5, TimeUnit.SECONDS);
    File dir = new File(new File("."), "test");
    Assert.assertFalse(dir.exists());
    MkDir mkdir = new MkDir(dir);
    c.perform(mkdir);
    Assert.assertTrue(dir.exists());
    Assert.assertTrue(dir.isDirectory());
    dir.delete();
  }
View Full Code Here

    server.shutdown();
  }

  @Test
  public void test() throws Exception {
    Client c = new Client("localhost");
    c.connect(5, TimeUnit.SECONDS);
    File target = new File(new File("."), "test");
    Assert.assertFalse(target.exists());
    byte[] data = new byte[RANDOM.nextInt(1024 * 1024) + 1];
    RANDOM.nextBytes(data);
    Put put = new Put(target, data);
    c.perform(put);
    Assert.assertTrue(target.exists());
    Assert.assertTrue(target.isFile());
    Assert.assertTrue(Arrays.equals(data, Put.toByteArray(target)));
    target.delete();
  }
View Full Code Here

    server.shutdown();
  }

  @Test
  public void test() throws Exception {
    Client c = new Client("localhost");
    c.connect(5, TimeUnit.SECONDS);
    File dir = new File(new File("."), "subdir");
    MkDir mkdir = new MkDir(dir);
    c.perform(mkdir);
    Assert.assertTrue(dir.exists());
    File target = new File(dir, "test");
    byte[] data = new byte[RANDOM.nextInt(1024 * 1024) + 1];
    RANDOM.nextBytes(data);
    Put put = new Put(target, data);
    c.perform(put);
    Assert.assertTrue(target.exists());
    Delete d = new Delete(dir);
    c.perform(d);
    Assert.assertFalse(target.exists());
    Assert.assertFalse(dir.exists());
  }
View Full Code Here

TOP

Related Classes of org.iosgi.outpost.Client

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.