protected void assertConsistencyAwareRemoveEquals(final Map<String, V> map, final String key, final Object equals) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assertEquals(map.remove(key), equals); } }); }
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); } } }); }
@Override protected void checkContentDisposition(Blob blob, String contentDisposition) { // This works for Swift Server 1.4.4/SWauth 1.0.3 but was null in previous versions. // TODO: Better testing for the different versions. super.checkContentDisposition(blob,contentDisposition); }
private void checkContentMetadata(Blob blob) { checkContentType(blob, "text/csv"); checkContentDisposition(blob, "attachment; filename=photo.jpg"); checkContentEncoding(blob, "gzip"); checkContentLanguage(blob, "en"); }
/** * requestor will create a container using the name returned from this. This method will take * care not to exceed the maximum containers permitted by a provider by deleting an existing * container first. * * @throws InterruptedException */ public String getScratchContainerName() throws InterruptedException { return allocateNewContainerName(getContainerName()); }
private String addObjectAndValidateContent(String sourcecontainer, String sourceKey) throws InterruptedException { String eTag = addBlobToContainer(sourcecontainer, sourceKey); validateContent(sourcecontainer, sourceKey); return eTag; }
protected String recycleContainer(final String container) throws InterruptedException { String newScratchContainer = allocateNewContainerName(container); createContainerAndEnsureEmpty(newScratchContainer); return newScratchContainer; }
@BeforeClass(groups = { "integration", "live" }, dependsOnMethods = "setupContext") @Override public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception { super.setUpResourcesOnThisThread(testContext); oneHundredOneConstitutions = getTestDataSupplier(); oneHundredOneConstitutionsMD5 = md5Supplier(oneHundredOneConstitutions); }
protected void assertContainerSize(final String containerName, final int size) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { try { assertEquals(view.getBlobStore().countBlobs(containerName), size); } catch (Exception e) { propagateIfPossible(e); } } }); }
/** * abandon old container name instead of waiting for the container to be created. * * @throws InterruptedException */ public void destroyContainer(String scratchContainer) throws InterruptedException { if (scratchContainer != null) { recycleContainerAndAddToPool(scratchContainer); } }
protected void assertConsistencyAwareDoesntContainKey(final Map<String, V> map) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assert !map.containsKey("one"); } }); }
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 assertConsistencyAwareMapSize(final Map<String, V> map, final int size) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assertEquals(map.size(), size); } }); }
protected void assertConsistencyAwareGetEquals(final Map<String, V> map, final String key, final Object equals) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assertEquals(map.get(key), equals); } }); }
/** * containsValue() uses eTag comparison to containerName contents, so this can be subject to * eventual consistency problems. */ protected void assertConsistencyAwareContainsValue(final Map<String, V> map, final Object value) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assert map.containsValue(value); } }); }
protected void assertConsistencyAwareKeySize(final Map<String, V> map, final int size) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assertEquals(map.keySet().size(), size); } }); }
protected void assertConsistencyAwareListContainer(final ListableMap<?, ?> map, final String containerNameName) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assertTrue(Iterables.size(map.list()) >= 0); } }); }
protected void assertConsistencyAwareContainsKey(final Map<String, V> map) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assert map.containsKey("one"); } }); }
protected void assertConsistencyAwareNotEmpty(final Map<String, V> map) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assert !map.isEmpty(); } }); }
protected void assertConsistencyAwareEmpty(final Map<String, V> map) throws InterruptedException { assertConsistencyAware(new Runnable() { public void run() { assert map.isEmpty(); } }); }