@Test(groups = { "integration", "live" }) public void testPutAll() throws InterruptedException, ExecutionException, TimeoutException { String bucketName = getContainerName(); try { Map<String, Blob> map = createMap(view, bucketName); ImmutableMap.Builder<String, Blob> newMap = ImmutableMap.builder(); for (Map.Entry<String, InputStream> entry : fiveInputs.entrySet()) { String key = entry.getKey(); newMap.put( key, view.getBlobStore().blobBuilder(key).payload(entry.getValue()) .contentLength((long) fiveBytes.get(key).length).build()); } map.putAll(newMap.build()); assertConsistencyAwareMapSize(map, 5); assertConsistencyAwareKeySetEquals(map, ImmutableSet.copyOf(fiveInputs.keySet())); fourLeftRemovingOne(map); } finally { returnContainer(bucketName); } }
@Test(groups = { "integration", "live" }) public void testPutMoreThanSingleListing() throws InterruptedException, ExecutionException, TimeoutException { if (maxResultsForTestListings() == 0) return; String bucketName = getContainerName(); try { BlobMap map = createMap(view, bucketName); Builder<String> keySet = ImmutableSet.builder(); for (int i = 0; i < maxResultsForTestListings() + 1; i++) { keySet.add(i + ""); } Map<String, Blob> newMap = Maps.newLinkedHashMap(); for (String key : keySet.build()) { newMap.put(key, map.blobBuilder().name(key).payload(key).build()); } map.putAll(newMap); newMap.clear(); assertConsistencyAwareMapSize(map, maxResultsForTestListings() + 1); assertConsistencyAwareKeySetEquals(map, keySet.build()); map.clear(); assertConsistencyAwareMapSize(map, 0); } finally { returnContainer(bucketName); } }