Commit 3d239a6d authored by Michael Proestler's avatar Michael Proestler
Browse files

implement TP_LIS_HELD_BV_07

parent bc86dd19
Loading
Loading
Loading
Loading
+23 −23
Original line number Diff line number Diff line
@@ -37,7 +37,9 @@ module AtsLIS_Functions {
                      );
	}
	
	function f_dereference(charstring v_params) runs on HttpComponent {
	function f_dereference(charstring v_params, template (omit) LocationRequest p_request) runs on HttpComponent {
	  
    
       // Local variables
    var Headers v_headers;
    
@@ -45,14 +47,12 @@ module AtsLIS_Functions {
    f_remove_headers_list({ c_header_accept, c_header_authorization }, v_headers);
    f_set_headers_list({ c_header_accept }, { "application/pidf+xml" }, v_headers);

	  httpPort.send(
      	             m_http_request(
                                     m_http_request_get(
                                                         v_params,
                                                         v_headers
                                                         )
                                     )
                      );
    if (isvalue(p_request)) {
      log("request template is defined, should use post for dereference");
      httpPort.send(m_http_request(m_http_request_post(v_params, v_headers, m_http_message_body_xml(m_body_xml_location_request(p_request)))));
    } else {
      httpPort.send(m_http_request(m_http_request_get(v_params,v_headers)));                                     
    }
	}
	
	
+88 −3
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ module AtsLIS_TestCases {


	/**
     * @desc "IUT successfully responds with a Cirle when the locationURI is dereferenced by HeldRequest"
     * @desc "IUT successfully responds with a Cirle when the locationURI is dereferenced by HTTP GET"
     */
    testcase TC_LIS_HELD_BV_06() runs on HttpComponent system TestAdapter {
        // Local Variabls
@@ -445,7 +445,7 @@ module AtsLIS_TestCases {
					
        f_cf_01_http_up();					               
        // Test Body
        f_dereference(v_params);        
        f_dereference(v_params, omit );        
        
        template Circle mw_expected_circle := mw_circle(mw_center_group_pos_1((PX_CIRCLE_POS[0] - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_POS[0] + PX_DOUBLE_CMP_EPSILON), (PX_CIRCLE_POS[1] - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_POS[1] + PX_DOUBLE_CMP_EPSILON)), mw_radius(PX_CIRCLE_UOM, (PX_CIRCLE_RADIUS - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_RADIUS + PX_DOUBLE_CMP_EPSILON)), PX_SRS_NAME);                

@@ -477,6 +477,91 @@ module AtsLIS_TestCases {
        f_cf_01_http_down();
    } // End of testcase TC_LIS_HELD_BV_06

    	/**
     * @desc "IUT successfully responds with a Cirle when the locationURI is dereferenced by HTTP POST"
     */
    testcase TC_LIS_HELD_BV_07() runs on HttpComponent system TestAdapter {
        // Local Variabls
        var HttpMessage v_response;

        // Test control
        f_check_pics({ values := {PICS_LIS_HELD_BY_REFERENCE_GET, PICS_LIS_GEOMETRY_CIRCLE}, names := {"PICS_LIS_HELD_BY_REFERENCE_GET", "PICS_LIS_GEOMETRY_CIRCLE"}});
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Preamble
		    f_sendRequest(m_locationRequest(
										{encvalue_unichar(valueof(m_device({ PX_DEVICE_NUMBER[PX_DEVICE_NUMBER_CIRCLE] })))},
										m_locationTypeType(
															m_locationTypeBase_locationUri,
                                							true
                               								)       
                               			)
					 )
		
                                                                           
        template LocationResponseType mdw_location_response modifies mw_location_response := {
         	 locationUriSet := {
         	   expires := ?,
         	   locationURI_list := ? length (1 .. infinity)
         	 },
         	 presence := omit
        }
                       
        v_response := f_receiveResponse(mw_http_location_response(mdw_location_response));
        
        var template charstring v_uri_pattern := "(http[s]#(0,1))://([^/\\s]+)/(?+)";
        var charstring v_uri;
        var charstring v_scheme;
        var charstring v_host;
        var charstring v_params;

        // Extract link details
        v_uri := oct2char(unichar2oct(v_response.response.body.xml_body.locationResponse.locationUriSet.locationURI_list[0]));
        v_scheme := regexp(v_uri, v_uri_pattern, 0);
        v_host := regexp(v_uri, v_uri_pattern, 1); // FIXME Add support of a different host
        v_params := "/" & regexp(v_uri, v_uri_pattern, 2);
        log("*** " & testcasename() & ": INFO: URI:", v_params);
               
	    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);               
		  f_cf_01_http_down();
					
        f_cf_01_http_up();					               
        // Test Body
        
        f_dereference(v_params, m_locationRequest({}));        
        
        template Circle mw_expected_circle := mw_circle(mw_center_group_pos_1((PX_CIRCLE_POS[0] - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_POS[0] + PX_DOUBLE_CMP_EPSILON), (PX_CIRCLE_POS[1] - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_POS[1] + PX_DOUBLE_CMP_EPSILON)), mw_radius(PX_CIRCLE_UOM, (PX_CIRCLE_RADIUS - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_RADIUS + PX_DOUBLE_CMP_EPSILON)), PX_SRS_NAME);                

        template Presence mw_presence := {          
            entity := ?,
            tuple_list := {
              	{
              	  	id := ?,          		
                  	status := {
	                    basic := *,
    	            	geopriv := mw_geopriv({ circle := mw_expected_circle}),
    	            	elem_list := { * }
        	      	},
                    elem_list := ?,
                    contact := *,
                    note_list := ?,
                    timestamp_ := *        	      	                     
          		}
            },
		   	note_list := ?,
			elem_list := ?                  
        }
        
        template HttpMessage mw_http_response_presence := mw_http_response(mw_http_response_ok(mw_http_message_body_xml(mw_body_xml_presence(mw_presence))));
        
        f_receiveResponse(mw_http_response_presence); 
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_LIS_HELD_BV_07

  } // End of group lis_role
  
} // End of module AtsLIS_TestCases