mirror of https://github.com/apache/jclouds.git
simpledb back to work
This commit is contained in:
parent
b6bbb9c1c6
commit
9388f8b5ca
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -66,7 +66,7 @@ public class SimpleDBAsyncClientTest extends RestClientTest<SimpleDBAsyncClient>
|
||||||
|
|
||||||
public void testListDomainsInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListDomainsInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SimpleDBAsyncClient.class.getMethod("listDomainsInRegion", String.class,
|
Method method = SimpleDBAsyncClient.class.getMethod("listDomainsInRegion", String.class,
|
||||||
ListDomainsOptions[].class);
|
ListDomainsOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method);
|
HttpRequest request = processor.createRequest(method);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1");
|
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");
|
assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Version=2009-04-15&Action=CreateDomain&DomainName=domainName",
|
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);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
@ -105,8 +105,8 @@ public class SimpleDBAsyncClientTest extends RestClientTest<SimpleDBAsyncClient>
|
||||||
assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Version=2009-04-15&Action=PutAttributes&DomainName=domainName&ItemName=itemName"
|
assertPayloadEquals(request, "Version=2009-04-15&Action=PutAttributes&DomainName=domainName&ItemName=itemName"
|
||||||
+ "&Attribute.1.Name=name" + "&Attribute.1.Value=fuzzy" + "&Attribute.1.Replace=true",
|
+ "&Attribute.1.Name=name" + "&Attribute.1.Value=fuzzy" + "&Attribute.1.Replace=true",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
@ -134,7 +134,11 @@ public class SimpleDBAsyncClientTest extends RestClientTest<SimpleDBAsyncClient>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestContextSpec<?, ?> createContextSpec() {
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
import org.jclouds.aws.domain.Region;
|
||||||
import org.jclouds.rest.RestContextFactory;
|
import org.jclouds.rest.RestContextFactory;
|
||||||
|
import org.jclouds.rest.RestContextSpec;
|
||||||
import org.jclouds.simpledb.SimpleDBAsyncClient;
|
import org.jclouds.simpledb.SimpleDBAsyncClient;
|
||||||
import org.jclouds.simpledb.SimpleDBAsyncClientTest;
|
import org.jclouds.simpledb.SimpleDBAsyncClientTest;
|
||||||
import org.testng.annotations.Test;
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue