protected void assertNotExists(final String containerName) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert !view.getBlobStore().containerExists(containerName) : "container " + containerName + " still exists"; } catch (Exception e) { propagateIfPossible(e); } } }); }
protected void assertConsistencyAwareContainerExists(final String containerName) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert view.getBlobStore().containerExists(containerName) : String.format("container %s doesn't exist", containerName); } catch (Exception e) { Throwables.propagate(e); } } }); }
protected void assertConsistencyAwareBlobDoesntExist(final String containerName, final String name) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert !view.getBlobStore().blobExists(containerName, name) : String.format("found %s in %s", name, containerName); } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertConsistencyAwareBlobDoesntExist(final String containerName, final String name) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert !view.getBlobStore().blobExists(containerName, name) : String.format("found %s in %s", name, containerName); } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertConsistencyAwareContainerExists(final String containerName) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert view.getBlobStore().containerExists(containerName) : String.format("container %s doesn't exist", containerName); } catch (Exception e) { Throwables.propagate(e); } } }); }
protected void assertConsistencyAwareBlobExpiryMetadata(final String containerName, final String blobName, final Date expectedExpires) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { Blob blob = view.getBlobStore().getBlob(containerName, blobName); Date actualExpires = blob.getPayload().getContentMetadata().getExpires(); assert expectedExpires.equals(actualExpires) : "expires=" + actualExpires + "; expected=" + expectedExpires; } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertNotExists(final String containerName) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert !view.getBlobStore().containerExists(containerName) : "container " + containerName + " still exists"; } catch (Exception e) { propagateIfPossible(e); } } }); }
protected void assertConsistencyAware(Runnable assertion) throws InterruptedException { assertConsistencyAware(view, assertion); }
protected void assertConsistencyAwareBlobInLocation(final String containerName, final String blobName, final Location loc) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { Location actualLoc = view.getBlobStore().getBlob(containerName, blobName).getMetadata().getLocation(); assert loc.equals(actualLoc) : String.format( "blob %s in %s, in location %s instead of %s", blobName, containerName, actualLoc, loc); } catch (Exception e) { Throwables.propagate(e); } } }); }
protected void assertConsistencyAwareBlobExpiryMetadata(final String containerName, final String blobName, final Date expectedExpires) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { Blob blob = view.getBlobStore().getBlob(containerName, blobName); Date actualExpires = blob.getPayload().getContentMetadata().getExpires(); assert expectedExpires.equals(actualExpires) : "expires=" + actualExpires + "; expected=" + expectedExpires; } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertConsistencyAware(Runnable assertion) throws InterruptedException { assertConsistencyAware(view, assertion); }
protected void assertConsistencyAwareBlobInLocation(final String containerName, final String blobName, final Location loc) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { Location actualLoc = view.getBlobStore().getBlob(containerName, blobName).getMetadata().getLocation(); assert loc.equals(actualLoc) : String.format( "blob %s in %s, in location %s instead of %s", blobName, containerName, actualLoc, loc); } catch (Exception e) { Throwables.propagate(e); } } }); }
protected void assertConsistencyAwareBlobExists(final String containerName, final String name) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert view.getBlobStore().blobExists(containerName, name) : String.format( "could not find %s in %s: %s", name, containerName, ImmutableSet.copyOf(Iterables.transform( view.getBlobStore().list(containerName), new Function<StorageMetadata, String>() { public String apply(StorageMetadata from) { return from.getName(); } }))); } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertConsistencyAwareContainerInLocation(final String containerName, final Location loc) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { StorageMetadata container = Iterables.find(view.getBlobStore().list(), new Predicate<StorageMetadata>() { @Override public boolean apply(@Nullable StorageMetadata input) { return input.getName().equals(containerName); } }); Location actualLoc = container.getLocation(); assert loc.equals(actualLoc) : String.format("blob %s, in location %s instead of %s", containerName, actualLoc, loc); } catch (Exception e) { Throwables.propagate(e); } } }); }
protected void assertConsistencyAwareContainerSize(final String containerName, final int count) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert view.getBlobStore().countBlobs(containerName) == count : String.format( "expected only %d values in %s: %s", count, containerName, ImmutableSet.copyOf(Iterables .transform(view.getBlobStore().list(containerName), new Function<StorageMetadata, String>() { public String apply(StorageMetadata from) { return from.getName(); } }))); } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertConsistencyAwareBlobExists(final String containerName, final String name) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert view.getBlobStore().blobExists(containerName, name) : String.format( "could not find %s in %s: %s", name, containerName, ImmutableSet.copyOf(Iterables.transform( view.getBlobStore().list(containerName), new Function<StorageMetadata, String>() { public String apply(StorageMetadata from) { return from.getName(); } }))); } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertConsistencyAwareContainerSize(final String containerName, final int count) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assert view.getBlobStore().countBlobs(containerName) == count : String.format( "expected only %d values in %s: %s", count, containerName, ImmutableSet.copyOf(Iterables .transform(view.getBlobStore().list(containerName), new Function<StorageMetadata, String>() { public String apply(StorageMetadata from) { return from.getName(); } }))); } catch (Exception e) { Throwables.propagateIfPossible(e); } } }); }
protected void assertConsistencyAwareContainerInLocation(final String containerName, final Location loc) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { StorageMetadata container = Iterables.find(view.getBlobStore().list(), new Predicate<StorageMetadata>() { @Override public boolean apply(@Nullable StorageMetadata input) { return input.getName().equals(containerName); } }); Location actualLoc = container.getLocation(); assert loc.equals(actualLoc) : String.format("blob %s, in location %s instead of %s", containerName, actualLoc, loc); } catch (Exception e) { Throwables.propagate(e); } } }); }