Added additional OData-Version response tests, improved logging, and revised the JSON Schema resource data to not require @odata.context (but still validate it) since it may not be an OData resource, and the specification doesn't require it to be present. Removed specific select lists from generic resoscript templates.

This commit is contained in:
Joshua Darnell 2020-03-31 13:03:20 -07:00
commit c32f83e682
6 changed files with 161 additions and 34 deletions

Binary file not shown.

View File

@ -18,9 +18,11 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-END3 - Request and Validate Server Metadata
When XML Metadata are requested from the service root in "ClientSettings_WebAPIURI"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the XML metadata returned by the server are valid
And Edm metadata are requested from the service root in "ClientSettings_WebAPIURI"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the Edm metadata returned by the server are valid
And the metadata contains a valid service document
And the metadata contains the "Parameter_EndpointResource" resource
@ -31,6 +33,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-END2 - Data System Endpoint test
When a GET request is made to the resolved Url in "REQ-WA103-END2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And the results match the expected DataSystem JSON schema
@ -39,6 +42,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QR1 - Search Parameters: Select KeyOrKeyNumeric Field
When a GET request is made to the resolved Url in "REQ-WA103-QR1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has singleton results in "Parameter_KeyOrKeyNumericField"
And the provided "Parameter_KeyOrKeyNumericValue" is returned in "Parameter_KeyOrKeyNumericField"
@ -47,6 +51,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QR3 - Query Support: $select
When a GET request is made to the resolved Url in "REQ-WA103-QR3"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -56,6 +61,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QR4 - Query Support: $top
When a GET request is made to the resolved Url in "REQ-WA103-QR4"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -66,12 +72,14 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QR5 - Query Support: $skip
When a GET request is made to the resolved Url in "REQ-WA103-QR5"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
And data are present for fields contained within the given select list
And a GET request is made to the resolved Url in "REQ-WA103-QR5" with $skip="Parameter_TopCount"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -81,27 +89,36 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO1.1 @core @2.4.4 @core-endorsement @OData-4.0
Scenario: REQ-WA103-QO1.1 - Query Support: $select case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.1"
Then the server responds with a status code of 400 if the server headers report OData version "4.0"
And the server has an OData-Version header value of "4.0" or "4.01"
Then the server responds with a status code of 400 if the server reports OData-Version "4.0"
And the server responds with a status code of 200 if the server reports OData-Version "4.01"
@REQ-WA103-QO1.2 @core @2.4.4 @core-endorsement @OData-4.0
Scenario: REQ-WA103-QO1.2 - Query Support: $filter case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.2"
Then the server responds with a status code of 400 if the server headers report OData version "4.0"
And the server has an OData-Version header value of "4.0" or "4.01"
Then the server responds with a status code of 400 if the server reports OData-Version "4.0"
And the server responds with a status code of 200 if the server reports OData-Version "4.01"
@REQ-WA103-QO1.3 @core @2.4.4 @core-endorsement @OData-4.0
Scenario: REQ-WA103-QO1.3 - Query Support: $orderby asc case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.3"
Then the server responds with a status code of 400 if the server headers report OData version "4.0"
And the server has an OData-Version header value of "4.0" or "4.01"
Then the server responds with a status code of 400 if the server reports OData-Version "4.0"
And the server responds with a status code of 200 if the server reports OData-Version "4.01"
@REQ-WA103-QO1.4 @core @2.4.4 @core-endorsement @OData-4.0
Scenario: REQ-WA103-QO1.4 - Query Support: $orderby desc case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.4"
Then the server responds with a status code of 400 if the server headers report OData version "4.0"
And the server has an OData-Version header value of "4.0" or "4.01"
Then the server responds with a status code of 400 if the server reports OData-Version "4.0"
And the server responds with a status code of 200 if the server reports OData-Version "4.01"
@REQ-WA103-QO2 @core @2.4.4 @filterability-endorsement
Scenario: REQ-WA103-QO2 - Query Support: $filter - Integer Comparison: eq
When a GET request is made to the resolved Url in "REQ-WA103-QO2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -112,6 +129,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO3 - Query Support: $filter - Integer Comparison: ne
When a GET request is made to the resolved Url in "REQ-WA103-QO3"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -122,6 +140,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO4 - Query Support: $filter - Integer Comparison: gt
When a GET request is made to the resolved Url in "REQ-WA103-QO4"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -132,6 +151,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO5 - Query Support: $filter - Integer Comparison: ge
When a GET request is made to the resolved Url in "REQ-WA103-QO5"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -142,6 +162,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO6 - Query Support: $filter - Integer Comparison: lt
When a GET request is made to the resolved Url in "REQ-WA103-QO6"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -152,6 +173,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO7 - Query Support: $filter - Integer Comparison: le
When a GET request is made to the resolved Url in "REQ-WA103-QO7"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -162,6 +184,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO9 - Query Support: $filter - Integer Comparison: and
When a GET request is made to the resolved Url in "REQ-WA103-QO9"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -172,6 +195,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO10 - Query Support: $filter - Integer Comparison: or
When a GET request is made to the resolved Url in "REQ-WA103-QO10"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -182,6 +206,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO11 - Query Support: $filter - Integer Comparison: not() (operator)
When a GET request is made to the resolved Url in "REQ-WA103-QO11"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -192,6 +217,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO25 - Query Support: $filter: Date portion of EdmDateTimeOffset field is greater than EdmDate value
When a GET request is made to the resolved Url in "REQ-WA103-QO25"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -202,6 +228,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO26 - Query Support: $filter: Time portion of EdmDateTimeOffset field is less than EdmTime value
When a GET request is made to the resolved Url in "REQ-WA103-QO26"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -212,6 +239,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO26.2 - Query Support: $filter: Date: EdmDateTimeOffset field is less than EdmDateTimeOffset value
When a GET request is made to the resolved Url in "REQ-WA103-QO26.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -222,6 +250,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO27 - Query Support: $filter: DateTimeOffset le now()
When a GET request is made to the resolved Url in "REQ-WA103-QO27"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -237,31 +266,37 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-END1 - Service Endpoint
When a GET request is made to the resolved Url in "REQ-WA103-END1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
@REQ-WA103-RC3 @core @2.5.2 @core-endorsement
Scenario: REQ-WA103-RC3 - 200 OK Request
When a GET request is made to the resolved Url in "REQ-WA103-RC3"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
@REQ-WA103-RC5 @core @2.4.2 @core-endorsement
Scenario: REQ-WA103-RC5 - 400 Bad Request
When a GET request is made to the resolved Url in "REQ-WA103-RC5"
Then the server responds with a status code of 400
And the server has an OData-Version header value of "4.0" or "4.01"
@REQ-WA103-RC06 @core @2.5.2 @core-endorsement
Scenario: REQ-WA103-RC06 - 403 Forbidden Request
When a GET request is made to the resolved Url in "REQ-WA103-RC06"
Then the server responds with a status code of 403
And the server has an OData-Version header value of "4.0" or "4.01"
@REQ-WA103-RC07 @core @2.5.2 @core-endorsement
Scenario: REQ-WA103-RC07 - 404 Not Found Request
When a GET request is made to the resolved Url in "REQ-WA103-RC07"
Then the server responds with a status code of 404
And the server has an OData-Version header value of "4.0" or "4.01"
@REQ-WA103-RC11 @core @2.5.2 @core-endorsement
Scenario: REQ-WA103-RC11 - 501 Not Implemented Request
When a GET request is made to the resolved Url in "REQ-WA103-RC11"
Then the server responds with a status code of 501
And the server has an OData-Version header value of "4.0" or "4.01"
#######################################
@ -272,6 +307,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QM7 - Support Single Value Lookups
When a GET request is made to the resolved Url in "REQ-WA103-QM7"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -282,6 +318,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QM8 - Support Multi Value Lookups
When a GET request is made to the resolved Url in "REQ-WA103-QM8"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -292,6 +329,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QM8.2 - Support Multi Value Lookups multiple values
When a GET request is made to the resolved Url in "REQ-WA103-QM8.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -303,6 +341,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO8 - Query Support: $filter - Comparison: has
When a GET request is made to the resolved Url in "REQ-WA103-QO8"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -313,6 +352,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO28.1 - Query Support: $orderby asc filtered
When a GET request is made to the resolved Url in "REQ-WA103-QO28.1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -323,6 +363,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO28.2 - Query Support: $orderby asc no filter
When a GET request is made to the resolved Url in "REQ-WA103-QO28.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -333,6 +374,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO28.3 - Query Support: $orderby desc filtered
When a GET request is made to the resolved Url in "REQ-WA103-QO28.3"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -343,6 +385,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO28.4 - Query Support: $orderby desc no filter
When a GET request is made to the resolved Url in "REQ-WA103-QO28.4"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -358,6 +401,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO18.1 - Query Support: $filter: Date: year
When a GET request is made to the resolved Url in "REQ-WA103-QO18.1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -368,6 +412,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO18.2 - Query Support: $filter: Date: year comparison with timestamp
When a GET request is made to the resolved Url in "REQ-WA103-QO18.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -378,6 +423,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO19.1 - Query Support: $filter: Date: month
When a GET request is made to the resolved Url in "REQ-WA103-QO19.1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -388,6 +434,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO19.2 - Query Support: $filter: Date: month comparison with timestamp
When a GET request is made to the resolved Url in "REQ-WA103-QO19.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -398,6 +445,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO20.1 - Query Support: $filter: Date: day
When a GET request is made to the resolved Url in "REQ-WA103-QO20.1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -408,6 +456,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO20.2 - Query Support: $filter: Date: day comparison with timestamp
When a GET request is made to the resolved Url in "REQ-WA103-QO20.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -418,6 +467,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO21 - Query Support: $filter: Date: hour comparison with timestamp
When a GET request is made to the resolved Url in "REQ-WA103-QO21"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -428,6 +478,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO22 - Query Support: $filter: Date: minute comparison with timestamp
When a GET request is made to the resolved Url in "REQ-WA103-QO22"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -438,6 +489,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO23 - Query Support: $filter: Date: second comparison with timestamp
When a GET request is made to the resolved Url in "REQ-WA103-QO23"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -448,6 +500,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO24 - Query Support: $filter: Date: fractional seconds comparison with timestamp
When a GET request is made to the resolved Url in "REQ-WA103-QO24"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -462,6 +515,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO13 - Query Support: $filter - String: contains
When a GET request is made to the resolved Url in "REQ-WA103-QO13"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -472,6 +526,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO14 - Query Support: $filter - String: ends with
When a GET request is made to the resolved Url in "REQ-WA103-QO14"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -482,6 +537,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO15 - Query Support: $filter - String: starts with
When a GET request is made to the resolved Url in "REQ-WA103-QO15"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -492,6 +548,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO16 - Query Support: $filter - String: tolower() support
When a GET request is made to the resolved Url in "REQ-WA103-QO16"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -502,6 +559,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO17 - Query Support: $filter - String: toupper() support
When a GET request is made to the resolved Url in "REQ-WA103-QO17"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -512,6 +570,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO29.1 - Query Support: $expand
When a GET request is made to the resolved Url in "REQ-WA103-QO29.1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -524,6 +583,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO29.2 - Query Support: $expand media photo count (TODO)
When a GET request is made to the resolved Url in "REQ-WA103-QO29.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -533,6 +593,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO29.3 - Query Support: $expand required field (TODO)
When a GET request is made to the resolved Url in "REQ-WA103-QO29.3"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -542,6 +603,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QM3 - Support Literals: any() Lambda Expression (TODO)
When a GET request is made to the resolved Url in "REQ-WA103-QM3"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -551,6 +613,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QM4 - Query Support Literals: all() Lambda Operator (TODO)
When a GET request is made to the resolved Url in "REQ-WA103-QM4"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -560,6 +623,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QM5.1 - Query Support: GeoSpatial Search Implementation (TODO)
When a GET request is made to the resolved Url in "REQ-WA103-QM5.1"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -569,6 +633,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QM5.2 - Query Support: GeoSpatial Search Implementation (TODO)
When a GET request is made to the resolved Url in "REQ-WA103-QM5.2"
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the response is valid JSON
And the response has results
And resource metadata for "Parameter_EndpointResource" contains the fields in the given select list
@ -578,6 +643,7 @@ Feature: Web API Server 1.0.2 Certification
Scenario: REQ-WA103-QO12 - Query Support: $filter - Grouping: filter (ge, le) and (gt, lt) and expect (gt, lt)
When a GET request is made to the resolved Url in "REQ-WA103-QO12" using the OData Client
Then the server responds with a status code of 200
And the server has an OData-Version header value of "4.0" or "4.01"
And the OData client response has client entity set data
And client entity set Integer data in "Parameter_IntegerField" "gt" "Parameter_IntegerValueLow"
And client entity set Integer data in "Parameter_IntegerField" "lt" "Parameter_IntegerValueHigh"

View File

@ -324,7 +324,7 @@ public class WebAPIServer_1_0_2 implements En {
/*
* GET request by requirementId (see generic.resoscript)
*/
When("^a GET request is made to the resolved Url in \"([^\"]*)\"$", this::executeGetRequest);
When("^a GET request is made to the resolved Url in \"([^\"]*)\"$", this::prepareAndExecuteGetRequest);
/*
* Assert response code
@ -336,7 +336,13 @@ public class WebAPIServer_1_0_2 implements En {
if (assertedResponseCode.intValue() != getTestContainer().getResponseCode().intValue()) {
if (getTestContainer().getODataClientErrorException() != null) {
LOG.error("OData Client Exception: " + getTestContainer().getODataClientErrorException().getODataError().getMessage());
if (getTestContainer().getODataClientErrorException().getODataError().getMessage() != null) {
LOG.error("Request failed with the following message: "
+ getTestContainer().getODataClientErrorException().getODataError().getMessage());
} else if (getTestContainer().getODataClientErrorException() != null) {
LOG.error("Request failed with the following message: "
+ getTestContainer().getODataClientErrorException().getMessage());
}
}
fail("ERROR: asserted response code does not match the one returned from the server!");
}
@ -377,7 +383,7 @@ public class WebAPIServer_1_0_2 implements En {
*
* TODO: make a general Header assertion function
*/
Then("^the server responds with a status code of (\\d+) if the server headers report OData version \"([^\"]*)\"$", (Integer assertedHttpResponseCode, String assertedODataVersion) -> {
Then("^the server responds with a status code of (\\d+) if the server reports OData-Version \"([^\"]*)\"$", (Integer assertedHttpResponseCode, String assertedODataVersion) -> {
try {
boolean versionsMatch = getTestContainer().getServerODataHeaderVersion().equals(assertedODataVersion),
responseCodesMatch = getTestContainer().getResponseCode().intValue() == assertedHttpResponseCode.intValue();
@ -387,6 +393,8 @@ public class WebAPIServer_1_0_2 implements En {
if (versionsMatch) {
LOG.info("Asserted Response Code: " + assertedHttpResponseCode + ", Response code: " + getTestContainer().getResponseCode());
assertTrue("ERROR: asserted response code does not match the one returned from the server!", responseCodesMatch);
} else {
LOG.info("Test skipped! Only applies when the asserted version matches the reported server version.");
}
} catch (Exception ex) {
//Don't fail tests like in other cases because get requests may generate exceptions that we want to
@ -428,8 +436,8 @@ public class WebAPIServer_1_0_2 implements En {
And("^the response has results$", () -> {
try {
int count = from(getTestContainer().getResponseData()).getList(JSON_VALUE_PATH, HashMap.class).size();
assertTrue("ERROR: no results were found in the '" + JSON_VALUE_PATH + "' path of the JSON response!", count > 0);
LOG.info("Results count is: " + count);
assertTrue("ERROR: no results returned from the server!", count > 0);
} catch (Exception ex) {
fail(ex.toString());
}
@ -782,7 +790,7 @@ public class WebAPIServer_1_0_2 implements En {
LOG.info("Searching metadata for fields in given select list: " + getTestContainer().getSelectList().toString());
getTestContainer().getSelectList().forEach(fieldName -> {
//need to skip the expand field when looking through the metadata
if (!fieldName.contentEquals(getTestContainer().getExpandField())) {
if (getTestContainer().getExpandField() == null || !fieldName.contentEquals(getTestContainer().getExpandField())) {
assertNotNull("ERROR: Field name '" + fieldName + "' is not present in server metadata!", getTestContainer().getCsdlForFieldName(fieldName));
LOG.info("Found: '" + fieldName.trim() + "'");
}
@ -1015,12 +1023,32 @@ public class WebAPIServer_1_0_2 implements En {
});
}
});
/*
* Ensures that the server reports one of the currently supported version headers, being 4.0 or 4.01 at the time of writing
* TODO: add additional items for additional subsequent OData versions, as released
*/
And("^the server has an OData-Version header value of \"([^\"]*)\" or \"([^\"]*)\"$", (String val1, String val2) -> {
assertNotNull("ERROR: must enter a first value", val1);
assertNotNull("ERROR: must enter a second value", val2);
assertNotNull("ERROR: must specify an 'OData-Version' in the response header!"
+ "\nSee: http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html#_Toc453752225" ,
getTestContainer().getServerODataHeaderVersion());
LOG.info("Reported OData-Version header value: '" + getTestContainer().getServerODataHeaderVersion() + "'");
assertTrue("ERROR: the 'OData-Version' response header must either be '" + val1 + "' or '" + val2 + "' (without quotes).",
getTestContainer().getServerODataHeaderVersion().contentEquals(val1)
|| getTestContainer().getServerODataHeaderVersion().contentEquals(val2) );
});
}
/*
* Execute Get Request Wrapper
*/
void executeGetRequest(String requestId) {
void prepareAndExecuteGetRequest(String requestId) {
try {
//reset local state each time a get request is run
getTestContainer().resetState();
@ -1029,9 +1057,12 @@ public class WebAPIServer_1_0_2 implements En {
getTestContainer().setRequest(getTestContainer().getSettings().getRequest(requestId));
LOG.info("Request ID: " + requestId);
//prepare request URI
getTestContainer().setRequestUri(Commander.prepareURI(Settings.resolveParameters(
getTestContainer().getSettings().getRequest(requestId), getTestContainer().getSettings()).getUrl()));
LOG.info("Request URI: " + getTestContainer().getRequestUri().toString());
//execute request
getTestContainer().executePreparedGetRequest();
} catch (Exception ex) {
LOG.debug("Exception was thrown in " + this.getClass() + ": " + ex.toString());

View File

@ -5,6 +5,7 @@ import org.apache.http.Header;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@ -27,9 +28,7 @@ import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.Year;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import static io.restassured.path.json.JsonPath.from;
@ -319,7 +318,13 @@ public final class TestUtils {
return convertInputStreamToString(oDataRawResponse.getRawResponse());
}
public static String getHeaderData(String key, Header[] headers) {
/**
* Helper method to find headers with a given key in an an array of headers
* @param key the header to get
* @param headers an array containing Header objects
* @return the value of the header with key, or null
*/
public static String getHeaderData(String key, Collection<Header> headers) {
String data = null;
for (Header header : headers) {
@ -330,6 +335,24 @@ public final class TestUtils {
return data;
}
/**
* Helper method to unpack headers from a raw OData response
* @param key the header to get
* @param oDataResponse the OData raw response from the request
* @return the value of the header with key, or null
*/
public static String getHeaderData(String key, ODataResponse oDataResponse) {
if (key == null || oDataResponse.getHeader(key) == null) return null;
ArrayList<String> result = new ArrayList<>(oDataResponse.getHeader(key));
if (result.size() > 0) {
return result.get(0);
} else {
return null;
}
}
/**
* Parses the given edmDateTimeOffsetString into a Java Instant (the type expected by the Olingo type converter).
*

View File

@ -92,6 +92,27 @@ public final class WebApiTestContainer implements TestContainer {
private AtomicReference<ODataRetrieveResponse<ClientEntitySet>> clientEntitySetResponse = new AtomicReference<>();
private AtomicReference<ClientEntitySet> clientEntitySet = new AtomicReference<>();
/**
* Resets the state of the test container
*/
public void resetState() {
clientEntitySetRequest.set(null);
clientEntitySetResponse.set(null);
clientEntitySet.set(null);
oDataRawResponse.set(null);
request.set(null);
requestUri.set(null);
responseCode.set(null);
responseData.set(null);
initialResponseData.set(null);
rawRequest.set(null);
oDataClientErrorException.set(null);
oDataServerErrorException.set(null);
serverODataHeaderVersion.set(null);
selectList.set(null);
testAppliesToServerODataHeaderVersion.set(false);
}
public void initialize() {
setServiceRoot(getSettings().getClientSettings().get(ClientSettings.SERVICE_ROOT));
@ -146,22 +167,6 @@ public final class WebApiTestContainer implements TestContainer {
return dataSystemEndpoint.startsWith(serviceRoot);
}
/**
* Resets the state of the test container
*/
public void resetState() {
oDataRawResponse.set(null);
request.set(null);
responseCode.set(null);
responseData.set(null);
initialResponseData.set(null);
rawRequest.set(null);
oDataClientErrorException.set(null);
oDataServerErrorException.set(null);
serverODataHeaderVersion.set(null);
testAppliesToServerODataHeaderVersion.set(false);
}
/**
* Executes HTTP GET request and sets the expected local variables in the WebApiTestContainer
* Handles exceptions and sets response codes as well.
@ -172,14 +177,14 @@ public final class WebApiTestContainer implements TestContainer {
getRawRequest().setFormat(ContentType.JSON.toContentTypeString());
setODataRawResponse(getRawRequest().execute());
setResponseData(TestUtils.convertInputStreamToString(getODataRawResponse().getRawResponse()));
setServerODataHeaderVersion(getODataRawResponse().getHeader(HEADER_ODATA_VERSION).toString());
setServerODataHeaderVersion(TestUtils.getHeaderData(HEADER_ODATA_VERSION, getODataRawResponse()));
setResponseCode(getODataRawResponse().getStatusCode());
LOG.info("Request succeeded..." + getResponseData().getBytes().length + " bytes received.");
} catch (ODataClientErrorException cex) {
LOG.debug("ODataClientErrorException caught. Check tests for asserted conditions...");
LOG.debug(cex);
setODataClientErrorException(cex);
setServerODataHeaderVersion(TestUtils.getHeaderData(HEADER_ODATA_VERSION, cex.getHeaderInfo()));
setServerODataHeaderVersion(TestUtils.getHeaderData(HEADER_ODATA_VERSION, Arrays.asList(cex.getHeaderInfo())));
setResponseCode(cex.getStatusLine().getStatusCode());
} catch (ODataServerErrorException ode) {
LOG.debug("ODataServerErrorException thrown in executeGetRequest. Check tests for asserted conditions...");
@ -256,6 +261,7 @@ public final class WebApiTestContainer implements TestContainer {
if (edm.get() == null) {
ODataRetrieveResponse<Edm> response = getCommander().prepareEdmMetadataRequest().execute();
responseCode.set(response.getStatusCode());
setServerODataHeaderVersion(TestUtils.getHeaderData(HEADER_ODATA_VERSION, response));
edm.set(response.getBody());
}
return edm.get();
@ -271,6 +277,7 @@ public final class WebApiTestContainer implements TestContainer {
if (xmlMetadata.get() == null) {
ODataRetrieveResponse<XMLMetadata> response = getCommander().prepareXMLMetadataRequest().execute();
responseCode.set(response.getStatusCode());
setServerODataHeaderVersion(TestUtils.getHeaderData(HEADER_ODATA_VERSION, response));
xmlMetadata.set(response.getBody());
}
return xmlMetadata.get();
@ -361,7 +368,7 @@ public final class WebApiTestContainer implements TestContainer {
}
public String getServerODataHeaderVersion() {
return serverODataHeaderVersion.get();
return this.serverODataHeaderVersion.get();
}
public void setServerODataHeaderVersion(String serverODataHeaderVersion) {

View File

@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "The Root Schema of the DataSystem resource",
"description": "The root schema comprises the entire JSON document.",
"description": "The root schema comprises the entire JSON document. See: https://members.reso.org/pages/viewpage.action?pageId=17629564#Appendix4-DataSystemXMLSchema-sample4Figure4-ODataJSONencapsulatedinstanceoftheschemaforreference.",
"required": [
"value"
],