Commit 2854874a authored by Garcia's avatar Garcia
Browse files

Add support of OpenGIS - Circle

parent 2c815f32
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
module LibNg112_EncdecDeclarations {
  
  import from XSD all;
  
  // RFC5985 Held
  import from urn_ietf_params_xml_ns_geopriv_held language "XSD" all;
  import from urn_ietf_params_xml_ns_geopriv_held_id language "XSD" all;
  import from urn_ietf_params_xml_ns_pidf_geopriv10 language "XSD" all;
  import from urn_ietf_params_xml_ns_pidf_geopriv10_basicPolicy language "XSD" all;
  
  import from urn_ietf_params_xml_ns_pidf_geopriv10_civicLoc language "XSD" all;

  // 
  import from urn_ietf_params_xml_ns_pidf language "XSD" all;
  
  // OpenGIS
  import from urn_ietf_params_xml_ns_pidf_geopriv10_geoShape language "XSD" all;
  import from http_www_opengis_net_gml language "XSD" all;
  
  external function enc_LocationRequest(in LocationRequest p_loction_request) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_LocationRequest(in octetstring p_pdu) return LocationRequest
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  external function enc_LocationResponse(in LocationResponse p_loction_response) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_LocationResponse(in octetstring p_pdu) return LocationResponse
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
    

  external function enc_Device(in Device p_device) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Device(in octetstring p_pdu) return Device
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  external function enc_Presence(in Presence p_presence) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Presence(in octetstring p_pdu) return Presence
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  external function enc_Tuple(in Tuple p_tuple) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Tuple(in octetstring p_pdu) return Tuple
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  external function enc_Geopriv(in Geopriv p_geopriv) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Geopriv(in octetstring p_pdu) return Geopriv
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  external function enc_Circle(in Circle p_circle) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Circle(in octetstring p_pdu) return Circle
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
} // End of module LibNg112_EncdecDeclarations
+22 −46
Original line number Diff line number Diff line
@@ -18,9 +18,16 @@ module TestCodec_HttpPort {
  import from urn_ietf_params_xml_ns_geopriv_held_id language "XSD" all;
  import from urn_ietf_params_xml_ns_pidf_geopriv10 language "XSD" all;
  import from urn_ietf_params_xml_ns_pidf_geopriv10_basicPolicy language "XSD" all;
  
  import from urn_ietf_params_xml_ns_pidf_geopriv10_civicLoc language "XSD" all;

  // 
  import from urn_ietf_params_xml_ns_pidf language "XSD" all;
  
  // OpenGIS
  import from urn_ietf_params_xml_ns_pidf_geopriv10_geoShape language "XSD" all;
  import from http_www_opengis_net_gml language "XSD" all;
  
  // LibCommon
    
  // LibHttp
@@ -31,52 +38,11 @@ module TestCodec_HttpPort {
  import from LibItsHttp_XmlTemplates all;
  import from LibItsHttp_TestSystem all;

  external function enc_LocationRequest(in LocationRequest p_loction_request) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_LocationRequest(in octetstring p_pdu) return LocationRequest
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  external function enc_LocationResponse(in LocationResponse p_loction_response) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_LocationResponse(in octetstring p_pdu) return LocationResponse
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
    

  external function enc_Device(in Device p_device) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Device(in octetstring p_pdu) return Device
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  external function enc_Presence(in Presence p_presence) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Presence(in octetstring p_pdu) return Presence
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  external function enc_Tuple(in Tuple p_tuple) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Tuple(in octetstring p_pdu) return Tuple
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  external function enc_Geopriv(in Geopriv p_tuple) return octetstring
  with { extension "prototype (convert) encode(XER:XER_EXTENDED)" };
  external function dec_Geopriv(in octetstring p_pdu) return Geopriv
  with { extension "prototype (convert) decode(XER:XER_EXTENDED)" };
  
  testcase tc_http_map_1() runs on HttpComponent system HttpTestAdapter {
    // Local variables
    var HeaderLines v_headers;
    var HttpMessage v_response;
    
    log(
        "####: m_locationRequest= ",
        enc_LocationRequest(
                            valueof(
                                    m_locationRequest(
                                                      { oct2unichar(enc_Device(valueof(m_device({ "<tel>+436501234567</tel>" })))) },
                                                      m_locationTypeType(m_locationTypeBase_geodetic, true)
                                                      )
                                    )));
    
    
    map(self:httpPort, system:httpPort);
    
    // Preamble
@@ -88,7 +54,7 @@ module TestCodec_HttpPort {
                                                    v_headers,
                                                    m_http_message_body_xml(m_body_xml_location_request(
                                                                                                        m_locationRequest(
                                                                                                                          { oct2unichar(enc_Device(valueof(m_device({ "<tel>+436501234567</tel>" })))) },
                                                                                                                          { encvalue_unichar(valueof(m_device({ "<tel>+436501234567</tel>" }))) },
                                                                                                                          m_locationTypeType(m_locationTypeBase_geodetic, true)
                                                                                                                          )
                                                                                                        )
@@ -102,21 +68,31 @@ module TestCodec_HttpPort {
                          mw_http_response(
                                           mw_http_response_ok(
                                                               mw_http_message_body_xml(
                                                                                        XmlBody: { locationResponse := mw_locationResponse(-, ?) }
                                                                                        )))) -> value v_response {
                                                                                        mw_body_xml_location_response(
                                                                                                                      mw_locationResponse(-, ?)
                                                                                                                      ))))) -> value v_response {
        var Presence v_presence;
        var Tuple v_tuple;
        var Geopriv v_geopriv;
        var Circle v_circle;
        var universal charstring v_temp;
        var integer v_result;
        
        tc_ac.stop;
        
        v_presence := dec_Presence(unichar2oct(v_response.response.body.xml_body.locationResponse.elem_list[0]));
        v_temp := v_response.response.body.xml_body.locationResponse.elem_list[0];
        v_result := decvalue_unichar(v_temp, v_presence);
        v_tuple := v_presence.tuple_list[0];
        log("v_tuple = ", v_tuple);
        
        v_geopriv := dec_Geopriv(unichar2oct(v_tuple.status.elem_list[0]));
        v_temp := v_tuple.status.elem_list[0];
        v_result := decvalue_unichar(v_temp, v_geopriv);
        log("v_geopriv = ", v_geopriv);
        
        v_temp := v_geopriv.location_info.elem_list[0];
        v_result := decvalue_unichar(v_temp, v_circle);
        log("v_circle = ", v_circle);
        
        setverdict(pass, "Get a response");
      }
      [] httpPort.receive(