public BucketMetadata apply(String name) { return new BucketMetadata(name, null, null); }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
@Test public void testCanParseListAllMyBuckets() throws HttpException { Set<BucketMetadata> s3Buckets = runParseListAllMyBuckets(); BucketMetadata container1 = Iterables.get(s3Buckets, 0); assert container1.getName().equals("adrianjbosstest"); Date expectedDate1 = new SimpleDateFormatDateService().iso8601DateParse("2009-03-12T02:00:07.000Z"); Date date1 = container1.getCreationDate(); assert date1.equals(expectedDate1); BucketMetadata container2 = (BucketMetadata) s3Buckets.toArray()[1]; assert container2.getName().equals("adrianjbosstest2"); Date expectedDate2 = new SimpleDateFormatDateService().iso8601DateParse("2009-03-12T02:00:09.000Z"); Date date2 = container2.getCreationDate(); assert date2.equals(expectedDate2); assert s3Buckets.size() == 2; CanonicalUser owner = new CanonicalUser("e1a5f66a480ca99a4fdfe8e318c3020446c9989d7004e7778029fbcc5d990fa0"); assert container1.getOwner().equals(owner); assert container2.getOwner().equals(owner); }
void bucketExists() throws Exception { String bucketName = getContainerName(); try { Set<BucketMetadata> list = getApi().listOwnedBuckets(); BucketMetadata firstBucket = Iterables.get(list, 0); BucketMetadata toMatch = new BucketMetadata(bucketName, new Date(), firstBucket.getOwner()); assert list.contains(toMatch); } finally { returnContainer(bucketName); } }
@Test public void testCanParseListAllMyBuckets() throws HttpException { Set<BucketMetadata> s3Buckets = runParseListAllMyBuckets(); BucketMetadata container1 = Iterables.get(s3Buckets, 0); assert container1.getName().equals("adrianjbosstest"); Date expectedDate1 = new SimpleDateFormatDateService().iso8601DateParse("2009-03-12T02:00:07.000Z"); Date date1 = container1.getCreationDate(); assert date1.equals(expectedDate1); BucketMetadata container2 = (BucketMetadata) s3Buckets.toArray()[1]; assert container2.getName().equals("adrianjbosstest2"); Date expectedDate2 = new SimpleDateFormatDateService().iso8601DateParse("2009-03-12T02:00:09.000Z"); Date date2 = container2.getCreationDate(); assert date2.equals(expectedDate2); assert s3Buckets.size() == 2; CanonicalUser owner = new CanonicalUser("e1a5f66a480ca99a4fdfe8e318c3020446c9989d7004e7778029fbcc5d990fa0"); assert container1.getOwner().equals(owner); assert container2.getOwner().equals(owner); }
void bucketExists() throws Exception { String bucketName = getContainerName(); try { Set<BucketMetadata> list = getApi().listOwnedBuckets(); BucketMetadata firstBucket = Iterables.get(list, 0); BucketMetadata toMatch = new BucketMetadata(bucketName, new Date(), firstBucket.getOwner()); assert list.contains(toMatch); } finally { returnContainer(bucketName); } }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public void endElement(String uri, String name, String qName) { if (qName.equals("ID")) { // owner stuff currentOwner = new CanonicalUser(currentOrNull(currentText)); } else if (qName.equals("DisplayName")) { currentOwner.setDisplayName(currentOrNull(currentText)); } else if (qName.equals("Bucket")) { buckets.add(new BucketMetadata(currentName, currentCreationDate, currentOwner)); } else if (qName.equals("Name")) { currentName = currentOrNull(currentText); } else if (qName.equals("CreationDate")) { currentCreationDate = dateParser.iso8601DateParse(currentOrNull(currentText)); } currentText = new StringBuilder(); }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public void endElement(String uri, String name, String qName) { if (qName.equals("ID")) { // owner stuff currentOwner = new CanonicalUser(currentOrNull(currentText)); } else if (qName.equals("DisplayName")) { currentOwner.setDisplayName(currentOrNull(currentText)); } else if (qName.equals("Bucket")) { buckets.add(new BucketMetadata(currentName, currentCreationDate, currentOwner)); } else if (qName.equals("Name")) { currentName = currentOrNull(currentText); } else if (qName.equals("CreationDate")) { currentCreationDate = dateParser .iso8601DateOrSecondsDateParse(currentOrNull(currentText)); } currentText.setLength(0); }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public void endElement(String uri, String name, String qName) { if (qName.equals("ID")) { // owner stuff currentOwner = new CanonicalUser(currentOrNull(currentText)); } else if (qName.equals("DisplayName")) { currentOwner.setDisplayName(currentOrNull(currentText)); } else if (qName.equals("Bucket")) { buckets.add(new BucketMetadata(currentName, currentCreationDate, currentOwner)); } else if (qName.equals("Name")) { currentName = currentOrNull(currentText); } else if (qName.equals("CreationDate")) { currentCreationDate = dateParser.iso8601DateParse(currentOrNull(currentText)); } currentText = new StringBuilder(); }
public StorageMetadata apply(BucketMetadata from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setType(StorageType.CONTAINER); to.setLocation(locationOfBucket.apply(from.getName())); to.setCreationDate(from.getCreationDate()); return to; } }
public void endElement(String uri, String name, String qName) { if (qName.equals("ID")) { // owner stuff currentOwner = new CanonicalUser(currentOrNull(currentText)); } else if (qName.equals("DisplayName")) { currentOwner.setDisplayName(currentOrNull(currentText)); } else if (qName.equals("Bucket")) { buckets.add(new BucketMetadata(currentName, currentCreationDate, currentOwner)); } else if (qName.equals("Name")) { currentName = currentOrNull(currentText); } else if (qName.equals("CreationDate")) { currentCreationDate = dateParser .iso8601DateOrSecondsDateParse(currentOrNull(currentText)); } currentText.setLength(0); }
public void endElement(String uri, String name, String qName) { if (qName.equals("ID")) { // owner stuff currentOwner = new CanonicalUser(currentOrNull(currentText)); } else if (qName.equals("DisplayName")) { currentOwner.setDisplayName(currentOrNull(currentText)); } else if (qName.equals("Bucket")) { buckets.add(new BucketMetadata(currentName, currentCreationDate, currentOwner)); } else if (qName.equals("Name")) { currentName = currentOrNull(currentText); } else if (qName.equals("CreationDate")) { currentCreationDate = dateParser .iso8601DateOrSecondsDateParse(currentOrNull(currentText)); } currentText.setLength(0); }