dexter has uploaded this change for review.

View Change

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(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/37/43537/1
diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn
index 7a8a937..410fb25 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);
}

@@ -504,22 +515,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));

@@ -561,22 +561,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));

@@ -623,20 +612,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);

@@ -905,20 +883,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));

@@ -948,22 +915,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 :=
{ { ipaEuiccDataError := "undefinedError" } };

- 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 change 43537. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9fe13b02ff7856ef3bd1a8a34655774e5e6676d9
Gerrit-Change-Number: 43537
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>