Package org.apache.deltacloud.client

Examples of org.apache.deltacloud.client.Image


*/
public class ImageDomUnmarshallingTest {

  @Test
  public void imageMayBeUnmarshalled() throws DeltaCloudClientException {
    Image image = new Image();
    ByteArrayInputStream inputStream = new ByteArrayInputStream(ImageResponse.response.getBytes());
    new ImageUnmarshaller().unmarshall(inputStream, image);
    assertNotNull(image);
    assertEquals(ImageResponse.id, image.getId());
    assertEquals(ImageResponse.name, image.getName());
    assertEquals(ImageResponse.ownerId, image.getOwnerId());
    assertEquals(ImageResponse.description, image.getDescription());
    assertEquals(ImageResponse.architecture, image.getArchitecture());
  }
View Full Code Here


  private ExecutorService executor = Executors.newSingleThreadExecutor();

  public void setUp() throws IOException, DeltaCloudClientException {
    ensureDeltaCloudIsRunning();
    this.client = new DeltaCloudClientImpl(DELTACLOUD_URL, DELTACLOUD_USER, DELTACLOUD_PASSWORD);
    Image image = getFirstImage(client);
    this.testInstance = createTestInstance(image);
  }
View Full Code Here

  }

  public Image getFirstImage(DeltaCloudClient client) throws DeltaCloudClientException {
    List<Image> images = client.listImages();
    assertTrue(images.size() >= 1);
    Image image = images.get(0);
    return image;
  }
View Full Code Here

    ByteArrayInputStream inputStream = new ByteArrayInputStream(ImagesResponse.response.getBytes());
    List<Image> images = new ArrayList<Image>();
    new ImagesUnmarshaller().unmarshall(inputStream, images);
    assertEquals(2, images.size());

    Image image = images.get(0);
    assertEquals(ImagesResponse.id1, image.getId());
    assertEquals(ImagesResponse.name1, image.getName());

    image = images.get(1);
    assertEquals(ImagesResponse.id2, image.getId());
    assertEquals(ImagesResponse.name2, image.getName());
  }
View Full Code Here

  @Test(expected = DeltaCloudClientException.class)
  public void cannotDestroyIfNotAuthenticated() throws MalformedURLException, DeltaCloudClientException {
    DeltaCloudClientImpl unauthenticatedClient = new DeltaCloudClientImpl(
        MockIntegrationTestContext.DELTACLOUD_URL,
        "badUser", "badPassword");
    Image image = testSetup.getFirstImage(unauthenticatedClient);
    unauthenticatedClient.createInstance(image.getId());
  }
View Full Code Here

  @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

    testSetup.getClient().createInstance("dummy");
  }

  @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

    super("images", "image");
  }

  @Override
  protected Image unmarshallChild(Node node) throws DeltaCloudClientException {
    Image image = new ImageUnmarshaller().unmarshall((Element) node, new Image());
    return image;
  }
View Full Code Here

TOP

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

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.