Commit fed4610e authored by Michael Proestler's avatar Michael Proestler
Browse files

add TC AtsECRF_TestCases.TC_ECRF_LOST_BV_02 AtsECRF_TestCases.TC_ECRF_LOST_BI_01

parent bd98272d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
module AtsECRF_AltSteps {
	
	import from LibItsHttp_TestSystem all;
	import from LibCommon_Sync all;
	import from LibItsHttp_Templates all;
	import from LibItsHttp_XmlTemplates all;
	
	altstep a_timeout() runs on HttpComponent {
	  [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
          }
	}
}
+91 −0
Original line number Diff line number Diff line
module AtsECRF_Functions {
	
	import from LibItsHttp_TestSystem all;
	import from LibItsHttp_Templates all;
	import from LibItsHttp_Functions all;
	import from LibItsHttp_TypesAndValues all;
	import from LibItsHttp_XmlTemplates all;
	
	import from LibCommon_Sync all;

	// RFC5222
	import from urn_ietf_params_xml_ns_lost1 language "XSD" all
    	with {
        	extension "File:../xsd/RFC5222_lost.xsd";
    	}

  // AtsECRF
  import from AtsECRF_Pics all;
  import from AtsECRF_Pixits all;

  type record Statement {    
    charstring name,
    boolean val
  }

  type record of Statement StatementList;

  function f_check_statements(StatementList p_statements) {
    var charstring v_msg := "";
    for(var integer v_i := 0; v_i < sizeof(p_statements); v_i := v_i + 1) {
      if (not(p_statements[v_i].val)) {
        if (lengthof(v_msg) > 0) {
          v_msg := v_msg & ", ";
        }
        v_msg := v_msg & p_statements[v_i].name;
      }
    }
    
    if (lengthof(v_msg) > 0) {
      log("*** " & testcasename() & ": " & v_msg &" required for executing the TC ***")
      setverdict(inconc);
      stop;
    }
  }

  function f_sendFindServiceRequest(template (value) FindService p_request) runs on HttpComponent {
    var boolean c_debug := true;

	  // Local variables
    var Headers v_headers;
    
    f_init_default_headers_list(-, -, v_headers);
    f_remove_headers_list({ c_header_accept, c_header_authorization }, v_headers);

    if (c_debug) {
      f_set_headers_list({ "X-TestcaseName"},{ testcasename()},v_headers);
    }
      
	  httpPort.send(
      	             m_http_request(
                                     m_http_request_post(
                                                         PICS_ECRF_URI,
                                                         v_headers,
                                                         m_http_message_body_xml(m_body_xml_find_service_request(p_request))
                                                         )
                                     )
                      );
  }

 

	function f_receiveResponse(template HttpMessage p_message) runs on HttpComponent return HttpMessage {
	  var HttpMessage v_response;

	  alt {
          [] httpPort.receive(p_message) -> value v_response {
             f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
          }
          [] httpPort.receive {
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
          }
        }
        
        return v_response;
	}

}
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,10 @@ module AtsECRF_Pics {
   */
  modulepar boolean PICS_ECRF_GEOMETRY_POINT := true;

  /**
   * @desc Does the IUT support geometry Circle?
   */
  modulepar boolean PICS_ECRF_GEOMETRY_CIRCLE := true;



+20 −0
Original line number Diff line number Diff line
module AtsECRF_Templates {
	
	import from LibItsHttp_Templates all;
	import from LibItsHttp_TypesAndValues all;
	import from LibItsHttp_XmlTemplates all;

	// RFC5222
	import from urn_ietf_params_xml_ns_lost1 language "XSD" all
    	with {
        	extension "File:../xsd/RFC5222_lost.xsd";
    	}

	template HttpMessage mw_http_find_service_response(    	
    	in template (present) FindServiceResponse p_find_service_response
    ) := mw_http_response(mw_http_response_ok(mw_http_message_body_xml(mw_body_xml_find_service_response(p_find_service_response))))

	template HttpMessage mw_http_find_service_response_error(
		in template ExceptionContainer p_error
	) := mw_http_response(mw_http_response_ok(mw_http_message_body_xml(mw_body_xml_find_service_response_error(p_error))))
}
+104 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ module AtsECRF_TestCases {
      // Test control
      f_check_statements({
        { name := "PICS_ECRF_FIND_SERVICE", val := PICS_ECRF_FIND_SERVICE },
        { name := "PICS_ECRF_FIND_SERVICE", val := PICS_ECRF_FIND_SERVICE }
        { name := "PICS_ECRF_GEOMETRY_POINT", val := PICS_ECRF_GEOMETRY_POINT }
      })

      // Test component configuration
@@ -156,6 +156,109 @@ module AtsECRF_TestCases {
      f_cf_01_http_down();
    }

   /**
    * @desc "IUT successfully responds with a service URI for a Circle in the service boundary"
    */
    testcase TC_ECRF_LOST_BV_02() runs on HttpComponent system TestAdapter {
      
      // Test control
      f_check_statements({
        { name := "PICS_ECRF_FIND_SERVICE", val := PICS_ECRF_FIND_SERVICE },
        { name := "PICS_ECRF_GEOMETRY_CIRCLE", val := PICS_ECRF_GEOMETRY_CIRCLE }
      })

      // Test component configuration
      f_cf_01_http_up();

      // Preamble
      f_sendFindServiceRequest(
        m_find_service_request(
                                {
                                  m_location(
                                              PX_LOCATION_ID,
                                              { m_extension_point(encvalue_unichar(valueof(m_circle(m_center_group_pos(PX_CIRCLE_IN_V_POLICE_SERVICE_BOUNDARY_POS), m_radius(PX_CIRCLE_UOM, PX_CIRCLE_IN_V_POLICE_SERVICE_BOUNDARY_RADIUS), PX_SRS_NAME)))) },
                                              "geodetic-2d" // TODO Use a Pixit
                                              )
                                },
                                { },
                                PX_E_POLICE_SERVICE_URN,
                                true
                              )
      );

      f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

      // Test Body
      tc_ac.start;
      f_receiveResponse(mw_http_find_service_response(
                                                      mw_find_service_response(
                                                                                { mw_mapping(
                                                                                    mw_expires_date_time(PX_LOST_EXPIRES),
                                                                                    PX_LOST_LAST_UPDATED,
                                                                                    PX_V_POLICE_SOURCE,
                                                                                    PX_E_POLICE_SOURCE_ID,
                                                                                    { mw_display_name(-, PX_E_POLICE_DISPLAY_NAME) },
                                                                                    { PX_E_POLICE_SIP_URI },
                                                                                    -,
                                                                                    PX_E_POLICE_SERVICE_URN,
                                                                                    -, -, -,
                                                                                    "112"
                                                                                  )
                                                                                }
                                                                              )
                                                        )
                        );

      // Postamble
      f_cf_01_http_down();
    }

   /**
    * @desc "IUT successfully responds with a service URI for a Circle in the service boundary"
    */
    testcase TC_ECRF_LOST_BI_01() runs on HttpComponent system TestAdapter {
      
      // Test control
      f_check_statements({
        { name := "PICS_ECRF_FIND_SERVICE", val := PICS_ECRF_FIND_SERVICE },
        { name := "PICS_ECRF_GEOMETRY_CIRCLE", val := PICS_ECRF_GEOMETRY_CIRCLE }
      })

      // Test component configuration
      f_cf_01_http_up();

      // Preamble
      f_sendFindServiceRequest(
        m_find_service_request(
                                {
                                  m_location(
                                              PX_LOCATION_ID,
                                              { m_extension_point(encvalue_unichar(valueof(m_circle(m_center_group_pos(PX_CIRCLE_IN_V_POLICE_SERVICE_BOUNDARY_POS), m_radius(PX_CIRCLE_UOM, PX_CIRCLE_IN_V_POLICE_SERVICE_BOUNDARY_RADIUS), PX_SRS_NAME)))) },
                                              "geodetic-2d" // TODO Use a Pixit
                                              )
                                },
                                { },
                                "urn:some:unknown:service",
                                true
                              )
      );

      f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

      // Test Body
      tc_ac.start;
      f_receiveResponse(mw_http_find_service_response_error(
                                                            mw_exception_serviceNotImplemented(
                                                                PX_V_POLICE_SOURCE,
                                                                mw_basic_exception
                                                            )
                        )
      );

      // Postamble
      f_cf_01_http_down();
    }

  } // End of group LOST

} // End of module AtsECRF_TestCases