JsonUnmarshallerContext unmarshallerContext = new JsonUnmarshallerContextImpl( jsonParser, simpleTypeUnmarshallers, customTypeMarshallers, response); registerAdditionalMetadataExpressions(unmarshallerContext);
JsonUnmarshallerContext unmarshallerContext = new JsonUnmarshallerContextImpl( jsonParser, simpleTypeUnmarshallers, customTypeMarshallers, response); registerAdditionalMetadataExpressions(unmarshallerContext);
@Test public void testHandleWithCRC32() throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream( "{\"key\" :\"Content\"}".getBytes(StringUtils.UTF8)); CRC32 crc32 = new CRC32(); crc32.update("{\"key\" :\"Content\"}".getBytes(StringUtils.UTF8)); HttpResponse response = new HttpResponse.Builder().statusText("testResponse") .statusCode(200).header("testKey", "testValue") .header("x-amz-crc32", String.valueOf(crc32.getValue())).content(bais).build(); Unmarshaller<String, JsonUnmarshallerContext> unmarshaller = new Unmarshaller<String, JsonUnmarshallerContext>() { @Override public String unmarshall(JsonUnmarshallerContext in) throws Exception { in.getReader().beginObject(); in.getReader().nextName(); return in.getReader().nextString(); } }; JsonResponseHandler<String> toTest = new JsonResponseHandler<String>(unmarshaller); // Is a no-op. just adding for code coverage of the no-op toTest.registerAdditionalMetadataExpressions(null); AmazonWebServiceResponse<String> awsResponse = toTest.handle(response); assertEquals(awsResponse.getResult(), "Content"); }
JsonUnmarshallerContext unmarshallerContext = new JsonUnmarshallerContextImpl( jsonParser, simpleTypeUnmarshallers, customTypeMarshallers, response); registerAdditionalMetadataExpressions(unmarshallerContext);