commsconfig/commsdatabaseshim/TE_commdb/src/Step_007_xx.cpp
changeset 72 ae47d0499bee
equal deleted inserted replaced
68:5da8188e392b 72:ae47d0499bee
       
     1 //
       
     2 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 // All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 //
       
     9 // Initial Contributors:
       
    10 // Nokia Corporation - initial contribution.
       
    11 //
       
    12 // Contributors:
       
    13 //
       
    14 // Description:
       
    15 //
       
    16 //
       
    17 //
       
    18 // This contains CommDb Unit Test Cases 007.XX
       
    19 
       
    20 // EPOC includes
       
    21 #include <e32base.h>
       
    22 #include <commdb.h>
       
    23 
       
    24 
       
    25 // Test system includes
       
    26 #include "Teststepcommdb.h"
       
    27 #include "Step_007_xx.h"
       
    28 
       
    29 //#ifndef SYMBIAN_COMMS_REPOSITORY
       
    30 //	_LIT(KTempDb3, "c:\\system\\data\\default3.dat");
       
    31 //#endif
       
    32 
       
    33 /////////////////////
       
    34 //	Test step 007.001
       
    35 /////////////////////
       
    36 
       
    37 // constructor
       
    38 CCommDbTest007_01::CCommDbTest007_01()
       
    39 	{
       
    40 	// store the name of this test case
       
    41 	SetTestStepName(_L("step_007_01"));
       
    42 	}
       
    43 
       
    44 // destructor
       
    45 CCommDbTest007_01::~CCommDbTest007_01()
       
    46 	{
       
    47 	}
       
    48 
       
    49 
       
    50 TVerdict CCommDbTest007_01::doTestStepPreambleL()
       
    51 	{
       
    52 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
    53         SetTestStepResult(EPass);	return TestStepResult();
       
    54 	}
       
    55 
       
    56 #define EXPECTED_FIELD_VALUE _L8("Call me back")
       
    57 
       
    58 TInt CCommDbTest007_01::executeStepL()
       
    59 	{
       
    60 	TInt ret = EFail;
       
    61 
       
    62 
       
    63 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone );
       
    64 	//Read the value from the field and compare it to the expected value
       
    65 	TBuf8<KCommsDbSvrMaxFieldLength> value;
       
    66 
       
    67 	iTheView->ReadTextL( TPtrC(ISP_IF_CALLBACK_INFO), value );
       
    68 
       
    69 	if( !value.Compare( TPtrC8(EXPECTED_FIELD_VALUE) ) )
       
    70 		{
       
    71 		ret = EPass;
       
    72 		}
       
    73 
       
    74 	return ret;
       
    75 	}
       
    76 
       
    77 TVerdict CCommDbTest007_01::doTestStepL( )
       
    78 	{
       
    79 	INFO_PRINTF1(_L("Step 007.01 called "));
       
    80 
       
    81 	SetTestStepResult(EFail);
       
    82 
       
    83 	if ( executeStepL() == EPass )
       
    84 		SetTestStepResult(EPass);	else
       
    85 		SetTestStepResult(EFail);
       
    86 	return TestStepResult();
       
    87 	}
       
    88 
       
    89 
       
    90 /////////////////////
       
    91 //	Test step 007.002
       
    92 /////////////////////
       
    93 
       
    94 // constructor
       
    95 CCommDbTest007_02::CCommDbTest007_02()
       
    96 	{
       
    97 	// store the name of this test case
       
    98 	SetTestStepName(_L("step_007_02"));
       
    99 	}
       
   100 
       
   101 // destructor
       
   102 CCommDbTest007_02::~CCommDbTest007_02()
       
   103 	{
       
   104 	}
       
   105 
       
   106 
       
   107 TVerdict CCommDbTest007_02::doTestStepPreambleL()
       
   108 	{
       
   109 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   110         SetTestStepResult(EPass);	return TestStepResult();
       
   111 	}
       
   112 
       
   113 #define EXPECTED_ISP_DESCRIPTION _S("Description")
       
   114 
       
   115 TInt CCommDbTest007_02::executeStepL()
       
   116 	{
       
   117 	TInt32 ret = EFail;
       
   118 
       
   119 
       
   120 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone );
       
   121 	//Read the value from the field and compare it to the expected value
       
   122 	TBuf<KCommsDbSvrMaxFieldLength> value;
       
   123 	iTheView->ReadTextL( TPtrC(ISP_DESCRIPTION), value );
       
   124 
       
   125 	if( !value.Compare( TPtrC(EXPECTED_ISP_DESCRIPTION) ) )
       
   126 		{
       
   127 		ret = EPass;
       
   128 		}
       
   129 
       
   130 	return ret;
       
   131 	}
       
   132 
       
   133 TVerdict CCommDbTest007_02::doTestStepL( )
       
   134 	{
       
   135 	INFO_PRINTF1(_L("Step 007.02 called "));
       
   136 	SetTestStepResult(EFail);
       
   137 	if ( executeStepL() == EPass  )
       
   138 		SetTestStepResult(EPass);	else
       
   139 		SetTestStepResult(EFail);
       
   140 	return TestStepResult();
       
   141 	}
       
   142 
       
   143 
       
   144 /////////////////////
       
   145 //	Test step 007.003
       
   146 /////////////////////
       
   147 
       
   148 // constructor
       
   149 CCommDbTest007_03::CCommDbTest007_03()
       
   150 	{
       
   151 	// store the name of this test case
       
   152 	SetTestStepName(_L("step_007_03"));
       
   153 	}
       
   154 
       
   155 // destructor
       
   156 CCommDbTest007_03::~CCommDbTest007_03()
       
   157 	{
       
   158 	}
       
   159 
       
   160 TVerdict CCommDbTest007_03::doTestStepPreambleL()
       
   161 	{
       
   162 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   163         SetTestStepResult(EPass);	return TestStepResult();
       
   164 	}
       
   165 
       
   166 #define EXPECTED_ISP_LOGIN_SCRIPT _S("wobble")
       
   167 
       
   168 TInt CCommDbTest007_03::executeStepL()
       
   169 	{
       
   170 	TInt32 ret = EFail;
       
   171 
       
   172 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone );
       
   173 
       
   174 	//Read the value from the LongText field and compare it to the expected value
       
   175 	HBufC* value = iTheView->ReadLongTextLC( TPtrC(ISP_LOGIN_SCRIPT) );
       
   176 
       
   177 	if ( value )
       
   178 		{
       
   179 		if( !value->Compare( TPtrC(EXPECTED_ISP_LOGIN_SCRIPT) ) )
       
   180 			{
       
   181 			ret = EPass;
       
   182 			}
       
   183 		CleanupStack::PopAndDestroy();
       
   184 		}
       
   185 
       
   186 
       
   187 	return ret;
       
   188 	}
       
   189 
       
   190 TVerdict CCommDbTest007_03::doTestStepL( )
       
   191 	{
       
   192 	INFO_PRINTF1(_L("Step 007.03 called "));
       
   193 
       
   194 	if ( executeStepL() == EPass  )
       
   195 		SetTestStepResult(EPass);	else
       
   196 		SetTestStepResult(EFail);
       
   197 	return TestStepResult();
       
   198 	}
       
   199 
       
   200 
       
   201 
       
   202 /////////////////////
       
   203 //	Test step 007.004
       
   204 /////////////////////
       
   205 
       
   206 // constructor
       
   207 CCommDbTest007_04::CCommDbTest007_04()
       
   208 	{
       
   209 	// store the name of this test case
       
   210 	SetTestStepName(_L("step_007_04"));
       
   211 	}
       
   212 
       
   213 // destructor
       
   214 CCommDbTest007_04::~CCommDbTest007_04()
       
   215 	{
       
   216 	}
       
   217 
       
   218 TVerdict CCommDbTest007_04::doTestStepPreambleL()
       
   219 	{
       
   220 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   221         SetTestStepResult(EPass);	return TestStepResult();
       
   222 	}
       
   223 
       
   224 #define EXPECTED_ISP_TYPE  2
       
   225 
       
   226 TInt CCommDbTest007_04::executeStepL()
       
   227 	{
       
   228 	TBool ret = EFail;
       
   229 
       
   230 
       
   231 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone);
       
   232 	//Read the value from the Uint field and compare it to the expected value
       
   233 	TUint32 value;
       
   234 	iTheView->ReadUintL( TPtrC(ISP_TYPE), value );
       
   235 
       
   236 	if( value == EXPECTED_ISP_TYPE )
       
   237 		{
       
   238 		ret = EPass;
       
   239 		}
       
   240 
       
   241 	return ret;
       
   242 }
       
   243 
       
   244 TVerdict CCommDbTest007_04::doTestStepL( )
       
   245 	{
       
   246 	INFO_PRINTF1(_L("Step 007.04 called "));
       
   247 
       
   248 
       
   249 	if ( executeStepL() == EPass  )
       
   250 		SetTestStepResult(EPass);	else
       
   251 		SetTestStepResult(EFail);
       
   252 
       
   253 	return TestStepResult();
       
   254 	}
       
   255 
       
   256 
       
   257 /////////////////////
       
   258 //	Test step 007.005
       
   259 /////////////////////
       
   260 
       
   261 // constructor
       
   262 CCommDbTest007_05::CCommDbTest007_05()
       
   263 	{
       
   264 	// store the name of this test case
       
   265 	SetTestStepName(_L("step_007_05"));
       
   266 	// default to no local objects allocated
       
   267 	iLocalObjects = EFalse;
       
   268 	}
       
   269 
       
   270 // destructor
       
   271 CCommDbTest007_05::~CCommDbTest007_05()
       
   272 	{
       
   273 	}
       
   274 
       
   275 TVerdict CCommDbTest007_05::doTestStepPreambleL()
       
   276 	{
       
   277 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   278         SetTestStepResult(EPass);	return TestStepResult();
       
   279 	}
       
   280 
       
   281 TInt CCommDbTest007_05::executeStepL()
       
   282 	{
       
   283 	TBool ret = EFail;
       
   284 
       
   285 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone);
       
   286 	//Read the value from the Uint field and compare it to the expected value
       
   287 	TBool expectedValue;
       
   288 	iTheView->ReadBoolL( TPtrC(ISP_DISPLAY_PCT), expectedValue );
       
   289 
       
   290 	if( expectedValue )
       
   291 		{
       
   292 		SetTestStepResult(EPass);		}
       
   293 
       
   294 	return ret;
       
   295 	}
       
   296 
       
   297 TVerdict CCommDbTest007_05::doTestStepL( )
       
   298 	{
       
   299 	INFO_PRINTF1(_L("Step 007.05 called "));
       
   300 
       
   301 	if ( executeStepL() == EPass  )
       
   302 		SetTestStepResult(EPass);	else
       
   303 		SetTestStepResult(EFail);
       
   304 	return TestStepResult();
       
   305 	}
       
   306 
       
   307 
       
   308 
       
   309 /////////////////////
       
   310 //	Test step 007.006
       
   311 /////////////////////
       
   312 
       
   313 // constructor
       
   314 CCommDbTest007_06::CCommDbTest007_06()
       
   315 	{
       
   316 	// store the name of this test case
       
   317 	SetTestStepName(_L("step_007_06"));
       
   318 	}
       
   319 
       
   320 // destructor
       
   321 CCommDbTest007_06::~CCommDbTest007_06()
       
   322 	{
       
   323 	}
       
   324 
       
   325 TVerdict CCommDbTest007_06::doTestStepPreambleL()
       
   326 	{
       
   327 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   328         SetTestStepResult(EPass);	return TestStepResult();
       
   329 	}
       
   330 
       
   331 #define EXPECTED_COLUMN_LENGTH	10		//Expected length of ISP_IP_ADDR column
       
   332 
       
   333 TInt CCommDbTest007_06::executeStepL()
       
   334 	{
       
   335 	TBool ret = EFail;
       
   336 
       
   337 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone );
       
   338 
       
   339 	//Read the length of a column
       
   340 	TInt value;
       
   341 	iTheView->ReadColumnLengthL( TPtrC(ISP_IP_ADDR), value );
       
   342 
       
   343 	if( value == EXPECTED_COLUMN_LENGTH )
       
   344 		SetTestStepResult(EPass);
       
   345 	return ret;
       
   346 	}
       
   347 
       
   348 TVerdict CCommDbTest007_06::doTestStepL( )
       
   349 	{
       
   350 	INFO_PRINTF1(_L("Step 007.06 called "));
       
   351 
       
   352 	if ( executeStepL() == EPass  )
       
   353 		SetTestStepResult(EPass);	else
       
   354 		SetTestStepResult(EFail);
       
   355 	return TestStepResult();
       
   356 	}
       
   357 
       
   358 
       
   359 /////////////////////
       
   360 //	Test step 007.007
       
   361 /////////////////////
       
   362 
       
   363 // constructor
       
   364 CCommDbTest007_07::CCommDbTest007_07()
       
   365 	{
       
   366 	// store the name of this test case
       
   367 	SetTestStepName(_L("step_007_07"));
       
   368 	}
       
   369 
       
   370 // destructor
       
   371 CCommDbTest007_07::~CCommDbTest007_07()
       
   372 	{
       
   373 	}
       
   374 
       
   375 
       
   376 
       
   377 TVerdict CCommDbTest007_07::doTestStepPreambleL()
       
   378 	{
       
   379 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   380         SetTestStepResult(EPass);	return TestStepResult();
       
   381 	}
       
   382 
       
   383 TInt CCommDbTest007_07::executeStepL()
       
   384 	{
       
   385 	TInt ret = KErrGeneral;
       
   386 
       
   387 	ret = iTheView->GotoFirstRecord();
       
   388 	if ( ret == KErrNotFound )
       
   389 		return ret;
       
   390 
       
   391 	//Try to read a column value from the empty view
       
   392 	TBuf<KCommsDbSvrMaxFieldLength> value;
       
   393 	iTheView->ReadTextL( TPtrC(ISP_DESCRIPTION), value );
       
   394 	return ret;
       
   395 	}
       
   396 
       
   397 TVerdict CCommDbTest007_07::doTestStepL( )
       
   398 	{
       
   399 	INFO_PRINTF1(_L("Step 007.07 called "));
       
   400 
       
   401 	//NB. create a view on an empty table
       
   402 	if ( executeStepL() == KErrNotFound )
       
   403 		SetTestStepResult(EPass);	else
       
   404 		SetTestStepResult(EFail);
       
   405 
       
   406 	return TestStepResult();
       
   407 	}
       
   408 
       
   409 /////////////////////
       
   410 //	Test step 007.08
       
   411 /////////////////////
       
   412 
       
   413 // constructor
       
   414 CCommDbTest007_08::CCommDbTest007_08()
       
   415 	{
       
   416 	// store the name of this test case
       
   417 	SetTestStepName(_L("step_007_08"));
       
   418 	// default to no local objects allocated
       
   419 	iLocalObjects = EFalse;
       
   420 	}
       
   421 
       
   422 // destructor
       
   423 CCommDbTest007_08::~CCommDbTest007_08()
       
   424 	{
       
   425 	}
       
   426 
       
   427 
       
   428 
       
   429 TVerdict CCommDbTest007_08::doTestStepPreambleL()
       
   430 	{
       
   431 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   432         SetTestStepResult(EPass);	return TestStepResult();
       
   433 	}
       
   434 
       
   435 TInt CCommDbTest007_08::executeStepL()
       
   436 	{
       
   437 	TBool ret = EFail;
       
   438 
       
   439 	ret = iTheView->GotoFirstRecord();
       
   440 	if ( ret == KErrNotFound )
       
   441 		{
       
   442          	SetTestStepResult(EPass);	
       
   443 		return TestStepResult();
       
   444 		}
       
   445 
       
   446 	//Read the length of a column
       
   447 	TInt value;
       
   448 	iTheView->ReadColumnLengthL( TPtrC(ISP_IF_PARAMS), value );
       
   449 	if ( value == 0 )
       
   450 		ret = EPass;
       
   451 
       
   452 	return ret;
       
   453 	}
       
   454 
       
   455 TVerdict CCommDbTest007_08::doTestStepL( )
       
   456 	{
       
   457 	INFO_PRINTF1(_L("Step 007.08 called "));
       
   458 
       
   459 	//NB. create a view on an empty table
       
   460 
       
   461 	if ( executeStepL() == EPass )
       
   462 		SetTestStepResult(EPass);	else
       
   463 		SetTestStepResult(EFail);
       
   464 	return TestStepResult();
       
   465 	}
       
   466 
       
   467 /////////////////////
       
   468 //	Test step 007.09
       
   469 /////////////////////
       
   470 
       
   471 // constructor
       
   472 CCommDbTest007_09::CCommDbTest007_09()
       
   473 	{
       
   474 	// store the name of this test case
       
   475 	SetTestStepName(_L("step_007_09"));
       
   476 	}
       
   477 
       
   478 // destructor
       
   479 CCommDbTest007_09::~CCommDbTest007_09()
       
   480 	{
       
   481 	}
       
   482 
       
   483 
       
   484 TVerdict CCommDbTest007_09::doTestStepPreambleL()
       
   485 	{
       
   486 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   487         SetTestStepResult(EPass);	return TestStepResult();
       
   488 	}
       
   489 
       
   490 TInt CCommDbTest007_09::executeStepL()
       
   491 	{
       
   492 	TInt ret = KErrGeneral;
       
   493 
       
   494 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone )
       
   495 
       
   496 	//Try to read from an invalid column
       
   497 	TBuf<KCommsDbSvrMaxFieldLength> value;
       
   498 	TRAPD(r, iTheView->ReadTextL( KInvalidColumnName, value ) );
       
   499 
       
   500 	ret = r;
       
   501 
       
   502 	return ret;
       
   503 	}
       
   504 
       
   505 TVerdict CCommDbTest007_09::doTestStepL( )
       
   506 	{
       
   507 	INFO_PRINTF1(_L("Step 007.09 called "));
       
   508 
       
   509 	//NB. create a view on an empty table
       
   510 
       
   511 	if ( executeStepL() == KErrNotFound )
       
   512 		SetTestStepResult(EPass);	else
       
   513 		SetTestStepResult(EFail);
       
   514 
       
   515 	return TestStepResult();
       
   516 	}
       
   517 
       
   518 
       
   519 /////////////////////
       
   520 //	Test step 007.10
       
   521 /////////////////////
       
   522 
       
   523 // constructor
       
   524 CCommDbTest007_10::CCommDbTest007_10()
       
   525 	{
       
   526 	// store the name of this test case
       
   527 	SetTestStepName(_L("step_007_10"));
       
   528 	}
       
   529 
       
   530 // destructor
       
   531 CCommDbTest007_10::~CCommDbTest007_10()
       
   532 	{
       
   533 	}
       
   534 
       
   535 
       
   536 TVerdict CCommDbTest007_10::doTestStepPreambleL()
       
   537 	{
       
   538 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   539         SetTestStepResult(EPass);	return TestStepResult();
       
   540 	}
       
   541 
       
   542 
       
   543 TInt CCommDbTest007_10::executeStepL()
       
   544 	{
       
   545 	TInt ret = KErrGeneral;
       
   546 
       
   547 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone );
       
   548 
       
   549 	//Try to read length of an invalid column
       
   550 	TInt value;
       
   551 	TRAPD(r,iTheView->ReadColumnLengthL( KInvalidColumnName, value ));
       
   552 	ret = r;
       
   553 
       
   554 	return ret;
       
   555 	}
       
   556 
       
   557 TVerdict CCommDbTest007_10::doTestStepL( )
       
   558 	{
       
   559 	INFO_PRINTF1(_L("Step 007.10 called "));
       
   560 
       
   561 	//NB. create a view on an empty table
       
   562 
       
   563 	if ( executeStepL() == KErrNotFound )
       
   564 		SetTestStepResult(EPass);	else
       
   565 		SetTestStepResult(EFail);
       
   566 	return TestStepResult();
       
   567 	}
       
   568 
       
   569 
       
   570 /////////////////////
       
   571 //	Test step 007.11
       
   572 /////////////////////
       
   573 
       
   574 // constructor
       
   575 CCommDbTest007_11::CCommDbTest007_11()
       
   576 	{
       
   577 	// store the name of this test case
       
   578 	SetTestStepName(_L("step_007_11"));
       
   579 	}
       
   580 
       
   581 // destructor
       
   582 CCommDbTest007_11::~CCommDbTest007_11()
       
   583 	{
       
   584 	}
       
   585 
       
   586 
       
   587 TVerdict CCommDbTest007_11::doTestStepPreambleL()
       
   588 	{
       
   589 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   590         SetTestStepResult(EPass);	return TestStepResult();
       
   591 	}
       
   592 
       
   593 TInt CCommDbTest007_11::executeStepL()
       
   594 	{
       
   595 	TInt ret = KErrGeneral;
       
   596 
       
   597 	CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone);
       
   598 
       
   599 	//Read a column that will have a NULL value
       
   600 	TBuf<KCommsDbSvrMaxFieldLength> value;
       
   601 	TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) );
       
   602 	if ( r==KErrNone && value.Size() == 0 )
       
   603 		{
       
   604 			//test passed
       
   605 			ret = KErrNone;
       
   606 		}
       
   607 	else if ( r != KErrNone )
       
   608 		{
       
   609 		//return the leave reason
       
   610 		ret = r;
       
   611 		}
       
   612 
       
   613 
       
   614 	return ret;
       
   615 	}
       
   616 
       
   617 TVerdict CCommDbTest007_11::doTestStepL( )
       
   618 	{
       
   619 	INFO_PRINTF1(_L("Step 007.11 called "));
       
   620 
       
   621 	if ( executeStepL() == KErrNone )
       
   622 		SetTestStepResult(EPass);	else
       
   623 		SetTestStepResult(EFail);
       
   624 
       
   625 	return TestStepResult();
       
   626 	}
       
   627 
       
   628 
       
   629 
       
   630 /////////////////////
       
   631 //	Test step 007.12
       
   632 /////////////////////
       
   633 
       
   634 // constructor
       
   635 CCommDbTest007_12::CCommDbTest007_12()
       
   636 	{
       
   637 	// store the name of this test case
       
   638 	SetTestStepName(_L("step_007_12"));
       
   639 	}
       
   640 
       
   641 // destructor
       
   642 CCommDbTest007_12::~CCommDbTest007_12()
       
   643 	{
       
   644 	}
       
   645 
       
   646 
       
   647 TVerdict CCommDbTest007_12::doTestStepPreambleL()
       
   648 	{
       
   649 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   650         SetTestStepResult(EPass);	return TestStepResult();
       
   651 	}
       
   652 
       
   653 
       
   654 TInt CCommDbTest007_12::executeStepL()
       
   655 	{
       
   656 	TInt ret = KErrGeneral;
       
   657 
       
   658 	CDBLEAVE( ret =  iTheView->GotoFirstRecord(), KErrNone )
       
   659 
       
   660 	//Try to read length of column containing a NULL value
       
   661 	TInt value = -1;
       
   662 	TRAPD(r, iTheView->ReadColumnLengthL( TPtrC(ISP_DESCRIPTION), value ) );
       
   663 	if ( r==KErrNone && value == 0 )
       
   664 		{
       
   665 			//test passed
       
   666 			ret = KErrNone;
       
   667 		}
       
   668 	else if ( r != KErrNone )
       
   669 		{
       
   670 		//return the leave reason
       
   671 		ret = r;
       
   672 		}
       
   673 
       
   674 	return ret;
       
   675 	}
       
   676 
       
   677 TVerdict CCommDbTest007_12::doTestStepL( )
       
   678 	{
       
   679 	INFO_PRINTF1(_L("Step 007.12 called "));
       
   680 
       
   681 	//NB. create a view on an empty table
       
   682 	if ( executeStepL() == KErrNone )
       
   683 		SetTestStepResult(EPass);	else
       
   684 		SetTestStepResult(EFail);
       
   685 
       
   686 	return TestStepResult();
       
   687 	}
       
   688 
       
   689 
       
   690 
       
   691 
       
   692 /////////////////////
       
   693 //	Test step 007.13
       
   694 /////////////////////
       
   695 /*
       
   696 //Removed since this test will not compile on Code warrior due to having an array of zero length
       
   697 // constructor
       
   698 CCommDbTest007_13::CCommDbTest007_13()
       
   699 	{
       
   700 	// store the name of this test case
       
   701 	SetTestStepName(_L("step_007_13"));
       
   702 	}
       
   703 
       
   704 // destructor
       
   705 CCommDbTest007_13::~CCommDbTest007_13()
       
   706 	{
       
   707 	}
       
   708 
       
   709 
       
   710 TVerdict CCommDbTest007_13::doTestStepPreambleL()
       
   711 	{
       
   712 	copyTestDatabase( EDatabase_1 );
       
   713 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   714         SetTestStepResult(EPass);	return TestStepResult();
       
   715 	}
       
   716 
       
   717 TInt CCommDbTest007_13::executeStepL()
       
   718 	{
       
   719 	TInt ret = KErrGeneral;
       
   720 
       
   721 
       
   722 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   723 
       
   724 	//Read a column and pass a zero length buffer
       
   725 
       
   726 	//This next line causes a warning
       
   727 	TBuf<0> value;
       
   728 
       
   729 
       
   730 	TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) );
       
   731 	if ( r==KErrNone  )
       
   732 		{
       
   733 			//test passed
       
   734 			ret = KErrNone;
       
   735 		}
       
   736 	else if ( r != KErrNone )
       
   737 		{
       
   738 		//return the leave reason
       
   739 		ret = r;
       
   740 		}
       
   741 
       
   742 	return ret;
       
   743 	}
       
   744 
       
   745 TVerdict CCommDbTest007_13::doTestStepL( )
       
   746 	{
       
   747 	INFO_PRINTF1(_L("Step 007.13 called."));
       
   748 
       
   749 	//NB. create a view on an empty table
       
   750 
       
   751 	if ( executeStepL() == KErrNone )
       
   752 		SetTestStepResult(EPass);	else
       
   753 		SetTestStepResult(EFail);
       
   754 
       
   755 	return TestStepResult();
       
   756 	}
       
   757 
       
   758 
       
   759 */
       
   760 
       
   761 
       
   762 /////////////////////
       
   763 //	Test step 007.14
       
   764 /////////////////////
       
   765 
       
   766 // constructor
       
   767 CCommDbTest007_14::CCommDbTest007_14()
       
   768 	{
       
   769 	// store the name of this test case
       
   770 	SetTestStepName(_L("step_007_14"));
       
   771 	}
       
   772 
       
   773 // destructor
       
   774 CCommDbTest007_14::~CCommDbTest007_14()
       
   775 	{
       
   776 	}
       
   777 
       
   778 
       
   779 TVerdict CCommDbTest007_14::doTestStepPreambleL()
       
   780 	{
       
   781 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   782         SetTestStepResult(EPass);	return TestStepResult();
       
   783 	}
       
   784 
       
   785 TInt CCommDbTest007_14::executeStepL()
       
   786 	{
       
   787 	TInt ret = KErrGeneral;
       
   788 
       
   789 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   790 
       
   791 	//Read a column and pass a small length buffer
       
   792 
       
   793 	TBuf<5> value;
       
   794 
       
   795 	TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) );
       
   796 	if ( r==KErrNone  )
       
   797 		{
       
   798 			//test passed
       
   799 			ret = KErrNone;
       
   800 		}
       
   801 	else if ( r != KErrNone )
       
   802 		{
       
   803 		//return the leave reason
       
   804 		ret = r;
       
   805 		}
       
   806 
       
   807 	return ret;
       
   808 	}
       
   809 
       
   810 TVerdict CCommDbTest007_14::doTestStepL( )
       
   811 	{
       
   812 	//NB. create a view on an empty table
       
   813 
       
   814 	if ( executeStepL() == KErrNone )
       
   815 		SetTestStepResult(EPass);	else
       
   816 		SetTestStepResult(EFail);
       
   817 
       
   818 	return TestStepResult();
       
   819 	}
       
   820 
       
   821 
       
   822 
       
   823 /////////////////////
       
   824 //	Test step 007.15
       
   825 /////////////////////
       
   826 
       
   827 // constructor
       
   828 CCommDbTest007_15::CCommDbTest007_15()
       
   829 	{
       
   830 	// store the name of this test case
       
   831 	SetTestStepName(_L("step_007_15"));
       
   832 	}
       
   833 
       
   834 // destructor
       
   835 CCommDbTest007_15::~CCommDbTest007_15()
       
   836 	{
       
   837 	}
       
   838 
       
   839 
       
   840 TVerdict CCommDbTest007_15::doTestStepPreambleL()
       
   841 	{
       
   842 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   843         SetTestStepResult(EPass);	return TestStepResult();
       
   844 	}
       
   845 
       
   846 
       
   847 #define ISP_DESCRIPTION_VALUE	_S("Isp #1")
       
   848 
       
   849 TInt CCommDbTest007_15::executeStepL()
       
   850 	{
       
   851 	TInt ret = KErrGeneral;
       
   852 
       
   853 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   854 
       
   855 	//Read a read only column
       
   856 	TBuf<KCommsDbSvrMaxFieldLength> value;
       
   857 	TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) );
       
   858 	if ( r==KErrNone && value.Compare(TPtrC(ISP_DESCRIPTION_VALUE) ) == 0 )
       
   859 		{
       
   860 			//test passed
       
   861 			ret = KErrNone;
       
   862 		}
       
   863 	else if ( r != KErrNone )
       
   864 		{
       
   865 		//return the leave reason
       
   866 		ret = r;
       
   867 		}
       
   868 
       
   869 	return ret;
       
   870 	}
       
   871 
       
   872 TVerdict CCommDbTest007_15::doTestStepL( )
       
   873 	{
       
   874 	INFO_PRINTF1(_L("Step 007.15 called"));
       
   875 
       
   876 	//NB. create a view on an empty table
       
   877 
       
   878 	if ( executeStepL() == KErrNone )
       
   879 		SetTestStepResult(EPass);	else
       
   880 		SetTestStepResult(EFail);
       
   881 
       
   882 	return TestStepResult();
       
   883 	}
       
   884 
       
   885 
       
   886 /////////////////////
       
   887 //	Test step 007.16
       
   888 // Check different paths in ReadTextL
       
   889 /////////////////////
       
   890 
       
   891 // constructor
       
   892 CCommDbTest007_16::CCommDbTest007_16()
       
   893 	{
       
   894 	// store the name of this test case
       
   895 	SetTestStepName(_L("step_007_16"));
       
   896 	}
       
   897 
       
   898 // destructor
       
   899 CCommDbTest007_16::~CCommDbTest007_16()
       
   900 	{
       
   901 	}
       
   902 
       
   903 
       
   904 TVerdict CCommDbTest007_16::doTestStepPreambleL()
       
   905 	{
       
   906 	openDbAndViewL(TPtrC(OUTGOING_GPRS));
       
   907         SetTestStepResult(EPass);	return TestStepResult();
       
   908 	}
       
   909 
       
   910 
       
   911 #define SHORT_APN_VALUE	_S("Test")
       
   912 
       
   913 // this is KCommsDbSvrRealMaxFieldLength chars long (=255)
       
   914 #define LONG_APN_VALUE	_S("TheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDog123")
       
   915 
       
   916 TInt CCommDbTest007_16::executeStepL()
       
   917 	{
       
   918 	CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   919 
       
   920 	// Read a short APN value
       
   921 	TBuf<KCommsDbSvrRealMaxFieldLength> value;
       
   922 	iTheView->ReadTextL( TPtrC( GPRS_APN ), value );
       
   923 
       
   924 	if (value.Compare(TPtrC(SHORT_APN_VALUE) ) != 0 )
       
   925 		{
       
   926 		User::Leave(KErrGeneral);
       
   927 		}
       
   928 
       
   929 	// check that the long desc test is valid - ie KCommsDbSvrRealMaxFieldLength
       
   930 	// hasn't changed since we wrote this
       
   931 	TPtrC longDesc(LONG_APN_VALUE);
       
   932 	if (longDesc.Length() != KCommsDbSvrRealMaxFieldLength)
       
   933 		{
       
   934 		User::Leave(KErrGeneral);
       
   935 		}
       
   936 
       
   937 	CDBLEAVE( iTheView->GotoNextRecord(), KErrNone );
       
   938 	iTheView->ReadTextL( TPtrC( GPRS_APN ), value );
       
   939 
       
   940 	if (value.Compare(TPtrC(LONG_APN_VALUE) ) != 0 )
       
   941 		{
       
   942 		User::Leave(KErrGeneral);
       
   943 		}
       
   944 
       
   945 	return KErrNone;
       
   946 	}
       
   947 
       
   948 TVerdict CCommDbTest007_16::doTestStepL( )
       
   949 	{
       
   950 	INFO_PRINTF1(_L("Step 007.16 called"));
       
   951 
       
   952 	//NB. create a view on an empty table
       
   953 
       
   954 	if ( executeStepL() == KErrNone )
       
   955 		SetTestStepResult(EPass);	else
       
   956 		SetTestStepResult(EFail);
       
   957 
       
   958 	return TestStepResult();
       
   959 	}
       
   960 
       
   961 
       
   962 /////////////////////
       
   963 //	Test step 007.17
       
   964 // Check different paths in ReadTextL
       
   965 /////////////////////
       
   966 
       
   967 // constructor
       
   968 CCommDbTest007_17::CCommDbTest007_17()
       
   969 	{
       
   970 	// store the name of this test case
       
   971 	SetTestStepName(_L("step_007_17"));
       
   972 	}
       
   973 
       
   974 // destructor
       
   975 CCommDbTest007_17::~CCommDbTest007_17()
       
   976 	{
       
   977 	}
       
   978 
       
   979 TVerdict CCommDbTest007_17::doTestStepL()
       
   980 	{
       
   981 	INFO_PRINTF1(_L("Step 007.17 called"));
       
   982 
       
   983 	SetTestStepResult(EPass);
       
   984 	//Heap test for 007.01 - uses default1.xml 
       
   985 	CCommDbTest007_01* step007_01 = new CCommDbTest007_01;
       
   986 	CleanupStack::PushL(step007_01);
       
   987 	doTestStepWithHeapFailureL( *step007_01, KErrNone );
       
   988 	if ( step007_01->TestStepResult() == EFail )
       
   989 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_01);
       
   990 
       
   991 	//Heap test for 007.02 - uses default1.xml 
       
   992 	CCommDbTest007_02* step007_02 = new CCommDbTest007_02;
       
   993 	CleanupStack::PushL(step007_02);
       
   994 	doTestStepWithHeapFailureL( *step007_02, KErrNone );
       
   995 	if ( step007_02->TestStepResult() == EFail )
       
   996 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_02);
       
   997 
       
   998 	//Heap test for 007.03 - uses default1.xml 
       
   999 	CCommDbTest007_03* step007_03 = new CCommDbTest007_03;
       
  1000 	CleanupStack::PushL(step007_03);
       
  1001 	doTestStepWithHeapFailureL( *step007_03, KErrNone );
       
  1002 	if ( step007_03->TestStepResult() == EFail )
       
  1003 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_03);
       
  1004 
       
  1005 	//Heap test for 007.04 - uses default1.xml 
       
  1006 	CCommDbTest007_04* step007_04 = new CCommDbTest007_04;
       
  1007 	CleanupStack::PushL(step007_04);
       
  1008 	doTestStepWithHeapFailureL( *step007_04, KErrNone );
       
  1009 	if ( step007_04->TestStepResult() == EFail )
       
  1010 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_04);
       
  1011 
       
  1012 	//Heap test for 007.05 - uses default1.xml 
       
  1013 	CCommDbTest007_05* step007_05 = new CCommDbTest007_05;
       
  1014 	CleanupStack::PushL(step007_05);
       
  1015 	doTestStepWithHeapFailureL( *step007_05, KErrNone );
       
  1016 	if ( step007_05->TestStepResult() == EFail )
       
  1017 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_05);
       
  1018 
       
  1019 	//Heap test for 007.06 - uses default1.xml 
       
  1020 	CCommDbTest007_06* step007_06 = new CCommDbTest007_06;
       
  1021 	CleanupStack::PushL(step007_06);
       
  1022 	doTestStepWithHeapFailureL( *step007_06, KErrNone );
       
  1023 	if ( step007_06->TestStepResult() == EFail )
       
  1024 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_06);
       
  1025 
       
  1026 	//Heap test for 007.07 - uses default7.xml 
       
  1027 	//Heap test for 007.08 - uses default7.xml 
       
  1028 
       
  1029 	//Heap test for 007.09 - uses default1.xml 
       
  1030 	CCommDbTest007_09* step007_09 = new CCommDbTest007_09;
       
  1031 	CleanupStack::PushL(step007_09);
       
  1032 	doTestStepWithHeapFailureL( *step007_09, KErrNotFound );
       
  1033 	if ( step007_09->TestStepResult() == EFail )
       
  1034 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_09);
       
  1035 
       
  1036 	//Heap test for 007.10 - uses default1.xml 
       
  1037 	CCommDbTest007_10* step007_10 = new CCommDbTest007_10;
       
  1038 	CleanupStack::PushL(step007_10);
       
  1039 	doTestStepWithHeapFailureL( *step007_10, KErrNotFound );
       
  1040 	if ( step007_10->TestStepResult() == EFail )
       
  1041 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_10);
       
  1042 
       
  1043 	//Heap test for 007.11 - uses default1.xml 
       
  1044 	CCommDbTest007_11* step007_11 = new CCommDbTest007_11;
       
  1045 	CleanupStack::PushL(step007_11);
       
  1046 	doTestStepWithHeapFailureL( *step007_11, KErrNone );
       
  1047 	if ( step007_11->TestStepResult() == EFail )
       
  1048 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_11);
       
  1049 
       
  1050 	//Heap test for 007.12 - uses default1.xml 
       
  1051 	CCommDbTest007_12* step007_12 = new CCommDbTest007_12;
       
  1052 	CleanupStack::PushL(step007_12);
       
  1053 	doTestStepWithHeapFailureL( *step007_12, KErrNone );
       
  1054 	if ( step007_12->TestStepResult() == EFail )
       
  1055 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_12);
       
  1056 
       
  1057 	//Heap test for 007.14 - uses default1.xml - panic test see 7.20
       
  1058 
       
  1059 	//Heap test for 007.15 - uses default1.xml 
       
  1060 	CCommDbTest007_15* step007_15 = new CCommDbTest007_15;
       
  1061 	CleanupStack::PushL(step007_15);
       
  1062 	doTestStepWithHeapFailureL( *step007_15, KErrNone );
       
  1063 	if ( step007_15->TestStepResult() == EFail )
       
  1064 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_15);
       
  1065 	
       
  1066 	return TestStepResult();
       
  1067 	}
       
  1068 
       
  1069 /////////////////////
       
  1070 //	Test step 007.18
       
  1071 // Check different paths in ReadTextL
       
  1072 /////////////////////
       
  1073 
       
  1074 // constructor
       
  1075 CCommDbTest007_18::CCommDbTest007_18()
       
  1076 	{
       
  1077 	// store the name of this test case
       
  1078 	SetTestStepName(_L("step_007_18"));
       
  1079 	}
       
  1080 
       
  1081 // destructor
       
  1082 CCommDbTest007_18::~CCommDbTest007_18()
       
  1083 	{
       
  1084 	}
       
  1085 
       
  1086 TVerdict CCommDbTest007_18::doTestStepL()
       
  1087 	{
       
  1088 	INFO_PRINTF1(_L("Step 007.18 called"));
       
  1089 
       
  1090 	SetTestStepResult(EPass);
       
  1091 	//Heap test for 007.07 - uses default7.xml 
       
  1092 	copyTestDatabase( EDatabase_7 );
       
  1093 	CCommDbTest007_07* step007_07 = new CCommDbTest007_07;
       
  1094 	CleanupStack::PushL(step007_07);
       
  1095 	doTestStepWithHeapFailureL( *step007_07, KErrNotFound );
       
  1096 	if ( step007_07->TestStepResult() == EFail )
       
  1097 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_07);
       
  1098 
       
  1099 
       
  1100 	//Heap test for 007.08 - uses default7.xml
       
  1101 	CCommDbTest007_08* step007_08 = new CCommDbTest007_08;
       
  1102 	CleanupStack::PushL(step007_08);
       
  1103 	doTestStepWithHeapFailureL( *step007_08, KErrNone );
       
  1104 	if ( step007_08->TestStepResult() == EFail )
       
  1105 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_08);
       
  1106 
       
  1107 	return TestStepResult();
       
  1108 	}
       
  1109 	
       
  1110 /////////////////////
       
  1111 //	Test step 007.19
       
  1112 // Check different paths in ReadTextL
       
  1113 /////////////////////
       
  1114 
       
  1115 // constructor
       
  1116 CCommDbTest007_19::CCommDbTest007_19()
       
  1117 	{
       
  1118 	// store the name of this test case
       
  1119 	SetTestStepName(_L("step_007_19"));
       
  1120 	}
       
  1121 
       
  1122 // destructor
       
  1123 CCommDbTest007_19::~CCommDbTest007_19()
       
  1124 	{
       
  1125 	}
       
  1126 
       
  1127 TVerdict CCommDbTest007_19::doTestStepL()
       
  1128 	{
       
  1129 	INFO_PRINTF1(_L("Step 007.19 called"));
       
  1130 
       
  1131 	SetTestStepResult(EPass);
       
  1132 	//Heap test for 007.16 - uses default3.xml
       
  1133 	CCommDbTest007_16* step007_16 = new CCommDbTest007_16;
       
  1134 	CleanupStack::PushL(step007_16);
       
  1135 	doTestStepWithHeapFailureL( *step007_16, KErrNone );
       
  1136 	if ( step007_16->TestStepResult() == EFail )
       
  1137 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_16);
       
  1138 
       
  1139 	return TestStepResult();
       
  1140 	}
       
  1141 	
       
  1142 /////////////////////
       
  1143 //	Test step 007.20
       
  1144 // Check different paths in ReadTextL
       
  1145 /////////////////////
       
  1146 
       
  1147 // constructor
       
  1148 CCommDbTest007_20::CCommDbTest007_20()
       
  1149 	{
       
  1150 	// store the name of this test case
       
  1151 	SetTestStepName(_L("step_007_20"));
       
  1152 	}
       
  1153 
       
  1154 // destructor
       
  1155 CCommDbTest007_20::~CCommDbTest007_20()
       
  1156 	{
       
  1157 	}
       
  1158 
       
  1159 TVerdict CCommDbTest007_20::doTestStepL()
       
  1160 	{
       
  1161 
       
  1162 	SetTestStepResult(EPass);
       
  1163 	//Heap test for 007.14 - uses default1.xml
       
  1164 	CCommDbTest007_14* step007_14 = new CCommDbTest007_14;
       
  1165 	CleanupStack::PushL(step007_14);
       
  1166 	doTestStepWithHeapFailureL( *step007_14, KErrNone );
       
  1167 	if ( step007_14->TestStepResult() == EFail )
       
  1168 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step007_14);
       
  1169 
       
  1170 	return TestStepResult();
       
  1171 	}