Commit 17448ced authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ updated library plugin

parent 32f62498
Loading
Loading
Loading
Loading
+123 −120
Original line number Diff line number Diff line
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"
	
    Note : "Message based types and instances"
    Package MessageBased {
        Import all from Standard
        Import all from TDL
        
        //Generic Method type -> required for generation!!!
        //Generic Method type
        Enumerated Method {
            Method GET,
            Method POST,
@@ -35,13 +39,6 @@ Package HTTP {
            optional Body body
        )
        
        //Generic Request instances
        Request GET ( )
        Request POST ( )
        Request PUT ( )
        Request PATCH ( )
        Request DELETE ( )
        
        //Generic Response type    
        Structure Response (
            optional Integer status,
@@ -50,25 +47,6 @@ Package HTTP {
            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 (
@@ -76,13 +54,12 @@ Package HTTP {
            String ^name,
            String ^value
        )
        Type Location
        Location path
        Location query

        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
@@ -93,10 +70,8 @@ Package HTTP {
            // 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
@@ -106,7 +81,6 @@ Package HTTP {
        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
@@ -123,4 +97,33 @@ Package HTTP {
            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")
    
    }
}
 No newline at end of file
+58 −0
Original line number Diff line number Diff line
Package HttpJavaMappings {
	Import all from Tdl
	Import all from Java
	Import all from HTTP.MessageBased
	
	@JavaPackage
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.adapters.http" as HttpAdapter
	
    @JavaClass
	Map Request to "HttpRequestData" in HttpAdapter as Request_Mapping {
		uri -> "uri",
		method -> "method",
		headers -> "headers",
		parameters -> "parameters",
		body -> "body"
    }
    @JavaClass
	Map Response to "HttpResponseData" in HttpAdapter as Response_Mapping {
		status -> "status",
		statusMessage -> "statusMessage",
		headers -> "headers",
		body -> "body"
    }
    @JavaClass
	Map Header to "HttpHeader" in HttpAdapter as Header_Mapping {
		^name -> "name",
		^value -> "value"
    }
    @JavaClass
	Map Parameter to "HttpRequestParameter" in HttpAdapter as Parameter_Mapping {
		location -> "location",
		^name -> "name",
		^value -> "value"
    }
    @JavaClass
	Map Location to "HttpParameterLocation" in HttpAdapter as Location_Mapping
	
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.adapters.http.HttpParameterLocation" as HttpParameterLocation
	Map path to "path" in HttpParameterLocation as path_mapping
	Map query to "query" in HttpParameterLocation as query_mapping
	Map cookie to "cookie" in HttpParameterLocation as cookie_mapping
	
	
    @JavaClass
	Map Method to "HttpMethod" in HttpAdapter as Method_Mapping
	
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.adapters.http.HttpMethod" as HttpMethod
	Map GET to "GET" in HttpMethod as GET_mapping
	Map POST to "POST" in HttpMethod as POST_mapping
	Map PUT to "PUT" in HttpMethod as PUT_mapping
	Map PATCH to "PATCH" in HttpMethod as PATCH_mapping
	Map DELETE to "DELETE" in HttpMethod as DELETE_mapping
}
+56 −0
Original line number Diff line number Diff line
Package Java {
	Import all from Tdl
	
	/* Applied to a DataResourceMapping to specify a package  */
	Annotation JavaPackage
	/* Applied to a DataElementMapping to specify an instance method  */
	Annotation JavaMethod
	/* Applied to a DataElementMapping to specify an class method  */
	Annotation JavaStaticMethod
	/* Applied to a DataResourceMapping or DataElementMapping to specify a class  */
	Annotation JavaClass
	/* Applied to a DataElementMapping to specify a field (of a class)  */
	Annotation JavaField
	/* Applied to a DataElementMapping to specify a static field (of a class)  */
	Annotation JavaStaticField
	/* Applied to a ParameterMapping to specify an instance method that returns the value of a field  */
	Annotation JavaGetter
	/* Applied to a ParameterMapping to specify an instance method that sets the field value  */
	Annotation JavaSetter
	
	
    @JavaPackage
    @MappingName : "Java"
    Use "java.lang" as JavaLang
	Map Boolean to "Boolean" in JavaLang as Boolean_mapping
	Map Integer to "Integer" in JavaLang as Integer_mapping
	Map String to "String" in JavaLang as String_mapping
	
	
	
    @JavaPackage
    @MappingName : "Java"
    Use "org.etsi.mts.tdl.execution.java.tri" as Tri
    
    @JavaClass
	Map Verdict to "Verdict" in Tri as Verdict_Mapping
	
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.tri.Verdict" as VerdictClass
	Map pass to "pass" in VerdictClass as pass_mapping
	Map fail to "fail" in VerdictClass as fail_mapping
	Map inconclusive to "inconclusive" in VerdictClass as inconclusive_mapping
	
	
    @JavaPackage
    @MappingName : "Java"
    Use "org.etsi.mts.tdl.execution.java.rt.core" as RuntimeCore
    
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.rt.core.TimeUnit" as TimeUnitClass
	Map second to "Second" in TimeUnitClass as second_mapping
	
	
}
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@ Package TDL {
	Type Verdict
	
	//TODO: these do not work at present -> literal values take precedence?
//	Boolean true
//	Boolean false
	Boolean ^true
	Boolean ^false
	Boolean True
	Boolean False
	
@@ -35,6 +35,7 @@ Package TDL {
    Annotation Test Purpose Description
    Annotation when
    Annotation then
    Annotation PICS
	
	Predefined == returns Boolean
	Predefined != returns Boolean
+56 −0
Original line number Diff line number Diff line
Package Tdl {
	//TODO: extract to standard library
	Constraint length
	Constraint minLength
	Constraint maxLength
	Constraint range
	Constraint format
	Constraint union
	Constraint uniontype
	
	Type Boolean
	Type Integer
	Type String
	Type Verdict
	
	//TODO: these do not work at present -> literal values take precedence?
	Boolean ^true
	Boolean ^false
	Boolean True
	Boolean False
	
	Verdict pass
	Verdict fail
	Verdict inconclusive
	
	Time second
	
	Annotation Master
	Annotation MappingName

    //standard annotations for STO
    Annotation Initial conditions
    Annotation Expected behaviour
    Annotation Final conditions
    Annotation Test Purpose Description
    Annotation when
    Annotation then
	
	Predefined == returns Boolean
	Predefined != returns Boolean
	Predefined and returns Boolean
	Predefined or returns Boolean
	Predefined xor returns Boolean
	Predefined not returns Boolean
	Predefined < returns Boolean
	Predefined > returns Boolean
	Predefined <= returns Boolean
	Predefined >= returns Boolean
	Predefined +
	Predefined -
	Predefined *
	Predefined /
	Predefined mod
	Predefined size returns Integer
	
}
 No newline at end of file
Loading