@Test public void testUpdateItems() throws IOException { List<UpdatableItemInfo> updateItems = Lists.newArrayList(new UpdatableItemInfo(ITEM_A_A.getResourceId(), TEST_METADATA)); GoogleCloudStorageItemInfo itemAAUpdated = updateObjectItemInfo(ITEM_A_A, ITEM_A_A.getMetaGeneration() + 1); List<GoogleCloudStorageItemInfo> result = gcs.updateItems(updateItems); verify(gcsDelegate).updateItems(eq(updateItems)); assertThat(result).containsExactly(itemAAUpdated); assertThat(cache.getAllItemsRaw()).containsExactly(itemAAUpdated); }
@Override public List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList) throws IOException { List<GoogleCloudStorageItemInfo> result = super.updateItems(itemInfoList); for (GoogleCloudStorageItemInfo item : result) { cache.putItem(item); } return result; }
PerformanceCachingGoogleCloudStorage extends ForwardingGoogleCloudStorage { @Override public List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList) throws IOException { List<GoogleCloudStorageItemInfo> result = super.updateItems(itemInfoList); for (GoogleCloudStorageItemInfo item : result) { cache.putItem(item); } return result; } }
PerformanceCachingGoogleCloudStorage extends ForwardingGoogleCloudStorage { @Override public List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList) throws IOException { List<GoogleCloudStorageItemInfo> result = super.updateItems(itemInfoList); for (GoogleCloudStorageItemInfo item : result) { cache.putItem(item); } return result; } PerformanceCachingGoogleCloudStorage(
      GoogleCloudStorage delegate, PerformanceCachingGoogleCloudStorageOptions options); @VisibleForTesting  PerformanceCachingGoogleCloudStorage(
      GoogleCloudStorage delegate,
      PrefixMappedItemCache cache); }
PerformanceCachingGoogleCloudStorage extends ForwardingGoogleCloudStorage { @Override public List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList) throws IOException { List<GoogleCloudStorageItemInfo> result = super.updateItems(itemInfoList); for (GoogleCloudStorageItemInfo item : result) { cache.putItem(item); } return result; } PerformanceCachingGoogleCloudStorage(
      GoogleCloudStorage delegate, PerformanceCachingGoogleCloudStorageOptions options); @VisibleForTesting  PerformanceCachingGoogleCloudStorage(
      GoogleCloudStorage delegate,
      PrefixMappedItemCache cache); @Override WritableByteChannel create(StorageResourceId resourceId); @Override void deleteBuckets(List<String> bucketNames); @Override void deleteObjects(List<StorageResourceId> resourceIds); @Override List<GoogleCloudStorageItemInfo> listBucketInfo(); @Override List<String> listObjectNames(String bucketName, String objectNamePrefix); @Override List<String> listObjectNames(
      String bucketName, String objectNamePrefix, ListObjectOptions listOptions); @Override List<GoogleCloudStorageItemInfo> listObjectInfo(String bucketName, String objectNamePrefix); @Override List<GoogleCloudStorageItemInfo> listObjectInfo(
      String bucketName, String objectNamePrefix, ListObjectOptions listOptions); @Override ListPage<GoogleCloudStorageItemInfo> listObjectInfoPage(
      String bucketName, String objectNamePrefix, ListObjectOptions listOptions, String pageToken); @Override GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId); @Override List<GoogleCloudStorageItemInfo> getItemInfos(List<StorageResourceId> resourceIds); @Override List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList); @Override void close(); @Override GoogleCloudStorageItemInfo composeObjects(
      List<StorageResourceId> sources, StorageResourceId destination, CreateObjectOptions options); @VisibleForTesting void invalidateCache(); }
PerformanceCachingGoogleCloudStorage extends ForwardingGoogleCloudStorage { @Override public List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList) throws IOException { List<GoogleCloudStorageItemInfo> result = super.updateItems(itemInfoList); for (GoogleCloudStorageItemInfo item : result) { cache.putItem(item); } return result; } PerformanceCachingGoogleCloudStorage(
      GoogleCloudStorage delegate, PerformanceCachingGoogleCloudStorageOptions options); @VisibleForTesting  PerformanceCachingGoogleCloudStorage(
      GoogleCloudStorage delegate,
      PrefixMappedItemCache cache); @Override WritableByteChannel create(StorageResourceId resourceId); @Override void deleteBuckets(List<String> bucketNames); @Override void deleteObjects(List<StorageResourceId> resourceIds); @Override List<GoogleCloudStorageItemInfo> listBucketInfo(); @Override List<String> listObjectNames(String bucketName, String objectNamePrefix); @Override List<String> listObjectNames(
      String bucketName, String objectNamePrefix, ListObjectOptions listOptions); @Override List<GoogleCloudStorageItemInfo> listObjectInfo(String bucketName, String objectNamePrefix); @Override List<GoogleCloudStorageItemInfo> listObjectInfo(
      String bucketName, String objectNamePrefix, ListObjectOptions listOptions); @Override ListPage<GoogleCloudStorageItemInfo> listObjectInfoPage(
      String bucketName, String objectNamePrefix, ListObjectOptions listOptions, String pageToken); @Override GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId); @Override List<GoogleCloudStorageItemInfo> getItemInfos(List<StorageResourceId> resourceIds); @Override List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList); @Override void close(); @Override GoogleCloudStorageItemInfo composeObjects(
      List<StorageResourceId> sources, StorageResourceId destination, CreateObjectOptions options); @VisibleForTesting void invalidateCache();  }