commsfwtools/preparedefaultcommsdatabase/te_commsdat/src/commsdatExtensionTests.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2006-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 //
       
    15 
       
    16 /**
       
    17  @file commsdatExtensionTests.cpp
       
    18 */
       
    19 #include "commsdatExtensionTests.h"
       
    20 #include "Te_commsdatSuiteDefs.h"
       
    21 #include <e32test.h>
       
    22 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    23 #include <commsdat_partner.h>
       
    24 #endif
       
    25 
       
    26 const TInt TELEPHONE_NO_SIZE = 50;
       
    27 //----------------------------------------------------------------------------------------------------------------
       
    28 CCommsdat201Step::CCommsdat201Step()
       
    29 /**
       
    30  * Constructor
       
    31  */
       
    32 	{
       
    33 	SetTestStepName(KCommsdat201Step);
       
    34 	}
       
    35 
       
    36 
       
    37 TVerdict CCommsdat201Step::doTestStepL()
       
    38 /**
       
    39  * @return - TVerdict code
       
    40  * Test Load on record set; should return KErrNotFound
       
    41  */
       
    42 	{
       
    43     SetTestStepResult(EFail);
       
    44 	INFO_PRINTF1(_L("Load within transaction - CCommsdat201Step::doTestStepL() "));
       
    45 
       
    46 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
    47  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
    48 #else
       
    49  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
    50 #endif
       
    51 	CleanupStack::PushL(cmdbSession);
       
    52 
       
    53 	cmdbSession->OpenTransactionL();
       
    54 
       
    55 	CMDBRecordSet<CCDDialOutISPRecord>* recordSet = new(ELeave) CMDBRecordSet<CCDDialOutISPRecord>(KCDTIdDialOutISPRecord);
       
    56 
       
    57 	TRAPD(loadErr, recordSet->LoadL(*cmdbSession));
       
    58 
       
    59 	if ( loadErr == KErrNotFound )
       
    60        	{
       
    61         SetTestStepResult(EPass);
       
    62         }
       
    63 
       
    64 	delete recordSet;
       
    65 	cmdbSession->Close();
       
    66 
       
    67 	CleanupStack::PopAndDestroy(cmdbSession);
       
    68 
       
    69 	return TestStepResult();
       
    70 	}
       
    71 
       
    72 //----------------------------------------------------------------------------------------------------------------
       
    73 
       
    74 CCommsdat202Step::CCommsdat202Step()
       
    75 /**
       
    76  * Constructor
       
    77  */
       
    78 	{
       
    79 	SetTestStepName(KCommsdat202Step);
       
    80 	}
       
    81 
       
    82 
       
    83 TVerdict CCommsdat202Step::doTestStepL()
       
    84 /**
       
    85  * @return - TVerdict code
       
    86  * Create a CMDBField object with an element id, check the element id and delete it
       
    87  */
       
    88 	{
       
    89     SetTestStepResult(EFail);
       
    90 	INFO_PRINTF1(_L("CCommsdat202Step::doTestStepL()"));
       
    91 
       
    92 	TMDBElementId elementId = 0x01010500;
       
    93 
       
    94 	TMDBElementId result;
       
    95 	CMDBField<TInt> *dbField = new(ELeave) CMDBField<TInt>(elementId);
       
    96 	result = dbField->ElementId();
       
    97 	INFO_PRINTF3(_L("result = %08x.  Should be %08x"), result, elementId);
       
    98 
       
    99     if (result == elementId)
       
   100     	{
       
   101     	SetTestStepResult(EPass);
       
   102     	}
       
   103 
       
   104 	delete dbField;
       
   105 
       
   106 	return TestStepResult();
       
   107 	}
       
   108 
       
   109 //----------------------------------------------------------------------------------------------------------------
       
   110 
       
   111 CCommsdat203Step::CCommsdat203Step()
       
   112 /**
       
   113  * Constructor
       
   114  */
       
   115 	{
       
   116 	SetTestStepName(KCommsdat203Step);
       
   117 	}
       
   118 
       
   119 
       
   120 TVerdict CCommsdat203Step::doTestStepL()
       
   121 /**
       
   122  * @return - TVerdict code
       
   123  * Create a CMDBRecordSet object and delete it
       
   124  */
       
   125 	{
       
   126     SetTestStepResult(EFail);
       
   127 	INFO_PRINTF1(_L("CCommsdat203Step::doTestStepL() "));
       
   128 
       
   129 	TMDBElementId elementLinking = 5;
       
   130 
       
   131 	CMDBRecordSet<CCDNetworkRecord> *dbField = new(ELeave) CMDBRecordSet<CCDNetworkRecord>(elementLinking);
       
   132 	delete dbField;
       
   133 
       
   134     SetTestStepResult(EPass);
       
   135 	return TestStepResult();
       
   136 	}
       
   137 
       
   138 //----------------------------------------------------------------------------------------------------------------
       
   139 
       
   140 CCommsdat204Step::CCommsdat204Step()
       
   141 /**
       
   142  * Constructor
       
   143  */
       
   144 	{
       
   145 	SetTestStepName(KCommsdat204Step);
       
   146 	}
       
   147 
       
   148 
       
   149 TVerdict CCommsdat204Step::doTestStepL()
       
   150 /**
       
   151  * @return - TVerdict code
       
   152  * Create a CMDBField object with an element id, check the attributes and delete it
       
   153  */
       
   154 	{
       
   155     SetTestStepResult(EFail);
       
   156 	INFO_PRINTF1(_L("CCommsdat204Step::doTestStepL() "));
       
   157 
       
   158 	TMDBElementId elementId = 0xfffffff;
       
   159 
       
   160  	TMDBAttributeFlags result;
       
   161 	CMDBField<TInt> *dbField = new(ELeave) CMDBField<TInt>(elementId);
       
   162     result = dbField->Attributes();
       
   163 
       
   164     INFO_PRINTF2(_L("attributes : result = %08x"), result);
       
   165 
       
   166     if (result  == (elementId & KCDMaskShowAttributes))
       
   167     	{
       
   168     	SetTestStepResult(EPass);
       
   169     	}
       
   170 
       
   171 	delete dbField;
       
   172 
       
   173 	return TestStepResult();
       
   174 	}
       
   175 
       
   176 //----------------------------------------------------------------------------------------------------------------
       
   177 
       
   178 CCommsdat205Step::CCommsdat205Step()
       
   179 /**
       
   180  * Constructor
       
   181  */
       
   182 	{
       
   183 	SetTestStepName(KCommsdat205Step);
       
   184 	}
       
   185 
       
   186 
       
   187 TVerdict CCommsdat205Step::doTestStepL()
       
   188 /**
       
   189  * @return - TVerdict code
       
   190  * Create a CMDBRecordLink object with an element id and an element and delete it
       
   191  */
       
   192 	{
       
   193     SetTestStepResult(EFail);
       
   194 	INFO_PRINTF1(_L("CCommsdat205Step::doTestStepL()"));
       
   195 
       
   196 	TMDBElementId elementId = 6;
       
   197 	CCDNetworkRecord *element = (CCDNetworkRecord*)CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord);
       
   198 	CMDBRecordLink<CCDNetworkRecord> *dbField = new(ELeave) CMDBRecordLink<CCDNetworkRecord>(elementId,element);
       
   199 	delete dbField;
       
   200 
       
   201     SetTestStepResult(EPass);
       
   202 	return TestStepResult();
       
   203 	}
       
   204 
       
   205 //----------------------------------------------------------------------------------------------------------------
       
   206 
       
   207 _LIT(KLongestPossibleTableName, "A table name which has 64 characters; that is the limit defined.");
       
   208 
       
   209 CCommsdat206Step::CCommsdat206Step()
       
   210 /**
       
   211  * Constructor
       
   212  */
       
   213 	{
       
   214 	SetTestStepName(KCommsdat206Step);
       
   215 	}
       
   216 
       
   217 TVerdict CCommsdat206Step::doTestStepL()
       
   218 /**
       
   219  * @return - TVerdict code
       
   220  * Testing medium texts as table names
       
   221  */
       
   222 	{
       
   223     SetTestStepResult(EFail);
       
   224 	INFO_PRINTF1(_L("Testing long table names in CCommsdat206Step::doTestStepL() "));
       
   225 
       
   226 	INFO_PRINTF1(_L("CCommsdat206Step::doTestStepL()"));
       
   227 
       
   228 	// Create a new table
       
   229 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   230  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   231 #else
       
   232  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   233 #endif
       
   234 	CleanupStack::PushL(cmdbSession);
       
   235 
       
   236 	CMDBGenericRecord* testRecord = static_cast<CMDBGenericRecord*>(CCDRecordBase::RecordFactoryL(KCDNewTableRequest));
       
   237 	CleanupStack::PushL(testRecord);
       
   238     testRecord->InitializeL(KLongestPossibleTableName(), TestGenRecordInfo);
       
   239 
       
   240 	TRAPD(storeErr, testRecord->StoreL(*cmdbSession));
       
   241 
       
   242 	CleanupStack::PopAndDestroy(testRecord);
       
   243 
       
   244 	testRecord = static_cast<CMDBGenericRecord *>(CCDRecordBase::RecordFactoryL(KCDTIdTestRecord));
       
   245 	CleanupStack::PushL(testRecord);
       
   246 
       
   247 	TRAPD(loadErr,testRecord->LoadL(*cmdbSession));
       
   248 
       
   249 	if(storeErr == KErrNone || loadErr == KErrNotFound)
       
   250 		{
       
   251 		SetTestStepResult(EPass);
       
   252 		}
       
   253 
       
   254 	cmdbSession->Close();
       
   255     CleanupStack::PopAndDestroy(2,cmdbSession);
       
   256 
       
   257 	return TestStepResult();
       
   258 	}
       
   259 
       
   260 //----------------------------------------------------------------------------------------------------------------
       
   261 
       
   262 CCommsdat207Step::CCommsdat207Step()
       
   263 /**
       
   264  * Constructor
       
   265  */
       
   266 	{
       
   267 	SetTestStepName(KCommsdat207Step);
       
   268 	}
       
   269 
       
   270 TVerdict CCommsdat207Step::doTestStepL()
       
   271 /**
       
   272  * @return - TVerdict code
       
   273  * Conn pref records with a rank of 2 are not permitted to be incoming
       
   274  */
       
   275 	{
       
   276     SetTestStepResult(EFail);
       
   277 	INFO_PRINTF1(_L("Testing validation for connection preferences "));
       
   278 
       
   279 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   280  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   281 #else
       
   282  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   283 #endif
       
   284 	CleanupStack::PushL(cmdbSession);
       
   285 
       
   286 	CCDConnectionPrefsRecord *cpRecord = (CCDConnectionPrefsRecord*)CCDRecordBase::RecordFactoryL(KCDTIdConnectionPrefsRecord);
       
   287 	CleanupStack::PushL(cpRecord);
       
   288 
       
   289 	cpRecord->SetRecordId(KConnPrefRecordId);
       
   290 	cpRecord->iDefaultIAP = 1;  // An arbitrary, but valiad IAP record id
       
   291 	cpRecord->iRanking = 2;     // A invalid ranking for incoming connection
       
   292 	cpRecord->iDirection = ECommDbConnectionDirectionIncoming;
       
   293 	TRAPD(storeErr, cpRecord->StoreL(*cmdbSession));
       
   294 
       
   295 	if(storeErr == KErrNotSupported)
       
   296 		{
       
   297 		SetTestStepResult(EPass);
       
   298 		}
       
   299 
       
   300 	cmdbSession->Close();
       
   301 	CleanupStack::PopAndDestroy(2,cmdbSession);
       
   302 
       
   303 	return TestStepResult();
       
   304 	}
       
   305 
       
   306 //----------------------------------------------------------------------------------------------------------------
       
   307 
       
   308 CCommsdat208Step::CCommsdat208Step()
       
   309 /**
       
   310  * Constructor
       
   311  */
       
   312 	{
       
   313 	SetTestStepName(KCommsdat208Step);
       
   314 	}
       
   315 
       
   316 TVerdict CCommsdat208Step::doTestStepL()
       
   317 /**
       
   318  * @return - TVerdict code
       
   319  * The ranking of conn pref record must be eiher 1 or 2,
       
   320  */
       
   321 	{
       
   322     SetTestStepResult(EFail);
       
   323 	INFO_PRINTF1(_L("Testing validation for connection preferences in CCommsdat208Step::doTestStepL() "));
       
   324 
       
   325 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   326  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   327 #else
       
   328  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   329 #endif
       
   330 	CleanupStack::PushL(cmdbSession);
       
   331 
       
   332 	CCDConnectionPrefsRecord *cpRecord = (CCDConnectionPrefsRecord*)CCDRecordBase::RecordFactoryL(KCDTIdConnectionPrefsRecord);
       
   333 	CleanupStack::PushL(cpRecord);
       
   334 
       
   335 	cpRecord->SetRecordId(KConnPrefRecordId);
       
   336 	cpRecord->iDefaultIAP = 1; // An arbitrary but still valid IAP record id
       
   337 	cpRecord->iRanking = 5;    // Invalid value, should cause KErrOverflow
       
   338 	TRAPD(storeErr, cpRecord->StoreL(*cmdbSession));
       
   339 	INFO_PRINTF2(_L("store returns %d"), storeErr);
       
   340 
       
   341 	if(storeErr == KErrOverflow)
       
   342 		{
       
   343 		SetTestStepResult(EPass);
       
   344 		}
       
   345     cmdbSession->Close();
       
   346 	CleanupStack::PopAndDestroy(2,cmdbSession);
       
   347 
       
   348 	return TestStepResult();
       
   349 	}
       
   350 
       
   351 //----------------------------------------------------------------------------------------------------------------
       
   352 
       
   353 CCommsdat209Step::CCommsdat209Step()
       
   354 /**
       
   355  * Constructor
       
   356  */
       
   357 	{
       
   358 	SetTestStepName(KCommsdat209Step);
       
   359 	}
       
   360 
       
   361 TVerdict CCommsdat209Step::doTestStepL()
       
   362 /**
       
   363  * @return - TVerdict code
       
   364  * Finding a record;
       
   365  */
       
   366 	{
       
   367     SetTestStepResult(EFail);
       
   368 	INFO_PRINTF1(_L("CCommsdat209Step::doTestStepL() "));
       
   369 
       
   370 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   371  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2);
       
   372 #else
       
   373  	CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1);
       
   374 #endif
       
   375 	CleanupStack::PushL(cmdbSession);
       
   376 
       
   377 	CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
   378 	CleanupStack::PushL(iapRecord);
       
   379 
       
   380 	iapRecord->iNetworkWeighting = 10;
       
   381     TBool found(EFalse);
       
   382 	found = iapRecord->FindL(*cmdbSession);
       
   383     if (found)
       
   384     	{
       
   385         SetTestStepResult(EPass);
       
   386     	}
       
   387 
       
   388     INFO_PRINTF2(_L("FindL returned %d, should be 1"), found);
       
   389     INFO_PRINTF2(_L("test result is %d"), TestStepResult());
       
   390     cmdbSession->Close();
       
   391     CleanupStack::PopAndDestroy(2,cmdbSession);
       
   392 	return TestStepResult();
       
   393 	}
       
   394 
       
   395 //----------------------------------------------------------------------------------------------------------------
       
   396 
       
   397 CCommsdat210Step::CCommsdat210Step()
       
   398 /**
       
   399  * Constructor
       
   400  */
       
   401 	{
       
   402 	SetTestStepName(KCommsdat210Step);
       
   403 	}
       
   404 
       
   405 TVerdict CCommsdat210Step::doTestStepL()
       
   406 /**
       
   407  * @return - TVerdict code
       
   408  * Resolve non-mobile phone number - EForDisplay
       
   409  * CED -i Z:\testdata\configs\te_commsdat_location_table3.cfg
       
   410  */
       
   411 	{
       
   412     SetTestStepResult(EFail);
       
   413 	INFO_PRINTF1(_L("Testing resolving phone number display in CCommsdat210Step::doTestStepL() "));
       
   414 
       
   415 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
   416 	CleanupStack::PushL(utils);
       
   417 
       
   418 	TPtrC number(_L("6294841"));
       
   419 	TBuf<TELEPHONE_NO_SIZE> dialString;
       
   420 
       
   421 	utils->ResolvePhoneNumberL(number, dialString, EForDisplay, KLocationRecordId, KChargecardRecordId);
       
   422 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
   423 
       
   424 	_LIT(KExpectedNumber, "89,6294841");
       
   425 
       
   426 	if(dialString == KExpectedNumber)
       
   427 		{
       
   428 		SetTestStepResult(EPass);
       
   429 		}
       
   430 
       
   431 	CleanupStack::PopAndDestroy(utils);
       
   432 	return TestStepResult();
       
   433 	}
       
   434 
       
   435 //----------------------------------------------------------------------------------------------------------------
       
   436 
       
   437 CCommsdat211Step::CCommsdat211Step()
       
   438 /**
       
   439  * Constructor
       
   440  */
       
   441 	{
       
   442 	SetTestStepName(KCommsdat211Step);
       
   443 	}
       
   444 
       
   445 TVerdict CCommsdat211Step::doTestStepL()
       
   446 /**
       
   447  * @return - TVerdict code
       
   448  * Resolve non-mobile phone number - EForDialing
       
   449  * CED -i Z:\testdata\configs\te_commsdat_location_table3.cfg
       
   450  */
       
   451 	{
       
   452     SetTestStepResult(EFail);
       
   453 	INFO_PRINTF1(_L("Testing resolving phone number for dial in CCommsdat211Step::doTestStepL() "));
       
   454 
       
   455 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
   456 	CleanupStack::PushL(utils);
       
   457 
       
   458 	TPtrC number(_L("6294841"));
       
   459 	TBuf<TELEPHONE_NO_SIZE> dialString;
       
   460 
       
   461 	utils->ResolvePhoneNumberL(number, dialString, EForDialing, KLocationRecordId, KChargecardRecordId);
       
   462 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
   463 
       
   464 	// 8 is disable call waiting, 9 is local call hence no international code or dialling code
       
   465 	_LIT(KExpectedNumber, "8WT9,P6294841");
       
   466 
       
   467 	if(dialString == KExpectedNumber)
       
   468 		{
       
   469 		SetTestStepResult(EPass);
       
   470 		}
       
   471 
       
   472 	CleanupStack::PopAndDestroy(utils);
       
   473 	return TestStepResult();
       
   474 	}
       
   475 
       
   476 //----------------------------------------------------------------------------------------------------------------
       
   477 
       
   478 CCommsdat212Step::~CCommsdat212Step()
       
   479 /**
       
   480  * Destructor
       
   481  */
       
   482 	{
       
   483 	delete iCDSession;
       
   484 	}
       
   485 
       
   486 CCommsdat212Step::CCommsdat212Step()
       
   487 /**
       
   488  * Constructor
       
   489  */
       
   490 	{
       
   491 	SetTestStepName(KCommsdat212Step);
       
   492 	}
       
   493 
       
   494 TVerdict CCommsdat212Step::doTestStepPreambleL()
       
   495 /**
       
   496  * @return - TVerdict code
       
   497  * Test looks up a previously stored access point record and
       
   498  * verifies its consistence
       
   499  */
       
   500 	{
       
   501     SetTestStepResult(EFail);
       
   502 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   503     iCDSession = CMDBSession::NewL(KCDVersion1_2);
       
   504 #else
       
   505     iCDSession = CMDBSession::NewL(KCDVersion1_1);
       
   506 #endif
       
   507 	SetTestStepResult(EPass);
       
   508 	return TestStepResult();
       
   509 	}
       
   510 
       
   511 CCDRecordBase* LoadLinkedRecordL(CMDBSession& aSession, TMDBElementId aElementId)
       
   512     {
       
   513    	CCDRecordBase *rec = static_cast<CCDRecordBase*>(CCDRecordBase::RecordFactoryL(aElementId));
       
   514     CleanupStack::PushL(rec);
       
   515     rec->LoadL(aSession);
       
   516     CleanupStack::Pop(rec);
       
   517     return rec;
       
   518     }
       
   519 
       
   520 
       
   521 TVerdict CCommsdat212Step::doTestStepL()
       
   522 /**
       
   523  * @return - TVerdict code
       
   524  */
       
   525 	{
       
   526 	SetTestStepResult(EFail);
       
   527 	// TH - This test looks exactly like test 195 I wonder why is that. Play dumb now, will raise later...
       
   528 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   529 	_LIT(KApName1, "dummynifMappedFromIAP1");
       
   530 	//_LIT(KSelName1, "SelectionPolicy1");
       
   531 	//const TUint KAp1 = 22;
       
   532 	const TUint KRecordId = 1;
       
   533 	
       
   534 	CCDAccessPointRecord* apRecord = static_cast<CCDAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdAccessPointRecord));
       
   535 	CleanupStack::PushL(apRecord);
       
   536 	
       
   537 	apRecord->iRecordName.SetL(KApName1);
       
   538 	
       
   539 	TInt found = apRecord->FindL(*iCDSession);
       
   540 	if (found)
       
   541 	    {
       
   542         INFO_PRINTF2(_L("apRecord loaded. Element id is %08x"), apRecord->ElementId());
       
   543         
       
   544         //Load the related IAP record
       
   545         CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
       
   546     	CleanupStack::PushL(iapRecord);
       
   547     	iapRecord->SetRecordId(KRecordId);
       
   548     	iapRecord->LoadL(*iCDSession);
       
   549         
       
   550         if(static_cast<TInt>(apRecord->iRecordTag) == iapRecord->RecordId())
       
   551    	        {
       
   552    	        INFO_PRINTF1(_L("AP and the 'linked' IAP record found"));
       
   553    	        SetTestStepResult(EPass);
       
   554    	        }
       
   555    	    else
       
   556    	        {
       
   557    	        INFO_PRINTF1(_L("AP and the 'linked' IAP record found"));
       
   558    	        }
       
   559    	        
       
   560         CleanupStack::PopAndDestroy(iapRecord);
       
   561         
       
   562 	    }
       
   563 	else
       
   564 	    {
       
   565 	    INFO_PRINTF1(_L("AccessPoint record not found"));
       
   566 	    }
       
   567         
       
   568     CleanupStack::PopAndDestroy(apRecord);
       
   569         
       
   570         
       
   571         
       
   572         
       
   573         
       
   574         
       
   575         
       
   576         /*
       
   577         
       
   578         //Load the Selection Policy record
       
   579        	CCDAPPrioritySelectionPolicyRecord* selPolRecord = static_cast<CCDAPPrioritySelectionPolicyRecord*>(CCDConnectionPrefsRecord::RecordFactoryL(KCDTIdApPrioritySelectionPolicyRecord));
       
   580     	CleanupStack::PushL(selPolRecord);
       
   581     	selPolRecord->SetRecordId(KRecordId);
       
   582     	selPolRecord->LoadL(*iCDSession);
       
   583         
       
   584     	TESTL(TPtrC(selPolRecord->iRecordName) == KSelName1);
       
   585         
       
   586         //-----------------------
       
   587         //OK, got the SelectionPolicyRecord - next step read the referenced AccessPointRecord
       
   588         CCDAccessPointRecord* apLink = static_cast<CCDAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdAccessPointRecord));
       
   589         apLink->SetRecordId(KRecordId);
       
   590         apLink->LoadL(*iCDSession);
       
   591         
       
   592         TUint recId = apLink->RecordId();
       
   593         //-----------------------
       
   594         
       
   595    	    //if(selPolRecord->iAp1 == KAp1)
       
   596    	    if(recId == KAp1)
       
   597    	        {
       
   598    	        INFO_PRINTF1(_L("Selection Policy record found"));
       
   599    	        SetTestStepResult(EPass);
       
   600    	        }
       
   601    	    else
       
   602    	        {
       
   603    	        INFO_PRINTF1(_L("Selection Policy record not found"));
       
   604    	        TUint s = selPolRecord->iAp1;
       
   605    	        INFO_PRINTF2(_L("selPolRecord->iAp1 is %d"), s);
       
   606    	        }
       
   607    	    CleanupStack::PopAndDestroy(apLink);
       
   608 	    CleanupStack::PopAndDestroy(selPolRecord);
       
   609 	    }
       
   610 	CleanupStack::PopAndDestroy(apRecord);*/
       
   611 #else
       
   612 	_LIT(KApName1, "SNAP1");
       
   613 	_LIT(KSelName1, "SelectionPolicy1");
       
   614 
       
   615     CCDAccessPointRecord* apRecord = static_cast<CCDAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdAccessPointRecord));
       
   616 	CleanupStack::PushL(apRecord);
       
   617 
       
   618     apRecord->iRecordName.SetL(KApName1);
       
   619 	TInt found = apRecord->FindL(*iCDSession);
       
   620 	if (found)
       
   621 	    {
       
   622         INFO_PRINTF2(_L("apRecord loaded. Element id is %08x"), apRecord->ElementId());
       
   623 
       
   624         //Load the Selection Policy record
       
   625        	CCDIAPPrioritySelectionPolicyRecord * selPolRecord = static_cast<CCDIAPPrioritySelectionPolicyRecord *>(LoadLinkedRecordL(*iCDSession, apRecord->iSelectionPolicy));
       
   626     	CleanupStack::PushL(selPolRecord);
       
   627 
       
   628     	TESTL(TPtrC(selPolRecord->iRecordName) == KSelName1);
       
   629 
       
   630    	    if(selPolRecord->iIap1.RecordId() == 1)
       
   631    	        {
       
   632    	        INFO_PRINTF1(_L("Selection Policy record found"));
       
   633    	        SetTestStepResult(EPass);
       
   634    	        }
       
   635    	    else
       
   636    	        {
       
   637    	        INFO_PRINTF1(_L("Selection Policy record not found"));
       
   638    	        }
       
   639 	    CleanupStack::PopAndDestroy(selPolRecord);
       
   640 	    }
       
   641 	CleanupStack::PopAndDestroy(apRecord);
       
   642 #endif
       
   643 	return TestStepResult();
       
   644 	}
       
   645 
       
   646 //----------------------------------------------------------------------------------------------------------------
       
   647 
       
   648 CCommsdat213Step::CCommsdat213Step()
       
   649 /**
       
   650  * Constructor
       
   651  */
       
   652 	{
       
   653 	SetTestStepName(KCommsdat213Step);
       
   654 	}
       
   655 
       
   656 TVerdict CCommsdat213Step::doTestStepL()
       
   657 /**
       
   658  * @return - TVerdict code
       
   659  * Check the read and write access to database fields
       
   660  */
       
   661 	{
       
   662     SetTestStepResult(EFail);
       
   663 	INFO_PRINTF1(_L("Testing read write Check access to database fields Commsdat213Step::doTestStepL() "));
       
   664 
       
   665 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
   666 	CleanupStack::PushL(utils);
       
   667 
       
   668 	TDesC16 number(_L("6294841"));
       
   669 	RMessagePtr2 aMessage;
       
   670 
       
   671 
       
   672 	TInt res1 = utils->CheckReadCapability(number,&aMessage);
       
   673 
       
   674 	TInt res2 = utils->CheckWriteCapability(number,&aMessage);
       
   675 
       
   676 	if(res1 == KErrNone && res2 == KErrNone)
       
   677 		{
       
   678 		INFO_PRINTF1(_L("Read and write access to database is checked"));
       
   679 		SetTestStepResult(EPass);
       
   680 		}
       
   681 	CleanupStack::PopAndDestroy(utils);
       
   682 
       
   683 	return TestStepResult();
       
   684 	}
       
   685 
       
   686 //----------------------------------------------------------------------------------------------------------------
       
   687 
       
   688 CCommsdat214Step::CCommsdat214Step()
       
   689 /**
       
   690  * Constructor
       
   691  */
       
   692 	{
       
   693 	SetTestStepName(KCommsdat214Step);
       
   694 	}
       
   695 
       
   696 TVerdict CCommsdat214Step::doTestStepL()
       
   697 /**
       
   698  * @return - TVerdict code
       
   699  * Resolve mobile phone number for dialing
       
   700  * CED -i Z:\testdata\configs\te_commsdat_location_table2.cfg
       
   701  */
       
   702 	{
       
   703     SetTestStepResult(EFail);
       
   704 	INFO_PRINTF1(_L("Testing resolving phone number for dialing in CCommsdat214Step::doTestStepL() "));
       
   705 
       
   706 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
   707 	CleanupStack::PushL(utils);
       
   708 
       
   709 	_LIT(KNumber, "6294841");
       
   710 	TPtrC number(KNumber);
       
   711 	TBuf<TELEPHONE_NO_SIZE> dialString;
       
   712 
       
   713 	utils->ResolvePhoneNumberFromDatabaseL(number, dialString, EForDialing, KLocationRecordId, KChargecardRecordId);
       
   714 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
   715 
       
   716 	if(dialString == KNumber)
       
   717 		{
       
   718 		SetTestStepResult(EPass);
       
   719 		}
       
   720 
       
   721 	CleanupStack::PopAndDestroy(utils);
       
   722 	return TestStepResult();
       
   723 	}
       
   724 
       
   725 //----------------------------------------------------------------------------------------------------------------
       
   726 
       
   727 CCommsdat215Step::CCommsdat215Step()
       
   728 /**
       
   729  * Constructor
       
   730  */
       
   731 	{
       
   732 	SetTestStepName(KCommsdat215Step);
       
   733 	}
       
   734 
       
   735 TVerdict CCommsdat215Step::doTestStepL()
       
   736 /**
       
   737  * @return - TVerdict code
       
   738  * Resolve mobile phone number for display
       
   739  * CED -i Z:\testdata\configs\te_commsdat_location_table2.cfg
       
   740  */
       
   741 	{
       
   742 
       
   743     SetTestStepResult(EFail);
       
   744 	INFO_PRINTF1(_L("Testing resolving phone number for display in CCommsdat215Step::doTestStepL() "));
       
   745 
       
   746 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
   747 	CleanupStack::PushL(utils);
       
   748 
       
   749 	_LIT(KNumber, "6294841");
       
   750 	TPtrC number(KNumber);
       
   751 	TBuf<TELEPHONE_NO_SIZE> dialString;
       
   752 
       
   753 	utils->ResolvePhoneNumberFromDatabaseL(number, dialString, EForDisplay, KLocationRecordId, KChargecardRecordId);
       
   754 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
   755 
       
   756 	if(dialString == KNumber)
       
   757 		{
       
   758 		SetTestStepResult(EPass);
       
   759 		}
       
   760 
       
   761 	CleanupStack::PopAndDestroy(utils);
       
   762 	return TestStepResult();
       
   763 	}
       
   764 
       
   765 
       
   766 
       
   767 
       
   768