Skip to content

Commit

Permalink
Adding Jackson annotations to be compatible with Jackson 1.9 due to b…
Browse files Browse the repository at this point in the history
…ehavior change since 1.8
  • Loading branch information
Yanacek committed Aug 19, 2013
1 parent 28b5dd5 commit ee38cfe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.Version;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonSubTypes;
import org.codehaus.jackson.annotate.JsonSubTypes.Type;
import org.codehaus.jackson.annotate.JsonTypeInfo;
Expand Down Expand Up @@ -474,22 +475,37 @@ private static abstract class RequestMixIn extends AmazonWebServiceRequestMixIn
@JsonIgnore
public abstract void setReturnValues(ReturnValue returnValue);

@JsonProperty
public abstract void setReturnValues(String returnValue);

@JsonIgnore
public abstract void setReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity);

@JsonProperty
public abstract void setReturnConsumedCapacity(String returnConsumedCapacity);

@JsonIgnore
public abstract void setReturnItemCollectionMetrics(ReturnItemCollectionMetrics returnItemCollectionMetrics);

@JsonProperty
public abstract void setReturnItemCollectionMetrics(String returnItemCollectionMetrics);

@JsonIgnore
public abstract boolean isConsistentRead();

@JsonProperty
public abstract boolean getConsistentRead();

}

private static abstract class AttributeValueUpdateMixIn {

@JsonIgnore
public abstract void setAction(AttributeAction attributeAction);

@JsonProperty
public abstract void setAction(String attributeAction);

}

private static class ByteBufferSerializer extends JsonSerializer<ByteBuffer> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.amazonaws.services.dynamodbv2.transactions;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -182,9 +183,11 @@ public void roundTripPutAll() {
item.put("attr_bs", new AttributeValue().withBS(ByteBuffer.wrap(new String("asdf").getBytes()), ByteBuffer.wrap(new String("asdf").getBytes())));
r1.setRequest(new PutItemRequest()
.withTableName(TABLE_NAME)
.withItem(item));
.withItem(item)
.withReturnValues("ALL_OLD"));
byte[] r1Bytes = Request.serialize("123", r1).array();
Request r2 = Request.deserialize("123", ByteBuffer.wrap(r1Bytes));
assertEquals(r1.getRequest(), ((PutItem)r2).getRequest());
byte[] r2Bytes = Request.serialize("123", r2).array();
assertArrayEquals(r1Bytes, r2Bytes);
}
Expand Down

0 comments on commit ee38cfe

Please sign in to comment.