From 70deff8c8c7b16495835af3e8a3b216b720c8426 Mon Sep 17 00:00:00 2001 From: "Luis A. Bastiao Silva" Date: Mon, 20 Dec 2010 22:56:31 +0000 Subject: [PATCH] adding some test functions to putAttributes --- .../aws/simpledb/SimpleDBAsyncClientTest.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java index 47e8d470b5..9168aec3ee 100644 --- a/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java @@ -23,6 +23,7 @@ import static org.testng.Assert.assertEquals; import java.io.IOException; import java.lang.reflect.Method; +import java.util.Map; import java.util.Properties; import org.jclouds.aws.domain.Region; @@ -95,11 +96,31 @@ public class SimpleDBAsyncClientTest extends RestClientTest } public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException { - Method method = SimpleDBAsyncClient.class.getMethod("createDomainInRegion", String.class, String.class); + Method method = SimpleDBAsyncClient.class.getMethod("putAttributes", String.class, String.class); for (String region : Region.ALL_SIMPLEDB) { processor.createRequest(method, region, "domainName"); } } + + public void testPutAttributes() throws SecurityException, NoSuchMethodException, IOException { + Method method = SimpleDBAsyncClient.class.getMethod("putAttributes", String.class, String.class, Map.class); + HttpRequest request = processor.createRequest(method, null, "domainName"); + + assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n"); + assertPayloadEquals(request, "Version=2009-04-15&Action=PutAttributes&DomainName=domainName&ItemName=itemName" + + "&Attribute.1.Name=name" + + "&Attribute.1.Value=fuzzy" + + "&Attribute.1.Replace=true", + "application/x-www-form-urlencoded", false); + + assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); + assertSaxResponseParserClassEquals(method, null); + assertExceptionParserClassEquals(method, null); + + checkFilters(request); + } + @Override protected void checkFilters(HttpRequest request) {