AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases.ttcn 51.3 KB
Newer Older
    /**
     * @desc Check that MEO responds with an error when it receives 
     *       a request for deleting an App Package referred with a wrong ID
     */
    testcase TC_MEC_MEC010p2_MEO_PKGM_004_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;

      // Test control
      if (not(PIC_APP_PACKAGE_MANAGEMENT)){
          log("*** " & testcasename() & ": PIC_APP_PACKAGE_MANAGEMENT required for executing the TC ***");
          setverdict(inconc);
          stop;
      }

      // Test component configuration
      f_cf_01_http_up();

      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_delete(
                                                         PICS_ROOT_API & PX_MEO_PKGM_URI_ONBOARDED & "/" & oct2char(unichar2oct(PX_ON_BOARDED_APP_PKG_ID, "UTF-8")),
                                                         v_headers
                     )));

      f_selfOrClientSyncAndVerdict(c_prDone, e_success);

      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_404_not_found
                            )) -> value v_response {
          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error code ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
    } // End of testcase TC_MEC_MEC010p2_MEO_PKGM_004_NF
    
    /**
     * @desc Check that MEO updates the operational state of an individual application package resource
     */
    testcase TC_MEC_MEC010p2_MEO_PKGM_005_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;

      // Test control
      if (not(PIC_APP_PACKAGE_MANAGEMENT)){
          log("*** " & testcasename() & ": PIC_APP_PACKAGE_MANAGEMENT required for executing the TC ***");
          setverdict(inconc);
          stop;
      }

      // Test component configuration
      f_cf_01_http_up();

      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_patch(
                                                       PICS_ROOT_API & PX_MEO_PKGM_URI,
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_create_package_management(
                                                                                                                      m_create_package_management(
                                                                                                                                                  "",
                                                                                                                                                  PX_APP_PKG_VERSION,
                                                                                                                                                  m_checksum(-, PX_CHECKSUM),
                                                                                                                                                  PX_APP_PKG_PATH
                     ))))));

      f_selfOrClientSyncAndVerdict(c_prDone, e_success);

      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_ok(
                                                                 mw_http_message_body_json(
                                                                                           mw_body_json_app_pkg_info(
                                                                                                                     mw_app_pkg_info/*(
                                                                                                                                           -,
                                                                                                                                           PX_APP_PKG_NAME,
                                                                                                                                           PX_APP_PKG_VERSION, 
                                                                                                                                           mw_checksum, 
                                                                                                                                           PX_OPERATIONAL_STATE, 
                                                                                                                                           PX_USAGE_STATE
                            )*/
                            ))))) -> value v_response {
          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with an App Package ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
    } // End of testcase TC_MEC_MEC010p2_MEO_PKGM_005_OK
    
  } // End of group pkgmgt
  
} // End of module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases