Package org.apache.deltacloud.client

Examples of org.apache.deltacloud.client.DeltaCloudClient


  }

  @Test
  public void canCreateKey() throws DeltaCloudClientException {
    String id = "test" + System.currentTimeMillis();
    DeltaCloudClient client = testSetup.getClient();
    try {
      Key key = client.createKey(id);
      assertNotNull(key);
      assertEquals(id, key.getId());
    } finally {
      quietlyDeleteKey(id);
    }
View Full Code Here


  }

  @Test(expected = DeltaCloudClientException.class)
  public void createDuplicateKeyThrowsException() throws DeltaCloudClientException {
    String id = "test" + System.currentTimeMillis();
    DeltaCloudClient client = testSetup.getClient();
    try {
      client.createKey(id);
      client.createKey(id);
    } finally {
      quietlyDeleteKey(id);
    }
  }
View Full Code Here

   * Checks if a key may be deleted.
   */
  @Test(expected = DeltaCloudNotFoundClientException.class)
  public void canDeleteKey() throws DeltaCloudClientException {
    String id = "test" + System.currentTimeMillis();
    DeltaCloudClient client = testSetup.getClient();
    Key key = client.createKey(id);
    assertNotNull(key);
    assertEquals(id, key.getId());
    key.destroy(client);
    client.listKey(key.getId());
  }
View Full Code Here

  }

  @Test
  public void canListKey() throws DeltaCloudClientException {
    String id = String.valueOf(System.currentTimeMillis());
    DeltaCloudClient client = testSetup.getClient();
    try {
      Key createdKey = client.createKey(id);
      Key listedKey = client.listKey(id);
      assertEquals(createdKey.getId(), listedKey.getId());
    } finally {
      quietlyDeleteKey(id);
    }
  }
View Full Code Here

  }

  @Test
  public void canListKeys() throws DeltaCloudClientException {
    String id = String.valueOf(System.currentTimeMillis());
    DeltaCloudClient client = testSetup.getClient();
    try {
      final Key createdKey = client.createKey(id);
      List<Key> keys = client.listKeys();
      assertNotNull(keys);
      assertThat(keys, hasItem(new BaseMatcher<Key>() {

        @Override
        public boolean matches(Object item) {
View Full Code Here

    }
  }

  private void quietlyDeleteKey(String id) {
    try {
      DeltaCloudClient client = testSetup.getClient();
      Key key = client.listKey(id);
      key.destroy(client);
    } catch (Exception e) {
      // ignore
    }
  }
View Full Code Here

   *             the delta cloud client exception
   */

  @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

  }

  @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

  @Test(expected = DeltaCloudClientException.class)
  public void destroyThrowsExceptionOnUnknowInstanceId() throws DeltaCloudClientException, IllegalArgumentException,
      InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException,
      NoSuchMethodException {
    DeltaCloudClient client = testSetup.getClient();
    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.DeltaCloudClient

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.