made sure MD5 are sent during testing

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2013 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-10-31 00:46:55 +00:00
parent f285e85ae7
commit 6336fa1823
3 changed files with 12 additions and 10 deletions

View File

@ -78,7 +78,7 @@ public class BaseBlobMapIntegrationTest<S> extends BaseMapIntegrationTest<S, Blo
String bucketName = getContainerName(); String bucketName = getContainerName();
try { try {
Map<String, Blob> map = createMap(context, bucketName); Map<String, Blob> map = createMap(context, bucketName);
putString(map, "one", "two"); putStringWithMD5(map, "one", "two");
assertConsistencyAwareContentEquals(map, "one", "two"); assertConsistencyAwareContentEquals(map, "one", "two");
// TODO track how often this occurs and potentially update map implementation // TODO track how often this occurs and potentially update map implementation
assertConsistencyAwareRemoveEquals(map, "one", null); assertConsistencyAwareRemoveEquals(map, "one", null);
@ -135,9 +135,10 @@ public class BaseBlobMapIntegrationTest<S> extends BaseMapIntegrationTest<S, Blo
String bucketName = getContainerName(); String bucketName = getContainerName();
try { try {
Map<String, Blob> map = createMap(context, bucketName); Map<String, Blob> map = createMap(context, bucketName);
putString(map, "one", "apple"); putStringWithMD5(map, "one", "apple");
Blob object = newBlob("one"); Blob object = newBlob("one");
object.setData("apple"); object.setData("apple");
object.generateMD5();
assertConsistencyAwareContainsValue(map, object); assertConsistencyAwareContainsValue(map, object);
} finally { } finally {
returnContainer(bucketName); returnContainer(bucketName);
@ -200,9 +201,10 @@ public class BaseBlobMapIntegrationTest<S> extends BaseMapIntegrationTest<S, Blo
} }
@Override @Override
protected void putString(Map<String, Blob> map, String key, String value) { protected void putStringWithMD5(Map<String, Blob> map, String key, String value) {
Blob object = newBlob(key); Blob object = newBlob(key);
object.setData(value); object.setData(value);
object.generateMD5();
map.put(key, object); map.put(key, object);
} }

View File

@ -78,7 +78,7 @@ public class BaseInputStreamMapIntegrationTest<S> extends BaseMapIntegrationTest
String bucketName = getContainerName(); String bucketName = getContainerName();
try { try {
Map<String, InputStream> map = createMap(context, bucketName); Map<String, InputStream> map = createMap(context, bucketName);
putString(map, "one", "two"); putStringWithMD5(map, "one", "two");
InputStream old = map.remove("one"); InputStream old = map.remove("one");
assertEquals(Utils.toStringAndClose(old), "two"); assertEquals(Utils.toStringAndClose(old), "two");
old = map.remove("one"); old = map.remove("one");
@ -309,7 +309,7 @@ public class BaseInputStreamMapIntegrationTest<S> extends BaseMapIntegrationTest
} }
@Override @Override
protected void putString(Map<String, InputStream> map, String key, String value) protected void putStringWithMD5(Map<String, InputStream> map, String key, String value)
throws InterruptedException, ExecutionException, TimeoutException { throws InterruptedException, ExecutionException, TimeoutException {
((InputStreamMap) map).putString(key, value); ((InputStreamMap) map).putString(key, value);
} }

View File

@ -106,7 +106,7 @@ public abstract class BaseMapIntegrationTest<S, V> extends BaseBlobStoreIntegrat
try { try {
Map<String, V> map = createMap(context, bucketName); Map<String, V> map = createMap(context, bucketName);
assertConsistencyAwareMapSize(map, 0); assertConsistencyAwareMapSize(map, 0);
putString(map, "one", "apple"); putStringWithMD5(map, "one", "apple");
assertConsistencyAwareMapSize(map, 1); assertConsistencyAwareMapSize(map, 1);
map.clear(); map.clear();
assertConsistencyAwareMapSize(map, 0); assertConsistencyAwareMapSize(map, 0);
@ -125,7 +125,7 @@ public abstract class BaseMapIntegrationTest<S, V> extends BaseBlobStoreIntegrat
try { try {
Map<String, V> map = createMap(context, bucketName); Map<String, V> map = createMap(context, bucketName);
assertConsistencyAwareKeySize(map, 0); assertConsistencyAwareKeySize(map, 0);
putString(map, "one", "two"); putStringWithMD5(map, "one", "two");
assertConsistencyAwareKeySize(map, 1); assertConsistencyAwareKeySize(map, 1);
assertConsistencyAwareKeySetEquals(map, ImmutableSet.of("one")); assertConsistencyAwareKeySetEquals(map, ImmutableSet.of("one"));
} finally { } finally {
@ -175,7 +175,7 @@ public abstract class BaseMapIntegrationTest<S, V> extends BaseBlobStoreIntegrat
try { try {
Map<String, V> map = createMap(context, bucketName); Map<String, V> map = createMap(context, bucketName);
assertConsistencyAwareDoesntContainKey(map); assertConsistencyAwareDoesntContainKey(map);
putString(map, "one", "apple"); putStringWithMD5(map, "one", "apple");
assertConsistencyAwareContainsKey(map); assertConsistencyAwareContainsKey(map);
} finally { } finally {
returnContainer(bucketName); returnContainer(bucketName);
@ -219,7 +219,7 @@ public abstract class BaseMapIntegrationTest<S, V> extends BaseBlobStoreIntegrat
try { try {
Map<String, V> map = createMap(context, bucketName); Map<String, V> map = createMap(context, bucketName);
assertConsistencyAwareEmpty(map); assertConsistencyAwareEmpty(map);
putString(map, "one", "apple"); putStringWithMD5(map, "one", "apple");
assertConsistencyAwareNotEmpty(map); assertConsistencyAwareNotEmpty(map);
} finally { } finally {
returnContainer(bucketName); returnContainer(bucketName);
@ -243,7 +243,7 @@ public abstract class BaseMapIntegrationTest<S, V> extends BaseBlobStoreIntegrat
}); });
} }
abstract protected void putString(Map<String, V> map, String key, String value) abstract protected void putStringWithMD5(Map<String, V> map, String key, String value)
throws InterruptedException, ExecutionException, TimeoutException; throws InterruptedException, ExecutionException, TimeoutException;
protected void fourLeftRemovingOne(Map<String, V> map) throws InterruptedException, protected void fourLeftRemovingOne(Map<String, V> map) throws InterruptedException,