AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases.ttcn 142 KB
Newer Older
      }

      // Test component configuration
      f_cf_01_http_up();

      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
                                                       PICS_ROOT_API & PX_APP_LCM_URI,
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_create_app_instance_request(
                                                                                                                        m_create_app_instance_request(
                                                                                                                                                      ""
                    ))))));
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);

      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_400_bad_request
                            )) -> value v_response {
          tc_ac.stop;
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct 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_MEX_LCM_01_OK
    
    /**
     * @desc Check that MEC API provider retrieves the list of App instances when requested
     */
    testcase TC_MEC_MEC010p2_MEX_LCM_02_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;

      // Test control
      if (not(PICS_APP_PACKAGE_MANAGEMENT)){
        log("*** " & testcasename() & ": PICS_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_get(
                                                       PICS_ROOT_API & PX_APP_LCM_URI,
                                                       v_headers
                    )));
      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_instance_info_list/*(
                                                                                                                               (*, mw_app_instance_info(-, PX_APP_ID), *)
*/
                            )))) -> value v_response {
          tc_ac.stop;
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct 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_MEX_LCM_02_OK
    
    /**
     * @desc Check that MEC API provider retrieves an App Package when requested
     */
    testcase TC_MEC_MEC010p2_MEX_LCM_03_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;

      // Test control
      if (not(PICS_APP_PACKAGE_MANAGEMENT)){
        log("*** " & testcasename() & ": PICS_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_get(
                                                       PICS_ROOT_API & PX_APP_LCM_URI &  "/" & oct2char(unichar2oct(PX_APP_INSTANCE_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_ok(
                                                                 mw_http_message_body_json(
                                                                                           mw_body_json_app_instance_info(
                                                                                                                          mw_app_instance_info(
                                                                                                                                               -, 
                                                                                                                                               PX_APP_ID,
                                                                                                                                               -, -, -, -, -, -,
                                                                                                                                               mw_link(
                                                                                                                                                       mw_link_type(
                                                                                                                                                                    PICS_ROOT_API & PX_APP_LCM_URI &  "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")))
                            ))))))) -> value v_response {
          tc_ac.stop;
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct 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_MEX_LCM_03_OK
    
    /**
     * @desc Check that MEC API provider fails on retrieving an App Instance when requested using wrong appInstanceId
     */
    testcase TC_MEC_MEC010p2_MEX_LCM_03_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;

      // Test control
      if (not(PICS_APP_PACKAGE_MANAGEMENT)){
        log("*** " & testcasename() & ": PICS_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_get(
                                                       PICS_ROOT_API & PX_APP_LCM_URI &  "/" & oct2char(unichar2oct(PX_NON_EXISTING_APP_INSTANCE_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 the correct 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_MEX_LCM_03_NF
    
    /**
     * @desc Check that MEC API provider service deletes an App Instance when requested
     */
    testcase TC_MEC_MEC010p2_MEX_LCM_04_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;

      // Test control
      if (not(PICS_APP_PACKAGE_MANAGEMENT)){
        log("*** " & testcasename() & ": PICS_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_APP_LCM_URI &  "/" & oct2char(unichar2oct(PX_APP_INSTANCE_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_204_no_content
                            )) -> value v_response {
          tc_ac.stop;
          log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct 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_MEX_LCM_04_OK
    
    /**
     * @desc Check that MEC API provider fails on deletion of an App Instance when requested using wrong appInstanceId
     */
    testcase TC_MEC_MEC010p2_MEX_LCM_04_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var Headers v_headers;
      var HttpMessage v_response;

      // Test control
      if (not(PICS_APP_PACKAGE_MANAGEMENT)){
        log("*** " & testcasename() & ": PICS_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_APP_LCM_URI &  "/" & oct2char(unichar2oct(PX_NON_EXISTING_APP_INSTANCE_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 the correct 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_MEX_LCM_04_NF
    
  } // End of group mex_lifcyclemgt
  
} // End of module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases