mboudreau / Alternator

A mock DynamoDB that runs locally for testing purposes - DEPRECATED, PLEASE USE DYNAMODB LOCAL: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
Apache License 2.0
78 stars 39 forks source link

Alternator 0.8.0-SNAPSHOT: Revise for version 1.6.11 of AWS SDK for Java. #84

Closed rrutt closed 10 years ago

rrutt commented 10 years ago

This addresses Issue #83 regarding use of version 1.6.8 or higher of the AWS SDK for Java:

https://github.com/mboudreau/Alternator/issues/83

The primary fix was to modify AlternatorDBClient.setEndpoint to explicitly pass "dynamodb" as the service name to the superclass to bypass new inference logic based on the class name of the client. The same revision was also made to AlternatorDBClientV2.setEndpoint.

super.setEndpoint(endpoint, "dynamodb", null);

Also, the .invoke method in both client classes was revised to unwrap the Response object now returned by the AmazonHttpClient.execute method. (Version 1.6.4 simply returned an object of type X.)

Response<X> result = client.execute(request, responseHandler, errorResponseHandler, executionContext);
return result.getAwsResponse();

All tests pass using 'mvn verify', including an alternate run with AlternatorTest.SPAWN_LOCAL_DB_SERVICE temporarily compiled as false, with an instance of Alternator running in another terminal window via 'mvn exec:java'.

I updated the maven-compiler-plugin version to 3.1 to resolve an issue with setting the <source> and <target> to Java 1.5 to match the AWS SDK for Java settings.

I updated the snapshot version of Alternator to 0.8.0 since this involves referencing a new version of the AWS SDK for Java for client projects.

The AWS SDK for Java source code can be reviewed at their GitHub repository:

https://github.com/aws/aws-sdk-java.git

mboudreau commented 10 years ago

You're awesome Rick :)