Commit ec79c944 authored by Yann Garcia's avatar Yann Garcia
Browse files

Bug fixed HTTP regexp expression

parent b090d150
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ system.httpPort.params := "HTTP(codecs=held:held_codec;html:html_codec;json:json
#TestCodec_Invite.tc_invite_request_1
#TestCodec_Invite.tc_invite_request_2
#TestCodec_Invite.tc_invite_request_3
TestCodec_Invite.tc_invite_request_4
#TestCodec_Invite.tc_invite_request_4
#TestCodec_Responses.tc_100_trying_1
#TestCodec_Responses.tc_180_ringing_1
#TestCodec_HttpRequest.tc_http_get_1
@@ -67,6 +67,8 @@ TestCodec_Invite.tc_invite_request_4
#TestCodec_Xsd.tc_linear_ring_1
#TestCodec_Xsd.tc_test_vendor_response_1
#TestCodec_Xsd.tc_test_vendor_response_2
TestCodec_Regexp.tc_regexp_1
TestCodec_Regexp.tc_regexp_2

[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
+10 −108
Original line number Diff line number Diff line
@@ -1536,7 +1536,7 @@ module AtsNg112_TestCases {
    } // End of testcase TC_ECRF_HTTP_POST_BV_07
    
    /**
     * @desc "IUT successfully responds with a service URI for a Circle that intersects multiple service boundaries"
     * @desc "IUT successfully responds with a service URI for a Circle in the service boundary with multiple services"
     */
    testcase TC_ECRF_HTTP_POST_BV_08() runs on HttpComponent system TestAdapter {
        // Local variables
@@ -1568,7 +1568,7 @@ module AtsNg112_TestCases {
                                                                                                                                        {
                                                                                                                                          m_location(
                                                                                                                                                     PX_LOCATION_ID,
                                                                                                                                                     { m_extension_point(encvalue_unichar(valueof(m_circle(m_center_group_pos(PX_CIRCLE_INTERSECTING_V_FIRE_SERVICE_BOUNDARY_POS), m_radius(PX_CIRCLE_UOM, PX_CIRCLE_INTERSECTING_V_FIRE_SERVICE_BOUNDARY_RADIUS), PX_SRS_NAME)))) },
                                                                                                                                                     { m_extension_point(encvalue_unichar(valueof(m_circle(m_center_group_pos(PX_CIRCLE_IN_V_FIRE_SERVICE_BOUNDARY_POS), m_radius(PX_CIRCLE_UOM, PX_CIRCLE_IN_V_FIRE_SERVICE_BOUNDARY_RADIUS), PX_SRS_NAME)))) },
                                                                                                                                                     "geodetic-2d" // TODO Use a Pixit
                                                                                                                                                     )
                                                                                                                                          },
@@ -1623,108 +1623,10 @@ module AtsNg112_TestCases {
        f_cf_01_http_down();
    } // End of testcase TC_ECRF_HTTP_POST_BV_08
    
    /**
     * @desc "IUT successfully responds with multiple service URIs for a Point in multiple service boundaries"
     */
    testcase TC_ECRF_HTTP_POST_BV_09() runs on HttpComponent system TestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_ECRF_IUT) or (not PICS_HTTP_POST_REQUEST) or (not PICS_SERVICE_LOST) or not(PICS_L_FIS_GEO1)) {
          log("*** " & testcasename() & ": PICS_ECRF_IUT and PICS_HTTP_POST_REQUEST and PICS_SERVICE_LOST and PICS_L_FIS_GEO1 required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, 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(
                                                                                                                 m_find_service_request(
                                                                                                                                        {
                                                                                                                                          m_location(
                                                                                                                                                     PX_LOCATION_ID,
                                                                                                                                                     { m_extension_point(encvalue_unichar(valueof(m_point(PX_POINT_IN_V_FIRE_SERVICE_BOUNDARY_POS, PX_SRS_NAME, "point1")))) },
                                                                                                                                                     "geodetic-2d" // TODO Use a Pixit
                                                                                                                                                     )
                                                                                                                                          },
                                                                                                                                        { },
                                                                                                                                        "urn:service:sos",
                                                                                                                                        true,
                                                                                                                                        value_
                                                                                                                                        )))
                                                         )));
        f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_success);
        
        // Test body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_xml(
                                                                                            mw_body_xml_find_service_response(
                                                                                                                              mw_find_service_response(
                                                                                                                                                       { mw_mapping(
                                                                                                                                                                    mw_expires_date_time(PX_LOST_EXPIRES),
                                                                                                                                                                    PX_LOST_LAST_UPDATED,
                                                                                                                                                                    PX_V_FIRE_SOURCE,
                                                                                                                                                                    -,
                                                                                                                                                                    { mw_display_name },
                                                                                                                                                                    { PX_V_FIRE_SIP_URI },
                                                                                                                                                                    mw_mapping_service_boundary,
                                                                                                                                                                    PX_V_FIRE_SERVICE_URN
                                                                                                                                                                    ),
                                                                                                                                                         mw_mapping(
                                                                                                                                                                    mw_expires_date_time(PX_LOST_EXPIRES),
                                                                                                                                                                    PX_LOST_LAST_UPDATED,
                                                                                                                                                                    PX_V_POLICE_SOURCE,
                                                                                                                                                                    -,
                                                                                                                                                                    { mw_display_name },
                                                                                                                                                                    { PX_V_POLICE_SIP_URI },
                                                                                                                                                                    mw_mapping_service_boundary,
                                                                                                                                                                    PX_V_POLICE_SERVICE_URN
                                                                                                                                                                    )
                                                                                                                                                         },
                                                                                                                                                       -,
                                                                                                                                                       LibItsHttp_XmlTemplates.mw_path(
                                                                                                                                                                                       { LibItsHttp_XmlTemplates.mw_via }
                                                                                                                                                                                       ),
                                                                                                                                                       -,
                                                                                                                                                       -,
                                                                                                                                                       mw_location_used(PX_LOCATION_ID)
                                                                                                                                                       )))))) -> value v_response {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with multiple services ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_ECRF_HTTP_POST_BV_09
    
    /**
     * @desc "IUT successfully responds with configured service types for a ListServices request"
     */
    testcase TC_ECRF_HTTP_POST_BV_10() runs on HttpComponent system TestAdapter {
    testcase TC_ECRF_HTTP_POST_BV_09() runs on HttpComponent system TestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
@@ -1786,12 +1688,12 @@ module AtsNg112_TestCases {
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_ECRF_HTTP_POST_BV_10
    } // End of testcase TC_ECRF_HTTP_POST_BV_09
    
    /**
     * @desc "IUT successfully responds with configured service types for a ListServicesByLocation request"
     */
    testcase TC_ECRF_HTTP_POST_BV_11() runs on HttpComponent system TestAdapter {
    testcase TC_ECRF_HTTP_POST_BV_10() runs on HttpComponent system TestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
@@ -1860,12 +1762,12 @@ module AtsNg112_TestCases {
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_ECRF_HTTP_POST_BV_11
    } // End of testcase TC_ECRF_HTTP_POST_BV_10
    
    /**
     * @desc "IUT successfully responds with configured service types for a ListServices request without service element"
     */
    testcase TC_ECRF_HTTP_POST_BV_12() runs on HttpComponent system TestAdapter {
    testcase TC_ECRF_HTTP_POST_BV_11() runs on HttpComponent system TestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
@@ -1932,12 +1834,12 @@ module AtsNg112_TestCases {
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_ECRF_HTTP_POST_BV_12
    } // End of testcase TC_ECRF_HTTP_POST_BV_11
    
    /**
     * @desc "IUT successfully responds with configured service types for a ListServicesByLocation request without service element"
     */
    testcase TC_ECRF_HTTP_POST_BV_13() runs on HttpComponent system TestAdapter {
    testcase TC_ECRF_HTTP_POST_BV_12() runs on HttpComponent system TestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
@@ -2004,7 +1906,7 @@ module AtsNg112_TestCases {
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_ECRF_HTTP_POST_BV_13
    } // End of testcase TC_ECRF_HTTP_POST_BV_12
    
  } // End of group ecrf_role
  
+4 −5
Original line number Diff line number Diff line
@@ -47,14 +47,13 @@ module AtsNg112_TestControl {
          execute(TC_ECRF_HTTP_POST_BV_08());
        }
        if (PICS_L_FIS_GEO1) {
          execute(TC_ECRF_HTTP_POST_BV_09());
          execute(TC_ECRF_HTTP_POST_BV_11());
          execute(TC_ECRF_HTTP_POST_BV_13());
        }
        if (PICS_L_LST_ALL1) {
          execute(TC_ECRF_HTTP_POST_BV_10());
          execute(TC_ECRF_HTTP_POST_BV_12());
        }
        if (PICS_L_LST_ALL1) {
          execute(TC_ECRF_HTTP_POST_BV_09());
          execute(TC_ECRF_HTTP_POST_BV_11());
        }
      }
    }
    if (PICS_ESRP_IUT) {
+4 −0
Original line number Diff line number Diff line
@@ -166,6 +166,10 @@ module LibNg112_Pixits {
  
  modulepar XSD.Double PX_CIRCLE_INTERSECTING_V_FIRE_SERVICE_BOUNDARY_RADIUS := 5000.0;
  
  modulepar DoubleList PX_CIRCLE_IN_V_FIRE_SERVICE_BOUNDARY_POS := { 48.22192, 16.34010 };
  
  modulepar XSD.Double PX_CIRCLE_IN_V_FIRE_SERVICE_BOUNDARY_RADIUS := 2.0;
  
  modulepar XSD.DateTime PX_LOST_EXPIRES := "2019-08-30T08:48:17+00:00";
  
  modulepar XSD.DateTime PX_LOST_LAST_UPDATED := "2018-08-30T08:48:17+00:00";
+65 −0
Original line number Diff line number Diff line
module TestCodec_Regexp {
  
  // LibNg112
  import from LibNg112_TypesAndValues all;
  import from LibNg112_Templates all;
  import from LibNg112_TestSystem all;
  
  // TestCodec
  import from TestCodec_TestAndSystem all;
  
  testcase tc_regexp_1() runs on TCType system TCType {
    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;
    
    v_uri := "http://192.168.3.126:28081/rest/api/interface/serviceFL/47037345-d63d-4f4e-a22f-43e972a45757";
    v_scheme := regexp(v_uri, v_uri_pattern, 0);
    log("v_scheme= ", v_scheme);
    if (v_scheme != "http") {
      setverdict(fail, "Wrong schema");
    }
    v_host := regexp(v_uri, v_uri_pattern, 1); // FIXME Add support of a different host
    log("v_host= ", v_host);
    if (v_host != "192.168.3.126:28081") {
      setverdict(fail, "Wrong host");
    }
    v_params := "/" & regexp(v_uri, v_uri_pattern, 2);
    log("v_params= ", v_params);
    if (v_params != "/rest/api/interface/serviceFL/47037345-d63d-4f4e-a22f-43e972a45757") {
      setverdict(fail, "Wrong param");
    }
    
    setverdict(pass);
  } // End of testcase tc_regexp_1
  
  testcase tc_regexp_2() runs on TCType system TCType {
    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;
    
    v_uri := "https://lis.gridgears.io/api/lis";
    v_scheme := regexp(v_uri, v_uri_pattern, 0);
    log("v_scheme= ", v_scheme);
    if (v_scheme != "https") {
      setverdict(fail, "Wrong schema");
    }
    v_host := regexp(v_uri, v_uri_pattern, 1); // FIXME Add support of a different host
    log("v_host= ", v_host);
    if (v_host != "lis.gridgears.io") {
      setverdict(fail, "Wrong host");
    }
    v_params := "/" & regexp(v_uri, v_uri_pattern, 2);
    log("v_params= ", v_params);
    if (v_params != "/api/lis") {
      setverdict(fail, "Wrong param");
    }
    
    setverdict(pass);
  } // End of testcase tc_regexp_2
  
} // End of module TestCodec_Regexp