Commit 4688594a authored by Yann Garcia's avatar Yann Garcia
Browse files

Big fixed on MEC-011 ATS

parent b0ed782c
Loading
Loading
Loading
Loading
+52 −47
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ module AtsMec_AppEnablementAPI_TestCases {
  import from LibMec_Pics all;
  import from LibMec_Pixits all;

  const charstring c_etag_http_header := "etag";

  /*
   * Application Service Availability Query (APPSAQ)
@@ -499,7 +500,8 @@ module AtsMec_AppEnablementAPI_TestCases {
       */
      function f_create_service(
                                out universal charstring p_service_name,
                                out ServiceInfo p_service_info
                                out ServiceInfo p_service_info,
                                out Headers p_headers
                                ) runs on HttpComponent return integer {
        var universal charstring v_service_name;
        var Headers v_headers;
@@ -546,6 +548,7 @@ module AtsMec_AppEnablementAPI_TestCases {
            tc_ac.stop;
            p_service_name := v_service_name;
            p_service_info := v_response.response.body.json_body.serviceInfo;
            p_headers := v_response.response.header;
            v_result := 0;
          }
          [] tc_ac.timeout {
@@ -603,6 +606,7 @@ module AtsMec_AppEnablementAPI_TestCases {
    testcase TC_MEC_SRV_APPSAQ_004_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var charstring_list v_etag;
      var universal charstring v_service_name;
      var ServiceInfo v_service_info;

@@ -619,13 +623,19 @@ module AtsMec_AppEnablementAPI_TestCases {
      // Test adapter configuration

      // Preamble
      if(f_create_service(v_service_name, v_service_info) == -1) {
      if(f_create_service(v_service_name, v_service_info, v_headers) == -1) {
        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
      }
      log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id);
      // TODO If-Match header needs to have a PROPER_ETAG
      if (f_check_headers(v_headers, c_etag_http_header) == false) {
        log("*** " & testcasename() & ": INCONC: 'ETag' HTTP header not set ***");
        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
      }
      f_get_header(v_headers, c_etag_http_header, v_etag); // TODO Check headers
      log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id, ", ETag=", v_etag[0]);
      // If-Match header needs to have a PROPER_ETAG
      f_init_default_headers_list(-, -, v_headers);
      f_set_headers_list({ "If-Match" }, v_etag, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
@@ -670,7 +680,7 @@ module AtsMec_AppEnablementAPI_TestCases {
      } // End of 'alt' statement

      // Postamble
      // TODO Delete service created
      f_delete_service(v_service_name);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_APPSAQ_004_OK

@@ -681,6 +691,7 @@ module AtsMec_AppEnablementAPI_TestCases {
    testcase TC_MEC_SRV_APPSAQ_004_BR() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var charstring_list v_etag;
      var universal charstring v_service_name := "";
      var ServiceInfo v_service_info;

@@ -697,14 +708,19 @@ module AtsMec_AppEnablementAPI_TestCases {
      // Test adapter configuration

      // Preamble
      if(f_create_service(v_service_name, v_service_info) == -1) {
      if(f_create_service(v_service_name, v_service_info, v_headers) == -1) {
        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
      }
      log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id);
      // TODO If-Match header needs to have a PROPER_ETAG
      if (f_check_headers(v_headers, c_etag_http_header) == false) {
        log("*** " & testcasename() & ": INCONC: 'ETag' HTTP header not set ***");
        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
      }
      f_get_header(v_headers, c_etag_http_header, v_etag); // TODO Check headers
      log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id, ", ETag=", v_etag[0]);
      // If-Match header needs to have a PROPER_ETAG
      f_init_default_headers_list(-, -, v_headers);

      f_set_headers_list({ "If-Match" }, v_etag, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
@@ -742,6 +758,7 @@ module AtsMec_AppEnablementAPI_TestCases {
      } // End of 'alt' statement

      // Postamble
      f_delete_service(v_service_name);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_APPSAQ_004_BR

@@ -815,6 +832,7 @@ module AtsMec_AppEnablementAPI_TestCases {
    testcase TC_MEC_SRV_APPSAQ_004_PF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var charstring_list v_etag;
      var universal charstring v_service_name;
      var ServiceInfo v_service_info;

@@ -831,14 +849,19 @@ module AtsMec_AppEnablementAPI_TestCases {
      // Test adapter configuration

      // Preamble
      if(f_create_service(v_service_name, v_service_info) == -1) {
      if(f_create_service(v_service_name, v_service_info, v_headers) == -1) {
        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
      }
      log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id);
      // TODO If-Match header needs to have an INVALID_ETAG
      if (f_check_headers(v_headers, c_etag_http_header) == false) {
        log("*** " & testcasename() & ": INCONC: 'ETag' HTTP header not set ***");
        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
      }
      f_get_header(v_headers, c_etag_http_header, v_etag);
      log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id, ", ETag=", v_etag[0]);
      // If-Match header needs to have an INVALID_ETAG
      f_init_default_headers_list(-, -, v_headers);
      f_set_headers_list({ "ETag" }, { int2str(f_get_current_timestamp_utc()) }, v_headers);
      f_set_headers_list({ "If-Match" }, { int2str(f_get_current_timestamp_utc()) }, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
@@ -878,6 +901,7 @@ module AtsMec_AppEnablementAPI_TestCases {
      } // End of 'alt' statement

      // Postamble
      f_delete_service(v_service_name);
      f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_APPSAQ_004_PF

@@ -1007,8 +1031,6 @@ module AtsMec_AppEnablementAPI_TestCases {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;
      var universal charstring v_service_name;
      var ServiceInfo v_service_info;

      // Test control
      if (not(PICS_MEC_PLAT) or not (PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
@@ -1024,40 +1046,21 @@ module AtsMec_AppEnablementAPI_TestCases {

      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      f_create_service(v_service_name, v_service_info);
      //v_service_name := oct2unichar(char2oct("service_" & int2str(f_get_current_timestamp_utc())));
      //TODO Create a subsciption (see TC_MEC_SRV_APPSUB_001_OK);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
                                                      "/" & PICS_ROOT_API & PX_ME_APP_SUPPORT_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions",
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_srv_avail_notif_subscription/*m_body_json_app_termination_notif_subscription*/(
                                                                                                                               m_srv_avail_notif_subscription(
                                                                                m_body_json_app_termination_notif_subscription(
                                                                                                                               m_app_termination_notif_subscription(
                                                                                                                                                                    PX_APP_TERM_NOTIF_CALLBACK_URI,
                                                                                                                                                              m_self(
                                                                                                                                                                    -/*m_self(
                                                                                                                                                                           { href := PX_HREF }
                                                                                                                                                                     ),
                                                                                                                                                              m_service_info(
                                                                                                                                                                             v_service_name,
                                                                                                                                                                             -, -, -, -, -, //-,
                                                                                                                                                                             m_transport_info(
                                                                                                                                                                                              "transportId1",
                                                                                                                                                                                              "TC_MEC_SRV_APPSUB_002_OK",
                                                                                                                                                                                              REST_HTTP,
                                                                                                                                                                                              "HTTP",
                                                                                                                                                                                              "2.0",
                                                                                                                                                                                              m_end_point_uris({"/meMp1/service/MyEntryPoint"}),
                                                                                                                                                                                              m_security_info
                                                                                                                                                                           )*/,
                                                                                                                                                                    "ID1"/*PX_APP_INSTANCE_ID*/
                                                                                                                                                                    )
                                                                                                                                                                             )                                                                                                                                                   )
                                                                                                                               /*m_app_termination_notif_subscription(
                                                                                                                                                                    PX_APP_TERM_NOTIF_CALLBACK_URI,
                                                                                                                                                                    m_self(
                                                                                                                                                                           { href := PX_HREF }
                                                                                                                                                                           ),
                                                                                                                                                                    PX_APP_INSTANCE_ID
                                                                                                                                                                    )*/
                                                                                                                               )
                                                                                )
                                                       )
@@ -1775,8 +1778,9 @@ module AtsMec_AppEnablementAPI_TestCases {
      // Test adapter configuration

      // Preamble
      // TODO If-Match header needs to have an INVALID_ETAG
      f_init_default_headers_list(-, -, v_headers);
      // If-Match header needs to have an INVALID_ETAG
      f_set_headers_list({ "If-Match" }, { int2str(f_get_current_timestamp_utc()) }, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
@@ -2019,7 +2023,7 @@ module AtsMec_AppEnablementAPI_TestCases {
      httpPort.send(
                    m_http_request(
                                   m_http_request_get(
                                                      "/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_SVC_URI & oct2char(unichar2oct(PX_NON_EXISTENT_SERVICE_ID, "UTF-8")),
                                                      "/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_SVC_URI & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SERVICE_ID, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
@@ -3037,8 +3041,9 @@ module AtsMec_AppEnablementAPI_TestCases {
      // Test adapter configuration

      // Preamble
      // TODO If-Match header needs to have an INVALID_ETAG
      f_init_default_headers_list(-, -, v_headers);
      // If-Match header needs to have an INVALID_ETAG
      f_set_headers_list({ "If-Match" }, { int2str(f_get_current_timestamp_utc()) }, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ module AppEnablementAPI_Pixits {
  
  modulepar ServiceInfo_Version PX_NEW_SERVICE_INFO_VERSION := "2.0.0";
  
  modulepar ServiceInfo_State PX_SERVICE_INFO_STATE := ACTIVE;
  modulepar ServiceState PX_SERVICE_INFO_STATE := ACTIVE;
  
  modulepar SerializerTypes PX_SERIALIZER := JSON;

+20 −22
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ module AppEnablementAPI_Templates {
  template (omit) ServiceInfo m_service_info(
                                             in SerName p_serName,
                                             in ServiceInfo_Version p_version := PX_SERVICE_INFO_VERSION,
                                             in ServiceInfo_State p_state := PX_SERVICE_INFO_STATE,
                                             in ServiceState p_state := PX_SERVICE_INFO_STATE,
                                             in SerializerTypes p_serializer := PX_SERIALIZER,
                                             //in ServiceInfo_Link p_links := PX_LINKS_SERVICE_INFO,
                                             in template (omit) SerInstanceId p_serInstanceId := omit,
@@ -75,7 +75,7 @@ module AppEnablementAPI_Templates {
  template ServiceInfo mw_service_info(
                                       template (present) SerName p_serName := ?,
                                       template (present) ServiceInfo_Version p_version := ?,
                                       template (present) ServiceInfo_State p_state := ?,
                                       template (present) ServiceState p_state := ?,
                                       template (present) SerializerTypes p_serializer := ?,
                                       //template (present) ServiceInfo_Link p_links := ?,
                                       template SerInstanceId p_serInstanceId := *,
@@ -111,16 +111,14 @@ module AppEnablementAPI_Templates {
  } // End of template mw_subscription_link_list

  template (value) Self m_self(
                              in template (value) LinkType p_self_,
                              in template (value) JSON.Bool p_readOnly := false
                              in template (value) LinkType p_self_
  ) := {
    self_    := p_self_,
    readOnly := p_readOnly
    self_    := p_self_
  } // End of template m_self

  template (value) AppTerminationNotificationSubscription m_app_termination_notif_subscription(
  template (omit) AppTerminationNotificationSubscription m_app_termination_notif_subscription(
                                                                                              in template (value) AppTerminationNotificationSubscription_CallbackReference p_callbackReference,
                                                                                               in template (value) Self p_links,
                                                                                              in template (omit) Self p_links := omit,
                                                                                              in template (value) AppInstanceId p_appInstanceId
  ) := {
    subscriptionType  := "AppTerminationNotificationSubscription",
@@ -129,17 +127,17 @@ module AppEnablementAPI_Templates {
    appInstanceId     := p_appInstanceId
  } // End of template m_app_termination_notif_subscription

  template (value) AppTerminationNotificationSubscription m_app_termination_notif_subscription_invalid(
  template (omit) AppTerminationNotificationSubscription m_app_termination_notif_subscription_invalid(
                                                                                                      in template (value) AppTerminationNotificationSubscription_CallbackReference p_callbackReference,
                                                                                                       in template (value) Self p_links,
                                                                                                      in template (omit) Self p_links := omit,
                                                                                                      in template (value) AppInstanceId p_appInstanceId
                                                                                                      ) modifies m_app_termination_notif_subscription := {
    subscriptionType  := "InvalidAppTerminationNotificationSubscription"
  } // End of template m_app_termination_notif_subscription_invalid

  template (present) AppTerminationNotificationSubscription mw_app_termination_notif_subscription(
  template AppTerminationNotificationSubscription mw_app_termination_notif_subscription(
                                                                                        template (present) AppTerminationNotificationSubscription_CallbackReference p_callbackReference := ?,
                                                                                                  template (present) Self p_links := ?,
                                                                                        template Self p_links := *,
                                                                                        template (present) AppInstanceId p_appInstanceId := ?
  ) := {
    subscriptionType  := "AppTerminationNotificationSubscription",
@@ -223,7 +221,7 @@ module AppEnablementAPI_Templates {
  template (omit) SerAvailabilityNotificationSubscription m_srv_avail_notif_subscription(
                                                                                         in template (value) SerAvailabilityNotificationSubscription_CallbackReference p_callbackReference,
                                                                                         in template (omit) Self p_links := omit,
                                                                                         in template (omit) ServiceInfo p_filteringCriteria := omit
                                                                                         in template (omit) FilteringCriteria p_filteringCriteria := omit
                                                                                         ) := {
    subscriptionType := "SerAvailabilityNotificationSubscription",
    callbackReference := p_callbackReference,
@@ -234,7 +232,7 @@ module AppEnablementAPI_Templates {
  template (omit) SerAvailabilityNotificationSubscription m_srv_avail_notif_subscription_invalid(
                                                                                                 in template (value) SerAvailabilityNotificationSubscription_CallbackReference p_callbackReference,
                                                                                                 in template (omit) Self p_links := omit,
                                                                                                 in template (omit) ServiceInfo p_filteringCriteria := omit
                                                                                                 in template (omit) FilteringCriteria p_filteringCriteria := omit
                                                                                                 ) modifies m_srv_avail_notif_subscription := {
    subscriptionType := "InvalidSerAvailabilityNotificationSubscription"
  } // End of template m_srv_avail_notif_subscription_invalid
@@ -242,7 +240,7 @@ module AppEnablementAPI_Templates {
  template SerAvailabilityNotificationSubscription mw_srv_avail_notif_subscription(
                                                                                   template (present) SerAvailabilityNotificationSubscription_CallbackReference p_callbackReference := ?,
                                                                                   template Self p_links := *,
                                                                                   template  ServiceInfo p_filteringCriteria := *
                                                                                   template FilteringCriteria p_filteringCriteria := *
                                                                                   ) := {
    subscriptionType := "SerAvailabilityNotificationSubscription",
    callbackReference := p_callbackReference,
+20 −6

File changed.

Preview size limit exceeded, changes collapsed.