commsfwtools/preparedefaultcommsdatabase/te_commsdat/src/commsdatNotificationTests.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CCommsdat150Step
       
    15 // CCommsdat151Step
       
    16 // CCommsdat152Step
       
    17 // CCommsdat153Step
       
    18 // CCommsdat154Step
       
    19 // CCommsdat155Step
       
    20 // CCommsdat156Step
       
    21 // CCommsdat157Step
       
    22 // CCommsdat158Step
       
    23 // CCommsdat159Step
       
    24 // CCommsdat160Step
       
    25 // CCommsdat161Step
       
    26 // CCommsdat162Step
       
    27 // CCommsdat163Step
       
    28 // CCommsdat164Step
       
    29 // CCommsdat165Step
       
    30 // NOTE:
       
    31 // Ensure that PublishProperties() is called in any tests that need it - relying on
       
    32 // a previous test having called it and setup the properties for subsequent tests will
       
    33 // mean that the subsequent tests will fail if ever run in isolation.
       
    34 // 
       
    35 //
       
    36 
       
    37 /**
       
    38  @file commsdatNotificationTests.cpp
       
    39 */
       
    40 #include "commsdatNotificationTests.h"
       
    41 #include "Te_commsdatSuiteDefs.h"
       
    42 #include "notificationtester.h"
       
    43 #include "CommsDatInternalDefs.h"
       
    44 #include <e32test.h>
       
    45 #include <d32comm.h>
       
    46 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    47 #include <commsdat_partner.h>
       
    48 #endif
       
    49 
       
    50 const TInt KNetworkWeighting = 10;
       
    51 
       
    52 CCommsdat150Step::CCommsdat150Step()
       
    53 /**
       
    54  * Constructor
       
    55  */
       
    56 	{
       
    57 	SetTestStepName(KCommsdat150Step);                                                                                           
       
    58 	}
       
    59 
       
    60 TVerdict CCommsdat150Step::doTestStepL()
       
    61 /**
       
    62  * @return - TVerdict code
       
    63  * 
       
    64  * Testing notification interface during RollBack Transaction; must do CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
    65  */
       
    66 	{
       
    67     SetTestStepResult(EFail);	
       
    68 	INFO_PRINTF1(_L("I am in CCommsdat150Step::doTestStepL(). Testing notification interface..."));
       
    69 
       
    70 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
    71 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
    72 #else
       
    73 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
    74 #endif
       
    75 	CleanupStack::PushL(cmdbSession); 
       
    76 
       
    77 	// need to define P&S properties	
       
    78     cmdbSession->PublishProperties();
       
    79     
       
    80     cmdbSession->OpenTransactionL();
       
    81 	
       
    82 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
    83 	CleanupStack::PushL(record); 
       
    84 	
       
    85 	record->iNetworkWeighting = KNetworkWeighting;
       
    86     TBool found = record->FindL(*cmdbSession);
       
    87 	
       
    88 	INFO_PRINTF3(_L("FindL returned %b for record %08x"), found, record->ElementId());
       
    89     
       
    90     if (found)
       
    91         {
       
    92         _LIT(KThreadName, "TestThread150");
       
    93         CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record);
       
    94         CleanupStack::PushL(tester);    
       
    95 	    TRequestStatus notified;
       
    96 	    tester->LogOn(notified);
       
    97 
       
    98 	    TPtrC testBearer(_L("Test Bearer"));
       
    99         record->iBearerType.SetMaxLengthL(testBearer.Length());
       
   100 	    record->iBearerType = testBearer;
       
   101 	    
       
   102 		record->ModifyL(*cmdbSession);		
       
   103 		
       
   104 	    if(tester->IsAdded())
       
   105 	    	{
       
   106 	    	INFO_PRINTF1(_L("added to active scheduler"));
       
   107 	    	}
       
   108 	    else
       
   109 	    	{
       
   110 	    	INFO_PRINTF1(_L("not added to active scheduler"));
       
   111 	    	}
       
   112 	    	
       
   113 		cmdbSession->RollbackTransactionL();
       
   114 
       
   115 	    User::WaitForRequest (notified);
       
   116    	    TInt testEvtType = 0;
       
   117 	    RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   118 
       
   119 	    if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ERollback)
       
   120 	    	{
       
   121 	    	SetTestStepResult(EPass);	
       
   122 	    	}
       
   123 
       
   124 	    cmdbSession->Close();
       
   125 	    CleanupStack::PopAndDestroy(tester);
       
   126         }
       
   127 	
       
   128 	CleanupStack::PopAndDestroy(record);
       
   129 	CleanupStack::PopAndDestroy(cmdbSession);
       
   130 
       
   131 	return TestStepResult();
       
   132 	}
       
   133 
       
   134 //----------------------------------------------------------------------------------------------------------------
       
   135 CCommsdat151Step::CCommsdat151Step()
       
   136 /**
       
   137  * Constructor
       
   138  */
       
   139 	{
       
   140 	SetTestStepName(KCommsdat151Step);                                                                                           
       
   141 	}
       
   142 
       
   143 TVerdict CCommsdat151Step::doTestStepL()
       
   144 /**
       
   145  * @return - TVerdict code
       
   146  * Test Notification after doing a Modify and Commit.
       
   147  * CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
   148  */
       
   149 	{
       
   150     SetTestStepResult(EFail);	
       
   151 	INFO_PRINTF1(_L("CCommsdat151Step::doTestStepL() in the file commsdat151Step.cpp"));
       
   152 
       
   153 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   154 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   155 #else
       
   156 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   157 #endif
       
   158 	CleanupStack::PushL(cmdbSession); 
       
   159 
       
   160 	// need to define P&S properties	
       
   161 	cmdbSession->PublishProperties();
       
   162 
       
   163 	cmdbSession->OpenTransactionL();
       
   164 
       
   165 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
   166 	CleanupStack::PushL(record); 
       
   167 	record->iNetworkWeighting = KNetworkWeighting;
       
   168 
       
   169 	INFO_PRINTF1(_L("Finding IAP record..."));
       
   170 
       
   171 	TBool found = record->FindL(*cmdbSession);
       
   172 
       
   173 	INFO_PRINTF3(_L("FindL result for record %08x was %b, should be 1"), record->ElementId(), found);
       
   174 
       
   175 	if (found)
       
   176 		{
       
   177 		_LIT(KThreadName,"TestThread151");
       
   178 		CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record);
       
   179 		CleanupStack::PushL(tester);
       
   180 
       
   181 		TRequestStatus notified;
       
   182 		tester->LogOn(notified);
       
   183 
       
   184 		INFO_PRINTF1(_L("Set NotificationTester"));
       
   185 
       
   186 		TPtrC testService(_L("Test Service"));
       
   187 		record->iServiceType.SetMaxLengthL(testService.Length());
       
   188 		record->iServiceType = testService;
       
   189 
       
   190 		record->ModifyL(*cmdbSession);	    
       
   191 
       
   192 		if(tester->IsAdded())
       
   193 			{
       
   194 			INFO_PRINTF1(_L("added to active scheduler"));
       
   195 			}
       
   196 		else
       
   197 			{
       
   198 			INFO_PRINTF1(_L("not added to active scheduler"));
       
   199 			}
       
   200 
       
   201 		cmdbSession->CommitTransactionL();
       
   202 
       
   203 		User::WaitForRequest (notified);
       
   204 
       
   205 		TInt testEvtType = 0;
       
   206 		RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   207 
       
   208 		if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ECommit)
       
   209 			{
       
   210 			SetTestStepResult(EPass); 	
       
   211 			}
       
   212 
       
   213 		cmdbSession->Close();	    	
       
   214 		CleanupStack::PopAndDestroy(tester); 
       
   215         }
       
   216 	else
       
   217 		{
       
   218 		cmdbSession->CommitTransactionL();		
       
   219 		cmdbSession->Close();
       
   220 		}
       
   221         
       
   222 	CleanupStack::PopAndDestroy(record);   
       
   223 	CleanupStack::PopAndDestroy(cmdbSession);
       
   224     
       
   225 	return TestStepResult();
       
   226 	}
       
   227 //----------------------------------------------------------------------------------------------------------------
       
   228 CCommsdat152Step::CCommsdat152Step()
       
   229 /**
       
   230  * Constructor
       
   231  */
       
   232 	{
       
   233 	SetTestStepName(KCommsdat152Step);                                                                                           
       
   234 	}
       
   235 
       
   236 
       
   237 TVerdict CCommsdat152Step::doTestStepL()
       
   238 /**
       
   239  * @return - TVerdict code
       
   240  * test CancelAllNotifications when there are no notifications
       
   241  * CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
   242  */
       
   243 	{
       
   244     SetTestStepResult(EFail);	
       
   245 	INFO_PRINTF1(_L("I am in CCommsdat152Step::doTestStepL() and trying to test CancelAllNotifications"));
       
   246 
       
   247 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   248 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   249 #else
       
   250 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   251 #endif
       
   252 	CleanupStack::PushL(cmdbSession);
       
   253 	
       
   254 	cmdbSession->OpenTransactionL();
       
   255 	cmdbSession->CancelAllNotifications();
       
   256 	cmdbSession->RollbackTransactionL();
       
   257 	
       
   258 	CleanupStack::PopAndDestroy(cmdbSession);
       
   259 	
       
   260 	SetTestStepResult(EPass);
       
   261 	return TestStepResult(); 
       
   262 	}
       
   263 //----------------------------------------------------------------------------------------------------------------
       
   264 CCommsdat153Step::CCommsdat153Step()
       
   265 /**
       
   266  * Constructor
       
   267  */
       
   268 	{
       
   269 	SetTestStepName(KCommsdat153Step);                                                                                           
       
   270 	}
       
   271 	
       
   272 TVerdict CCommsdat153Step::doTestStepL()
       
   273 /**
       
   274  * @return - TVerdict code
       
   275  * test Cancelling a Notification
       
   276  * CED -i Z:\testdata\configs\te_commsdat_modembearer_table1.cfg
       
   277  */
       
   278 	{
       
   279     SetTestStepResult(EFail);	
       
   280 	INFO_PRINTF1(_L("I am in CCommsdat153Step::doTestStepL() and trying to test CancelAllNotifications"));
       
   281 
       
   282 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   283 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   284 #else
       
   285 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   286 #endif
       
   287 	CleanupStack::PushL(cmdbSession);
       
   288 	
       
   289 	cmdbSession->OpenTransactionL();
       
   290 	
       
   291 	CCDModemBearerRecord *record = static_cast<CCDModemBearerRecord *>(CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord));
       
   292 	CleanupStack::PushL(record);
       
   293 
       
   294 	record->iDataBits = EData8;
       
   295 	
       
   296 	TBool found = record->FindL(*cmdbSession);
       
   297 	
       
   298 	if(found)
       
   299 		{
       
   300 		_LIT(KThreadName, "TestThread153");
       
   301 		CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record);
       
   302         CleanupStack::PushL(tester);
       
   303        	
       
   304   	    TRequestStatus notified;
       
   305 	    tester->LogOn(notified);
       
   306 
       
   307         INFO_PRINTF1(_L("Set NotificationTester"));  
       
   308         record->iDataBits = EData7;
       
   309         
       
   310 	    record->ModifyL(*cmdbSession);
       
   311 	     		
       
   312    	    if(tester->IsAdded())
       
   313 	    	{
       
   314 	    	INFO_PRINTF1(_L("added to active scheduler"));
       
   315 	    	}
       
   316 	    else
       
   317 	    	{
       
   318 	    	INFO_PRINTF1(_L("not added to active scheduler"));
       
   319 	    	}
       
   320 
       
   321 	   	tester->CancelNotification(notified);
       
   322 	   	
       
   323 	   	User::WaitForRequest (notified);
       
   324 
       
   325         if(tester->iStatus == KErrCancel)
       
   326 	    	{
       
   327 	    	SetTestStepResult(EPass);
       
   328 	    	}
       
   329 	    	
       
   330 	    cmdbSession->Close();	
       
   331 	    
       
   332         CleanupStack::PopAndDestroy(tester);
       
   333 		}
       
   334 	
       
   335 	CleanupStack::PopAndDestroy(record);
       
   336 	CleanupStack::PopAndDestroy(cmdbSession);
       
   337 	
       
   338 	
       
   339 	return TestStepResult(); 
       
   340 	}
       
   341 
       
   342 //----------------------------------------------------------------------------------------------------------------
       
   343 CCommsdat154Step::CCommsdat154Step()
       
   344 /**
       
   345  * Constructor
       
   346  */
       
   347 	{
       
   348 	SetTestStepName(KCommsdat154Step);                                                                                           
       
   349 	}
       
   350 
       
   351 TVerdict CCommsdat154Step::doTestStepL()
       
   352 /**
       
   353  * @return - TVerdict code
       
   354  * 
       
   355  * Testing notification interface while Closing a session; must do CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
   356  */
       
   357 	{
       
   358     SetTestStepResult(EFail);	
       
   359 	INFO_PRINTF1(_L("I am in CCommsdat154Step::doTestStepL(). Testing notification interface..."));
       
   360 
       
   361 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   362 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   363 #else
       
   364 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   365 #endif
       
   366 	CleanupStack::PushL(cmdbSession); 
       
   367 
       
   368 	// need to define P&S properties	
       
   369 	cmdbSession->PublishProperties();
       
   370 
       
   371 	cmdbSession->OpenTransactionL();
       
   372 
       
   373 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
   374 	CleanupStack::PushL(record); 
       
   375 
       
   376 	record->iNetworkWeighting = KNetworkWeighting;
       
   377 	TBool found = record->FindL(*cmdbSession);
       
   378 
       
   379 	INFO_PRINTF3(_L("FindL returned %b for record %08x"), found, record->ElementId());
       
   380     
       
   381 	if (found)
       
   382 		{
       
   383 		_LIT(KThreadName, "TestThread154");
       
   384 		CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record);
       
   385 		CleanupStack::PushL(tester);    
       
   386 		TRequestStatus notified;
       
   387 		tester->LogOn(notified);
       
   388 
       
   389 		if(tester->IsAdded())
       
   390 			{
       
   391 			INFO_PRINTF1(_L("added to active scheduler"));
       
   392 			}
       
   393 		else
       
   394 			{
       
   395 			INFO_PRINTF1(_L("not added to active scheduler"));
       
   396 			}
       
   397 
       
   398 		cmdbSession->Close();
       
   399 
       
   400 		User::WaitForRequest (notified);
       
   401 
       
   402 		TInt testEvtType = 0;
       
   403 		RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   404 
       
   405 		if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::EClose)
       
   406 			{
       
   407 			SetTestStepResult(EPass);	
       
   408 			}
       
   409 		CleanupStack::PopAndDestroy(tester);
       
   410 		}
       
   411 
       
   412 	CleanupStack::PopAndDestroy(record);
       
   413 	CleanupStack::PopAndDestroy(cmdbSession);
       
   414 
       
   415 	return TestStepResult();
       
   416 	}
       
   417 
       
   418 //----------------------------------------------------------------------------------------------------------------
       
   419 CCommsdat155Step::CCommsdat155Step()
       
   420 /**
       
   421  * Constructor
       
   422  */
       
   423 	{
       
   424 	SetTestStepName(KCommsdat155Step);                                                                                           
       
   425 	}
       
   426 
       
   427 
       
   428 TVerdict CCommsdat155Step::doTestStepL()
       
   429 /**
       
   430  * @return - TVerdict code
       
   431  * Test notification on linked records with modifying records
       
   432  * CED -i Z:\testdata\configs\te_commsdat_wap_access_sms.cfg
       
   433  */
       
   434 	{
       
   435     SetTestStepResult(EFail);	
       
   436 	INFO_PRINTF1(_L("Testing notification over linked records CCommsdat155Step::doTestStepL() "));
       
   437 	
       
   438 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   439 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   440 #else
       
   441 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   442 #endif
       
   443 	CleanupStack::PushL(cmdbSession);
       
   444 
       
   445 	// need to define P&S properties	
       
   446 	cmdbSession->PublishProperties();
       
   447 
       
   448 	cmdbSession->OpenTransactionL();
       
   449 
       
   450 	CCDWAPAccessPointRecord* apRecord = static_cast<CCDWAPAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
       
   451 	
       
   452 	apRecord->SetRecordId(41);	
       
   453 	
       
   454 	TPtrC name(_L("Voda"));
       
   455 	apRecord->iWAPCurrentBearer.SetMaxLengthL(name.Length());
       
   456 	apRecord->iWAPCurrentBearer = name;
       
   457 	
       
   458 	apRecord->LoadL(*cmdbSession);
       
   459 
       
   460 	_LIT(KThreadName, "TestThread155");
       
   461 	CNotificationTester *tester = CNotificationTester::NewL(KThreadName,cmdbSession, apRecord);
       
   462 	CleanupStack::PushL(tester);
       
   463 	
       
   464 	TRequestStatus notified;
       
   465 	tester->LogOn(notified);
       
   466 	
       
   467 	CCDWAPSMSBearerRecord* sbRecord = static_cast<CCDWAPSMSBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPSMSBearerRecord));
       
   468 	CleanupStack::PushL(sbRecord);
       
   469 	
       
   470 	sbRecord->SetRecordId(1);
       
   471 	sbRecord->iWAPAccessPointId = apRecord->RecordId();
       
   472 	sbRecord->iWAPAccessPointId.iLinkedRecord = apRecord;
       
   473 	sbRecord->LoadL(*cmdbSession);
       
   474 	
       
   475 	CMDBElement* linkToAPRecord = sbRecord->iWAPAccessPointId.iLinkedRecord;
       
   476 	
       
   477 	if(tester->IsAdded())
       
   478 	    {
       
   479 	    INFO_PRINTF1(_L("added to active scheduler"));
       
   480 	    }
       
   481 	else
       
   482 	  	{
       
   483 	   	INFO_PRINTF1(_L("not added to active scheduler"));
       
   484 	   	}	
       
   485 	
       
   486 	_LIT(KWapBearer, "ArbitraryName");
       
   487 	if(linkToAPRecord != NULL)
       
   488 		{
       
   489 		static_cast<CCDWAPAccessPointRecord *>(linkToAPRecord)->iWAPCurrentBearer.SetL(KWapBearer);
       
   490 		static_cast<CCDWAPAccessPointRecord *>(linkToAPRecord)->ModifyL(*cmdbSession);
       
   491 		cmdbSession->CommitTransactionL();
       
   492 		}
       
   493 	   	
       
   494 	User::WaitForRequest(notified);
       
   495 	
       
   496 	TInt testEvtType = 0;
       
   497 	RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   498 	
       
   499 	if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ECommit)
       
   500 	   	{
       
   501 		 SetTestStepResult(EPass); 	
       
   502 	   	}
       
   503 	   	
       
   504 	cmdbSession->Close();	   	
       
   505 	CleanupStack::PopAndDestroy(sbRecord);
       
   506 	CleanupStack::PopAndDestroy(tester);
       
   507 	CleanupStack::PopAndDestroy(cmdbSession);
       
   508 	
       
   509 	return TestStepResult();
       
   510 	}
       
   511 
       
   512 //----------------------------------------------------------------------------------------------------------------
       
   513 CCommsdat156Step::CCommsdat156Step()
       
   514 /**
       
   515  * Constructor
       
   516  */
       
   517 	{
       
   518 	SetTestStepName(KCommsdat156Step);                                                                                           
       
   519 	}
       
   520 
       
   521 TVerdict CCommsdat156Step::doTestStepL()
       
   522 /**
       
   523  * @return - TVerdict code
       
   524  * Test notification on linked records with modifying links
       
   525  * CED -i Z:\testdata\configs\te_commsdat_wap_access_sms.cfg
       
   526  */
       
   527 	{
       
   528     SetTestStepResult(EFail);	
       
   529 	INFO_PRINTF1(_L("Testing notification over linked records CCommsdat156Step::doTestStepL() "));
       
   530 	
       
   531 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   532 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   533 #else
       
   534 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   535 #endif
       
   536 	CleanupStack::PushL(cmdbSession);
       
   537 
       
   538 	// need to define P&S properties	
       
   539 	cmdbSession->PublishProperties();
       
   540 
       
   541 	cmdbSession->OpenTransactionL();
       
   542 	
       
   543 	CCDWAPAccessPointRecord* apRecord = static_cast<CCDWAPAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
       
   544 	
       
   545 	apRecord->SetRecordId(41);	
       
   546 
       
   547 	TPtrC name(_L("Voda"));
       
   548 	apRecord->iWAPCurrentBearer.SetMaxLengthL(name.Length());
       
   549 	apRecord->iWAPCurrentBearer = name;
       
   550 	apRecord->LoadL(*cmdbSession);
       
   551 
       
   552    	_LIT(KThreadName, "TestThread156");
       
   553 	CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, apRecord);
       
   554 	CleanupStack::PushL(tester);
       
   555 	
       
   556     TRequestStatus notified;
       
   557 	tester->LogOn(notified);
       
   558 	
       
   559 	CCDWAPSMSBearerRecord* sbRecord = static_cast<CCDWAPSMSBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPSMSBearerRecord));
       
   560 	CleanupStack::PushL(sbRecord);
       
   561 	
       
   562 	sbRecord->SetRecordId(1);
       
   563 	sbRecord->iWAPAccessPointId = apRecord->RecordId();
       
   564 	sbRecord->iWAPAccessPointId.iLinkedRecord = apRecord;
       
   565     sbRecord->LoadL(*cmdbSession);   
       
   566 	
       
   567 	CMDBElement* linkToAPRecord = sbRecord->iWAPAccessPointId.iLinkedRecord;
       
   568 	
       
   569 	if(tester->IsAdded())
       
   570 	    {
       
   571 	    INFO_PRINTF1(_L("added to active scheduler"));
       
   572 	    }
       
   573 	else
       
   574 	  	{
       
   575 	   	INFO_PRINTF1(_L("not added to active scheduler"));
       
   576 	   	}	
       
   577   
       
   578 	_LIT(KWapBearer, "ArbitraryName");
       
   579 	if(linkToAPRecord != NULL)
       
   580 		{
       
   581 		static_cast<CCDWAPAccessPointRecord *>(linkToAPRecord)->iWAPCurrentBearer.SetL(KWapBearer);
       
   582 		static_cast<CCDWAPAccessPointRecord *>(linkToAPRecord)->iWAPCurrentBearer.ModifyL(*cmdbSession);
       
   583 		cmdbSession->CommitTransactionL();		
       
   584 		}		
       
   585 	   	
       
   586 	User::WaitForRequest(notified);
       
   587 	
       
   588 	TInt testEvtType = 0;
       
   589 	RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   590 	
       
   591 	if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ECommit)
       
   592 	   	{
       
   593 		 SetTestStepResult(EPass); 	
       
   594 	   	}
       
   595 	   	
       
   596 	cmdbSession->Close();	   		   	
       
   597 	CleanupStack::PopAndDestroy(sbRecord);
       
   598 	CleanupStack::PopAndDestroy(tester);
       
   599   	CleanupStack::PopAndDestroy(cmdbSession);
       
   600 	
       
   601 	return TestStepResult();
       
   602 	}
       
   603 
       
   604 
       
   605 //----------------------------------------------------------------------------------------------------------------
       
   606 CCommsdat157Step::CCommsdat157Step()
       
   607 /**
       
   608  * Constructor
       
   609  */
       
   610 	{
       
   611 	SetTestStepName(KCommsdat157Step);                                                                                           
       
   612 	}
       
   613 
       
   614 
       
   615 TVerdict CCommsdat157Step::doTestStepL()
       
   616 /**
       
   617  * @return - TVerdict code
       
   618  * Test notification on linked records with deleting records
       
   619  * CED -i Z:\testdata\configs\te_commsdat_wap_access_sms.cfg
       
   620  */
       
   621 	{
       
   622     SetTestStepResult(EFail);	
       
   623 	INFO_PRINTF1(_L("Testing notification over linked records CCommsdat157Step::doTestStepL() "));
       
   624 	
       
   625 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   626 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   627 #else
       
   628 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   629 #endif
       
   630 	CleanupStack::PushL(cmdbSession);
       
   631 
       
   632 	// need to define P&S properties	
       
   633 	cmdbSession->PublishProperties();
       
   634 
       
   635 	CCDWAPAccessPointRecord* apRecord = static_cast<CCDWAPAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
       
   636 	
       
   637 	apRecord->SetRecordId(41);
       
   638 
       
   639 	TPtrC name(_L("Voda"));
       
   640 	apRecord->iWAPCurrentBearer.SetMaxLengthL(name.Length());
       
   641 	apRecord->iWAPCurrentBearer = name;	
       
   642 	
       
   643 	apRecord->LoadL(*cmdbSession);
       
   644 	
       
   645 	_LIT(KThreadName, "TestThread157");
       
   646 	CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, apRecord);
       
   647 	CleanupStack::PushL(tester);
       
   648 	
       
   649     TRequestStatus notified;
       
   650 	tester->LogOn(notified);
       
   651 	
       
   652 	CCDWAPSMSBearerRecord* sbRecord = static_cast<CCDWAPSMSBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPSMSBearerRecord));
       
   653 	CleanupStack::PushL(sbRecord);
       
   654 	
       
   655 	sbRecord->SetRecordId(1);
       
   656 	sbRecord->iWAPAccessPointId = apRecord->RecordId();
       
   657 	sbRecord->iWAPAccessPointId.iLinkedRecord = apRecord;
       
   658 
       
   659 	TBool found = sbRecord->FindL(*cmdbSession);	
       
   660 	
       
   661 	if(tester->IsAdded())
       
   662 	    {
       
   663 	    INFO_PRINTF1(_L("added to active scheduler"));
       
   664 	    }
       
   665 	else
       
   666 	  	{
       
   667 	   	INFO_PRINTF1(_L("not added to active scheduler"));
       
   668 	   	}	
       
   669 	
       
   670 	if(found)
       
   671 		{
       
   672 		CMDBElement* linkToAPRecord = sbRecord->iWAPAccessPointId.iLinkedRecord;
       
   673 		if(linkToAPRecord != NULL)
       
   674 			{
       
   675 			static_cast<CCDWAPAccessPointRecord *>(linkToAPRecord)->DeleteL(*cmdbSession);	
       
   676 			}
       
   677 		}
       
   678 	
       
   679 	User::WaitForRequest(notified);
       
   680 	
       
   681 	TInt testEvtType = 0;
       
   682 	RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   683 	
       
   684 	if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ECommit)
       
   685 	    {
       
   686 	   	SetTestStepResult(EPass); 	
       
   687 	    }
       
   688 
       
   689 	cmdbSession->Close();		    
       
   690 	
       
   691 	CleanupStack::PopAndDestroy(sbRecord);
       
   692 	CleanupStack::PopAndDestroy(tester);
       
   693 	CleanupStack::PopAndDestroy(cmdbSession);
       
   694 	
       
   695 	return TestStepResult();
       
   696 	}
       
   697 
       
   698 //----------------------------------------------------------------------------------------------------------------
       
   699 CCommsdat158Step::CCommsdat158Step()
       
   700 /**
       
   701  * Constructor
       
   702  */
       
   703 	{
       
   704 	SetTestStepName(KCommsdat158Step);                                                                                           
       
   705 	}
       
   706 
       
   707 TVerdict CCommsdat158Step::doTestStepL()
       
   708 /**
       
   709  * @return - TVerdict code
       
   710  * Test notification on linked records with deleting fields
       
   711  * CED -i Z:\testdata\configs\te_commsdat_wap_access_sms.cfg
       
   712  */
       
   713 	{
       
   714     SetTestStepResult(EFail);	
       
   715 	INFO_PRINTF1(_L("Testing notification over linked records CCommsdat158Step::doTestStepL() "));
       
   716 	
       
   717 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   718 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   719 #else
       
   720 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   721 #endif
       
   722 	CleanupStack::PushL(cmdbSession);
       
   723 
       
   724 	// need to define P&S properties	
       
   725 	cmdbSession->PublishProperties();
       
   726 
       
   727 	CCDWAPAccessPointRecord* apRecord = static_cast<CCDWAPAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord));
       
   728 	
       
   729 	apRecord->SetRecordId(41);	
       
   730 
       
   731 	TPtrC name(_L("Voda"));
       
   732 	apRecord->iWAPCurrentBearer.SetMaxLengthL(name.Length());
       
   733 	apRecord->iWAPCurrentBearer = name;	
       
   734 	
       
   735 	apRecord->LoadL(*cmdbSession);
       
   736 	
       
   737 	_LIT(KThreadName, "TestThread158");
       
   738 	CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, apRecord);
       
   739 	CleanupStack::PushL(tester);
       
   740 	
       
   741     TRequestStatus notified;
       
   742 	tester->LogOn(notified);
       
   743 	
       
   744 	CCDWAPSMSBearerRecord* sbRecord = static_cast<CCDWAPSMSBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPSMSBearerRecord));
       
   745 	CleanupStack::PushL(sbRecord);
       
   746 	
       
   747 	sbRecord->SetRecordId(1);
       
   748 	sbRecord->iWAPAccessPointId = apRecord->RecordId();
       
   749 	sbRecord->iWAPAccessPointId.iLinkedRecord = apRecord;
       
   750 	
       
   751 	if(tester->IsAdded())
       
   752 	    {
       
   753 	    INFO_PRINTF1(_L("added to active scheduler"));
       
   754 	    }
       
   755 	else
       
   756 	  	{
       
   757 	   	INFO_PRINTF1(_L("not added to active scheduler"));
       
   758 	   	}	
       
   759 	
       
   760 	TBool found = sbRecord->FindL(*cmdbSession);
       
   761 	if(found )
       
   762 		{
       
   763 		CMDBElement* linkToAPRecord = sbRecord->iWAPAccessPointId.iLinkedRecord;
       
   764 		if(linkToAPRecord != NULL)
       
   765 			{
       
   766 			static_cast<CCDWAPAccessPointRecord *>(linkToAPRecord)->iWAPCurrentBearer.DeleteL(*cmdbSession);	
       
   767 			}
       
   768 		}
       
   769 	
       
   770 	User::WaitForRequest(notified);
       
   771 	
       
   772 	TInt testEvtType = 0;
       
   773 	RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   774 	
       
   775 	if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ECommit)
       
   776 	   	{
       
   777 		SetTestStepResult(EPass); 	
       
   778 	   	}
       
   779 	
       
   780 	cmdbSession->Close();	   	
       
   781 
       
   782 	CleanupStack::PopAndDestroy(sbRecord);
       
   783 	CleanupStack::PopAndDestroy(tester);
       
   784 	CleanupStack::PopAndDestroy(cmdbSession);
       
   785 	
       
   786 	return TestStepResult();
       
   787 	}
       
   788 //---------------------------------------------------------------------------------------------------------------
       
   789 CCommsdat159Step::CCommsdat159Step()
       
   790 /**
       
   791  * Constructor
       
   792  */
       
   793 	{
       
   794 	SetTestStepName(KCommsdat159Step);                                                                                           
       
   795 	}
       
   796 
       
   797 
       
   798 TVerdict CCommsdat159Step::doTestStepL()
       
   799 /**
       
   800  * @return - TVerdict code
       
   801  * test CancelAllNotifications when there are no notifications
       
   802  */
       
   803 	{
       
   804     SetTestStepResult(EFail);	
       
   805 	INFO_PRINTF1(_L("Testing transaction behaviour in CCommsdat159Step::doTestStepL() "));
       
   806 	
       
   807 	
       
   808 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   809 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   810 #else
       
   811 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   812 #endif
       
   813 	CleanupStack::PushL(cmdbSession);
       
   814 	
       
   815 	TRAPD(rollbackErr, cmdbSession->RollbackTransactionL()); // should give KErrAlreadyInTransaction
       
   816 	INFO_PRINTF2(_L("Rollback without transaction returns : %d"), rollbackErr);
       
   817 	if(rollbackErr == KErrNotFound)
       
   818 		{
       
   819 		SetTestStepResult(EPass);
       
   820 		}
       
   821 	
       
   822 	CleanupStack::PopAndDestroy(cmdbSession);
       
   823 	
       
   824 	return TestStepResult();
       
   825 	}
       
   826 
       
   827 //----------------------------------------------------------------------------------------------------------------
       
   828 CCommsdat160Step::CCommsdat160Step()
       
   829 /**
       
   830  * Constructor
       
   831  */
       
   832 	{
       
   833 	SetTestStepName(KCommsdat160Step);                                                                                           
       
   834 	}
       
   835 
       
   836 
       
   837 TVerdict CCommsdat160Step::doTestStepL()
       
   838 /**
       
   839  * @return - TVerdict code
       
   840  * .tests type operator RECORD_TYPE with different data types. 
       
   841  */
       
   842 	{
       
   843     SetTestStepResult(EFail);	
       
   844 	INFO_PRINTF1(_L("CCommsdat160Step::doTestStepL() in the file commsdat160Step.cpp"));
       
   845 
       
   846 	//Initialisation of ptrIapRecord and ptrService  
       
   847 	
       
   848     CCDIAPRecord* ptrIapRecord = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
   849     CleanupStack::PushL(ptrIapRecord);
       
   850     CCDServiceRecordBase* ptrService = static_cast<CCDServiceRecordBase*>(CCDRecordBase::RecordFactoryL(KCDTIdLANServiceRecord));   
       
   851     
       
   852     TInt testVal = 10;        
       
   853     
       
   854     ptrService->iServiceEnableLlmnr = ETrue;//ptrService is used to access  iServiceEnableLlmnr of type TBool    
       
   855     ptrIapRecord->iService.iLinkedRecord  = ptrService;//ptrIapRecord is used to access  iService of type CCDServiceRecordBase
       
   856     ptrIapRecord->iService = testVal; // ptrService is used to access SetRecordId of type TInt
       
   857     ptrService = NULL;
       
   858   
       
   859    
       
   860    	//Checking if type operators are working
       
   861    	TInt serviceId = ptrIapRecord->iService; 
       
   862     TESTL(serviceId == testVal);           //accessing integer value
       
   863        
       
   864    
       
   865     CCDServiceRecordBase* ptrIapService = ptrIapRecord->iService; 
       
   866     if(ptrIapService->iServiceEnableLlmnr)
       
   867     	{
       
   868     	SetTestStepResult(EPass);            //accesing Boolean value  
       
   869     	}
       
   870     	
       
   871     CleanupStack::PopAndDestroy(ptrIapRecord);
       
   872 	
       
   873 	
       
   874 	
       
   875     return TestStepResult();
       
   876 	}
       
   877 
       
   878 //-------------------------------------------------------------------------------------------------------------------------------------------
       
   879 
       
   880 CCommsdat161Step::CCommsdat161Step()
       
   881 /**
       
   882  * Constructor
       
   883  */
       
   884 	{
       
   885 	SetTestStepName(KCommsdat161Step);                                                                                           
       
   886 	}
       
   887 
       
   888 TVerdict CCommsdat161Step::doTestStepL()
       
   889 /**
       
   890  * @return - TVerdict code
       
   891  * 
       
   892  * Testing notification interface. Request notification using one session instance and change  database with another one. Must do CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
   893  */
       
   894 	{
       
   895     SetTestStepResult(EFail);	
       
   896 	INFO_PRINTF1(_L("I am in CCommsdat161Step::doTestStepL(). Testing notification interface..."));
       
   897 
       
   898 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   899 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   900 #else
       
   901 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   902 #endif
       
   903 	CleanupStack::PushL(cmdbSession); 
       
   904 
       
   905 	// need to define P&S properties (doing it on one session is enough)
       
   906 	cmdbSession->PublishProperties();
       
   907 
       
   908 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   909 	CMDBSession *cmdbSession2 = CMDBSession::NewL(KCDVersion1_2);
       
   910 #else
       
   911 	CMDBSession *cmdbSession2 = CMDBSession::NewL(KCDVersion1_1);
       
   912 #endif
       
   913 	CleanupStack::PushL(cmdbSession2); 	
       
   914     
       
   915     cmdbSession->OpenTransactionL();
       
   916 	
       
   917 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
   918 	CleanupStack::PushL(record); 
       
   919 	
       
   920 	record->iNetworkWeighting = KNetworkWeighting;
       
   921     TBool found = record->FindL(*cmdbSession);
       
   922 	
       
   923 	INFO_PRINTF3(_L("FindL returned %b for record %08x"), found, record->ElementId());
       
   924     
       
   925     if (found)
       
   926         {
       
   927         _LIT(KThreadName, "TestThread161");
       
   928         CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession2, record);
       
   929         CleanupStack::PushL(tester);    
       
   930 	    TRequestStatus notified;
       
   931 	    tester->LogOn(notified);
       
   932 
       
   933 	    TPtrC testBearer(_L("Test Bearer"));
       
   934         record->iBearerType.SetMaxLengthL(testBearer.Length());
       
   935 	    record->iBearerType = testBearer;
       
   936 	    
       
   937 		record->ModifyL(*cmdbSession);        
       
   938 		
       
   939 	    if(tester->IsAdded())
       
   940 	    	{
       
   941 	    	INFO_PRINTF1(_L("added to active scheduler"));
       
   942 	    	}
       
   943 	    else
       
   944 	    	{
       
   945 	    	INFO_PRINTF1(_L("not added to active scheduler"));
       
   946 	    	}
       
   947 	    	
       
   948 		cmdbSession->RollbackTransactionL();	    	    	
       
   949 
       
   950 	    User::WaitForRequest (notified);
       
   951    	    TInt testEvtType = 0;
       
   952 	    RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
   953 
       
   954 	    if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ERollback)
       
   955 	    	{
       
   956 	    	SetTestStepResult(EPass);	
       
   957 	    	}
       
   958 
       
   959 	    cmdbSession->Close();
       
   960 	    CleanupStack::PopAndDestroy(tester);
       
   961         }
       
   962 	
       
   963 	CleanupStack::PopAndDestroy(record);
       
   964 	CleanupStack::PopAndDestroy(cmdbSession2);
       
   965 	CleanupStack::PopAndDestroy(cmdbSession);
       
   966 
       
   967 	return TestStepResult();
       
   968 	}
       
   969 
       
   970 //-------------------------------------------------------------------------------------------------------------------------------------------
       
   971 
       
   972 CCommsdat162Step::CCommsdat162Step()
       
   973 /**
       
   974  * Constructor
       
   975  */
       
   976 	{
       
   977 	SetTestStepName(KCommsdat162Step);
       
   978 	}
       
   979 
       
   980 TVerdict CCommsdat162Step::doTestStepL()
       
   981 /**
       
   982  * @return - TVerdict code
       
   983  * 
       
   984  * Testing notification interface. Request notification by several different clients. Check that all are completed. Must do CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
   985  */
       
   986 	{
       
   987     SetTestStepResult(EFail);	
       
   988 	INFO_PRINTF1(_L("I am in CCommsdat162Step::doTestStepL(). Testing notification interface..."));
       
   989 
       
   990 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   991 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   992 #else
       
   993 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   994 #endif
       
   995 	CleanupStack::PushL(cmdbSession); 
       
   996 
       
   997 	// need to define P&S properties	
       
   998 	cmdbSession->PublishProperties();
       
   999 
       
  1000     cmdbSession->OpenTransactionL();
       
  1001 	
       
  1002 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
  1003 	CleanupStack::PushL(record); 
       
  1004 	
       
  1005 	record->iNetworkWeighting = KNetworkWeighting;
       
  1006     TBool found = record->FindL(*cmdbSession);
       
  1007 	
       
  1008 	INFO_PRINTF3(_L("FindL returned %b for record %08x"), found, record->ElementId());
       
  1009     
       
  1010     if (found)
       
  1011         {
       
  1012         _LIT(KThreadName, "TestThread162");
       
  1013         CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record);
       
  1014         CleanupStack::PushL(tester);    
       
  1015 	    TRequestStatus notified;
       
  1016 	    tester->LogOn(notified);
       
  1017 	    
       
  1018         _LIT(KThreadName1, "TestThread162_1");
       
  1019         CNotificationTester *tester1 = CNotificationTester::NewL(KThreadName1, cmdbSession, record);
       
  1020         CleanupStack::PushL(tester1);    
       
  1021 	    TRequestStatus notified1;
       
  1022 	    tester1->LogOn(notified1);
       
  1023 
       
  1024         _LIT(KThreadName2, "TestThread162_2");
       
  1025         CNotificationTester *tester2 = CNotificationTester::NewL(KThreadName2, cmdbSession, record);
       
  1026         CleanupStack::PushL(tester2);    
       
  1027 	    TRequestStatus notified2;
       
  1028 	    tester2->LogOn(notified2);
       
  1029 	    
       
  1030 
       
  1031 	    TPtrC testBearer(_L("Test Bearer"));
       
  1032         record->iBearerType.SetMaxLengthL(testBearer.Length());
       
  1033 	    record->iBearerType = testBearer;
       
  1034 	    
       
  1035 		record->ModifyL(*cmdbSession);			    
       
  1036 		
       
  1037 	    if(tester->IsAdded() && tester1->IsAdded() && tester2->IsAdded())
       
  1038 	    	{
       
  1039 	    	INFO_PRINTF1(_L("added to active scheduler"));
       
  1040 	    	}
       
  1041 	    else
       
  1042 	    	{
       
  1043 	    	INFO_PRINTF1(_L("not added to active scheduler"));
       
  1044 	    	}
       
  1045 	    	
       
  1046 		cmdbSession->RollbackTransactionL();	    	
       
  1047 
       
  1048 	    User::WaitForRequest (notified);
       
  1049 	    User::WaitForRequest (notified1);
       
  1050 	    User::WaitForRequest (notified2);
       
  1051 	    
       
  1052    	    TInt testEvtType = 0;
       
  1053 	    RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
  1054 
       
  1055 	    if(tester->iStatus == KErrNone && tester1->iStatus == KErrNone && tester2->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ERollback)
       
  1056 	    	{
       
  1057 	    	SetTestStepResult(EPass);	
       
  1058 	    	}
       
  1059 
       
  1060 	    cmdbSession->Close();
       
  1061 	    CleanupStack::PopAndDestroy(tester2);
       
  1062 	    CleanupStack::PopAndDestroy(tester1);
       
  1063 	    CleanupStack::PopAndDestroy(tester);
       
  1064         }
       
  1065 	
       
  1066 	CleanupStack::PopAndDestroy(record);
       
  1067 	CleanupStack::PopAndDestroy(cmdbSession);
       
  1068 
       
  1069 	return TestStepResult();
       
  1070 	}
       
  1071 
       
  1072 //-------------------------------------------------------------------------------------------------------------------------------------------
       
  1073 
       
  1074 CCommsdat163Step::CCommsdat163Step()
       
  1075 /**
       
  1076  * Constructor
       
  1077  */
       
  1078 	{
       
  1079 	SetTestStepName(KCommsdat163Step);
       
  1080 	}
       
  1081 
       
  1082 TVerdict CCommsdat163Step::doTestStepL()
       
  1083 /**
       
  1084  * @return - TVerdict code
       
  1085  * 
       
  1086  * Testing notification interface. Request notification by several different clients and then cancel prticular one. Check that all are completed. Must do CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
  1087  *
       
  1088  * NOTE: this test seems to require step 162 to have been run.
       
  1089  */
       
  1090 	{
       
  1091 	SetTestStepResult(EFail);	
       
  1092 	INFO_PRINTF1(_L("I am in CCommsdat163Step::doTestStepL(). Testing notification interface..."));
       
  1093 
       
  1094 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
  1095 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
  1096 #else
       
  1097 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
  1098 #endif
       
  1099 	CleanupStack::PushL(cmdbSession); 
       
  1100 
       
  1101 	// need to define P&S properties	
       
  1102 	cmdbSession->PublishProperties();
       
  1103 
       
  1104 	cmdbSession->OpenTransactionL();
       
  1105 
       
  1106 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
  1107 	CleanupStack::PushL(record); 
       
  1108 	
       
  1109 	record->iNetworkWeighting = KNetworkWeighting;
       
  1110 	TBool found = record->FindL(*cmdbSession);
       
  1111 
       
  1112 	INFO_PRINTF3(_L("FindL returned %b for record %08x"), found, record->ElementId());
       
  1113     
       
  1114 	if (found)
       
  1115 		{
       
  1116 		_LIT(KThreadName, "TestThread163");
       
  1117 		CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record);
       
  1118 		CleanupStack::PushL(tester);    
       
  1119 		TRequestStatus notified;
       
  1120 		tester->LogOn(notified);
       
  1121 
       
  1122 		_LIT(KThreadName1, "TestThread163_1");
       
  1123 		CNotificationTester *tester1 = CNotificationTester::NewL(KThreadName1, cmdbSession, record);
       
  1124 		CleanupStack::PushL(tester1);    
       
  1125 		TRequestStatus notified1;
       
  1126 		tester1->LogOn(notified1);
       
  1127 
       
  1128 		_LIT(KThreadName2, "TestThread163_2");
       
  1129 		CNotificationTester *tester2 = CNotificationTester::NewL(KThreadName2, cmdbSession, record);
       
  1130 		CleanupStack::PushL(tester2);    
       
  1131 		TRequestStatus notified2;
       
  1132 		tester2->LogOn(notified2);
       
  1133 
       
  1134 
       
  1135 		TPtrC testBearer(_L("Test Bearer"));
       
  1136 		record->iBearerType.SetMaxLengthL(testBearer.Length());
       
  1137 		record->iBearerType = testBearer;
       
  1138 
       
  1139 		record->ModifyL(*cmdbSession);			    
       
  1140 
       
  1141 		if(tester->IsAdded() && tester1->IsAdded() && tester2->IsAdded())
       
  1142 			{
       
  1143 			INFO_PRINTF1(_L("added to active scheduler"));
       
  1144 			}
       
  1145 		else
       
  1146 			{
       
  1147 			INFO_PRINTF1(_L("not added to active scheduler"));
       
  1148 			}
       
  1149 
       
  1150 		tester1->CancelNotification(notified1);
       
  1151 
       
  1152 		cmdbSession->RollbackTransactionL();	    	
       
  1153 
       
  1154 		User::WaitForRequest (notified);
       
  1155 		User::WaitForRequest (notified1);
       
  1156 		User::WaitForRequest (notified2);
       
  1157 
       
  1158 		TInt testEvtType = 0;
       
  1159 		RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
  1160 
       
  1161 		if(tester->iStatus == KErrNone && tester1->iStatus == KErrCancel && tester2->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ERollback)
       
  1162 			{
       
  1163 			SetTestStepResult(EPass);	
       
  1164 			}
       
  1165 
       
  1166 		cmdbSession->Close();
       
  1167 		CleanupStack::PopAndDestroy(tester2);
       
  1168 		CleanupStack::PopAndDestroy(tester1);
       
  1169 		CleanupStack::PopAndDestroy(tester);
       
  1170 		}
       
  1171 
       
  1172 	CleanupStack::PopAndDestroy(record);
       
  1173 	CleanupStack::PopAndDestroy(cmdbSession);
       
  1174 
       
  1175 	return TestStepResult();
       
  1176 	}
       
  1177 
       
  1178 //-------------------------------------------------------------------------------------------------------------------------------------------
       
  1179 
       
  1180 CCommsdat164Step::CCommsdat164Step()
       
  1181 /**
       
  1182  * Constructor
       
  1183  */
       
  1184 	{
       
  1185 	SetTestStepName(KCommsdat164Step);
       
  1186 	}
       
  1187 
       
  1188 TVerdict CCommsdat164Step::doTestStepL()
       
  1189 /**
       
  1190  * @return - TVerdict code
       
  1191  * 
       
  1192  * Testing notification interface. Request notification by several different clients and then cancel all. Check that all are completed. Must do CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
  1193  *
       
  1194  * NOTE: this test seems to require step 163 to have been performed.
       
  1195  */
       
  1196 	{
       
  1197     SetTestStepResult(EFail);	
       
  1198 	INFO_PRINTF1(_L("I am in CCommsdat164Step::doTestStepL(). Testing notification interface..."));
       
  1199 
       
  1200 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
  1201 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
  1202 #else
       
  1203 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
  1204 #endif
       
  1205 	CleanupStack::PushL(cmdbSession); 
       
  1206 
       
  1207     cmdbSession->OpenTransactionL();
       
  1208 
       
  1209 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
  1210 	CleanupStack::PushL(record); 
       
  1211 	
       
  1212 	record->iNetworkWeighting = KNetworkWeighting;
       
  1213     TBool found = record->FindL(*cmdbSession);
       
  1214 	
       
  1215 	INFO_PRINTF3(_L("FindL returned %b for record %08x"), found, record->ElementId());
       
  1216     
       
  1217     if (found)
       
  1218         {
       
  1219         _LIT(KThreadName, "TestThread164");
       
  1220         CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record);
       
  1221         CleanupStack::PushL(tester);    
       
  1222 	    TRequestStatus notified;
       
  1223 	    tester->LogOn(notified);
       
  1224 	    
       
  1225         _LIT(KThreadName1, "TestThread164_1");
       
  1226         CNotificationTester *tester1 = CNotificationTester::NewL(KThreadName1, cmdbSession, record);
       
  1227         CleanupStack::PushL(tester1);    
       
  1228 	    TRequestStatus notified1;
       
  1229 	    tester1->LogOn(notified1);
       
  1230 
       
  1231         _LIT(KThreadName2, "TestThread164_2");
       
  1232         CNotificationTester *tester2 = CNotificationTester::NewL(KThreadName2, cmdbSession, record);
       
  1233         CleanupStack::PushL(tester2);    
       
  1234 	    TRequestStatus notified2;
       
  1235 	    tester2->LogOn(notified2);
       
  1236 	    
       
  1237 
       
  1238 	    TPtrC testBearer(_L("Test Bearer"));
       
  1239         record->iBearerType.SetMaxLengthL(testBearer.Length());
       
  1240 	    record->iBearerType = testBearer;
       
  1241 	    
       
  1242 		record->ModifyL(*cmdbSession);			    
       
  1243 		
       
  1244 	    if(tester->IsAdded() && tester1->IsAdded() && tester2->IsAdded())
       
  1245 	    	{
       
  1246 	    	INFO_PRINTF1(_L("added to active scheduler"));
       
  1247 	    	}
       
  1248 	    else
       
  1249 	    	{
       
  1250 	    	INFO_PRINTF1(_L("not added to active scheduler"));
       
  1251 	    	}
       
  1252 	    	
       
  1253 	    cmdbSession->CancelAllNotifications();
       
  1254 	    
       
  1255 	    User::WaitForRequest (notified);
       
  1256 	    User::WaitForRequest (notified1);
       
  1257 	    User::WaitForRequest (notified2);
       
  1258 	    
       
  1259    	    TInt testEvtType = 0;
       
  1260 	    RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
  1261 
       
  1262 	    if(tester->iStatus == KErrCancel && tester1->iStatus == KErrCancel && tester2->iStatus == KErrCancel && testEvtType == TCDNotifiableEvent::EClose)
       
  1263 	    	{
       
  1264 	    	SetTestStepResult(EPass);	
       
  1265 	    	}
       
  1266 
       
  1267 	    cmdbSession->Close();
       
  1268 	    CleanupStack::PopAndDestroy(tester2);
       
  1269 	    CleanupStack::PopAndDestroy(tester1);
       
  1270 	    CleanupStack::PopAndDestroy(tester);
       
  1271         }
       
  1272 	
       
  1273 	CleanupStack::PopAndDestroy(record);
       
  1274 	CleanupStack::PopAndDestroy(cmdbSession);
       
  1275 
       
  1276 	return TestStepResult();
       
  1277 	}
       
  1278 
       
  1279 //-------------------------------------------------------------------------------------------------------------------------------------------
       
  1280 
       
  1281 CCommsdat165Step::CCommsdat165Step()
       
  1282 /**
       
  1283  * Constructor
       
  1284  */
       
  1285 	{
       
  1286 	SetTestStepName(KCommsdat165Step);
       
  1287 	}
       
  1288 
       
  1289 TVerdict CCommsdat165Step::doTestStepL()
       
  1290 /**
       
  1291  * @return - TVerdict code
       
  1292  * 
       
  1293  * Testing notification interface. Request notification by a client twice or more. Must do CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg
       
  1294  */
       
  1295 	{
       
  1296     SetTestStepResult(EFail);	
       
  1297 	INFO_PRINTF1(_L("I am in CCommsdat165Step::doTestStepL(). Testing notification interface..."));
       
  1298 
       
  1299 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
  1300 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
  1301 #else
       
  1302 	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
  1303 #endif
       
  1304 	CleanupStack::PushL(cmdbSession); 
       
  1305 
       
  1306 	// need to define P&S properties	
       
  1307 	cmdbSession->PublishProperties();
       
  1308 
       
  1309     cmdbSession->OpenTransactionL();
       
  1310 
       
  1311 	CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
  1312 	CleanupStack::PushL(record); 
       
  1313 	
       
  1314 	record->iNetworkWeighting = KNetworkWeighting;
       
  1315     TBool found = record->FindL(*cmdbSession);
       
  1316 	
       
  1317 	INFO_PRINTF3(_L("FindL returned %b for record %08x"), found, record->ElementId());
       
  1318     
       
  1319     if (found)
       
  1320         {
       
  1321 	    TRequestStatus notified;
       
  1322 	    
       
  1323 		record->RequestNotification(*cmdbSession, notified);
       
  1324 		record->RequestNotification(*cmdbSession, notified);
       
  1325 		record->RequestNotification(*cmdbSession, notified);	    
       
  1326 
       
  1327 	    TPtrC testBearer(_L("Test Bearer"));
       
  1328         record->iBearerType.SetMaxLengthL(testBearer.Length());
       
  1329 	    record->iBearerType = testBearer;
       
  1330 	    
       
  1331 		record->ModifyL(*cmdbSession);		
       
  1332 	    	
       
  1333 		cmdbSession->RollbackTransactionL();	    	
       
  1334 		
       
  1335 	    User::WaitForRequest (notified);
       
  1336 	    
       
  1337    	    TInt testEvtType = 0;
       
  1338 	    RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType);
       
  1339 
       
  1340 	    if(notified == KErrNone && testEvtType == TCDNotifiableEvent::ERollback)
       
  1341 	    	{
       
  1342 	    	SetTestStepResult(EPass);	
       
  1343 	    	}
       
  1344 
       
  1345 	    cmdbSession->Close();
       
  1346         }
       
  1347 	
       
  1348 	CleanupStack::PopAndDestroy(record);
       
  1349 	CleanupStack::PopAndDestroy(cmdbSession);
       
  1350 
       
  1351 	return TestStepResult();
       
  1352 	}
       
  1353 
       
  1354 //-------------------------------------------------------------------------------------------------------------------------------------------