Package org.apache.deltacloud.client

Examples of org.apache.deltacloud.client.Instance


    this.testInstance = createTestInstance(image);
  }

  private Instance createTestInstance(Image image) throws DeltaCloudClientException {
    assertNotNull(image);
    Instance instance = client.createInstance(image.getId());
    return instance;
  }
View Full Code Here


      @Override
      public Instance call() throws Exception {
        try {
          while (System.currentTimeMillis() < startTime + timeout) {
            Instance instance = client.listInstances(instanceId);
            if (instance.getState() == state) {
              return instance;
            }
            Thread.sleep(200);
          }
          return null;
View Full Code Here

  }

  @Test
  public void cannotRebootStoppedInstance() throws DeltaCloudClientException, InterruptedException,
      ExecutionException {
    Instance testInstance = testSetup.getTestInstance();
    DeltaCloudClient client = testSetup.getClient();
    try {
      testInstance.stop(client);
      testInstance = client.listInstances(testInstance.getId()); // reload
      assertTrue(testInstance.getState() == State.STOPPED);
      assertFalse(testInstance.reboot(client));
    } finally {
      testInstance.start(client);
      client.listInstances(testInstance.getId()); // reload
    }
  }
View Full Code Here

  @Test
  public void listContainsTestInstance() throws DeltaCloudClientException {
    DeltaCloudClient client = testSetup.getClient();
    List<Instance> instances = client.listInstances();
    assertTrue(instances.size() > 0);
    Instance testInstance = testSetup.getTestInstance();
    assertNotNull(testSetup.getInstanceById(testInstance.getId(), client));
  }
View Full Code Here

    assertNotNull(testSetup.getInstanceById(testInstance.getId(), client));
  }

  @Test
  public void listTestInstance() throws DeltaCloudClientException {
    Instance instance = testSetup.getClient().listInstances(testSetup.getTestInstance().getId());
    assertNotNull(instance);
    Instance testInstance = testSetup.getTestInstance();
    assertEquals(testInstance.getId(), instance.getId());
    assertInstance(
        testInstance.getName()
        , testInstance.getOwnerId()
        , testInstance.getImageId()
        , testInstance.getRealmId()
        , testInstance.getProfileId()
        , testInstance.getMemory()
        , testInstance.getPrivateAddresses()
        , testInstance.getPublicAddresses()
        , instance);
  }
View Full Code Here

        , instance);
  }

  @Test(expected = DeltaCloudNotFoundClientException.class)
  public void listDestroyedInstanceThrowsException() throws DeltaCloudClientException {
    Instance testInstance = testSetup.getTestInstance();
    testSetup.quietlyDestroyInstance(testInstance);
    testSetup.getClient().listInstances(testInstance.getId());
  }
View Full Code Here

    unauthenticatedClient.createInstance(image.getId());
  }

  @Test
  public void canCreateInstance() throws DeltaCloudClientException {
    Instance instance = null;
    try {
      Image image = testSetup.getFirstImage(testSetup.getClient());
      instance = testSetup.getClient().createInstance(image.getId());
      assertTrue(instance != null);
      assertEquals(image.getId(), instance.getImageId());
      assertEquals(State.RUNNING, instance.getState());
    } finally {
      testSetup.quietlyDestroyInstance(instance);
    }
  }
View Full Code Here

  @Test(expected=DeltaCloudClientException.class)
  public void canDestroy() throws DeltaCloudClientException {
    Image image = testSetup.getFirstImage(testSetup.getClient());
    DeltaCloudClient client = testSetup.getClient();
    Instance instance = client.createInstance(image.getId());
    instance.stop(client);
    instance.destroy(client);
    client.listInstances(instance.getId());
  }
View Full Code Here

    client.performAction(
        createInstanceAction(
            "destroy",
            MockIntegrationTestContext.DELTACLOUD_URL,
            HttpMethod.POST,
            new Instance()));
  }
View Full Code Here

  }

  @Test
  public void canShutdownInstance() throws DeltaCloudClientException {
    Instance testInstance = testSetup.getTestInstance();
    DeltaCloudClient client = testSetup.getClient();
    testInstance.stop(client);
    testInstance = client.listInstances(testInstance.getId()); // reload!
    assertEquals(State.STOPPED, testInstance.getState());
  }
View Full Code Here

TOP

Related Classes of org.apache.deltacloud.client.Instance

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.