diff --git a/README.md b/README.md index 043bbba..6c8a0dc 100644 --- a/README.md +++ b/README.md @@ -452,9 +452,9 @@ Please feel free to suggest additional tags that might be useful. A sample of the runtime terminal output follows: ```gherkin - > Task :testWebApiServer_1_0_2_Platinum - - @REQ-WA103-END3 @core @x.y.z @core-endorsement @metadata +> Task :testWebApiServer_1_0_2_Platinum + + @REQ-WA103-END3 @core @2.4.1 @core-endorsement @metadata Scenario: Request and Validate Server Metadata Using RESOScript: /path/to/your.resoscript @@ -471,16 +471,16 @@ A sample of the runtime terminal output follows: Found Default Entity Container: 'Default' When a default entity container exists for the service root in "ClientSettings_WebAPIURI" - Fetching XMLMetadata with OData Client from: https://api.server.com/$metadata - XML Metadata retrieved from: https://api.server.com - And XML Metadata are requested from the service root in "ClientSettings_WebAPIURI" - Asserted Response Code: 200, Server Response Code: 200 Then the server responds with a status code of 200 Edm Metadata is valid! And the Edm metadata returned by the server are valid + Fetching XMLMetadata with OData Client from: https://api.server.com/$metadata + XML Metadata retrieved from: https://api.server.com + And XML Metadata are requested from the service root in "ClientSettings_WebAPIURI" + XML Metadata is valid! And the XML metadata returned by the server are valid @@ -501,7 +501,7 @@ A sample of the runtime terminal output follows: 1 Scenarios (1 passed) 10 Steps (10 passed) - 0m3.177s + 0m3.071s ``` diff --git a/build/libs/web-api-commander.jar b/build/libs/web-api-commander.jar index b4ab633..95735fa 100644 Binary files a/build/libs/web-api-commander.jar and b/build/libs/web-api-commander.jar differ diff --git a/src/main/java/org/reso/certification/stepdefs/WebAPIServer_1_0_2.java b/src/main/java/org/reso/certification/stepdefs/WebAPIServer_1_0_2.java index 40b17ac..8db9445 100644 --- a/src/main/java/org/reso/certification/stepdefs/WebAPIServer_1_0_2.java +++ b/src/main/java/org/reso/certification/stepdefs/WebAPIServer_1_0_2.java @@ -835,6 +835,7 @@ public class WebAPIServer_1_0_2 implements En { ODataRetrieveResponse oDataRetrieveResponse = commander.get().getODataRetrieveEdmResponse(); responseCode.set(oDataRetrieveResponse.getStatusCode()); edm.set(oDataRetrieveResponse.getBody()); + assertNotNull("ERROR: could not find default entity container for given service root: " + serviceRoot, edm.get().getEntityContainer()); LOG.info("Found Default Entity Container: '" + edm.get().getEntityContainer().getNamespace() + "'"); } catch (ODataClientErrorException cex) { diff --git a/src/main/java/org/reso/commander/Commander.java b/src/main/java/org/reso/commander/Commander.java index 1c2f4e7..1a5e15d 100644 --- a/src/main/java/org/reso/commander/Commander.java +++ b/src/main/java/org/reso/commander/Commander.java @@ -199,18 +199,9 @@ public class Commander { * @return XMLMetadata representation of the server metadata. */ public XMLMetadata getXMLMetadata() { - if (xmlMetadata == null) { - try { - EdmMetadataRequest metadataRequest = client.getRetrieveRequestFactory().getMetadataRequest(serviceRoot); - LOG.info("Fetching XMLMetadata with OData Client from: " + metadataRequest.getURI().toString()); - return metadataRequest.getXMLMetadata(); - } catch (ODataClientErrorException cex) { - LOG.error("ERROR: could not retrieve Metadata for the given service root!"); - LOG.error(cex.getStatusLine().toString()); - throw cex; - } - } - return null; + EdmMetadataRequest metadataRequest = client.getRetrieveRequestFactory().getMetadataRequest(serviceRoot); + LOG.info("Fetching XMLMetadata with OData Client from: " + metadataRequest.getURI().toString()); + return metadataRequest.getXMLMetadata(); } /** @@ -218,15 +209,9 @@ public class Commander { * @return the OData response retrieved from the server when making the request. */ public ODataRetrieveResponse getODataRetrieveEdmResponse() { - try { - EdmMetadataRequest metadataRequest = client.getRetrieveRequestFactory().getMetadataRequest(serviceRoot); - LOG.info("Fetching Edm with OData Client from: " + metadataRequest.getURI().toString()); - return metadataRequest.execute(); - } catch (ODataClientErrorException cex) { - LOG.error("ERROR: could not retrieve Metadata for the given service root!"); - LOG.error(cex.getStatusLine().toString()); - throw cex; - } + EdmMetadataRequest metadataRequest = client.getRetrieveRequestFactory().getMetadataRequest(serviceRoot); + LOG.info("Fetching Edm with OData Client from: " + metadataRequest.getURI().toString()); + return metadataRequest.execute(); } /**