public CloudFilesObject get(String path, long start) { final SwiftObject swiftObject; if (start == 0) { swiftObject = objectApi.get(path); } else { swiftObject = objectApi.get(path, new GetOptions().startAt(start)); } Payload payload = swiftObject.getPayload(); return new CloudFilesObject(payload, this.region, this.container, path); }
/** * @see GetOptions#ifETagDoesntMatch(String) */ public static GetOptions ifETagDoesntMatch(String eTag) { GetOptions options = new GetOptions(); return options.ifETagDoesntMatch(eTag); }
/** * @see GetOptions#getIfModifiedSince() */ public static GetOptions ifModifiedSince(Date ifModifiedSince) { GetOptions options = new GetOptions(); return options.ifModifiedSince(ifModifiedSince); }
/** * @see GetOptions#ifUnmodifiedSince(Date) */ public static GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { GetOptions options = new GetOptions(); return options.ifUnmodifiedSince(ifUnmodifiedSince); }
/** * @see GetOptions#range(long, long) */ public static GetOptions range(long start, long end) { GetOptions options = new GetOptions(); return options.range(start, end); }
/** * @see GetOptions#tail(long) */ public static GetOptions tail(long count) { GetOptions options = new GetOptions(); return options.tail(count); }
/** * @see GetOptions#getIfModifiedSince() */ public static GetOptions ifModifiedSince(Date ifModifiedSince) { GetOptions options = new GetOptions(); return options.ifModifiedSince(ifModifiedSince); }
/** * @see GetOptions#ifUnmodifiedSince(Date) */ public static GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { GetOptions options = new GetOptions(); return options.ifUnmodifiedSince(ifUnmodifiedSince); }
@Test public void testNullIfUnmodifiedSince() { GetOptions options = new GetOptions(); assertNull(options.getIfUnmodifiedSince()); }
@Test public void testNullIfETagMatches() { GetOptions options = new GetOptions(); assertNull(options.getIfMatch()); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStartAtFail() { GetOptions options = new GetOptions(); options.startAt(-1); }
@Test public void testNullRange() { GetOptions options = new GetOptions(); assertNull(options.getRange()); }
@Test public void testRangeZeroToFive() { GetOptions options = new GetOptions(); options.range(0, 5); assertEquals(options.getRange(), "bytes=0-5"); }
@Test public void testRangeZeroToFiveAnd10through100() { GetOptions options = new GetOptions(); options.range(0, 5).range(10, 100); assertEquals(options.getRange(), "bytes=0-5,10-100"); }
@Test public void testIfUnmodifiedSince() { Date ifUnmodifiedSince = new Date(999999l); org.jclouds.blobstore.options.GetOptions in = new org.jclouds.blobstore.options.GetOptions(); in.ifUnmodifiedSince(ifUnmodifiedSince); GetOptions expected = new GetOptions(); expected.ifUnmodifiedSince(ifUnmodifiedSince); assertEquals(fn.apply(in), expected); }
@Test public void testIfETagMatches() { GetOptions options = new GetOptions(); options.ifETagMatches(etag); matchesHex(options.getIfMatch()); }
@Test public void testIfETagDoesntMatch() { GetOptions options = new GetOptions(); options.ifETagDoesntMatch(etag); matchesHex(options.getIfNoneMatch()); }
@Test public void testRangesTail(){ org.jclouds.blobstore.options.GetOptions in = new org.jclouds.blobstore.options.GetOptions(); in.tail(1024); GetOptions expected = new GetOptions(); expected.tail(1024); assertEquals(fn.apply(in), expected); } @Test
@Test public void testRangesStart(){ org.jclouds.blobstore.options.GetOptions in = new org.jclouds.blobstore.options.GetOptions(); in.startAt(1024); GetOptions expected = new GetOptions(); expected.startAt(1024); assertEquals(fn.apply(in), expected); }
public void testModifiedSinceAndRange() { GetOptions options = new GetOptions(); options.ifModifiedSince(now); options.range(0, 1024); assertEquals(options.getIfModifiedSince(), nowExpected); bytes1to1024(options); }