static Tuple<BlobInfo, BlobTargetOption[]> convert(BlobInfo info, BlobWriteOption... options) { BlobInfo.Builder infoBuilder = info.toBuilder().setCrc32c(null).setMd5(null); List<BlobTargetOption> targetOptions = Lists.newArrayListWithCapacity(options.length); for (BlobWriteOption option : options) { switch (option.option) { case IF_CRC32C_MATCH: infoBuilder.setCrc32c(info.getCrc32c()); break; case IF_MD5_MATCH: infoBuilder.setMd5(info.getMd5()); break; default: targetOptions.add(option.toTargetOption()); break; } } return Tuple.of( infoBuilder.build(), targetOptions.toArray(new BlobTargetOption[targetOptions.size()])); } }
assertEquals(expected.getContentLanguage(), value.getContentLanguage()); assertEquals(expected.getCustomerEncryption(), value.getCustomerEncryption()); assertEquals(expected.getCrc32c(), value.getCrc32c()); assertEquals(expected.getCreateTime(), value.getCreateTime()); assertEquals(expected.getDeleteTime(), value.getDeleteTime());
assertEquals(CONTENT_LANGUAGE, BLOB_INFO.getContentLanguage()); assertEquals(CUSTOMER_ENCRYPTION, BLOB_INFO.getCustomerEncryption()); assertEquals(CRC32, BLOB_INFO.getCrc32c()); assertEquals(DELETE_TIME, BLOB_INFO.getDeleteTime()); assertEquals(ETAG, BLOB_INFO.getEtag()); assertNull(DIRECTORY_INFO.getContentLanguage()); assertNull(DIRECTORY_INFO.getCustomerEncryption()); assertNull(DIRECTORY_INFO.getCrc32c()); assertNull(DIRECTORY_INFO.getCreateTime()); assertNull(DIRECTORY_INFO.getDeleteTime());
assertNull(blobInfo.getContentLanguage()); assertNull(blobInfo.getCustomerEncryption()); assertNull(blobInfo.getCrc32c()); assertNull(blobInfo.getCreateTime()); assertNull(blobInfo.getDeleteTime());
static Tuple<BlobInfo, BlobTargetOption[]> convert(BlobInfo info, BlobWriteOption... options) { BlobInfo.Builder infoBuilder = info.toBuilder().setCrc32c(null).setMd5(null); List<BlobTargetOption> targetOptions = Lists.newArrayListWithCapacity(options.length); for (BlobWriteOption option : options) { switch (option.option) { case IF_CRC32C_MATCH: infoBuilder.setCrc32c(info.getCrc32c()); break; case IF_MD5_MATCH: infoBuilder.setMd5(info.getMd5()); break; default: targetOptions.add(option.toTargetOption()); break; } } return Tuple.of( infoBuilder.build(), targetOptions.toArray(new BlobTargetOption[targetOptions.size()])); } }