simpledb back to work

This commit is contained in:
Adrian Cole 2011-04-29 15:03:19 -07:00
parent b6bbb9c1c6
commit 9388f8b5ca
3 changed files with 14 additions and 45 deletions

View File

@ -1,40 +0,0 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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<String> providers = Providers.getSupportedProviders();
assert Iterables.contains(providers, "simpledb") : providers;
}
}

View File

@ -66,7 +66,7 @@ public class SimpleDBAsyncClientTest extends RestClientTest<SimpleDBAsyncClient>
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<SimpleDBAsyncClient>
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<SimpleDBAsyncClient>
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<SimpleDBAsyncClient>
@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());
}
}

View File

@ -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());
}
}