added support for single-valued enumeration checking

This commit is contained in:
Joshua Darnell 2020-02-27 11:00:18 -08:00
parent bcd91acb3f
commit 3f82b07d7f
5 changed files with 207 additions and 125 deletions

View File

@ -35,10 +35,10 @@ dependencies {
compile 'io.rest-assured:json-path:4.2.0'
compile 'io.rest-assured:json-schema-validator:4.2.0'
compile 'io.cucumber:cucumber-java8:5.2.0'
compile 'io.cucumber:cucumber-junit:5.2.0'
compile 'io.cucumber:cucumber-java8:5.4.0'
compile 'io.cucumber:cucumber-junit:5.4.0'
compile 'net.masterthought:cucumber-reporting:5.0.2'
compile 'net.masterthought:cucumber-reporting:5.1.1'
}
configurations {
@ -79,7 +79,7 @@ task testWebApiServer_1_0_2() {
'--plugin',
'pretty',
'--plugin',
'html:build/test-report',
'html:build/web-api-server-1.0.2-report',
'--glue',
'org.reso.certification.stepdefs#WebAPIServer_1_0_2',
'src/main/java/org/reso/certification/features'

Binary file not shown.

View File

@ -106,14 +106,18 @@
<!-- Enumerated Field for "has" testing -->
<Parameter Name="FilterHasField" Value="PropertyType" />
<Parameter Name="FilterHasValue" Value="PropertyEnums.PropertyType'Rental'" />
<Parameter Name="FilterHasValue" Value="Residential" />
<Parameter Name="FilterHasLookupValue" Value="PropertyEnums.PropertyType'*Parameter_FilterHasValue*'" />
<!-- Enumerated Field for SingleValue/Multi-value testing -->
<Parameter Name="SingleValueLookupField" Value="PropertyType" />
<Parameter Name="SingleValueLookupValue" Value="PropertyEnums.PropertyType'Rental'" />
<Parameter Name="SingleLookupValue" Value="Residential"/>
<Parameter Name="SingleValueLookupValue" Value="PropertyEnums.PropertyType'*Parameter_SingleLookupValue*'" />
<Parameter Name="MultipleValueLookupField" Value="Appliances" />
<Parameter Name="MultipleValueLookupValue1" Value="PropertyEnums.Appliances'Refrigerator'"/>
<Parameter Name="MultipleValueLookupValue2" Value="PropertyEnums.Appliances'Stacked'" />
<Parameter Name="MultipleLookupValue1" Value="Refrigerator" />
<Parameter Name="MultipleValueLookupValue1" Value="PropertyEnums.Appliances'*Parameter_MultipleLookupValue1*'"/>
<Parameter Name="MultipleLookupValue2" Value="Stacked" />
<Parameter Name="MultipleValueLookupValue2" Value="PropertyEnums.Appliances'*Parameter_MultipleLookupValue2*'" />
<!-- For Expand Testing -->
<Parameter Name="ExpandField" Value="ListAgent" />
@ -177,7 +181,7 @@
<!-- NOTE: for this test, we always assume that /$metadata is relative to the Web API Service Root, referred to as WebAPIURI here -->
<Request
TestDescription="Metadata Endpoint"
RequirementId="REQ-WA103-END3.metadata"
RequirementId="REQ-WA103-END3"
MetallicLevel="Core"
Capability="Core"
WebAPIReference=""
@ -187,7 +191,7 @@
<Request
TestDescription="Data System"
RequirementId="REQ-WA103-END2.datasystem"
RequirementId="REQ-WA103-END2"
MetallicLevel="Core"
Capability="Core Support"
WebAPIReference=""
@ -197,187 +201,187 @@
<Request
TestDescription="Search Parameters: Select UniqueID"
RequirementId="REQ-WA103-QR1.select.uniqueId"
RequirementId="REQ-WA103-QR1"
MetallicLevel="Core"
Capability="Query functions"
WebAPIReference="2.4.1"
OutputFile="REQ-WA103-QR1.select.uniqueId.json"
OutputFile="REQ-WA103-QR1.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*(*Parameter_UniqueIDValue*)?$select=*Parameter_UniqueID*"
/>
<Request
TestDescription="Query Support: $select"
RequirementId="REQ-WA103-QR3.select"
RequirementId="REQ-WA103-QR3"
MetallicLevel="Core"
Capability="Query functions"
WebAPIReference="2.4.2"
OutputFile="REQ-WA103-QR3.select.json"
OutputFile="REQ-WA103-QR3.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $top"
RequirementId="REQ-WA103-QR4.top"
RequirementId="REQ-WA103-QR4"
MetallicLevel="Core"
Capability="Client paging ($top, $skip)"
WebAPIReference="2.4.2"
OutputFile="REQ-WA103-QR4.top.json"
OutputFile="REQ-WA103-QR4.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $skip"
RequirementId="REQ-WA103-QR5.skip"
RequirementId="REQ-WA103-QR5"
MetallicLevel="Core"
Capability="Client pageability ($top, $skip)"
WebAPIReference="2.4.2"
OutputFile="REQ-WA103-QR5.skip.json"
OutputFile="REQ-WA103-QR5.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $select case-sensitivity. Expect 400 response on OData 4.0"
RequirementId="REQ-WA103-QO1.select.case"
RequirementId="REQ-WA103-QO1.1"
MetallicLevel="Core"
Capability="Core"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO1.select.case.json"
OutputFile="REQ-WA103-QO1.1.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$SeLeCt=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* eq *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter case-sensitivity. Expect 400 response on OData 4.0"
RequirementId="REQ-WA103-QO1.filter.case"
RequirementId="REQ-WA103-QO1.2"
MetallicLevel="Core"
Capability="Core"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO1.filter.case.json"
OutputFile="REQ-WA103-QO1.2.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$FiLtEr=*Parameter_FilterIntegerField* eq *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $orderby asc case-sensitivity. Expect 400 response on OData 4.0"
RequirementId="REQ-WA103-QO1.orderby.asc.case"
RequirementId="REQ-WA103-QO1.3"
MetallicLevel="Core"
Capability="Core"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO1.orderby.asc.case.json"
OutputFile="REQ-WA103-QO1.3.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_SortCount*&amp;$select=*Parameter_FilterIntegerField*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*&amp;$OrDeRbY=*Parameter_FilterIntegerField* asc"
/>
<Request
TestDescription="Query Support: $orderby desc case-sensitivity. Expect 400 response on OData 4.0"
RequirementId="REQ-WA103-QO1.orderby.desc.case"
RequirementId="REQ-WA103-QO1.4"
MetallicLevel="Core"
Capability="Core"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO1.orderby.desc.case.json"
OutputFile="REQ-WA103-QO1.4.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_SortCount*&amp;$select=*Parameter_FilterIntegerField*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*&amp;$oRdErBy=*Parameter_FilterIntegerField* desc"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: eq (equal)"
RequirementId="REQ-WA103-QO2.filter.int.compare.eq"
RequirementId="REQ-WA103-QO2"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO2.filter.int.compare.eq.json"
OutputFile="REQ-WA103-QO2"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* eq *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: ne (not equal)"
RequirementId="REQ-WA103-QO3.filter.int.compare.ne"
RequirementId="REQ-WA103-QO3"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO3.filter.int.compare.ne.json"
OutputFile="REQ-WA103-QO3"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* ne *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: gt (greater than)"
RequirementId="REQ-WA103-QO4.filter.int.compare.gt"
RequirementId="REQ-WA103-QO4"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO4.filter.int.compare.gt.json"
OutputFile="REQ-WA103-QO4"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: ge (greater or equal)"
RequirementId="REQ-WA103-QO5.filter.int.compare.ge"
RequirementId="REQ-WA103-QO5"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO5.filter.int.compare.ge.json"
OutputFile="REQ-WA103-QO5.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* ge *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: lt (less than)"
RequirementId="REQ-WA103-QO6.filter.int.compare.lt"
RequirementId="REQ-WA103-QO6"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO6.filter.int.compare.lt.json"
OutputFile="REQ-WA103-QO6.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* lt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: le (less or equal)"
RequirementId="REQ-WA103-QO7.filter.int.compare.le"
RequirementId="REQ-WA103-QO7"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO7.filter.int.compare.le.json"
OutputFile="REQ-WA103-QO7.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* le *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: and"
RequirementId="REQ-WA103-QO9.filter.int.compare.and"
RequirementId="REQ-WA103-QO9"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO9.filter.int.compare.and.json"
OutputFile="REQ-WA103-QO9.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueLow* and *Parameter_FilterIntegerField* lt *Parameter_FilterIntegerValueHigh**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer Comparison: or"
RequirementId="REQ-WA103-QO10.filter.int.compare.or"
RequirementId="REQ-WA103-QO10"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO10.filter.int.compare.or.json"
OutputFile="REQ-WA103-QO10.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterIntegerField* gt *Parameter_FilterIntegerValueHigh* or *Parameter_FilterIntegerField* lt *Parameter_FilterIntegerValueLow**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter - Integer: not operator"
RequirementId="REQ-WA103-QO11.filter.int.compare.not.operator"
RequirementId="REQ-WA103-QO11"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO11.filter.int.compare.not.operator.json"
OutputFile="REQ-WA103-QO11.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=not(*Parameter_FilterNotField* le *Parameter_FilterNotValue*)*Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter: Date portion of EdmDateTimeOffset field is less than EdmDate value."
RequirementId="REQ-WA103-QO25.filter.date.gt.dateValue"
RequirementId="REQ-WA103-QO25"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO25.filter.date.gt.dateValue.json"
OutputFile="REQ-WA103-QO25.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=date(*Parameter_TimestampField*) gt *Parameter_DateValue**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter: Time portion of EdmDateTimeOffset field is less than EdmTime value."
RequirementId="REQ-WA103-QO26.filter.time.lt.timeValue"
RequirementId="REQ-WA103-QO26"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
@ -387,34 +391,24 @@
<Request
TestDescription="Query Support: $filter: Date: EdmDateTimeOffset field is less than EdmDateTimeOffset value."
RequirementId="REQ-WA103-QO26.filter.dateTimeOffset.ls.dateTimeOffsetValue"
RequirementId="REQ-WA103-QO26"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO26.filter.dateTimeOffset.ls.dateTimeOffsetValue.json"
OutputFile="REQ-WA103-QO26.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_TimestampField* lt *Parameter_DateTimeValue**Parameter_RequiredParameters*"
/>
<Request
TestDescription="Query Support: $filter: Date: Now"
TestDescription="Query Support: $filter: DateTimeOffset le now()"
RequirementId="REQ-WA103-QO27"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO27_now.json"
OutputFile="REQ-WA103-QO27.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_TimestampField* le now()*Parameter_RequiredParameters*"
/>
<Request
TestDescription="Support Annotations"
RequirementId="REQ-WA103-QM6"
MetallicLevel="Bronze"
Capability="Core"
WebAPIReference="2.4.8"
OutputFile="REQ-WA103-QM6.json"
Url=""
/>
<Request
TestDescription="Support Single Value Lookups"
RequirementId="REQ-WA103-QM7"
@ -452,7 +446,7 @@
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO8.json"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterHasField* has *Parameter_FilterHasValue**Parameter_RequiredParameters*"
Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_SelectList*&amp;$filter=*Parameter_FilterHasField* has *Parameter_FilterHasLookupValue**Parameter_RequiredParameters*"
/>
<Request

View File

@ -9,14 +9,14 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-END3 @core @x.y.z @core-endorsement
Scenario: Request and Validate Server Metadata
When a GET request is made to the resolved Url in "REQ-WA103-END3.metadata"
When a GET request is made to the resolved Url in "REQ-WA103-END3"
Then the server responds with a status code of 200
And the response is valid XML
And the metadata returned is valid
@REQ-WA103-END2 @core @x.y.z @core-endorsement
Scenario: Data System Endpoint test
When a GET request is made to the resolved Url in "REQ-WA103-END2.datasystem"
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 response is valid JSON
And the response has results
@ -24,7 +24,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QR1 @core @2.4.1 @query-functions-endorsement
Scenario: Search Parameters: Select UniqueID
When a GET request is made to the resolved Url in "REQ-WA103-QR1.select.uniqueId"
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 response is valid JSON
And the response has singleton results in the "Parameter_UniqueID" field
@ -32,7 +32,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QR3 @core @2.4.2 @query-functions-endorsement
Scenario: Query Support: $select
When a GET request is made to the resolved Url in "REQ-WA103-QR3.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 response is valid JSON
And the response has results
@ -40,7 +40,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QR4 @core @2.4.2 @client-paging-endorsement
Scenario: Query Support: $top
When a GET request is made to the resolved Url in "REQ-WA103-QR4.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 response is valid JSON
And the response has results
@ -48,39 +48,39 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QR5 @core @2.4.2 @query-support-endorsement
Scenario: Query Support: $skip
When a GET request is made to the resolved Url in "REQ-WA103-QR5.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 response is valid JSON
And the response has results
And a GET request is made to the resolved Url in "REQ-WA103-QR5.skip" with $skip="Parameter_TopCount"
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 response is valid JSON
And the response has results
And data in the "Parameter_UniqueId" fields are different in the second request than in the first
@REQ-WA103-QO1 @REQ-WA103-QO1.select @core @2.4.4 @core-endorsement @OData-4.0
@REQ-WA103-QO1.1 @REQ-WA103-QO1.select @core @2.4.4 @core-endorsement @OData-4.0
Scenario: Query Support: $select case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.select.case"
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"
@REQ-WA103-QO1 @REQ-WA103-QO1.filter @core @2.4.4 @core-endorsement @OData-4.0
@REQ-WA103-QO1.2 @core @2.4.4 @core-endorsement @OData-4.0
Scenario: Query Support: $filter case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.filter.case"
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"
@REQ-WA103-QO1 @REQ-WA103-QO1.orderby.asc.case @core @2.4.4 @core-endorsement @OData-4.0
@REQ-WA103-QO1.3 @core @2.4.4 @core-endorsement @OData-4.0
Scenario: Query Support: $orderby asc case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.orderby.asc.case"
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"
@REQ-WA103-QO1 @REQ-WA103-QO1.orderby.desc.case @core @2.4.4 @core-endorsement @OData-4.0
@REQ-WA103-QO1.4 @core @2.4.4 @core-endorsement @OData-4.0
Scenario: Query Support: $orderby desc case-sensitivity for OData 4.0
When a GET request is made to the resolved Url in "REQ-WA103-QO1.orderby.desc.case"
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"
@REQ-WA103-QO2 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: eq
When a GET request is made to the resolved Url in "REQ-WA103-QO2.filter.int.compare.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 response is valid JSON
And the response has results
@ -88,7 +88,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO3 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: ne
When a GET request is made to the resolved Url in "REQ-WA103-QO3.filter.int.compare.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 response is valid JSON
And the response has results
@ -96,7 +96,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO4 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: gt
When a GET request is made to the resolved Url in "REQ-WA103-QO4.filter.int.compare.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 response is valid JSON
And the response has results
@ -104,7 +104,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO5 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: ge
When a GET request is made to the resolved Url in "REQ-WA103-QO5.filter.int.compare.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 response is valid JSON
And the response has results
@ -112,7 +112,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO6 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: lt
When a GET request is made to the resolved Url in "REQ-WA103-QO6.filter.int.compare.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 response is valid JSON
And the response has results
@ -120,7 +120,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO7 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: le
When a GET request is made to the resolved Url in "REQ-WA103-QO7.filter.int.compare.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 response is valid JSON
And the response has results
@ -128,7 +128,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO9 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: and
When a GET request is made to the resolved Url in "REQ-WA103-QO9.filter.int.compare.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 response is valid JSON
And the response has results
@ -136,7 +136,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO10 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: or
When a GET request is made to the resolved Url in "REQ-WA103-QO10.filter.int.compare.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 response is valid JSON
And the response has results
@ -144,7 +144,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO11 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter - Integer Comparison: not() (operator)
When a GET request is made to the resolved Url in "REQ-WA103-QO11.filter.int.compare.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 response is valid JSON
And the response has results
@ -152,7 +152,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO25 @core @2.4.4 @filterability-endorsement
Scenario: 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.filter.date.gt.dateValue"
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 response is valid JSON
And the response has results
@ -160,7 +160,7 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO26 @core @2.4.4 @filterability-endorsement
Scenario: 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.filter.time.lt.timeValue"
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 response is valid JSON
And the response has results
@ -168,8 +168,24 @@ Feature: Web API Server 1.0.2 Certification
@REQ-WA103-QO26.2 @core @2.4.4 @filterability-endorsement
Scenario: 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.filter.dateTimeOffset.ls.dateTimeOffsetValue"
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 response is valid JSON
And the response has results
And DateTimeOffset data in "Parameter_TimestampField" "lt" "Parameter_DateTimeValue"
@REQ-WA103-QO27 @core @2.4.4 @filterability-endorsement
Scenario: Query Support: $filter: Date: EdmDateTimeOffset field is less than EdmDateTimeOffset value
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 response is valid JSON
And the response has results
And DateTimeOffset data in "Parameter_TimestampField" "le" now()
@REQ-WA103-QM7 @bronze @2.4.9 @queryability-endorsement
Scenario: 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 response is valid JSON
And the response has results
And Data in "Parameter_SingleValueLookupField" has "Parameter_SingleLookupValue"

View File

@ -26,6 +26,7 @@ import java.io.*;
import java.net.URI;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@ -103,7 +104,7 @@ public class WebAPIServer_1_0_2 implements En {
try {
rawRequest.set(commander.get().getClient().getRetrieveRequestFactory().getRawRequest(requestUri));
oDataRawResponse.set(rawRequest.get().execute());
responseData.set(convertInputStreamToString(oDataRawResponse.get().getRawResponse()));
responseData.set(Utils.convertInputStreamToString(oDataRawResponse.get().getRawResponse()));
serverODataHeaderVersion.set(oDataRawResponse.get().getHeader(HEADER_ODATA_VERSION).toString());
LOG.info("Request succeeded..." + responseData.get().getBytes().length + " bytes received.");
} catch (ODataClientErrorException cex) {
@ -459,7 +460,7 @@ public class WebAPIServer_1_0_2 implements En {
AtomicReference<Date> assertedValue = new AtomicReference<>();
assertedValue.set(Utils.parseDateFromEdmDateString(Utils.resolveValue(parameterAssertedValue, settings)));
LOG.info("Asserted date is: " + assertedValue.get().toString());
LOG.info("Asserted value is: " + assertedValue.get().toString());
from(responseData.get()).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> {
try {
@ -480,7 +481,7 @@ public class WebAPIServer_1_0_2 implements En {
AtomicReference<Time> assertedValue = new AtomicReference<>();
assertedValue.set(Utils.parseTimeOfDayFromEdmTimeOfDayString(Utils.resolveValue(parameterAssertedValue, settings)));
LOG.info("Asserted time is: " + assertedValue.get().toString());
LOG.info("Asserted value is: " + assertedValue.get().toString());
from(responseData.get()).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> {
try {
@ -496,20 +497,34 @@ public class WebAPIServer_1_0_2 implements En {
* Timestamp comparison glue
*/
And("^DateTimeOffset data in \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$", (String parameterFieldName, String op, String parameterAssertedValue) -> {
String fieldName = Utils.resolveValue(parameterFieldName, settings);
AtomicReference<Timestamp> fieldValue = new AtomicReference<>();
AtomicReference<Timestamp> assertedValue = new AtomicReference<>();
Utils.assertDateTimeOffset(parameterFieldName, op, parameterAssertedValue, responseData.get());
});
assertedValue.set(Utils.parseTimestampFromEdmDateTimeOffsetString(Utils.resolveValue(parameterAssertedValue, settings)));
LOG.info("Asserted time is: " + assertedValue.get().toString());
/*
* Timestamp comparison to now()
*/
And("^DateTimeOffset data in \"([^\"]*)\" \"([^\"]*)\" now\\(\\)$", (String parameterFieldName, String op) -> {
Utils.assertDateTimeOffset(parameterFieldName, op, Timestamp.from(Instant.now()), responseData.get());
});
/*
* Lookups
*/
And("^Data in \"([^\"]*)\" has \"([^\"]*)\"$", (String parameterFieldName, String parameterAssertedValue) -> {
String fieldName = Utils.resolveValue(parameterFieldName, settings);
AtomicReference<String> fieldValue = new AtomicReference<>();
AtomicReference<String> assertedValue = new AtomicReference<>();
AtomicBoolean result = new AtomicBoolean(false);
assertedValue.set(Utils.resolveValue(parameterAssertedValue, settings));
LOG.info("Asserted value is: " + assertedValue.get());
from(responseData.get()).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> {
try {
fieldValue.set(Utils.parseTimestampFromEdmDateTimeOffsetString(item.get(fieldName).toString()));
assertTrue(Utils.compare(fieldValue.get(), op, assertedValue.get()));
} catch (Exception ex){
LOG.error(ex.toString());
}
fieldValue.set(item.get(fieldName).toString());
result.set(fieldValue.get().contentEquals(assertedValue.get()));
LOG.info("Assert True: " + fieldValue.get() + " equals " + assertedValue.get() + " ==> " + result.get());
assertTrue(result.get());
});
});
}
@ -531,11 +546,47 @@ public class WebAPIServer_1_0_2 implements En {
private static class Utils {
/**
* For each parameterFieldName value in responseData, assertTrue(value op timestamp)
* @param parameterFieldName the field name containing data
* @param op an OData binary operator to be used for comparsions
* @param parameterAssertedValue value to be used for comparisons
* @param responseData string containing JSON response data
*/
private static void assertDateTimeOffset(String parameterFieldName, String op, String parameterAssertedValue, String responseData) {
AtomicReference<Timestamp> assertedValue = new AtomicReference<>();
assertedValue.set(parseTimestampFromEdmDateTimeOffsetString(resolveValue(parameterAssertedValue, settings)));
assertDateTimeOffset(parameterFieldName, op, assertedValue.get(), responseData);
}
/**
* For each parameterFieldName value in responseData, assertTrue(value op timestamp)
* @param parameterFieldName the field name containing data
* @param op an OData binary operator to be used for comparsions
* @param timestamp value to be used for comparisons
* @param responseData string containing JSON response data
*/
private static void assertDateTimeOffset(String parameterFieldName, String op, Timestamp timestamp, String responseData) {
LOG.info("Asserted time is: " + timestamp);
String fieldName = resolveValue(parameterFieldName, settings);
AtomicReference<Timestamp> fieldValue = new AtomicReference<>();
from(responseData).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> {
try {
fieldValue.set(parseTimestampFromEdmDateTimeOffsetString(item.get(fieldName).toString()));
assertTrue(compare(fieldValue.get(), op, timestamp));
} catch (Exception ex) {
LOG.error(ex.toString());
}
});
}
/**
* Returns true if each item in the list is true
* @param lhs left hand value
* @param op a binary operator for use in comparsions
* @param rhs right hand value
* @param lhs Integer value
* @param op an OData binary operator for use for comparisons
* @param rhs Integer value
* @return true if lhs op rhs produces true, false otherwise
*/
private static boolean compare(Integer lhs, String op, Integer rhs) {
@ -560,6 +611,13 @@ public class WebAPIServer_1_0_2 implements En {
return result;
}
/**
* Timestamp Comparator
* @param lhs Timestamp to compare
* @param op an OData binary operator to use for comparisons
* @param rhs Timestamp to compare
* @return true if lhs op rhs, false otherwise
*/
private static boolean compare(Timestamp lhs, String op, Timestamp rhs) {
String operator = op.toLowerCase();
boolean result = false;
@ -581,6 +639,13 @@ public class WebAPIServer_1_0_2 implements En {
return result;
}
/**
* Time Comparator
* @param lhs Time to compare
* @param op an OData binary operator to use for comparisons
* @param rhs Time to compare
* @return true if lhs op rhs, false otherwise
*/
private static boolean compare(Time lhs, String op, Time rhs) {
String operator = op.toLowerCase();
boolean result = false;
@ -602,6 +667,13 @@ public class WebAPIServer_1_0_2 implements En {
return result;
}
/**
* Date Comparator
* @param lhs Date to compare
* @param op an OData binary operator to use for comparisons
* @param rhs Date to compare
* @return true if lhs op rhs, false otherwise
*/
private static boolean compare(Date lhs, String op, Date rhs) {
String operator = op.toLowerCase();
boolean result = false;
@ -754,7 +826,6 @@ public class WebAPIServer_1_0_2 implements En {
return null;
}
}
}
/**
* Converts the given inputStream to a string.
@ -776,4 +847,5 @@ public class WebAPIServer_1_0_2 implements En {
}
return null;
}
}
}