Search in sources :

Example 1 with SwiftObject

use of org.jclouds.openstack.swift.v1.domain.SwiftObject in project druid by druid-io.

the class CloudFilesObjectApiProxyTest method getTest.

@Test
public void getTest() {
    final String path = "path";
    final String region = "region";
    final String container = "container";
    CloudFilesApi cloudFilesApi = createMock(CloudFilesApi.class);
    ObjectApi objectApi = createMock(ObjectApi.class);
    SwiftObject swiftObject = createMock(SwiftObject.class);
    Payload payload = createMock(Payload.class);
    expect(cloudFilesApi.getObjectApi(region, container)).andReturn(objectApi);
    expect(objectApi.get(path)).andReturn(swiftObject);
    expect(swiftObject.getPayload()).andReturn(payload);
    replayAll();
    CloudFilesObjectApiProxy cfoApiProxy = new CloudFilesObjectApiProxy(cloudFilesApi, region, container);
    CloudFilesObject cloudFilesObject = cfoApiProxy.get(path);
    assertEquals(cloudFilesObject.getPayload(), payload);
    assertEquals(cloudFilesObject.getRegion(), region);
    assertEquals(cloudFilesObject.getContainer(), container);
    assertEquals(cloudFilesObject.getPath(), path);
    verifyAll();
}
Also used : ObjectApi(org.jclouds.openstack.swift.v1.features.ObjectApi) SwiftObject(org.jclouds.openstack.swift.v1.domain.SwiftObject) CloudFilesApi(org.jclouds.rackspace.cloudfiles.v1.CloudFilesApi) Payload(org.jclouds.io.Payload) Test(org.junit.Test)

Example 2 with SwiftObject

use of org.jclouds.openstack.swift.v1.domain.SwiftObject in project druid by druid-io.

the class CloudFilesObjectApiProxy method get.

public CloudFilesObject get(String path) {
    SwiftObject swiftObject = objectApi.get(path);
    Payload payload = swiftObject.getPayload();
    return new CloudFilesObject(payload, this.region, this.container, path);
}
Also used : SwiftObject(org.jclouds.openstack.swift.v1.domain.SwiftObject) Payload(org.jclouds.io.Payload)

Aggregations

Payload (org.jclouds.io.Payload)2 SwiftObject (org.jclouds.openstack.swift.v1.domain.SwiftObject)2 ObjectApi (org.jclouds.openstack.swift.v1.features.ObjectApi)1 CloudFilesApi (org.jclouds.rackspace.cloudfiles.v1.CloudFilesApi)1 Test (org.junit.Test)1