Skip to content

Commit 634113e

Browse files
authored
Add tests for the case where a list or a map contains date shapes wit… (#3774)
* Add tests for the case where a list or a map contains date shapes with timestampFormat * Fix tests
1 parent a54b4ce commit 634113e

File tree

4 files changed

+69
-5
lines changed

4 files changed

+69
-5
lines changed

test/protocol-tests-core/src/main/resources/software/amazon/awssdk/protocol/suites/cases/query-output.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,5 +349,46 @@
349349
"stringMember": ""
350350
}
351351
}
352+
},
353+
{
354+
"description": "ListOfTimeStamp with known values unmarshalled correctly",
355+
"given": {
356+
"response": {
357+
"status_code": 200,
358+
"body": "<AllTypesResponse><AllTypesResult><ListOfTimeStamp><item>1398796238.123</item><item>2591234567.123</item></ListOfTimeStamp></AllTypesResult></AllTypesResponse>"
359+
}
360+
},
361+
"when": {
362+
"action": "unmarshall",
363+
364+
"operation": "AllTypes"
365+
},
366+
"then": {
367+
"deserializedAs": {
368+
"ListOfTimeStamp": [1398796238123,2591234567123]
369+
}
370+
}
371+
},
372+
{
373+
"description": "MapOfTimeStamp with known values unmarshalled correctly",
374+
"given": {
375+
"response": {
376+
"status_code": 200,
377+
"body": "<AllTypesResponse><AllTypesResult><MapOfTimeStamp><entry><key>test1</key><value>1398796238.123</value></entry><entry><key>test2</key><value>2591234567.123</value></entry></MapOfTimeStamp></AllTypesResult></AllTypesResponse>"
378+
}
379+
},
380+
"when": {
381+
"action": "unmarshall",
382+
383+
"operation": "AllTypes"
384+
},
385+
"then": {
386+
"deserializedAs": {
387+
"MapOfTimeStamp": {
388+
"test1": "1398796238123",
389+
"test2": "2591234567123"
390+
}
391+
}
392+
}
352393
}
353394
]

test/protocol-tests/src/main/resources/codegen-resources/awsjson/service-2.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@
169169
"type":"timestamp",
170170
"timestampFormat":"iso8601"
171171
},
172+
"UnixTimestamp":{
173+
"type":"timestamp",
174+
"timestampFormat":"unixTimestamp"
175+
},
172176
"ListOfAllTypesStructs":{
173177
"type":"list",
174178
"member":{"shape":"AllTypesStructure"}
@@ -300,12 +304,12 @@
300304
"Timestamp":{"type":"timestamp"},
301305
"ListOfTimeStamp":{
302306
"type":"list",
303-
"member":{"shape":"Timestamp"}
307+
"member":{"shape":"UnixTimestamp"}
304308
},
305309
"MapOfTimeStamp":{
306310
"type":"map",
307311
"key":{"shape":"String"},
308-
"value":{"shape":"Timestamp"}
312+
"value":{"shape":"UnixTimestamp"}
309313
},
310314
"MyDocument": {
311315
"type": "structure",

test/protocol-tests/src/main/resources/codegen-resources/query/service-2.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@
8787
"structWithNestedTimestampMember":{"shape":"StructWithTimestamp"},
8888
"blobArg":{"shape":"BlobType"},
8989
"blobMap":{"shape":"BlobMapType"},
90-
"listOfBlobs":{"shape":"ListOfBlobsType"}
90+
"listOfBlobs":{"shape":"ListOfBlobsType"},
91+
"ListOfTimeStamp": {"shape": "ListOfTimeStamp"},
92+
"MapOfTimeStamp": {"shape": "MapOfTimeStamp"}
9193
}
9294
},
9395
"BlobMapType":{
@@ -213,6 +215,19 @@
213215
"NestedTimestamp":{"shape":"Timestamp"}
214216
}
215217
},
218+
"ListOfTimeStamp":{
219+
"type":"list",
220+
"member":{"shape":"UnixTimestamp","locationName":"item"}
221+
},
222+
"MapOfTimeStamp":{
223+
"type":"map",
224+
"key":{"shape":"String"},
225+
"value":{"shape":"UnixTimestamp"}
226+
},
227+
"UnixTimestamp":{
228+
"type":"timestamp",
229+
"timestampFormat":"unixTimestamp"
230+
},
216231
"ImplicitPayloadException":{
217232
"type":"structure",
218233
"members":{

test/protocol-tests/src/main/resources/codegen-resources/restjson/service-2.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@
393393
"type":"timestamp",
394394
"timestampFormat":"iso8601"
395395
},
396+
"UnixTimestamp":{
397+
"type":"timestamp",
398+
"timestampFormat":"unixTimestamp"
399+
},
396400
"JsonValuesStructure":{
397401
"type":"structure",
398402
"members":{
@@ -771,12 +775,12 @@
771775
"Timestamp":{"type":"timestamp"},
772776
"ListOfTimeStamp":{
773777
"type":"list",
774-
"member":{"shape":"Timestamp"}
778+
"member":{"shape":"UnixTimestamp"}
775779
},
776780
"MapOfTimeStamp":{
777781
"type":"map",
778782
"key":{"shape":"String"},
779-
"value":{"shape":"Timestamp"}
783+
"value":{"shape":"UnixTimestamp"}
780784
},
781785
"EventStreamOperationRequest": {
782786
"type": "structure",

0 commit comments

Comments
 (0)