blob: 710e30111582056f6337d5b3ea1f23b2669c54c5 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
module EPTF_NameService_test {
import from EPTF_CLL_NameService_Definitions all;
import from EPTF_CLL_NameService_Functions all;
import from EPTF_CLL_NameServiceClient_Functions all;
type component EPTF_NS_Client_Test extends EPTF_NS_Client_CT {
timer t_wait := 0.5;
}
function f_EPTF_NS_Client_Behaviour_1(in charstring pl_selfName, in EPTF_NS_CT pl_NS_ServerCompRef) runs on EPTF_NS_Client_Test {
f_EPTF_NS_Client_init_CT(pl_selfName,pl_NS_ServerCompRef);
f_EPTF_NS_RegisterName("Name1",1);
var EPTF_NS_QueryResp vl_queryResp;
f_EPTF_NS_Query("Name2",vl_queryResp); // query item registered in another component
log("QueryResp Received: ", vl_queryResp);
f_EPTF_NS_Client_cleanup_CT();
t_wait.start;
alt {
[] t_wait.timeout {}
}
}
testcase tc_EPTF_NS_test() runs on EPTF_NS_Client_Test {
var EPTF_NS_CT vl_NS_Server := EPTF_NS_CT.create;
vl_NS_Server.start(f_EPTF_NS_main_CT("NameServiceServer"));
var EPTF_NS_Client_Test vl_NS_Client := EPTF_NS_Client_Test.create;
vl_NS_Client.start(f_EPTF_NS_Client_Behaviour_1("NS_Client#1",vl_NS_Server));
// I am another client:
f_EPTF_NS_Client_init_CT("NS_Client#2",vl_NS_Server);
f_EPTF_NS_RegisterName("Name2",1);
f_EPTF_NS_RegisterName("Name2",2); // try to register the same name with different id
f_EPTF_NS_DeregisterName("Name2");
f_EPTF_NS_RegisterName("Name2",2); // try to register the same name after deregistration
f_EPTF_NS_RegisterName("Name3",3); // register a new name
f_EPTF_NS_RegisterName("Name4"); // register a new name with id omit
var EPTF_NS_QueryResp vl_queryResp;
f_EPTF_NS_Query("Name3",vl_queryResp);
log("QueryResp Received: ", vl_queryResp);
f_EPTF_NS_Query("Name1",vl_queryResp); // query item registered in another component
log("QueryResp Received: ", vl_queryResp);
f_EPTF_NS_Query("Name0",vl_queryResp); // query an unregistered item
log("QueryResp Received: ", vl_queryResp);
f_EPTF_NS_Query("Name4",vl_queryResp); // query an registered item with id omit
log("QueryResp Received: ", vl_queryResp);
f_EPTF_NS_DeregisterName("Name2"); // deregister
f_EPTF_NS_DeregisterName("Name2"); // try to deregister the same name after deregistration
f_EPTF_NS_Client_cleanup_CT();
t_wait.start;
alt {
[] t_wait.timeout {}
}
setverdict(pass);
}
} // end of module