Paws L (A little party planned)

Well it looks like a wrap for PAWS XML as the last thing I am working on is getting the test suite to pass

Looking at S3 I have only 1 error with the 09_requestst.t test suite;


ok 829 - Call S3->SelectObjectContent from t/09_requests/s3-select-object-content.request
not ok 830 - Got content eq from request
# Failed test 'Got content eq from request'
# at t/09_requests.t line 123.
# got: '<SelectObjectContentRequest xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><InputSerialization><CompressionType>NONE</CompressionType></InputSerialization><OutputSerialization><CSV><FieldDelimiter>\,</FieldDelimiter><QuoteCharacter>\'</QuoteCharacter><QuoteEscapeCharacter>\"</QuoteEscapeCharacter><QuoteFields>ASNEEDED</QuoteFields><RecordDelimiter>\\n</RecordDelimiter></CSV></OutputSerialization><Expression>MyExpression</Expression><ExpressionType>SQL</ExpressionType></SelectObjectContentRequest>'
# expected: '<InputSerialization><CompressionType>NONE</CompressionType></InputSerialization><OutputSerialization><CSV><FieldDelimiter>\,</FieldDelimiter><QuoteCharacter>\'</QuoteCharacter><QuoteEscapeCharacter>\"</QuoteEscapeCharacter><QuoteFields>ASNEEDED</QuoteFields><RecordDelimiter>\\n</RecordDelimiter></CSV></OutputSerialization>'

I rechecked the API and my real world test and found the action 'SelectObjectContent
' it is a one off case in S3 that requires the root tag and the 'xmlns' to be present;

So a simple fix to the test got that.

The 10_response.t test had a few more problems as I had 10 fails in there I had a problem with the 'MetricsConfiguration' class the tags. The XML back from the server was fine


<Tag>
<Key>priority</Key>
<Value>high</Value>
</Tag>

but my output into the class was off


'And' => bless( {
'Prefix' => 'documents',
'Tags' => []
}, 'Paws::S3::MetricsAndOperator' )

So I checked that generated class MetricsAndOperator; and it looked ok;


 has Tags => (is => 'ro', isa => 'ArrayRef[Paws::S3::Tag]', request_name => 'Tag', list_request_name => 'Tag'  , traits => ['NameInRequest','ListNameInRequest']  );

I changed that 'ist_request_name' to 'Tags' and I got the correct results so that must mean my template is not in order.

I quick look in object.tt and this


--[%- IF (shape.members.${param_name}.locationName %], list_request_name => '[% shape.members.${param_name}.locationName %]'
++[%- IF (shape.members.${param_name}.locationName != member.member.locationName) %], list_request_name => '[% shape.members.${param_name}.locationName %]'

Fixed that problem. So I did a recompile to see if I broke anything else.

Oh well 314 tests fails on cloudfront on 10_response.t. So something when awry.

Look at one fail I see that it links back to the CloudFrontOriginAccessIdentityList and its items attribute


  has Items => (is => 'ro', isa => 'ArrayRef[Paws::CloudFront::CloudFrontOriginAccessIdentitySummary]', request_name => 'CloudFrontOriginAccessIdentitySummary', list_request_name => ''  , traits => ['NameInRequest','ListNameInRequest']  );

This time that 'list_request_name ' is present and empty and when I put 'Items' in there things work fine so the template once again;

Well ran the tests again and just playing 'whack a mole' as I make a change in one I kill the other and now I have 140 fails in the 09 suite and . Darn!

Well after playing about with the templates for a good few hours I dropped that line of inquiry and concentrated on what I could do in 'RestXMLResponse.pm' and withing a few mins I found a solution in the 'new_from_result_struct' sub.


--if ($meta->does("ListNameInRequest")){
++if ($meta->does("ListNameInRequest") and $meta->{list_request_name} eq 'Items'){
$result->{$meta->{list_request_name}}= $result->{$meta->
{list_request_name}}->[0]->{$meta->request_name};
}

I did do some hard-coding here but I double checked all the Boto and all those 'Items' and 'ListNameInRequest' line up correctly so I think I can get away with this.

I also took the opportunity to clean up the 'object.tt' template a little and this patch


--[%- IF (member.type == 'list' and member.member.locationName.defined) %][% traits.push('NameInRequest','ListNameInRequest') %], request_name => '[% member.member.locationName %]'
++[%- IF (shape.members.${param_name}.locationName) %], list_request_name => '[% shape.members.${param_name}.locationName %]'
[%- IF (shape.members.${param_name}.locationName != member.member.locationName) %], list_request_name => '[%- IF (!shape.members.${param_name}.locationName.defined) %][%param_name%][% ELSE %][% shape.members.${param_name}.locationName %][% END %]'
[%- ELSE %]
--, list_request_name => '[% param_name %]'
++, list_request_name => '[%member.member.locationName %]'
[% END %] 
[%- ELSE %] 


Fixed up a few other errors.

I recompiled the differing code bases and I now just fixed up 12 tests in the 09_requests.t suite, and 6 test in the 10_response.t suite and now I am getting 100% pass

I recompiled everything and I now have the full system testing with 100%.

So that is the end I guess. Now I just have to wait for this to get into PAWs. I don''t seem much action on that part and all the emails I sent out to Jose Luis Martinez have bounced back.

Hopefully we can see some action in the near future.

IMG_1838.JPG

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations