dexter has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43537?usp=email )

 (

1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: eIM_Tests: move boilerplate code into f_init_handler
......................................................................

eIM_Tests: move boilerplate code into f_init_handler

Each testcase calls a set of f_init_... functions. Those function calls
are the same for all testcases. Let's move them into f_init_handler

Related: SYS#8203
Change-Id: I9fe13b02ff7856ef3bd1a8a34655774e5e6676d9
---
M eim/eIM_Tests.ttcn
1 file changed, 11 insertions(+), 66 deletions(-)

Approvals:
  osmith: Looks good to me, approved
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve




diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn
index 5e0ee3e..14370b6 100644
--- a/eim/eIM_Tests.ttcn
+++ b/eim/eIM_Tests.ttcn
@@ -97,7 +97,18 @@
 private type function void_fn(charstring id) runs on eIM_ConnHdlr;

 private function f_init_handler(void_fn fn, charstring id, eIM_ConnHdlrPars 
pars) runs on eIM_ConnHdlr {
+       var HTTP_Adapter_Params http_adapter_pars;
        g_pars_EIM := pars;
+       f_http_register();
+
+       f_init_pipe();
+       http_adapter_pars := {
+               http_host := mp_esipa_ip,
+               http_port := mp_esipa_port,
+               use_ssl := not mp_esipa_disable_ssl
+       };
+       f_http_init(http_adapter_pars);
+
        fn.apply(id);
 }

@@ -505,22 +516,11 @@
  * See also: GSMA SGP.32, section 3.2.3.2: Indirect Profile Download */
 private function f_TC_proc_indirect_prfle_dwnld(charstring id) runs on 
eIM_ConnHdlr {
        var charstring resource_id;
-       var HTTP_Adapter_Params http_adapter_pars;
        var charstring smdpp_add := mp_es9p_ip & ":" & int2str(mp_es9p_port)
        var charstring activationCode := "1$" & smdpp_add & "$MyMatchingId"
        var template EsipaMessageFromEimToIpa esipa_res;
        var octetstring eimTransactionId;

-       f_http_register();
-
-       f_init_pipe();
-       http_adapter_pars := {
-               http_host := mp_esipa_ip,
-               http_port := mp_esipa_port,
-               use_ssl := not mp_esipa_disable_ssl
-       };
-       f_http_init(http_adapter_pars);
-
        /* Create a new download at the eIM */
        resource_id := f_rest_create_order("download", 
ts_JSON_REST_download_order(eID, activationCode));

@@ -562,22 +562,11 @@
  * See also: GSMA SGP.32, section 3.2.3.3: Cancel Session Procedure for 
Indirect Profile Download */
 private function f_TC_proc_indirect_prfle_dwnld_cancel_session(charstring id) 
runs on eIM_ConnHdlr {
        var charstring resource_id;
-       var HTTP_Adapter_Params http_adapter_pars;
        var charstring smdpp_add := mp_es9p_ip & ":" & int2str(mp_es9p_port)
        var charstring activationCode := "1$" & smdpp_add & "$MyMatchingId"
        var template EsipaMessageFromEimToIpa esipa_res;
        var octetstring eimTransactionId;

-       f_http_register();
-
-       f_init_pipe();
-       http_adapter_pars := {
-               http_host := mp_esipa_ip,
-               http_port := mp_esipa_port,
-               use_ssl := not mp_esipa_disable_ssl
-       };
-       f_http_init(http_adapter_pars);
-
        /* Create a new download at the eIM */
        resource_id := f_rest_create_order("download", 
ts_JSON_REST_download_order(eID, activationCode));

@@ -624,20 +613,9 @@
                                                            template (present) 
EuiccPackageResult euiccPackageResult)
 runs on eIM_ConnHdlr {
        var charstring resource_id;
-       var HTTP_Adapter_Params http_adapter_pars;
        var template EsipaMessageFromEimToIpa esipa_res;
        var template EuiccPackageSigned euiccPackageSigned := 
tr_euiccPackageSigned(euiccPackage);

-       f_http_register();
-
-       f_init_pipe();
-       http_adapter_pars := {
-               http_host := mp_esipa_ip,
-               http_port := mp_esipa_port,
-               use_ssl := not mp_esipa_disable_ssl
-       };
-       f_http_init(http_adapter_pars);
-
        /* Create a new download at the eIM */
        resource_id := f_rest_create_order(facility, order);

@@ -906,20 +884,9 @@
  * See also: GSMA SGP.32, section 2.11.1.2: IpaEuiccDataRequest */
 private function f_TC_proc_euicc_data_req(charstring id) runs on eIM_ConnHdlr {
        var charstring resource_id;
-       var HTTP_Adapter_Params http_adapter_pars;
        var template EsipaMessageFromEimToIpa esipa_res;
        var octetstring eimTransactionId;

-       f_http_register();
-
-       f_init_pipe();
-       http_adapter_pars := {
-               http_host := mp_esipa_ip,
-               http_port := mp_esipa_port,
-               use_ssl := not mp_esipa_disable_ssl
-       };
-       f_http_init(http_adapter_pars);
-
        /* Create a new download at the eIM */
        resource_id := f_rest_create_order("edr", ts_JSON_REST_edr_order(eID, 
'80BF20BF228384A5A688A9BF2B'O));

@@ -949,22 +916,11 @@
  * See also: GSMA SGP.32, section 2.11.1.2: IpaEuiccDataRequest */
 private function f_TC_proc_euicc_data_req_err(charstring id) runs on 
eIM_ConnHdlr {
        var charstring resource_id;
-       var HTTP_Adapter_Params http_adapter_pars;
        var template EsipaMessageFromEimToIpa esipa_res;
        var template octetstring eimTransactionId;
        var template JSON_REST_Results expected_outcome :=
                { { euiccDataResult := { edrResult := "undefinedError", 
euiccData := omit } } };

-       f_http_register();
-
-       f_init_pipe();
-       http_adapter_pars := {
-               http_host := mp_esipa_ip,
-               http_port := mp_esipa_port,
-               use_ssl := not mp_esipa_disable_ssl
-       };
-       f_http_init(http_adapter_pars);
-
        /* Create a new download at the eIM */
        resource_id := f_rest_create_order("edr", ts_JSON_REST_edr_order(eID, 
'80BF20BF228384A5A688A9BF2B'O));

@@ -993,21 +949,10 @@
 /* (see also above) Test enable PSMO */
 private function f_TC_proc_notifyStateChange(charstring id) runs on 
eIM_ConnHdlr {
        var charstring resource_id;
-       var HTTP_Adapter_Params http_adapter_pars;
        var template EsipaMessageFromEimToIpa esipa_res;
        var JSON_REST_Euicc_State euiccState;
        var JSON_REST_Result outcome;

-       f_http_register();
-
-       f_init_pipe();
-       http_adapter_pars := {
-               http_host := mp_esipa_ip,
-               http_port := mp_esipa_port,
-               use_ssl := not mp_esipa_disable_ssl
-       };
-       f_http_init(http_adapter_pars);
-
        /* Ensure that the stateChangeCauseList at the eIM is empty, for that 
we set the stateChangeCauseList to an
         * empty list. */
        euiccState.stateChangeCauseList := {};

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43537?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9fe13b02ff7856ef3bd1a8a34655774e5e6676d9
Gerrit-Change-Number: 43537
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to