blob: 76657ac5f5816dd2c383916c1f52ff6153126e14 [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_LoggingDS_TestCases
//
// Purpose:
// This module provides test for the Logging client/server
// functionality
//
// Module Parameters:
// -
//
// Module depends on:
// <>
//
// Current Owner:
// ELSZSKU
//
// Last Review Date:
// 2008-
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
module EPTF_LoggingDS_TestCases
{
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_Logging_Definitions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_LoggingClient_Functions all;
import from EPTF_CLL_DataSource_Functions all;
import from EPTF_CLL_DataSource_Definitions all;
import from EPTF_CLL_DataSourceClient_Functions all;
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_LoggingServer_Definitions all;
import from EPTF_CLL_LoggingServer_Functions all;
import from EPTF_CLL_Logging_Functions all;
friend module EPTF_LoggingDSGUI_TestCases;
//type EPTF_LoggingServer_CT LoggingDS_TestServer_CT
type record LoggingDS_EnabledVarIds {
integer globalVarId,
integer client1VarId,
integer client2VarId,
LoggingDS_EnabledVarIdsTypes CLLBoth,
LoggingDS_EnabledVarIdsTypes CLLSecond, //short
LoggingDS_EnabledVarIdsTypes UserBoth, //short
LoggingDS_EnabledVarIdsTypes UserSecond
}
//c_ctypeCLLSecond
//type record of EPTF_IntegerArray2D EPTF_IntegerArray3D;
type record LoggingDS_EnabledVarIdsTypes{
LoggingDS_EnabledVarIdsClasses global,
LoggingDS_EnabledVarIdsClasses client1,
LoggingDS_EnabledVarIdsClasses client2
}
type record LoggingDS_EnabledVarIdsClasses{
integer globalVarId,
integer debugVarId,
integer verboseVarId,
integer infoVarId
}
type record LoggingDS_EnabledStates {
boolean userBothDebug,
boolean userBothInfo,
boolean cllBothDebug,
boolean cllBothInfo
}
type component LoggingDS_Test_CT extends EPTF_LoggingClient_CT, EPTF_DataSource_CT{
const charstring c_clientName1 := "LoggingClient1"
const charstring c_clientName2 := "LoggingClient2"
//iterators
var integer v_LoggingDS_varId_clients;
var integer v_LoggingDS_varId_selectionTypes;
var integer v_LoggingDS_varId_typesCLL;
var integer v_LoggingDS_varId_typesUser;
var integer v_LoggingDS_varId_clientCTypeCLLBoth;
var integer v_LoggingDS_varId_clientCTypeUserBoth;
var integer v_LoggingDS_varId_clientCTypeCLLSecond;
var integer v_LoggingDS_varId_clientCTypeUserSecond;
var integer v_LoggingDS_varId_classesUserSecond;
var integer v_LoggingDS_varId_classesUserBoth;
var integer v_LoggingDS_varId_classesCLLBoth;
var integer v_LoggingDS_logTypeIdUserBoth;
var integer v_LoggingDS_logTypeIdCLLBoth;
var LoggingDS_EnabledVarIds v_LoggingDS_enabledData;
var EPTF_LoggingServer_CT v_LoggingDS_server;
var EPTF_LoggingClient_CT v_LoggingDS_client2;
}
const float c_LoggingDS_varSyncInterval := 0.1;
function f_LoggingDS_Test_serverBehavior(in EPTF_DataSource_CT pl_dsServer)
runs on EPTF_LoggingServer_CT{
f_EPTF_LoggingServer_init_CT(%definitionId, pl_dsServer);
f_EPTF_Var_setSyncInterval(c_LoggingDS_varSyncInterval);
f_EPTF_Base_wait4Shutdown();
}
const charstring c_ctypeCLLBoth := "TestCLLLogTypeOnBoth"
const charstring c_ctypeCLLSecond := "TestCLLLogTypeOnSecond"
const charstring c_ctypeUserBoth := "TestUserLogTypeOnBoth"
const charstring c_ctypeUserSecond := "TestUserLogTypeOnSecond"
const charstring c_logmaskDebug := "Debug";
const charstring c_logmaskDebugVerbose := "DebugVerbose"
const charstring c_logmaskInfo := "Info";
const integer c_logClassDebug := 0;
const integer c_logClassInfo := 1;
const integer c_logClassDebugVerbose := 2;
const EPTF_Logging_EventClassPrefixList c_loggingEventClasses := { c_logmaskDebug, c_logmaskInfo, c_logmaskDebugVerbose };
const EPTF_Logging_EventClassPrefixList c_loggingEventClassesShort := { c_logmaskDebug, c_logmaskInfo };
function f_LoggingDS_Test_clientBehavior(
in EPTF_LoggingServer_CT pl_server,
in charstring pl_selfName,
in EPTF_DataSource_CT pl_sourceCompRef,
in boolean pl_addSelections)
runs on EPTF_LoggingClient_CT{
f_EPTF_LoggingClient_init_CT(pl_selfName, pl_server, pl_sourceCompRef);
f_EPTF_Var_setSyncInterval(c_LoggingDS_varSyncInterval);
//Registers as a client
var integer vl_logTypeId := f_EPTF_Logging_registerComponentMasks(c_ctypeCLLBoth, c_loggingEventClasses, EPTF_Logging_CLL);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, c_logClassDebugVerbose);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, c_logClassDebug);
f_EPTF_Logging_disableLocalMask(vl_logTypeId, c_logClassInfo);
vl_logTypeId := f_EPTF_Logging_registerComponentMasks(c_ctypeCLLSecond, c_loggingEventClassesShort, EPTF_Logging_CLL);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, c_logClassDebug);
f_EPTF_Logging_disableLocalMask(vl_logTypeId, c_logClassInfo);
vl_logTypeId := f_EPTF_Logging_registerComponentMasks(c_ctypeUserBoth, c_loggingEventClassesShort, EPTF_Logging_user);
f_EPTF_Logging_disableLocalMask(vl_logTypeId, c_logClassDebug);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, c_logClassInfo);
vl_logTypeId := f_EPTF_Logging_registerComponentMasks(c_ctypeUserSecond, c_loggingEventClasses, EPTF_Logging_user);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, c_logClassDebugVerbose);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, c_logClassDebug);
f_EPTF_Logging_disableLocalMask(vl_logTypeId, c_logClassInfo);
if(pl_addSelections){
var integer vl_selection := f_EPTF_Logging_registerSelection("Debug");
//Register CLLBoth class
vl_logTypeId := f_EPTF_Logging_registerComponentMasks("AppLib_B", {"Traffic errors: "}, vl_selection);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, 0);
vl_selection := f_EPTF_Logging_registerSelection("Traffic");
//Register CLLBoth class
vl_logTypeId := f_EPTF_Logging_registerComponentMasks("AppLib_A", {"Traffic errors: "}, vl_selection);
f_EPTF_Logging_enableLocalMask(vl_logTypeId, 0);
}
//f_EPTF_Logging_logAll();
f_EPTF_Base_wait4Shutdown();
}
friend function f_LoggingDS_initConfig(in boolean pl_addSelections)
runs on LoggingDS_Test_CT{
f_LoggingDS_init();
f_LoggingDS_initClient();
f_LoggingDS_registerCLLBoth();
f_LoggingDS_registerUserBoth();
f_LoggingDS_createClient2(pl_addSelections);
timer t1;
t1.start(3.0*c_LoggingDS_varSyncInterval);
t1.timeout;
}
private function f_LoggingDSNeg_initConfig()
runs on LoggingDS_Test_Neg_CT{
f_EPTF_DataSource_init_CT(c_clientName1);
f_EPTF_Var_setSyncInterval(c_LoggingDS_varSyncInterval);
f_EPTF_LoggingServer_init_CT(c_clientName1, self);
v_LoggingDS_server := self;
f_LoggingDS_initClient();
f_LoggingDS_registerCLLBoth();
f_LoggingDS_registerUserBoth();
f_LoggingDS_createClient2(false);
timer t1;
t1.start(3.0*c_LoggingDS_varSyncInterval);
t1.timeout;
}
private function f_LoggingDS_init()
runs on LoggingDS_Test_CT{
f_EPTF_DataSource_init_CT(c_clientName1);
f_EPTF_Var_setSyncInterval(c_LoggingDS_varSyncInterval);
//Creates and starts a server
v_LoggingDS_server := EPTF_LoggingServer_CT.create;
v_LoggingDS_server.start( f_LoggingDS_Test_serverBehavior(self) );
f_EPTF_Logging_init_CT(c_clientName1);
}
private function f_LoggingDS_initClient()
runs on LoggingDS_Test_CT{
//Register logging client
f_EPTF_LoggingClient_init_CT(c_clientName1, v_LoggingDS_server, self);
}
private function f_LoggingDS_registerCLLBoth()
runs on LoggingDS_Test_CT{
//Register CLLBoth class
v_LoggingDS_logTypeIdCLLBoth := f_EPTF_Logging_registerComponentMasks(c_ctypeCLLBoth, c_loggingEventClasses, EPTF_Logging_CLL);
f_EPTF_Logging_enableLocalMask(v_LoggingDS_logTypeIdCLLBoth, c_logClassDebugVerbose);
f_EPTF_Logging_enableLocalMask(v_LoggingDS_logTypeIdCLLBoth, c_logClassDebug);
f_EPTF_Logging_disableLocalMask(v_LoggingDS_logTypeIdCLLBoth, c_logClassInfo);
}
private function f_LoggingDS_registerUserBoth()
runs on LoggingDS_Test_CT{
v_LoggingDS_logTypeIdUserBoth := f_EPTF_Logging_registerComponentMasks(c_ctypeUserBoth, c_loggingEventClassesShort, EPTF_Logging_user);
f_EPTF_Logging_enableLocalMask(v_LoggingDS_logTypeIdUserBoth, c_logClassDebug);
f_EPTF_Logging_disableLocalMask(v_LoggingDS_logTypeIdUserBoth, c_logClassInfo);
}
//Creates a new client, and registers classes
private function f_LoggingDS_createClient2(in boolean pl_addSelections)
runs on LoggingDS_Test_CT{
v_LoggingDS_client2 := EPTF_LoggingClient_CT.create;
v_LoggingDS_client2.start( f_LoggingDS_Test_clientBehavior(v_LoggingDS_server, c_clientName2, self, pl_addSelections) );
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_elements
//
// Purpose:
// Tests the behavior client-server features of the Logging
// and their DataSource client
//
// Detailed Comments:
// - There are 2 clients in the test: "LoggingClient1" and "LoggingClient2".
// - The MTC extends the EPTF_DataSource_CT and the EPTF_LoggingClient_CT.
// - After the initialization of the DataSource, it starts
// a new PTC, which is the Logging server.
// - First the test verifies the iterators of the Logging Server when
// there are no clients connected.
// - Then initializes the LoggingClient CT, but does not register logmasks yet.
// - After it verifies the "Clients" iterator, which must now contain the new client.
// - Registers a new component type, "CLLBoth" under the "CLL" selection.
// - Verifies the change of the "ComponentTypes" iterator.
// - Registers a new type, "UserBoth" under the "User" selection.
// - Verifies the change of the "ComponentTypes" iterators for both selections.
// - Starts a new client, "LoggingClient2", which registers
// "CLLBoth", "UserBoth", "CLLSecond" and "UserSecond" type under the
// selections indicated in their names.
// - Verifies the "Clients" iterator, which must now contain the new client.
// - Verifies the change of the "ComponentTypes" iterators for both selections.
// - Verifies the "Clients" iterator for "CLLBoth", "UserBoth", "CLLSecond" and "UserSecond" types.
// - Verifies the change of the "ComponentTypes" iterator for both selections.
// - Verifies the "Classes" iterator for "CLLBoth", "UserBoth", "CLLSecond" and "UserSecond" types.
// - After verifying the iterators, it verifies the enabled states.
// - First tries to get the DataSource variables for
// - global logging
// - global logging for "CLLBoth", "UserBoth", "CLLSecond" and "UserSecond" types and for their log classes
// - client logging on clients
// - logging for "CLLBoth", "UserBoth", "CLLSecond" and "UserSecond" types
// and for their log classes on both clients
// - After getting the DataSource variables tests the way from Logging <f_EPTF_Logging_enableLocalMask>
// to the data sources. Compares the values of the DataSource elements of the class log enable states to the
// expected state according to the previous <f_EPTF_Logging_enableLocalMask> calls.
// - Enables/disables some class logs and type logs, and verifies if the appropriate
// external data values changed properly.
// - Finally verifies the way from DataSource elements to the logging enabled states.
// - First on clients:
// Sets class log, type log and client log enabled state, then checks with <f_EPTF_Logging_isEnabled>
// function if the appropriate class logs are enabled/disabled properly.
// - The it repeats the verification setting the global enabled states on the server.
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_elements() runs on LoggingDS_Test_CT
{
const EPTF_CharstringList c_Logging_selectionList := {"EPTF_CLL", "EPTF_User"};
//Init Logging, start DS server
f_LoggingDS_init();
timer t_guard;
t_guard.start( 0.55 );
t_guard.timeout;
f_LoggingDS_getVar(v_LoggingDS_varId_clients,c_LoggingServer_sourceId, c_LoggingServer_iteratorClients);
//Here the clients list must be empty, since no one registered
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_clients, {}, c_LoggingServer_iteratorClients);
//Selections
f_LoggingDS_getVar(v_LoggingDS_varId_selectionTypes,c_LoggingServer_sourceId, c_LoggingServer_iteratorSelectionTypes);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_selectionTypes,c_Logging_selectionList,c_LoggingServer_iteratorSelectionTypes);
//Register logging client
f_LoggingDS_initClient();
//The synchronization happens here
t_guard.start( 0.25 );
t_guard.timeout;
f_LoggingDS_getVar(v_LoggingDS_varId_typesCLL,c_LoggingServer_sourceId, c_LoggingServer_iteratorComponentTypes,{{c_LoggingServer_paramNameSelection,c_Logging_selectionList[EPTF_Logging_CLL]}});
var EPTF_CharstringList vl_cllTypes := f_EPTF_Var_getCharstringlistValue(v_LoggingDS_varId_typesCLL);
//Check client list
//It must contain only this client
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_clients,{c_clientName1},c_LoggingServer_iteratorClients);
//Register CLLBoth class
f_LoggingDS_registerCLLBoth();
t_guard.start( 0.15 );
t_guard.timeout;
//Check initial environment
if(not f_EPTF_Logging_isEnabled(v_LoggingDS_logTypeIdCLLBoth, c_logClassDebugVerbose)){
setverdict ( inconc,"Initial DebugVerbose logging is disabled!" );
f_EPTF_Base_stopAll(fail);
}
if(not f_EPTF_Logging_isEnabled(v_LoggingDS_logTypeIdCLLBoth, c_logClassDebug)){
setverdict ( inconc,"Initial DebugNormal logging is disabled!" );
f_EPTF_Base_stopAll(fail);
}
if(f_EPTF_Logging_isEnabled(v_LoggingDS_logTypeIdCLLBoth, c_logClassInfo)){
setverdict ( inconc,"Initial Info logging is enabled!" );
f_EPTF_Base_stopAll(fail);
}
//c_LoggingServer_iteratorComponentTypes, first client only
//Now the last registered type is the last in the list. If it changed, the test shall be changed.
vl_cllTypes[sizeof(vl_cllTypes)]:=c_ctypeCLLBoth;
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_typesCLL,vl_cllTypes,c_LoggingServer_iteratorComponentTypes&", {"&c_ctypeCLLBoth&"}");
f_LoggingDS_registerUserBoth();
t_guard.start( 0.25 );
t_guard.timeout;
f_LoggingDS_getVar(v_LoggingDS_varId_typesUser,c_LoggingServer_sourceId, c_LoggingServer_iteratorComponentTypes,{{c_LoggingServer_paramNameSelection,c_Logging_selectionList[EPTF_Logging_user]}});
//Now the last registered type is the last in the list. If it changed, the test shall be changed.
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_typesUser,{c_ctypeUserBoth},c_LoggingServer_iteratorComponentTypes);
//Creates a new client, and registers classes
f_LoggingDS_createClient2(false)
t_guard.start( 0.4 );
t_guard.timeout;
//The client list must contain two clients
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_clients,{c_clientName1, c_clientName2},c_LoggingServer_iteratorClients);
//Clients list for c_ctypeCLLBoth must contain both clients
f_LoggingDS_getVar(
v_LoggingDS_varId_clientCTypeCLLBoth,
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClients,
{{c_LoggingServer_paramNameComponentType,c_ctypeCLLBoth}}
);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_clientCTypeCLLBoth,{c_clientName1, c_clientName2},
c_LoggingServer_iteratorClients&", {"&c_LoggingServer_paramNameComponentType&":="&c_ctypeCLLBoth&"}");
//Clients list for c_ctypeUserBoth must contain both clients
f_LoggingDS_getVar(v_LoggingDS_varId_clientCTypeUserBoth,
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClients,
{{c_LoggingServer_paramNameComponentType,c_ctypeUserBoth}}
);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_clientCTypeUserBoth,{c_clientName1, c_clientName2},
c_LoggingServer_iteratorClients&", {"&c_LoggingServer_paramNameComponentType&":="&c_ctypeUserBoth&"}");
//Clients list for c_ctypeCLLSecond must contain only the second client
f_LoggingDS_getVar(v_LoggingDS_varId_clientCTypeCLLSecond,
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClients,
{{c_LoggingServer_paramNameComponentType,c_ctypeCLLSecond}}
);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_clientCTypeCLLSecond,{c_clientName2},
c_LoggingServer_iteratorClients&", {"&c_LoggingServer_paramNameComponentType&":="&c_ctypeUserSecond&"}");
//Clients list for c_ctypeUserSecond must contain only the second client
f_LoggingDS_getVar(v_LoggingDS_varId_clientCTypeUserSecond,
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClients,
{{c_LoggingServer_paramNameComponentType,c_ctypeUserSecond}}
);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_clientCTypeUserSecond,{c_clientName2},
c_LoggingServer_iteratorClients&", {"&c_LoggingServer_paramNameComponentType&":="&c_ctypeUserSecond&"}");
//c_LoggingServer_iteratorComponentTypes, both clients
vl_cllTypes[sizeof(vl_cllTypes)]:=c_ctypeCLLSecond;
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_typesCLL,vl_cllTypes,c_LoggingServer_iteratorComponentTypes&", {"&c_ctypeCLLSecond&"}");
//c_LoggingServer_iteratorComponentTypes, both clients
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_typesUser,{c_ctypeUserBoth,c_ctypeUserSecond},c_LoggingServer_iteratorComponentTypes&", {"&c_ctypeUserSecond&"}");
//c_LoggingServer_iteratorClasses
f_LoggingDS_getVar(v_LoggingDS_varId_classesUserSecond,
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClasses,
{{c_LoggingServer_paramNameComponentType,c_ctypeUserSecond}}
);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_classesUserSecond,
c_loggingEventClasses,c_LoggingServer_iteratorClasses,{{c_LoggingServer_paramNameComponentType,c_ctypeUserSecond}});
f_LoggingDS_getVar(v_LoggingDS_varId_classesUserBoth,
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClasses,
{{c_LoggingServer_paramNameComponentType,c_ctypeUserBoth}}
);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_classesUserBoth,
c_loggingEventClassesShort,c_LoggingServer_iteratorClasses,{{c_LoggingServer_paramNameComponentType,c_ctypeUserBoth}});
f_LoggingDS_getVar(v_LoggingDS_varId_classesCLLBoth,
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClasses,
{{c_LoggingServer_paramNameComponentType,c_ctypeCLLBoth}}
);
f_LoggingDS_checkIteratorContent(v_LoggingDS_varId_classesCLLBoth,c_loggingEventClasses,c_LoggingServer_iteratorClasses,{{c_LoggingServer_paramNameComponentType,c_ctypeCLLBoth}});
//Enabled states - build up the tree
//Global
f_LoggingDS_getVar(v_LoggingDS_enabledData.globalVarId,
c_LoggingServer_sourceId,
c_LoggingServer_dataElementLogEnabled);
//Component type
//Global enabled states
//Classes for CLLBoth
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.CLLBoth.global, "", c_ctypeCLLBoth, false);
//Classes for CLLSecond
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.CLLSecond.global, "", c_ctypeCLLSecond, true);
//Classes for UserBoth
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.UserBoth.global, "", c_ctypeUserBoth, true);
//Classes for UserSecond
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.UserSecond.global, "", c_ctypeUserSecond, false);
//Clients
//"LoggingClient1"
f_LoggingDS_getVar(v_LoggingDS_enabledData.client1VarId,
c_LoggingClient_sourceId,
c_LoggingServer_dataElementLogEnabled,
{},
c_clientName1);
//Classes on client1
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.CLLBoth.client1, c_clientName1, c_ctypeCLLBoth, false);
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.UserBoth.client1, c_clientName1, c_ctypeUserBoth, true);
//"LoggingClient2"
f_LoggingDS_getVar(v_LoggingDS_enabledData.client2VarId,
c_LoggingClient_sourceId,
c_LoggingServer_dataElementLogEnabled,
{},
c_clientName2);
//Classes on client2
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.CLLBoth.client2, c_clientName2, c_ctypeCLLBoth, false);
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.CLLSecond.client2, c_clientName2, c_ctypeCLLSecond, true);
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.UserBoth.client2, c_clientName2, c_ctypeUserBoth, true);
f_LoggingDS_getVarIds(v_LoggingDS_enabledData.UserSecond.client2, c_clientName2, c_ctypeUserSecond, false);
//---------------------------------------------------------
//Tests the way from Logging f_EPTF_Logging_enableLocalMask to the data sources
//Check enabled value 4 c_ctypeUserSecond, c_logClassInfo on client2. Must be false, since the client behavior disables it.
if(f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserSecond.client2.infoVarId)){
setverdict(fail,"enabled value 4 c_ctypeUserSecond, c_logClassInfo on client2 must be false.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 c_ctypeUserSecond, c_logClassInfo on client2. Must be false, since the client behavior enables it.
if(not f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserSecond.client2.debugVarId)){
setverdict(fail,"enabled value 4 c_ctypeUserSecond, debug on client2 must be true.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 UserBoth, c_logClassInfo on client2. Must be true.
if(not f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client2.infoVarId)){
setverdict(fail,"enabled value 4 UserBoth, c_logClassInfo on client2 must be true.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 c_ctypeUserSecond, c_logClassInfo on client2. Must be false.
if(f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client2.debugVarId)){
setverdict(fail,"enabled value 4 c_ctypeUserSecond, debug on client2 must be false.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 UserBoth, c_logClassInfo on client1. Must be false.
if(f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client1.infoVarId)){
setverdict(fail,"enabled value 4 UserBoth, info on client1 must be false.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 c_ctypeUserSecond, c_logClassInfo on client1. Must be false.
if(not f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client1.debugVarId)){
setverdict(fail,"enabled value 4 UserBoth, debug on client1 must be true.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 UserBoth on client1 class independent. Must be true.
if(not f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client1.globalVarId)){
setverdict(fail,"enabled value 4 UserBoth, class independent on client1 must be true.");
f_EPTF_Base_stopAll(fail);
}
//Change the enabled state on client1 4 UserBoth, c_logClassInfo
f_EPTF_Logging_enableLocalMask(v_LoggingDS_logTypeIdUserBoth, c_logClassInfo);
f_EPTF_Logging_disableLocalMask(v_LoggingDS_logTypeIdUserBoth, c_logClassDebug);
f_EPTF_Logging_disableLocal(v_LoggingDS_logTypeIdCLLBoth);
t_guard.start( 0.15 );
t_guard.timeout;
//Check enabled value 4 UserBoth, c_logClassInfo on client1. Must be true now.
if(not f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client1.infoVarId)){
setverdict(fail,"enabled value 4 UserBoth, c_logClassInfo on client1 must be changed to true.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 c_ctypeUserSecond, c_logClassInfo on client1. Must be changed to false.
if(f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client1.debugVarId)){
setverdict(fail,"enabled value 4 UserBoth, debug on client1 must be changed to false.");
f_EPTF_Base_stopAll(fail);
}
//Check enabled value 4 UserBoth on client1 class independent. Must be changed to false.
if(not f_EPTF_Var_getBoolValue(v_LoggingDS_enabledData.UserBoth.client1.globalVarId)){
setverdict(fail,"enabled value 4 UserBoth on client1 class independent. Must be changed to false.");
f_EPTF_Base_stopAll(fail);
}
f_EPTF_Logging_enableLocalMask(v_LoggingDS_logTypeIdUserBoth, c_logClassInfo);
f_EPTF_Logging_enableLocalMask(v_LoggingDS_logTypeIdCLLBoth, c_logClassInfo);
f_EPTF_Logging_enableLocal(v_LoggingDS_logTypeIdCLLBoth);
//------------------------------------------------
//Tests the way from data sources to the Logging f_EPTF_Logging_isEnabled.
//Client data sources
//Class of CT on client (lowest) level. ----
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.client1.debugVarId,{boolVal := false});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates(pl_userBothDebug := false)
//Set back
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.client1.debugVarId,{boolVal := true});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates();
//CT on client level ----
//Disable component type log 4 UserBoth on client1
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.client1.globalVarId,{boolVal := false});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates(pl_userBothDebug := false, pl_userBothInfo := false);
//Set back
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.client1.globalVarId,{boolVal := true});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates();
//Client level ----
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.client1VarId,{boolVal := false});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates(false,false,false,false);
//Set back
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.client1VarId,{boolVal := true});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates();
//Server side data sources
//Class of CT level. ----
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.global.debugVarId,{boolVal := false});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates(pl_userBothDebug := false);
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.global.debugVarId,{boolVal := true});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates();
//Class level. ----
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.global.globalVarId,{boolVal := false});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates(pl_userBothDebug := false, pl_userBothInfo := false);
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.UserBoth.global.globalVarId,{boolVal := true});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates();
//Global
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.globalVarId,{boolVal := false});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates(false,false,false,false);
f_EPTF_Var_adjustContent(v_LoggingDS_enabledData.globalVarId,{boolVal := true});
t_guard.start( 0.15 );
t_guard.timeout;
f_LoggingDS_checkEnabledStates();
f_EPTF_Base_stop(pass);
}
private function f_LoggingDS_checkEnabledStates(
boolean pl_userBothDebug := true,
boolean pl_userBothInfo := true,
boolean pl_cllBothDebug := true,
boolean pl_cllBothInfo := true
)
runs on LoggingDS_Test_CT{
var LoggingDS_EnabledStates vl_states;
f_LoggingDS_getEnabled(vl_states);
var template LoggingDS_EnabledStates tl_expectedStates := {pl_userBothDebug,pl_userBothInfo,pl_cllBothDebug,pl_cllBothInfo};
if(not match ( vl_states, tl_expectedStates )){
setverdict ( fail, log2str(match ( vl_states, tl_expectedStates )) );
log("Expected: ",tl_expectedStates);
log("Received: ",vl_states);
f_EPTF_Base_stopAll(fail);
}
}
private function f_LoggingDS_getEnabled(out LoggingDS_EnabledStates pl_states)
runs on LoggingDS_Test_CT{
pl_states.cllBothDebug := f_EPTF_Logging_isEnabled(v_LoggingDS_logTypeIdCLLBoth, c_logClassDebug)
pl_states.cllBothInfo := f_EPTF_Logging_isEnabled(v_LoggingDS_logTypeIdCLLBoth, c_logClassInfo)
pl_states.userBothDebug := f_EPTF_Logging_isEnabled(v_LoggingDS_logTypeIdUserBoth, c_logClassDebug)
pl_states.userBothInfo := f_EPTF_Logging_isEnabled(v_LoggingDS_logTypeIdUserBoth, c_logClassInfo)
}
private function f_LoggingDS_getDataVar(
in charstring pl_source,
in charstring pl_ptcName := "",
in charstring pl_element,
in EPTF_DataSource_Params pl_params := {},
in EPTF_Var_SubscriptionMode pl_subscriptionMode := tsp_EPTF_DataSource_subscriptionMode,
in integer pl_refreshRate := tsp_EPTF_DataSource_refreshRate
) runs on LoggingDS_Test_CT return integer {
var integer vl_ret := -1;
var charstring vl_dataVarName;
if(0 == f_EPTF_DataSource_getData(vl_dataVarName, pl_source, pl_ptcName, pl_element, pl_params, pl_subscriptionMode, pl_refreshRate)){
vl_ret := f_EPTF_Var_getId(vl_dataVarName);
}
return vl_ret;
}
private function f_LoggingDS_getVar(
out integer pl_varId,
in charstring pl_source,
in charstring pl_element,
in EPTF_DataSource_Params pl_params := {},
in charstring pl_ptcName := "")
runs on LoggingDS_Test_CT{
pl_varId := f_LoggingDS_getDataVar(pl_source, pl_ptcName, pl_element, pl_params, realtime);
if(0 > pl_varId){
setverdict ( fail, "DS variable for "&pl_element&" not found! Params: ",pl_params );
f_EPTF_Base_stopAll(fail);
}
}
private function f_LoggingDS_checkIteratorContent(
in integer pl_varId,
in EPTF_CharstringList pl_expected,
in charstring pl_iteratorName,
in EPTF_DataSource_Params pl_params := {})
runs on LoggingDS_Test_CT{
var EPTF_CharstringList vl_temp :=
f_EPTF_Var_getCharstringlistValue(pl_varId);
if(not match ( vl_temp, pl_expected )){
setverdict ( fail, "Content of iterator "&pl_iteratorName&" does not match:",match( vl_temp, pl_expected ),"\n Parameters: ",pl_params );
f_EPTF_Base_stopAll(fail);
}
}
private function f_LoggingDS_getVarIds(
inout LoggingDS_EnabledVarIdsClasses pl_tree,
in charstring pl_client,
in charstring pl_type,
in boolean pl_short)
runs on LoggingDS_Test_CT{
//action("Client: ",pl_client,", Type: ",pl_type);
var charstring vl_source := c_LoggingServer_sourceId
if("" != pl_client){
vl_source := c_LoggingClient_sourceId;
}
var EPTF_DataSource_Params vl_params := {{c_LoggingServer_paramNameComponentType,pl_type}}
f_LoggingDS_getVar(pl_tree.globalVarId,
vl_source,
c_LoggingServer_dataElementLogEnabled,
vl_params,
pl_client
);
//Classes
vl_params[1] := {c_LoggingServer_paramNameClass,c_logmaskDebug};
f_LoggingDS_getVar(pl_tree.debugVarId,
vl_source,
c_LoggingServer_dataElementLogEnabled,
vl_params,
pl_client
);
if(not pl_short){
vl_params[1] := {c_LoggingServer_paramNameClass,c_logmaskDebugVerbose};
f_LoggingDS_getVar(pl_tree.verboseVarId,
vl_source,
c_LoggingServer_dataElementLogEnabled,
vl_params,
pl_client
);
}
vl_params[1] := {c_LoggingServer_paramNameClass,c_logmaskInfo};
f_LoggingDS_getVar(pl_tree.infoVarId,
vl_source,
c_LoggingServer_dataElementLogEnabled,
vl_params,
pl_client
);
}
group negative{
type component LoggingDS_Test_Neg_CT extends LoggingDS_Test_CT, EPTF_LoggingServer_CT{
var charstring v_LoggingDS_expectedWarningMsg;
var boolean v_LoggingDS_expectedWarningReceived := false;
}
///////////////////////////////////////////////////////////
// Function: f_LoggingDS_Test_Neg
//
// Purpose:
// Initializes a configuration similar to the described in
// <tc_LoggingDS_elements>, except that the logging sever is on the
// MTC, just as the first client and the DataSource server.
// If someone tries to get an iterator or external data element with
// invalid parameters, the DataSource clients must write a warning
// which contains the name of the invalid parameter, and the name of
// the element to be get.
// The test
// - registers a preamble function for the logging: <f_LoggingDS_Test_Neg_preambleFn>
// - registers a cleanup function, which checks the flag set by the <f_LoggingDS_Test_Neg_preambleFn>
// - tries to retrieve an iterator or external data element
// specified by the parameters
// - the cleanup sets the verdict according the flag
//
///////////////////////////////////////////////////////////
private function f_LoggingDS_Test_Neg(
in charstring pl_expectedMsg,
in charstring pl_source,
in charstring pl_element,
in EPTF_DataSource_Params pl_params := {},
in charstring pl_ptcName := ""
)
runs on LoggingDS_Test_Neg_CT{
f_LoggingDSNeg_initConfig();
f_EPTF_Base_registerCleanup(refers(f_LoggingDS_Test_Neg_cleanup));
f_EPTF_Logging_registerPreambleFn(refers( f_LoggingDS_Test_Neg_preambleFn ));
v_LoggingDS_expectedWarningMsg := pl_expectedMsg&pl_element&"*";
var integer vl_varId := f_LoggingDS_getDataVar(pl_source, pl_ptcName, pl_element, pl_params);
if(-1 != vl_varId){
setverdict(fail,"DataSource '"&pl_source&" should return -1 for variable of pl_element. It returned "&int2str(vl_varId)&", the id of "&f_EPTF_Var_getName(vl_varId));
}
f_EPTF_Base_stopAll(pass);
}
private function f_LoggingDS_Test_Neg_cleanup() runs on LoggingDS_Test_Neg_CT{
if(not v_LoggingDS_expectedWarningReceived){
setverdict(fail,"Expected '"&v_LoggingDS_expectedWarningMsg&"' message not received.")
}
}
///////////////////////////////////////////////////////////
// Function: f_LoggingDS_Test_Neg_preambleFn
//
// Purpose:
// Matches the received log statement with an expected one.
// If matched, sets a flag to true.
//
///////////////////////////////////////////////////////////
private function f_LoggingDS_Test_Neg_preambleFn(in charstring pl_message)
runs on LoggingDS_Test_Neg_CT {
if (not match(pl_message,pattern "*Warning*")) {
return;
}
if (match(pl_message,pattern v_LoggingDS_expectedWarningMsg)) {
v_LoggingDS_expectedWarningReceived := true;
}
}
//-------------------
//Server side iterators
//-------------------
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_iterators_badElem
//
// Purpose:
// Tries to get an invalid element.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_iterators_badElem() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*",
c_LoggingServer_sourceId,
"bubu",
{{"malacka","mikkamakka"}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_iteratorSelectionTypes
//
// Purpose:
// SelectionTypes iterator has no parameters. Tests with
// an invalid parameter.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_iteratorSelectionTypes_badParam() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorSelectionTypes,
{{"bubu","mikkamakka"}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_Clients_badParamName
//
// Purpose:
// Clients iterator has an optional parameter, <c_LoggingServer_paramNameComponentType>.
// This test checks with invalid parameter name.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_Clients_badParamName() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorSelectionTypes,
{{"bubu",c_ctypeCLLBoth}});
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_Clients_badParamContent
//
// Purpose:
// Clients iterator has an optional parameter, <c_LoggingServer_paramNameComponentType>.
// This test checks with invalid component type name parameter.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_Clients_badParamContent() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClients,
{{c_LoggingServer_paramNameComponentType,"bubu"}})
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_ComponentTypes_badParamName
//
// Purpose:
// ComponentTypes iterator has a mandatory parameter, <paramNameSelection>.
// This test checks with invalid parameter name.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_ComponentTypes_badParamName() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorComponentTypes,
{{"bubu","mikkamakka"}})
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_ComponentTypes_badParamContent
//
// Purpose:
// ComponentTypes iterator has a mandatory parameter, <paramNameSelection>.
// This test checks with invalid parameter content.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_ComponentTypes_badParamContent() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorComponentTypes,
{{c_LoggingServer_paramNameSelection,"bubu"}})
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_ComponentTypes_noParam
//
// Purpose:
// ComponentTypes iterator has a mandatory parameter, <paramNameSelection>.
// This test checks without parameter.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_ComponentTypes_noParam() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*mpty*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorComponentTypes,
{})
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_Classes_noParam
//
// Purpose:
// ComponentTypes iterator has a mandatory parameter, <c_LoggingServer_paramNameComponentType>.
// This test checks without parameter.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_Classes_noParam() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*mpty*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClasses,
{})
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_Classes_badParamContent
//
// Purpose:
// ComponentTypes iterator has a mandatory parameter, <c_LoggingServer_paramNameComponentType>.
// This test checks with invalid parameter content.
// See also: <f_LoggingDS_Test_Neg>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_Classes_badParamContent() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingServer_sourceId,
c_LoggingServer_iteratorClasses,
{{c_LoggingServer_paramNameComponentType,"bubu"}})
}
//Server side c_LoggingServer_dataElementLogEnabled
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_Enabled_badCTypeName
//
// Purpose:
// Tests retrieving the LogEnabled data element if the <c_LoggingServer_paramNameComponentType>
// has an invalid content.
// See also: <f_LoggingDS_Test_Neg>, <c_LoggingServer_dataElementLogEnabled>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_Enabled_badCTypeName() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingServer_sourceId,
c_LoggingServer_dataElementLogEnabled,
{
{c_LoggingServer_paramNameComponentType,"bubu"},
{c_LoggingServer_paramNameClass,c_logmaskDebug}
})
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_Enabled_badClassName
//
// Purpose:
// Tests retrieving the LogEnabled data element if the <c_LoggingServer_paramNameClass>
// has an invalid content.
// See also: <f_LoggingDS_Test_Neg>, <c_LoggingServer_dataElementLogEnabled>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_Enabled_badClassName() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*"&c_logmaskDebugVerbose&"*",
c_LoggingServer_sourceId,
c_LoggingServer_dataElementLogEnabled,
{
{c_LoggingServer_paramNameComponentType,c_ctypeCLLSecond},
{c_LoggingServer_paramNameClass,c_logmaskDebugVerbose}
})
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_Enabled_noCType
//
// Purpose:
// Tests retrieving the LogEnabled data element if the <c_LoggingServer_paramNameClass>
// is set, but c_LoggingServer_paramNameComponentType is not.
// See also: <f_LoggingDS_Test_Neg>, <c_LoggingServer_dataElementLogEnabled>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_Enabled_noCType() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*"&c_LoggingServer_paramNameComponentType&"*",
c_LoggingServer_sourceId,
c_LoggingServer_dataElementLogEnabled,
{
{c_LoggingServer_paramNameClass,c_ctypeCLLBoth}
})
}
//Client side c_LoggingClient_dataElementLogEnabled
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_ClientEnabled_badCTypeName
//
// Purpose:
// Tests retrieving the LogEnabled data element if the <c_LoggingServer_paramNameComponentType>
// has an invalid content.
// See also: <f_LoggingDS_Test_Neg>, <c_LoggingServer_dataElementLogEnabled>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_ClientEnabled_badCTypeName() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*bubu*",
c_LoggingClient_sourceId,
c_LoggingClient_dataElementLogEnabled,
{
{c_LoggingClient_paramNameComponentType,"bubu"},
{c_LoggingClient_paramNameClass,c_logmaskDebug}
},
c_clientName1)
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_ClientEnabled_badClassName
//
// Purpose:
// Tests retrieving the LogEnabled data element if the <c_LoggingClient_paramNameClass>
// has an invalid content.
// See also: <f_LoggingDS_Test_Neg>, <c_LoggingClient_dataElementLogEnabled>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_ClientEnabled_badClassName() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*"&c_logmaskDebugVerbose&"*",
c_LoggingClient_sourceId,
c_LoggingClient_dataElementLogEnabled,
{
{c_LoggingClient_paramNameComponentType,c_ctypeUserBoth},
{c_LoggingClient_paramNameClass,c_logmaskDebugVerbose}
},
c_clientName1)
}
///////////////////////////////////////////////////////////
// Testcase: tc_LoggingDS_ClientEnabled_noCType
//
// Purpose:
// Tests retrieving the LogEnabled data element if the <c_LoggingClient_paramNameClass>
// is set, but c_LoggingClient_paramNameComponentType is not.
// See also: <f_LoggingDS_Test_Neg>, <c_LoggingClient_dataElementLogEnabled>
//
///////////////////////////////////////////////////////////
testcase tc_LoggingDS_ClientEnabled_noCType() runs on LoggingDS_Test_Neg_CT{
f_LoggingDS_Test_Neg(
"*"&c_LoggingClient_paramNameComponentType&"*",
c_LoggingClient_sourceId,
c_LoggingClient_dataElementLogEnabled,
{
{c_LoggingClient_paramNameClass,c_ctypeCLLBoth}
},
c_clientName1)
}
}
group Help {
type component Logging_HelpTest_CT extends LoggingDS_Test_CT {
var boolean v_Logging_ready := false;
var boolean v_LoggingClient_ready := false;
}
function f_EPTF_Logging_Test_checkLoggingReady(
in charstring pl_source,
in charstring pl_ptcName
) runs on Logging_HelpTest_CT {
if (pl_source == c_LoggingServer_sourceId) {
v_Logging_ready := true;
}
if (pl_source == c_LoggingClient_sourceId) {
v_LoggingClient_ready := true;
}
}
function f_EPTF_Logging_Test_helpCheck(in charstring pl_source := "", in charstring pl_element := "", in charstring pl_expectedPattern := "") runs on Logging_HelpTest_CT {
var charstring vl_helpTEXT;
var octetstring vl_helpJSON;
vl_helpTEXT := f_EPTF_DataSource_getHelpTEXT(pl_source, pl_element);
action("Help for "&pl_source&": ", vl_helpTEXT);
if (pl_expectedPattern!="") {
// check if the TEXT help contains the pattern:
if(not match(vl_helpTEXT,pattern pl_expectedPattern)) {
setverdict(fail,"The TEXT help does not match the expected pattern: ", match(vl_helpTEXT,pattern pl_expectedPattern));
f_EPTF_Base_stop(none);
}
}
vl_helpJSON := f_EPTF_DataSource_getHelpJSON(pl_source,pl_element);
action("HelpJSON for "&pl_source&": ", vl_helpJSON);
}
testcase tc_EPTF_Logging_Test_help() runs on Logging_HelpTest_CT {
f_EPTF_DataSource_init_CT("MTC");
v_Logging_ready := false;
v_LoggingClient_ready := false;
f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_Logging_Test_checkLoggingReady));
f_LoggingDS_init();
f_LoggingDS_createClient2(false);
timer t1;
t1.start(2.0);
t1.timeout;
/* timer T_guard, T_alt;
T_guard.start( 100.0 );
T_alt.start( 0.0 );
alt{
[] T_guard.timeout{
setverdict(fail,"Timeout during config");
f_EPTF_Base_stopAll();
}
[v_Logging_ready and v_LoggingClient_ready] T_alt.timeout{}
};*/
// Logging
f_EPTF_Logging_Test_helpCheck(pl_source := c_LoggingServer_sourceId,pl_expectedPattern := "*Source: \""&c_LoggingServer_sourceId&"\"\n\n*DataElement: \"help\"*")
// LoggingClient:
f_EPTF_Logging_Test_helpCheck(pl_source := c_LoggingClient_sourceId,pl_expectedPattern := "*Source: \""&c_LoggingClient_sourceId&"\"\n\n*DataElement: \"help\"*")
setverdict(pass);
f_EPTF_Base_stop(none);
}
} //group Help
control{
execute(tc_LoggingDS_elements());
execute(tc_LoggingDS_iterators_badElem());
execute(tc_LoggingDS_iteratorSelectionTypes_badParam());
execute(tc_LoggingDS_Clients_badParamName());
execute(tc_LoggingDS_Clients_badParamContent());
execute(tc_LoggingDS_ComponentTypes_badParamName());
execute(tc_LoggingDS_ComponentTypes_badParamContent());
execute(tc_LoggingDS_ComponentTypes_noParam());
execute(tc_LoggingDS_Classes_noParam());
execute(tc_LoggingDS_Classes_badParamContent());
execute(tc_LoggingDS_Enabled_badCTypeName());
execute(tc_LoggingDS_Enabled_badClassName());
execute(tc_LoggingDS_Enabled_noCType());
execute(tc_LoggingDS_ClientEnabled_badCTypeName());
execute(tc_LoggingDS_ClientEnabled_badClassName());
execute(tc_LoggingDS_ClientEnabled_noCType());
execute(tc_EPTF_Logging_Test_help());
}
} // end of module