automated-v1 Checkpoint 2 (#2)

* Test REQ-WA103-QO1 working, added assert handling for cases with HTTP Client exceptions
* Added additional test support methods for testing specific OData verisions, also reset for local state
* Assert stepdef cleanup
* Added support for asserting response codes, like 400s, for a specific OData version
* Added support for arithmetic integer comparisons
* Updated resoscript variables and added further test support
* Added Integer Comparison Tests (through REQ-WA103-QO11)
* Rebuilt for Java 1.8 and cleaned up some of the logging and int compare tests
* Updated Dockerfile, generic.resoscript, and removing assertions from the runRESOScript action. Gradle should be used for assertion testing. See README
* Added support for EdmDateTimeOffset and EdmDate parsing and comparisons
* Added more TimeOfDay, Time, DateTimeOffset glue
* Added support for single-valued enumerations
This commit is contained in:
Joshua Darnell 2020-02-27 11:07:28 -08:00 committed by GitHub
parent 97722ba86c
commit 41c3d633b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 454 additions and 140 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,176 +201,176 @@
<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: Date"
TestDescription="Query Support: $filter: Date portion of EdmDateTimeOffset field is less than EdmDate value."
RequirementId="REQ-WA103-QO25"
MetallicLevel="Core"
Capability="Filterability ($filter)"
@ -376,7 +380,7 @@
/>
<Request
TestDescription="Query Support: $filter: Date: Time"
TestDescription="Query Support: $filter: Time portion of EdmDateTimeOffset field is less than EdmTime value."
RequirementId="REQ-WA103-QO26"
MetallicLevel="Core"
Capability="Filterability ($filter)"
@ -386,35 +390,25 @@
/>
<Request
TestDescription="Query Support: $filter: Date: Time (2)"
TestDescription="Query Support: $filter: Date: EdmDateTimeOffset field is less than EdmDateTimeOffset value."
RequirementId="REQ-WA103-QO26"
MetallicLevel="Core"
Capability="Filterability ($filter)"
WebAPIReference="2.4.4"
OutputFile="REQ-WA103-QO26-2.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,8 +144,48 @@ 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
And Integer data in "Parameter_FilterNotField" "ne" "Parameter_FilterNotValue"
@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"
Then the server responds with a status code of 200
And the response is valid JSON
And the response has results
And Date data in "Parameter_TimestampField" "gt" "Parameter_DateValue"
@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"
Then the server responds with a status code of 200
And the response is valid JSON
And the response has results
And TimeOfDay data in "Parameter_TimestampField" "lt" "Parameter_TimeValue"
@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"
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

@ -12,7 +12,11 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDate;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
import org.apache.olingo.commons.core.edm.primitivetype.EdmTimeOfDay;
import org.reso.commander.Commander;
import org.reso.models.ClientSettings;
import org.reso.models.Request;
@ -20,10 +24,10 @@ import org.reso.models.Settings;
import java.io.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
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;
import java.util.concurrent.atomic.AtomicReference;
@ -31,6 +35,8 @@ import java.util.function.Function;
import static io.restassured.path.json.JsonPath.from;
import static org.junit.Assert.*;
import static org.reso.models.Settings.CLIENT_SETTING_PREFIX;
import static org.reso.models.Settings.PARAMETER_PREFIX;
public class WebAPIServer_1_0_2 implements En {
private static final Logger LOG = LogManager.getLogger(WebAPIServer_1_0_2.class);
@ -98,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) {
@ -233,7 +239,11 @@ public class WebAPIServer_1_0_2 implements En {
LOG.info("Number of Results: " + numResults.get());
LOG.info("Number of Fields: " + fieldList.size());
LOG.info("Field with Data: " + numFieldsWithData.get());
LOG.info("Percent Fill: " + ((numResults.get() * fieldList.size()) / (1.0 * numFieldsWithData.get()) * 100) + "%");
if (numFieldsWithData.get() > 0) {
LOG.info("Percent Fill: " + ((numResults.get() * fieldList.size()) / (1.0 * numFieldsWithData.get()) * 100) + "%");
} else {
LOG.info("Percent Fill: 0% - no fields with data found!");
}
assertTrue(numFieldsWithData.get() > 0);
});
@ -431,16 +441,92 @@ public class WebAPIServer_1_0_2 implements En {
if (op.contentEquals(Operators.AND)) {
itemResult.set(lhsResult.get() && rhsResult.get());
LOG.info("assertTrue: " + lhsResult.get() + " AND " + rhsResult.get() + " ==> " + itemResult.get());
LOG.info("Assert True: " + lhsResult.get() + " AND " + rhsResult.get() + " ==> " + itemResult.get());
assertTrue(itemResult.get());
} else if (op.contentEquals(Operators.OR)) {
itemResult.set(lhsResult.get() || rhsResult.get());
LOG.info("assertTrue: " + lhsResult.get() + " OR " + rhsResult.get() + " ==> " + itemResult.get());
LOG.info("Assert True: " + lhsResult.get() + " OR " + rhsResult.get() + " ==> " + itemResult.get());
assertTrue(itemResult.get());
}
});
});
/*
* Date Comparison glue
*/
And("^Date data in \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$", (String parameterFieldName, String op, String parameterAssertedValue) -> {
String fieldName = Utils.resolveValue(parameterFieldName, settings);
AtomicReference<Date> fieldValue = new AtomicReference<>();
AtomicReference<Date> assertedValue = new AtomicReference<>();
assertedValue.set(Utils.parseDateFromEdmDateString(Utils.resolveValue(parameterAssertedValue, settings)));
LOG.info("Asserted value is: " + assertedValue.get().toString());
from(responseData.get()).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> {
try {
fieldValue.set(Utils.parseDateFromEdmDateTimeOffsetString(item.get(fieldName).toString()));
assertTrue(Utils.compare(fieldValue.get(), op, assertedValue.get()));
} catch (Exception ex){
LOG.error(ex.toString());
}
});
});
/*
* Time comparison glue
*/
And("^TimeOfDay data in \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$", (String parameterFieldName, String op, String parameterAssertedValue) -> {
String fieldName = Utils.resolveValue(parameterFieldName, settings);
AtomicReference<Time> fieldValue = new AtomicReference<>();
AtomicReference<Time> assertedValue = new AtomicReference<>();
assertedValue.set(Utils.parseTimeOfDayFromEdmTimeOfDayString(Utils.resolveValue(parameterAssertedValue, settings)));
LOG.info("Asserted value is: " + assertedValue.get().toString());
from(responseData.get()).getList(JSON_VALUE_PATH, HashMap.class).forEach(item -> {
try {
fieldValue.set(Utils.parseTimeOfDayFromEdmDateTimeOffsetString(item.get(fieldName).toString()));
assertTrue(Utils.compare(fieldValue.get(), op, assertedValue.get()));
} catch (Exception ex){
LOG.error(ex.toString());
}
});
});
/*
* Timestamp comparison glue
*/
And("^DateTimeOffset data in \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\"$", (String parameterFieldName, String op, String parameterAssertedValue) -> {
Utils.assertDateTimeOffset(parameterFieldName, op, parameterAssertedValue, responseData.get());
});
/*
* 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 -> {
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());
});
});
}
/**
@ -460,41 +546,156 @@ 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) {
String operator = op.toLowerCase();
boolean result = false;
switch (op) {
case Operators.EQ:
result = lhs.equals(rhs);
break;
case Operators.NE:
result = !lhs.equals(rhs);
break;
case Operators.GREATER_THAN:
result = lhs > rhs;
break;
case Operators.GREATER_THAN_OR_EQUAL:
result = lhs >= rhs;
break;
case Operators.LESS_THAN:
result = lhs < rhs;
break;
case Operators.LESS_THAN_OR_EQUAL:
result = lhs <= rhs;
break;
if (operator.contentEquals(Operators.GREATER_THAN)) {
result = lhs > rhs;
} else if (operator.contentEquals(Operators.GREATER_THAN_OR_EQUAL)) {
result = lhs >= rhs;
} else if (operator.contentEquals(Operators.EQ)) {
result = lhs.equals(rhs);
} else if (operator.contentEquals(Operators.NE)) {
result = !lhs.equals(rhs);
} else if (operator.contentEquals(Operators.LESS_THAN)) {
result = lhs < rhs;
} else if (operator.contentEquals(Operators.LESS_THAN_OR_EQUAL)) {
result = lhs <= rhs;
}
LOG.info("Compare: " + lhs + " " + op + " " + rhs + " ==> " + result);
LOG.info("Compare: " + lhs + " " + operator + " " + rhs + " ==> " + result);
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;
if (operator.contentEquals(Operators.GREATER_THAN)) {
result = lhs.after(rhs);
} else if (operator.contentEquals(Operators.GREATER_THAN_OR_EQUAL)) {
result = lhs.after(rhs) || lhs.equals(rhs);
} else if (operator.contentEquals(Operators.EQ)) {
result = lhs.equals(rhs);
} else if (operator.contentEquals(Operators.NE)) {
result = !lhs.equals(rhs);
} else if (operator.contentEquals(Operators.LESS_THAN)) {
result = lhs.before(rhs);
} else if (operator.contentEquals(Operators.LESS_THAN_OR_EQUAL)) {
result = lhs.before(rhs) || lhs.equals(rhs);
}
LOG.info("Compare: " + lhs + " " + operator + " " + rhs + " ==> " + result);
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;
if (operator.contentEquals(Operators.GREATER_THAN)) {
result = lhs.toLocalTime().isAfter(rhs.toLocalTime());
} else if (operator.contentEquals(Operators.GREATER_THAN_OR_EQUAL)) {
result = lhs.toLocalTime().isAfter(rhs.toLocalTime()) || lhs.toLocalTime().equals(rhs.toLocalTime());
} else if (operator.contentEquals(Operators.EQ)) {
result = lhs.toLocalTime().equals(rhs.toLocalTime());
} else if (operator.contentEquals(Operators.NE)) {
result = !lhs.toLocalTime().equals(rhs.toLocalTime());
} else if (operator.contentEquals(Operators.LESS_THAN)) {
result = lhs.toLocalTime().isBefore(rhs.toLocalTime());
} else if (operator.contentEquals(Operators.LESS_THAN_OR_EQUAL)) {
result = lhs.toLocalTime().isBefore(rhs.toLocalTime()) || lhs.toLocalTime().equals(rhs.toLocalTime());
}
LOG.info("Compare: " + lhs + " " + operator + " " + rhs + " ==> " + result);
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;
if (operator.contentEquals(Operators.GREATER_THAN)) {
result = lhs.after(rhs);
} else if (operator.contentEquals(Operators.GREATER_THAN_OR_EQUAL)) {
result = lhs.after(rhs) || lhs.equals(rhs);
} else if (operator.contentEquals(Operators.EQ)) {
result = lhs.equals(rhs);
} else if (operator.contentEquals(Operators.NE)) {
result = !lhs.equals(rhs);
} else if (operator.contentEquals(Operators.LESS_THAN)) {
result = lhs.before(rhs);
} else if (operator.contentEquals(Operators.LESS_THAN_OR_EQUAL)) {
result = lhs.before(rhs) || lhs.equals(rhs);
}
LOG.info("Compare: " + lhs + " " + operator + " " + rhs + " ==> " + result);
return result;
}
/**
* Tests the given string to see if it's valid JSON
* @param jsonString the JSON string to test the validity of
@ -516,12 +717,12 @@ public class WebAPIServer_1_0_2 implements En {
* @return the resolved setting or item if it's not a client setting or parameter
*/
private static String resolveValue(String item, Settings settings) {
if (item.contains("Parameter_")) {
return settings.getParameters().getValue(item.replace("Parameter_", ""));
if (item.contains(PARAMETER_PREFIX)) {
return settings.getParameters().getValue(item.replace(PARAMETER_PREFIX, ""));
}
if (item.contains("ClientSettings_")) {
return settings.getClientSettings().get(item.replace("ClientSettings_", ""));
if (item.contains(CLIENT_SETTING_PREFIX)) {
return settings.getClientSettings().get(item.replace(CLIENT_SETTING_PREFIX, ""));
}
return item;
@ -546,26 +747,105 @@ public class WebAPIServer_1_0_2 implements En {
}
return data;
}
}
/**
* Converts the given inputStream to a string.
* @param inputStream the input stream to convert.
* @return the string value contained in the stream.
*/
private static String convertInputStreamToString(InputStream inputStream) {
InputStreamReader isReader = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(isReader);
StringBuilder sb = new StringBuilder();
String str;
try {
while((str = reader.readLine())!= null){
sb.append(str);
/**
* Parses the given edmDateTimeOffsetString into a Java Instant (the type expected by the Olingo type converter).
* @param edmDateTimeOffsetString string representation of an Edm DateTimeOffset to parse.
* @return the corresponding Instant value.
*/
private static Timestamp parseTimestampFromEdmDateTimeOffsetString(String edmDateTimeOffsetString) {
try {
return EdmDateTimeOffset.getInstance().valueOfString(edmDateTimeOffsetString, true, null, null, null, null, Timestamp.class);
} catch (EdmPrimitiveTypeException ex) {
LOG.error(ex.toString());
return null;
}
return sb.toString();
} catch (Exception ex) {
LOG.error("Error in convertInputStreamToString: " + ex);
}
return null;
/**
* Parses the given edmDateString into a Java date (the type expected by the Olingo type converter).
* @param edmDateString the date string to convert.
* @return the corresponding Data value.
*/
private static Timestamp parseTimestampFromEdmDateString(String edmDateString) {
try {
return EdmDate.getInstance().valueOfString(edmDateString, true, null, null, null, null, Timestamp.class);
} catch (EdmPrimitiveTypeException ex) {
LOG.error(ex.toString());
return null;
}
}
/**
* Parses the given edmDateString into a Java date (the type expected by the Olingo type converter).
* @param edmTimeOfDayOffsetString the date string to convert.
* @return the corresponding Data value.
*/
private static Time parseTimeOfDayFromEdmTimeOfDayString(String edmTimeOfDayOffsetString) {
try {
return EdmTimeOfDay.getInstance().valueOfString(edmTimeOfDayOffsetString, true, null, null, null, null, Time.class);
} catch (EdmPrimitiveTypeException ex) {
LOG.error(ex.toString());
return null;
}
}
private static Time parseTimeOfDayFromEdmDateTimeOffsetString(String edmDateTimeOffsetString) {
try {
return EdmDateTimeOffset.getInstance().valueOfString(edmDateTimeOffsetString, true, null, null, null, null, Time.class);
} catch (EdmPrimitiveTypeException ex) {
LOG.error(ex.toString());
return null;
}
}
/**
* Parses the given edmDateString into a Java Date
* @param edmDateString the date string to convert.
* @return the corresponding Date value.
*/
private static Date parseDateFromEdmDateString(String edmDateString) {
try {
return EdmDate.getInstance().valueOfString(edmDateString, true, null, null, null, null, Date.class);
} catch (EdmPrimitiveTypeException ex) {
LOG.error(ex.toString());
return null;
}
}
/**
* Parses the given edmDateTimeOffsetString into a Java Date
* @param edmDateTimeOffsetString string representation of an Edm DateTimeOffset to parse.
* @return the corresponding Date value.
*/
private static Date parseDateFromEdmDateTimeOffsetString(String edmDateTimeOffsetString) {
try {
return EdmDateTimeOffset.getInstance().valueOfString(edmDateTimeOffsetString, true, null, null, null, null, Date.class);
} catch (EdmPrimitiveTypeException ex) {
LOG.error(ex.toString());
return null;
}
}
/**
* Converts the given inputStream to a string.
* @param inputStream the input stream to convert.
* @return the string value contained in the stream.
*/
private static String convertInputStreamToString(InputStream inputStream) {
InputStreamReader isReader = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(isReader);
StringBuilder sb = new StringBuilder();
String str;
try {
while((str = reader.readLine())!= null){
sb.append(str);
}
return sb.toString();
} catch (Exception ex) {
LOG.error("Error in convertInputStreamToString: " + ex);
}
return null;
}
}
}

View File

@ -46,8 +46,8 @@ public class Settings {
return settings;
}
static final String CLIENT_SETTING_PREFIX = "ClientSettings_";
static final String PARAMETER_PREFIX = "Parameter_";
public static final String CLIENT_SETTING_PREFIX = "ClientSettings_";
public static final String PARAMETER_PREFIX = "Parameter_";
/**
* Resolves the parameters in request with parameters.