diff --git a/plugins/org.etsi.mts.tdl.library/src/org/etsi/mts/tdl/library/HTTP.tdltx b/plugins/org.etsi.mts.tdl.library/src/org/etsi/mts/tdl/library/HTTP.tdltx index 499cf0e53cb0c7c0d2b0d5075e10547ac442d3ec..7e2c4b71535f0f479bef1421c435f403a0be98b3 100644 --- a/plugins/org.etsi.mts.tdl.library/src/org/etsi/mts/tdl/library/HTTP.tdltx +++ b/plugins/org.etsi.mts.tdl.library/src/org/etsi/mts/tdl/library/HTTP.tdltx @@ -1,129 +1,172 @@ +@Version: "1.0.0" Package HTTP { - - Package MessageBasedConfiguration { - Import all from MessageBased - Message Gate HTTPGate accepts Request,Response - Message Gate HTTPSGate accepts Request,Response - Component API { - // Add variables and timers here or define new component types and configurations - gate HTTPGate http - gate HTTPSGate https - } - Configuration BasicClientServer { - API client as Tester, - API poller as Tester, - API server as SUT, - connect client::http to server::http - } - } - - Note : "Message based types and instances" - Package MessageBased { - Import all from TDL - - //Generic Method type - Enumerated Method { - Method GET, - Method POST, - Method PUT, - Method PATCH, - Method DELETE - } - - //Generic Request type - Structure Request ( - String uri, - optional Method method, - optional Headers headers, - optional Parameters parameters, - optional Body body - ) - - //Generic Response type - Structure Response ( - optional Integer status, - optional String statusMessage, - optional Headers headers, - optional Body body - ) - - //supporting types - Collection Parameters of Parameter - Structure Parameter ( - Location location, - String ^name, - String ^value - ) - Enumerated Location { - Location path, - Location query, - //may need a structure, not necessarily relevant in standardized testing - Location cookie - } - //separate headers -> not necessary - //Location header; - Collection Headers of Header - Structure Header ( - String ^name, - String ^value - // not relevant in TDL? - // optional contentLength of type Integer, - // optional contentType of type String - ) - //Base body for extension - Structure Body ( ) - //Basic string body - Structure StringBody extends Body ( - String text - ) - - //Basic wrapper for collection responses - Structure CollectionBody extends Body ( - Bodies items - ) - //Any body can be included - //If consistent type is needed, a custom subtype shall be defined and used - Collection Bodies of Body - - //Custom collection data instances can be defined - // - inline in the responses - // - predefined as a separate data element - //Custom collection data instances can be defined - //to enforce type consistency specific for API - - //Basic form body - Structure FormBody extends Body ( - String field, - String content - ) - } - - Package Templates { - //Generic Request instances - Import all from MessageBased - Request rGET ( ) - Request rPOST ( ) - Request rPUT ( ) - Request rPATCH ( ) - Request rDELETE ( ) - - //Generic Response instances, name = status code - Response r200 (statusMessage = "OK") - Response r201 (statusMessage = "Created") - Response r204 (statusMessage = "No Content") - Response r400 (statusMessage = "Bad Request") - Response r401 (statusMessage = "Not Found") - Response r403 (statusMessage = "Not Authorized") - Response r404 (statusMessage = "Forbidden") - //Generic Response instances, name = status message - Response OK (status = "200") - Response Created (status = "201") - Response NoContent (status = "204") - Response BadRequest (status = "400") - Response NotFound (status = "404") - Response NotAuthorized (status = "401") - Response Forbidden (status = "403") + Package MessageBasedConfiguration { + Import all from MessageBased + Message Gate HTTPGate accepts Request,Response + Message Gate HTTPSGate accepts Request,Response + Component API { + // Add variables and timers here or define new component types and configurations + gate HTTPGate http + gate HTTPSGate https + } + Configuration BasicClientServer { + API client as Tester, + API poller as Tester, + API server as SUT, + connect client::http to server::http + } + } + + Note : "Message based types and instances" + Package MessageBased { + Import all from TDL + + // HTTP methods + Enumerated Method { + Method GET, + Method POST, + Method PUT, + Method PATCH, + Method DELETE + } + + // Generic Request type + Structure Request ( + String uri, + optional Method method, + optional Headers headers, + optional Parameters parameters, + optional QueryParameters queryParameters, + optional PathParameters pathParameters, + optional Body body + ) + + // Generic Response type + Structure Response ( + optional Integer status, + optional String statusMessage, + optional Headers headers, + optional Body body + ) + + // Supporting types + Collection Parameters of Parameter + Structure Parameter ( + Location location, + String ^name, + String ^value + ) + Enumerated Location { + Location path, + Location query, + // TODO may need a structure, not necessarily relevant in standardized testing + Location cookie + } + + Structure PathParameters () + Structure QueryParameters () + + Collection Headers of Header + Structure Header ( + String ^name, + String ^value + ) + + // Base body for extension + Structure Body () + + // Basic string body + Structure StringBody extends Body ( + String text + ) + + // Basic wrapper for collection responses + Structure CollectionBody extends Body ( + Bodies items + ) + + // Any body can be included + // If consistent type is needed, a custom subtype shall be defined and used + Collection Bodies of Body + // Custom collection data instances can be defined + // - inline in the responses + // - predefined as a separate data element + + // Custom collection data instances can be defined + // to enforce type consistency specific for API + + // Basic form body + Structure FormBody extends Body ( + String field, + String content + ) + } - } + Package Templates { + Import all from MessageBased + + // Generic Request instances + Request rGET ( + method = GET + ) + Request rPOST ( + method = POST + ) + Request rPUT ( + method = PUT + ) + Request rPATCH ( + method = PATCH + ) + Request rDELETE ( + method = DELETE + ) + + // Generic Response instances, name = status code + Response r200 ( + statusMessage = "OK" + ) + Response r201 ( + statusMessage = "Created" + ) + Response r204 ( + statusMessage = "No Content" + ) + Response r400 ( + statusMessage = "Bad Request" + ) + Response r401 ( + statusMessage = "Unauthorized" + ) + Response r403 ( + statusMessage = "Forbidden" + ) + Response r404 ( + statusMessage = "Not Found" + ) + + // Generic Response instances, name = status message + Response OK ( + status = 200 + ) + Response Created ( + status = 201 + ) + Response NoContent ( + status = 204 + ) + Response BadRequest ( + status = 400 + ) + Response NotFound ( + status = 404 + ) + Response NotAuthorized ( + status = 401 + ) + Response Forbidden ( + status = 403 + ) + } } \ No newline at end of file diff --git a/plugins/org.etsi.mts.tdl.tx.ui/templates/HTTP.tdltx b/plugins/org.etsi.mts.tdl.tx.ui/templates/HTTP.tdltx index ebf69870faf864cede1e6b634315b84a2a321c61..aca535db244f3fb74b3bfbaa18e744acf3cf5581 100644 --- a/plugins/org.etsi.mts.tdl.tx.ui/templates/HTTP.tdltx +++ b/plugins/org.etsi.mts.tdl.tx.ui/templates/HTTP.tdltx @@ -1,127 +1,172 @@ @Version: "1.0.0" -Package HTTP { - Import all from TDL +Package HTTP { Package MessageBasedConfiguration { - Import all from MessageBased - Message Gate HTTPGate accepts Request,Response - Component API { - //Add variables and timers here or define new component types and configurations - gate HTTPGate http - } - Configuration BasicClientServer { - API client as Tester, - API server as SUT, - connect client::http to server::http - } - - } + Import all from MessageBased + Message Gate HTTPGate accepts Request,Response + Message Gate HTTPSGate accepts Request,Response + Component API { + // Add variables and timers here or define new component types and configurations + gate HTTPGate http + gate HTTPSGate https + } + Configuration BasicClientServer { + API client as Tester, + API poller as Tester, + API server as SUT, + connect client::http to server::http + } + } Note : "Message based types and instances" Package MessageBased { - Import all from TDL - - //Generic Method type -> required for generation!!! - Enumerated Method { - Method GET, - Method POST, - Method PUT, - Method PATCH, - Method DELETE - } - - //Generic Request type - Structure Request ( - String uri, - optional Method method, - optional Headers headers, - optional Parameters parameters, - optional Body body - ) - - //Generic Request instances - Request GET ( ) - Request POST ( ) - Request PUT ( ) - Request PATCH ( ) - Request DELETE ( ) - - //Generic Response type - Structure Response ( - optional Integer status, - optional String statusMessage, - optional Headers headers, - optional Body body - ) - - //Generic Response instances, name = status code - - Response r200 (statusMessage = "OK") - Response r201 (statusMessage = "Created") - Response r204 (statusMessage = "No Content") - Response r400 (statusMessage = "Bad Request") - Response r401 (statusMessage = "Not Found") - Response r403 (statusMessage = "Not Authorized") - Response r404 (statusMessage = "Forbidden") - - //Generic Response instances, name = status message - Response OK (status = "200") - Response Created (status = "201") - Response NoContent (status = "204") - Response BadRequest (status = "400") - Response NotFound (status = "404") - Response NotAuthorized (status = "401") - Response Forbidden (status = "403") - - //supporting types - Collection Parameters of Parameter - Structure Parameter ( - Location location, - String ^name, - String ^value - ) + Import all from TDL + + // HTTP methods + Enumerated Method { + Method GET, + Method POST, + Method PUT, + Method PATCH, + Method DELETE + } + + // Generic Request type + Structure Request ( + String uri, + optional Method method, + optional Headers headers, + optional Parameters parameters, + optional QueryParameters queryParameters, + optional PathParameters pathParameters, + optional Body body + ) + + // Generic Response type + Structure Response ( + optional Integer status, + optional String statusMessage, + optional Headers headers, + optional Body body + ) + + // Supporting types + Collection Parameters of Parameter + Structure Parameter ( + Location location, + String ^name, + String ^value + ) Enumerated Location { Location path, Location query, - //may need a structure, not necessarily relevant in standardized testing - Location cookie + // TODO may need a structure, not necessarily relevant in standardized testing + Location cookie } - Annotation QueryParameters - - Collection Headers of Header - Structure Header ( - String ^name, - String ^value - ) - - //Base body for extension - Structure Body ( ) - - //Basic string body - Structure StringBody extends Body ( - String text - ) - - //Basic wrapper for collection responses - Structure CollectionBody extends Body ( - Bodies items - ) - - //Any body can be included - //If consistent type is needed, a custom subtype shall be defined and used - Collection Bodies of Body - - //Custom collection data instances can be defined - // - inline in the responses - // - predefined as a separate data element - //Custom collection data instances can be defined - //to enforce type consistency specific for API + Structure PathParameters () + Structure QueryParameters () + + Collection Headers of Header + Structure Header ( + String ^name, + String ^value + ) + + // Base body for extension + Structure Body () + + // Basic string body + Structure StringBody extends Body ( + String text + ) + + // Basic wrapper for collection responses + Structure CollectionBody extends Body ( + Bodies items + ) + + // Any body can be included + // If consistent type is needed, a custom subtype shall be defined and used + Collection Bodies of Body + // Custom collection data instances can be defined + // - inline in the responses + // - predefined as a separate data element + + // Custom collection data instances can be defined + // to enforce type consistency specific for API + + // Basic form body + Structure FormBody extends Body ( + String field, + String content + ) + } - //Basic form body - Structure FormBody extends Body ( - String field, - String content - ) - } + Package Templates { + Import all from MessageBased + + // Generic Request instances + Request rGET ( + method = GET + ) + Request rPOST ( + method = POST + ) + Request rPUT ( + method = PUT + ) + Request rPATCH ( + method = PATCH + ) + Request rDELETE ( + method = DELETE + ) + + // Generic Response instances, name = status code + Response r200 ( + statusMessage = "OK" + ) + Response r201 ( + statusMessage = "Created" + ) + Response r204 ( + statusMessage = "No Content" + ) + Response r400 ( + statusMessage = "Bad Request" + ) + Response r401 ( + statusMessage = "Unauthorized" + ) + Response r403 ( + statusMessage = "Forbidden" + ) + Response r404 ( + statusMessage = "Not Found" + ) + + // Generic Response instances, name = status message + Response OK ( + status = 200 + ) + Response Created ( + status = 201 + ) + Response NoContent ( + status = 204 + ) + Response BadRequest ( + status = 400 + ) + Response NotFound ( + status = 404 + ) + Response NotAuthorized ( + status = 401 + ) + Response Forbidden ( + status = 403 + ) + } } \ No newline at end of file