From 9388f8b5ca21784a8660c569e20700ad9436d4b1 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 29 Apr 2011 15:03:19 -0700 Subject: [PATCH] simpledb back to work --- .../simpledb/ProvidersInPropertiesTest.java | 40 ------------------- .../simpledb/SimpleDBAsyncClientTest.java | 14 ++++--- .../simpledb/AWSSimpleDBAsyncClientTest.java | 5 +++ 3 files changed, 14 insertions(+), 45 deletions(-) delete mode 100644 sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/ProvidersInPropertiesTest.java diff --git a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/ProvidersInPropertiesTest.java b/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/ProvidersInPropertiesTest.java deleted file mode 100644 index 656190552d..0000000000 --- a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/ProvidersInPropertiesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ==================================================================== - */ -package org.jclouds.simpledb; - -import org.jclouds.rest.Providers; -import org.testng.annotations.Test; - -import com.google.common.collect.Iterables; - -/** - * - * @author Adrian Cole - * - */ -@Test(groups = "unit") -public class ProvidersInPropertiesTest { - - @Test - public void testSupportedProviders() { - Iterable providers = Providers.getSupportedProviders(); - assert Iterables.contains(providers, "simpledb") : providers; - } - -} diff --git a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java b/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java index 4473039e39..010252ad27 100644 --- a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java +++ b/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java @@ -66,7 +66,7 @@ public class SimpleDBAsyncClientTest extends RestClientTest public void testListDomainsInRegion() throws SecurityException, NoSuchMethodException, IOException { Method method = SimpleDBAsyncClient.class.getMethod("listDomainsInRegion", String.class, - ListDomainsOptions[].class); + ListDomainsOptions[].class); HttpRequest request = processor.createRequest(method); assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1"); @@ -87,7 +87,7 @@ public class SimpleDBAsyncClientTest extends RestClientTest assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n"); assertPayloadEquals(request, "Version=2009-04-15&Action=CreateDomain&DomainName=domainName", - "application/x-www-form-urlencoded", false); + "application/x-www-form-urlencoded", false); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertSaxResponseParserClassEquals(method, null); @@ -105,8 +105,8 @@ public class SimpleDBAsyncClientTest extends RestClientTest 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); + + "&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); @@ -134,7 +134,11 @@ public class SimpleDBAsyncClientTest extends RestClientTest @Override public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec(provider, "identity", "credential", new Properties()); + // TODO take this out, when the service is registered in jclouds-core/rest.properties + Properties restProperties = new Properties(); + restProperties.setProperty(provider + ".contextbuilder", SimpleDBContextBuilder.class.getName()); + restProperties.setProperty(provider + ".propertiesbuilder", SimpleDBPropertiesBuilder.class.getName()); + return new RestContextFactory(restProperties).createContextSpec(provider, "foo", "bar", getProperties()); } } diff --git a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java b/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java index 939b7f8ab7..ba90b363fb 100644 --- a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java +++ b/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java @@ -24,6 +24,7 @@ import java.util.Properties; import org.jclouds.aws.domain.Region; import org.jclouds.rest.RestContextFactory; +import org.jclouds.rest.RestContextSpec; import org.jclouds.simpledb.SimpleDBAsyncClient; import org.jclouds.simpledb.SimpleDBAsyncClientTest; import org.testng.annotations.Test; @@ -53,4 +54,8 @@ public class AWSSimpleDBAsyncClientTest extends SimpleDBAsyncClientTest { } } + @Override + public RestContextSpec createContextSpec() { + return new RestContextFactory().createContextSpec(provider, "foo", "bar", getProperties()); + } }