commsconfig/commsdatabaseshim/TE_commdb/src/Step_015_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 015.XX
       
    19 
       
    20 // EPOC includes
       
    21 #include <e32base.h>
       
    22 #include <commdb.h>
       
    23 #include <d32comm.h>
       
    24 
       
    25 
       
    26 // Test system includes
       
    27 #include "Teststepcommdb.h"
       
    28 #include "Step_015_xx.h"
       
    29 
       
    30 
       
    31 
       
    32 /////////////////////
       
    33 //	Test step 015.01
       
    34 /////////////////////
       
    35 
       
    36 // constructor
       
    37 CCommDbTest015_01::CCommDbTest015_01()
       
    38 	{
       
    39 	// store the name of this test case
       
    40 	SetTestStepName(_L("step_015_01"));
       
    41 	}
       
    42 
       
    43 // destructor
       
    44 CCommDbTest015_01::~CCommDbTest015_01()
       
    45 	{
       
    46 	}
       
    47 
       
    48 
       
    49 TVerdict CCommDbTest015_01::doTestStepPreambleL()
       
    50 	{	
       
    51 	openDbL();
       
    52         SetTestStepResult(EPass);	return TestStepResult();
       
    53 	}
       
    54 
       
    55 
       
    56 TInt CCommDbTest015_01::executeStepL()
       
    57 	{
       
    58 	TInt ret=KErrGeneral;
       
    59 
       
    60 	//Check the inTransaction flag
       
    61 
       
    62 	TRAPD(r, iTheDb->BeginTransaction() );
       
    63 
       
    64 	ret  = !(iTheDb->InTransaction() );
       
    65 
       
    66 	if ( r != KErrNone )
       
    67 		{
       
    68 		ret = r;
       
    69 		}
       
    70 
       
    71 
       
    72 	return ret;
       
    73 	}
       
    74 
       
    75 
       
    76 
       
    77 TVerdict CCommDbTest015_01::doTestStepL( )
       
    78 	{
       
    79 	INFO_PRINTF1(_L("Step 015.01 called "));
       
    80 
       
    81 	if ( executeStepL() == KErrNone )
       
    82 		SetTestStepResult(EPass);	else
       
    83 		SetTestStepResult(EFail);
       
    84 	return TestStepResult();
       
    85 	}
       
    86 
       
    87 /////////////////////
       
    88 //	Test step 015.02
       
    89 /////////////////////
       
    90 
       
    91 // constructor
       
    92 CCommDbTest015_02::CCommDbTest015_02()
       
    93 	{
       
    94 	// store the name of this test case
       
    95 	SetTestStepName(_L("step_015_02"));
       
    96 	}
       
    97 
       
    98 // destructor
       
    99 CCommDbTest015_02::~CCommDbTest015_02()
       
   100 	{
       
   101 	}
       
   102 
       
   103 TVerdict CCommDbTest015_02::doTestStepPreambleL()
       
   104 	{	
       
   105 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   106         SetTestStepResult(EPass);	return TestStepResult();
       
   107 	}
       
   108 	
       
   109 
       
   110 
       
   111 TInt CCommDbTest015_02::executeStepL()
       
   112 	{
       
   113 	TInt ret=KErrGeneral;
       
   114 
       
   115 	TUint32 id;
       
   116 	TBool beforeValue=EFalse, afterValue=EFalse;
       
   117 
       
   118 	
       
   119 	//Check that the write lock flag is set when the
       
   120 	//database is written to.
       
   121 	//Take a copy of the flag before we insert a record
       
   122 	TRAPD(r, beforeValue = iTheDb->IsDatabaseWriteLockedL() );
       
   123 
       
   124 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   125 	
       
   126 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   127 
       
   128 	//Take a copy after the insert
       
   129 	afterValue = iTheDb->IsDatabaseWriteLockedL();
       
   130 
       
   131 	iTheView->CancelRecordChanges();
       
   132 
       
   133 	//Now get the flag value after the record has been written
       
   134 
       
   135 	if ( r == KErrNone )
       
   136 		{
       
   137 		if ( !beforeValue  && afterValue  )
       
   138 			ret = KErrNone;
       
   139 		}
       
   140 		else
       
   141 		{	
       
   142 			//return the trap value
       
   143 			ret = r;
       
   144 		}
       
   145 
       
   146 	return ret;
       
   147 	}
       
   148 
       
   149 
       
   150 
       
   151 TVerdict CCommDbTest015_02::doTestStepL( )
       
   152 	{
       
   153 	INFO_PRINTF1(_L("Step 015.02 called "));
       
   154 
       
   155 	if ( executeStepL() == KErrNone )
       
   156 		SetTestStepResult(EPass);	else
       
   157 		SetTestStepResult(EFail);
       
   158 	return TestStepResult();
       
   159 	}
       
   160 
       
   161 
       
   162 
       
   163 /////////////////////
       
   164 //	Test step 015.03
       
   165 /////////////////////
       
   166 
       
   167 // constructor
       
   168 CCommDbTest015_03::CCommDbTest015_03()
       
   169 	{
       
   170 	// store the name of this test case
       
   171 	SetTestStepName(_L("step_015_03"));
       
   172 	// default to no local objects allocated
       
   173 	}
       
   174 
       
   175 // destructor
       
   176 CCommDbTest015_03::~CCommDbTest015_03()
       
   177 	{
       
   178 	}
       
   179 
       
   180 TVerdict CCommDbTest015_03::doTestStepPreambleL()
       
   181 	{	
       
   182 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   183         SetTestStepResult(EPass);	return TestStepResult();
       
   184 	}
       
   185 
       
   186 
       
   187 TInt CCommDbTest015_03::executeStepL()
       
   188 	{
       
   189 	TUint32 id;
       
   190 
       
   191 	//Commit a record and check for correct state of flags
       
   192 
       
   193 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   194 
       
   195 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   196 
       
   197 	_LIT(KName,"CCommDbTest015_03");
       
   198 	_LIT(KTsy,"HAYES");
       
   199 	_LIT8(KModemInitString,"AT&F1");
       
   200 	_LIT8(KModemFaxInitString,"AT&d2");
       
   201 	//Write some sample data into the table
       
   202 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName);
       
   203 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   204 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   205 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   206 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   207 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   208 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   209 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   210 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   211 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   212 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   213 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   214 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   215 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   216 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   217 
       
   218 	CDBLEAVE ( iTheView->PutRecordChanges(), KErrNone );
       
   219 	User::LeaveIfError(iTheDb->CommitTransaction());
       
   220 
       
   221 	delete iTheView;
       
   222 	iTheView=NULL;
       
   223 
       
   224 	//Create a new view that should have the record in it
       
   225 	iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName);
       
   226 	CleanupStack::Pop();
       
   227 
       
   228 	User::LeaveIfError(iTheView->GotoFirstRecord());	//Will leave if first record isn't there
       
   229 
       
   230 	if (! iTheDb->IsDatabaseWriteLockedL() && ! iTheDb->InTransaction() )
       
   231 			return KErrNone;
       
   232 
       
   233 	return KErrGeneral;
       
   234 	}
       
   235 
       
   236 
       
   237 
       
   238 TVerdict CCommDbTest015_03::doTestStepL( )
       
   239 	{
       
   240 	INFO_PRINTF1(_L("Step 015.03 called "));
       
   241 
       
   242 	if ( executeStepL() == KErrNone )
       
   243 		SetTestStepResult(EPass);	else
       
   244 		SetTestStepResult(EFail);
       
   245 	return TestStepResult();
       
   246 	}
       
   247 
       
   248 
       
   249 
       
   250 
       
   251 
       
   252 /////////////////////
       
   253 //	Test step 015.04
       
   254 /////////////////////
       
   255 
       
   256 // constructor
       
   257 CCommDbTest015_04::CCommDbTest015_04()
       
   258 	{
       
   259 	// store the name of this test case
       
   260 	SetTestStepName(_L("step_015_04"));
       
   261 	// default to no local objects allocated
       
   262 	}
       
   263 
       
   264 // destructor
       
   265 CCommDbTest015_04::~CCommDbTest015_04()
       
   266 	{
       
   267 	}
       
   268 
       
   269 TVerdict CCommDbTest015_04::doTestStepPreambleL()
       
   270 	{	
       
   271 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   272         SetTestStepResult(EPass);	return TestStepResult();
       
   273 	}
       
   274 
       
   275 
       
   276 TInt CCommDbTest015_04::executeStepL()
       
   277 	{
       
   278 	TInt ret=KErrGeneral;
       
   279 	TUint32 id;
       
   280 
       
   281 	
       
   282 	//Check that we can rollback a transaction
       
   283 	//NB Test assumes that the table is empty
       
   284 
       
   285 
       
   286 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   287 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   288 
       
   289 	_LIT(KName,"CCommDbTest015_04");
       
   290 	_LIT(KTsy,"HAYES");
       
   291 	_LIT8(KModemInitString,"AT&F1");
       
   292 	_LIT8(KModemFaxInitString,"AT&d2");
       
   293 	//Write some sample data into the table
       
   294 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName);
       
   295 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   296 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   297 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   298 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   299 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   300 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   301 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   302 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   303 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   304 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   305 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   306 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   307 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   308 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   309 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   310 
       
   311 	//Rollback the record we've just written
       
   312 	TRAPD(r, iTheDb->RollbackTransaction() );
       
   313 
       
   314 	//Get rid of our view
       
   315 	delete iTheView;
       
   316 	iTheView=0;
       
   317 
       
   318 	//Create a new view that should have the record in it
       
   319 	iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName);
       
   320 
       
   321 	CleanupStack::Pop();
       
   322 
       
   323 	ret = iTheView->GotoFirstRecord();
       
   324 
       
   325 	if ( r == KErrNone )
       
   326 		{
       
   327 		if ( ret == KErrNotFound )
       
   328 			ret = KErrNone;
       
   329 		else
       
   330 			ret = KErrGeneral;
       
   331 		}
       
   332 	else
       
   333 		{	
       
   334 		//Trap occoured, so return that value instead
       
   335 		ret = r;
       
   336 		}
       
   337 
       
   338 	
       
   339 	return ret;
       
   340 	}
       
   341 
       
   342 TVerdict CCommDbTest015_04::doTestStepPostambleL()
       
   343 	{
       
   344 	
       
   345 	//Get rid of our view
       
   346 	if(iTheView)
       
   347 		{
       
   348 		delete iTheView;
       
   349 		}
       
   350 	iTheView=0;
       
   351 
       
   352 	_LIT(KName,"CCommDbTest015_04");
       
   353 	//Create a new view that should have the record that was added in executeStepL and
       
   354 	// may have been left in by a leave condition
       
   355 	iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName);
       
   356 	CleanupStack::Pop();
       
   357 
       
   358 	if(iTheView->GotoFirstRecord() == KErrNone)
       
   359 		{
       
   360 		iTheView->DeleteRecord();
       
   361 		}
       
   362 
       
   363 	// Cleanup after test run
       
   364 	CTestStepCommDb::doTestStepPostambleL();	
       
   365         SetTestStepResult(EPass);	return TestStepResult();
       
   366 	}
       
   367 
       
   368 TVerdict CCommDbTest015_04::doTestStepL( )
       
   369 	{
       
   370 	INFO_PRINTF1(_L("Step 015.04 called "));
       
   371 
       
   372 	if ( executeStepL() == KErrNone )
       
   373 		SetTestStepResult(EPass);	else
       
   374 		SetTestStepResult(EFail);
       
   375 	return TestStepResult();
       
   376 	}
       
   377 
       
   378 
       
   379 
       
   380 /////////////////////
       
   381 //	Test step 015.05
       
   382 /////////////////////
       
   383 
       
   384 // constructor
       
   385 CCommDbTest015_05::CCommDbTest015_05()
       
   386 	{
       
   387 	// store the name of this test case
       
   388 	SetTestStepName(_L("step_015_05"));
       
   389 	}
       
   390 
       
   391 // destructor
       
   392 CCommDbTest015_05::~CCommDbTest015_05()
       
   393 	{
       
   394 	}
       
   395 
       
   396 
       
   397 TVerdict CCommDbTest015_05::doTestStepPreambleL()
       
   398 	{	
       
   399 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   400         SetTestStepResult(EPass);	return TestStepResult();
       
   401 	}
       
   402 
       
   403 
       
   404 TInt CCommDbTest015_05::executeStepL()
       
   405 	{
       
   406 	TInt ret=KErrGeneral;
       
   407 	TUint32 id;
       
   408 
       
   409 	//Try to rollback without a prior call to BeginTransaction()
       
   410 
       
   411 	//
       
   412 	// NB. This test will cause the DBMS server to Panic!
       
   413 	//
       
   414 
       
   415 
       
   416 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   417 
       
   418 	_LIT(KName,"CCommDbTest015_05");
       
   419 	_LIT(KTsy,"HAYES");
       
   420 	_LIT8(KModemInitString,"AT&F1");
       
   421 	_LIT8(KModemFaxInitString,"AT&d2");
       
   422 	//Write some sample data into the table
       
   423 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName);
       
   424 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   425 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   426 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   427 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   428 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   429 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   430 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   431 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   432 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   433 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   434 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   435 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   436 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   437 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   438 
       
   439 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   440 	//This will cause a panic
       
   441 	TRAPD(r, iTheDb->RollbackTransaction() );
       
   442 
       
   443 	delete iTheView ;
       
   444 	iTheView=0;
       
   445 
       
   446 	//Create a new view that would have the record in it
       
   447 	iTheView = iTheDb->OpenViewLC(TPtrC(MODEM_BEARER), _L("Select * from Modem where Name='CCommDbTest015_05'") );
       
   448 	CleanupStack::Pop();
       
   449 
       
   450 
       
   451 	ret = iTheView->GotoFirstRecord();
       
   452 
       
   453 	if ( r == KErrNone )
       
   454 		{
       
   455 		if ( ret == KErrNotFound  )
       
   456 			ret = KErrNone;
       
   457 		else
       
   458 			ret = KErrGeneral;
       
   459 		}
       
   460 	else
       
   461 		{	
       
   462 		//Trap occoured, so return that value instead
       
   463 		ret = r;
       
   464 		}
       
   465 
       
   466 
       
   467 	return ret;
       
   468 	}
       
   469 
       
   470 
       
   471 
       
   472 TVerdict CCommDbTest015_05::doTestStepPostambleL()
       
   473 	{
       
   474 	//Get rid of our view
       
   475 	if(iTheView)
       
   476 		{
       
   477 		delete iTheView;
       
   478 		}
       
   479 	iTheView=0;
       
   480 
       
   481 	_LIT(KName,"CCommDbTest015_05");
       
   482 	//Create a new view that should have the record that was added in executeStepL and
       
   483 	// may have been left in by a leave condition
       
   484 	iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName);
       
   485 	CleanupStack::Pop();
       
   486 
       
   487 	if(iTheView->GotoFirstRecord() == KErrNone)
       
   488 		{
       
   489 		iTheView->DeleteRecord();
       
   490 		}
       
   491 
       
   492 	// Cleanup after test run
       
   493 	CTestStepCommDb::doTestStepPostambleL();	
       
   494         SetTestStepResult(EPass);	return TestStepResult();
       
   495 	}
       
   496 
       
   497 
       
   498 TVerdict CCommDbTest015_05::doTestStepL( )
       
   499 	{
       
   500 	INFO_PRINTF1(_L("Step 015.05 called "));
       
   501 
       
   502 	TRAPD(leaveCode, executeStepL());
       
   503 	if (leaveCode != KErrNotSupported) // SQL views no longer supported
       
   504 		{
       
   505 		SetTestStepResult(EFail);		}
       
   506 
       
   507 	return TestStepResult();
       
   508 	}
       
   509 
       
   510 
       
   511 /////////////////////
       
   512 //	Test step 015.06
       
   513 /////////////////////
       
   514 
       
   515 // constructor
       
   516 CCommDbTest015_06::CCommDbTest015_06()
       
   517 	{
       
   518 	// store the name of this test case
       
   519 	SetTestStepName(_L("step_015_06"));
       
   520 	}
       
   521 
       
   522 // destructor
       
   523 CCommDbTest015_06::~CCommDbTest015_06()
       
   524 	{
       
   525 	}
       
   526 
       
   527 TVerdict CCommDbTest015_06::doTestStepPreambleL()
       
   528 	{	
       
   529 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   530         SetTestStepResult(EPass);	return TestStepResult();
       
   531 	}
       
   532 
       
   533 
       
   534 TInt CCommDbTest015_06::executeStepL()
       
   535 	{
       
   536 	TInt ret=KErrGeneral;
       
   537 	TUint32 id;
       
   538 
       
   539 	//Try to commit without a prior call to BeginTransaction()
       
   540 
       
   541 	//
       
   542 	// NB. This test will cause the DBMS server to Panic!
       
   543 	//
       
   544 
       
   545 
       
   546 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   547 
       
   548 	_LIT(KName,"CCommDbTest015_06");
       
   549 	_LIT(KTsy,"HAYES");
       
   550 	_LIT8(KModemInitString,"AT&F1");
       
   551 	_LIT8(KModemFaxInitString,"AT&d2");
       
   552 	//Write some sample data into the table
       
   553 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName);
       
   554 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   555 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   556 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   557 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   558 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   559 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   560 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   561 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   562 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   563 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   564 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   565 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   566 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   567 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   568 
       
   569 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   570 	//This will cause a panic
       
   571 	TRAPD(r, iTheDb->CommitTransaction() );
       
   572 
       
   573 	delete  iTheView ;
       
   574 	iTheView=0;
       
   575 
       
   576 	//Create a new view that would have the record in it
       
   577 	iTheView = iTheDb->OpenViewLC(TPtrC(MODEM_BEARER), _L("Select * from Modem where Name='CCommDbTest015_06'") );
       
   578 	CleanupStack::Pop();
       
   579 
       
   580 	ret = iTheView->GotoFirstRecord();
       
   581 
       
   582 	if ( r == KErrNone )
       
   583 		{
       
   584 		if ( ret == KErrNotFound  )
       
   585 			ret = KErrNone;
       
   586 		else
       
   587 			ret = KErrGeneral;
       
   588 		}
       
   589 	else
       
   590 		{	
       
   591 		//Trap occoured, so return that value instead
       
   592 		ret = r;
       
   593 		}
       
   594 
       
   595 
       
   596 	return ret;
       
   597 	}
       
   598 
       
   599 
       
   600 
       
   601 TVerdict CCommDbTest015_06::doTestStepPostambleL()
       
   602 	{
       
   603 	//Get rid of our view
       
   604 	if(iTheView)
       
   605 		{
       
   606 		delete iTheView;
       
   607 		}
       
   608 	iTheView=0;
       
   609 
       
   610 	_LIT(KName,"CCommDbTest015_06");
       
   611 	//Create a new view that should have the record that was added in executeStepL and
       
   612 	// may have been left in by a leave condition
       
   613 	iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName);
       
   614 	CleanupStack::Pop();
       
   615 
       
   616 	if(iTheView->GotoFirstRecord() == KErrNone)
       
   617 		{
       
   618 		iTheView->DeleteRecord();
       
   619 		}
       
   620 
       
   621 	// Cleanup after test run
       
   622 	CTestStepCommDb::doTestStepPostambleL();	
       
   623         SetTestStepResult(EPass);	return TestStepResult();
       
   624 	}
       
   625 
       
   626 
       
   627 TVerdict CCommDbTest015_06::doTestStepL( )
       
   628 	{
       
   629 	INFO_PRINTF1(_L("Step 015.06 called "));
       
   630 
       
   631 	TRAPD(leaveCode, executeStepL());
       
   632 	if (leaveCode != KErrNotSupported) // SQL views no longer supported
       
   633 		{
       
   634 		SetTestStepResult(EFail);		}
       
   635 
       
   636 	return TestStepResult();
       
   637 	}
       
   638 
       
   639 
       
   640 
       
   641 /////////////////////
       
   642 //	Test step 015.07
       
   643 /////////////////////
       
   644 
       
   645 // constructor
       
   646 CCommDbTest015_07::CCommDbTest015_07()
       
   647 	{
       
   648 	// store the name of this test case
       
   649 	SetTestStepName(_L("step_015_07"));
       
   650 	}
       
   651 
       
   652 // destructor
       
   653 CCommDbTest015_07::~CCommDbTest015_07()
       
   654 	{
       
   655 	}
       
   656 
       
   657 
       
   658 TVerdict CCommDbTest015_07::doTestStepPreambleL()
       
   659 	{	
       
   660 	openDbAndViewL(TPtrC(MODEM_BEARER));
       
   661         SetTestStepResult(EPass);	return TestStepResult();
       
   662 	}
       
   663 
       
   664 
       
   665 TInt CCommDbTest015_07::executeStepL()
       
   666 	{
       
   667 	TInt ret=KErrGeneral;
       
   668 	TUint32 id;
       
   669 
       
   670 
       
   671 	//Close the database while inside a transaction
       
   672 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   673 
       
   674 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   675 
       
   676 	_LIT(KName,"CCommDbTest015_07");
       
   677 	_LIT(KTsy,"HAYES");
       
   678 	_LIT8(KModemInitString,"AT&F1");
       
   679 	_LIT8(KModemFaxInitString,"AT&d2");
       
   680 	//Write some sample data into the table
       
   681 	iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName);
       
   682 	iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy);
       
   683 	iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600);
       
   684 	iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8);
       
   685 	iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1);
       
   686 	iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone);
       
   687 	iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD));	//KConfigObeyCTS;
       
   688 	iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0);
       
   689 	iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0);
       
   690 	iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0);
       
   691 	iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString);
       
   692 	iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8);
       
   693 	iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString);
       
   694 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer);
       
   695 	iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet);
       
   696 
       
   697 	CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   698 	
       
   699 	delete  iTheView ;
       
   700 	iTheView=0;
       
   701 
       
   702 	//Close the DB
       
   703 	delete iTheDb;
       
   704 	iTheDb = 0;
       
   705 
       
   706 	//NB Only get here if we didnt trap, so it must have passed
       
   707 	ret = KErrNone;
       
   708 
       
   709 
       
   710 	return ret;
       
   711 	}
       
   712 
       
   713 
       
   714 
       
   715 TVerdict CCommDbTest015_07::doTestStepL( )
       
   716 	{
       
   717 	INFO_PRINTF1(_L("Step 015.07 called "));
       
   718 
       
   719 	if ( executeStepL() == KErrNone )
       
   720 		SetTestStepResult(EPass);	else
       
   721 		SetTestStepResult(EFail);
       
   722 	return TestStepResult();
       
   723 	}
       
   724 
       
   725 
       
   726 /////////////////////
       
   727 //	Test step 015.08
       
   728 /////////////////////
       
   729 
       
   730 // constructor
       
   731 CCommDbTest015_08::CCommDbTest015_08()
       
   732 	{
       
   733 	// store the name of this test case
       
   734 	SetTestStepName(_L("step_015_08"));
       
   735 	}
       
   736 
       
   737 // destructor
       
   738 CCommDbTest015_08::~CCommDbTest015_08()
       
   739 	{
       
   740 	}
       
   741 
       
   742 
       
   743 TVerdict CCommDbTest015_08::doTestStepPreambleL()
       
   744 	{	
       
   745 	openDbAndViewL(TPtrC(DIAL_OUT_ISP));
       
   746         SetTestStepResult(EPass);	return TestStepResult();
       
   747 	}
       
   748 
       
   749 
       
   750 TInt CCommDbTest015_08::tryDatabaseWriteL(void)
       
   751 {
       
   752 	TInt ret;
       
   753 
       
   754 	//Open the database
       
   755 	CCommsDatabase* theDb;
       
   756 	theDb=CCommsDatabase::NewL(EDatabaseTypeIAP);
       
   757 	CleanupStack::PushL(theDb);
       
   758 
       
   759 	//Open a view
       
   760 	CCommsDbTableView* theView;
       
   761 	theView = theDb->OpenTableLC( TPtrC(DIAL_OUT_ISP) );
       
   762 
       
   763 	//Try to write
       
   764 	TUint32 id;
       
   765 	ret = theView->InsertRecord( id );
       
   766 
       
   767 	CleanupStack::PopAndDestroy(2);
       
   768 
       
   769 	return ret;
       
   770 }
       
   771 
       
   772 //
       
   773 //	This function is executed as a separate thread from Step 015_08.
       
   774 //  It will try to write to the database, and should fail, as the database
       
   775 //  will be write locked by CCommDbTest015_08::executeStepL()
       
   776 //
       
   777 TInt CCommDbTest015_08::step015_08Thread ( void * /*ptr*/ )
       
   778 	{
       
   779 	TInt ret=KErrGeneral;
       
   780 
       
   781 	// get clean-up stack
       
   782 	CTrapCleanup* cleanup=CTrapCleanup::New(); 
       
   783 
       
   784 	if(!cleanup)
       
   785 		return KErrNoMemory;
       
   786 	//try to write to the database
       
   787 	TRAPD(r, ret = tryDatabaseWriteL() );
       
   788 
       
   789 	if ( r!=KErrNone )
       
   790 		ret = r;
       
   791 
       
   792 	// done with the clean up stack
       
   793 	delete cleanup; 
       
   794 
       
   795 	
       
   796 	return ret;		
       
   797 	}
       
   798 
       
   799 TInt CCommDbTest015_08::executeStepL()
       
   800 	{
       
   801 	TInt ret=KErrGeneral;
       
   802 
       
   803 
       
   804 	//Lock the database, then request another thread to attempt a write
       
   805 
       
   806 	//Start an insert to lock the database
       
   807 	TUint32 id;
       
   808 	
       
   809 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   810 	CDBLEAVE( iTheView->InsertRecord( id ), KErrNone );
       
   811 
       
   812 	TEST( iTheDb->IsDatabaseWriteLockedL() );
       
   813 	
       
   814 	//Set up a new thread
       
   815 	RThread t;
       
   816 
       
   817 	TInt res=t.Create(_L("Step015_08Thread"),step015_08Thread, KDefaultStackSize,&User::Heap(),0 );
       
   818 
       
   819 	if ( res != KErrNone )
       
   820 		User::Leave( res );
       
   821 
       
   822 	// start the thread and request the status
       
   823 	TRequestStatus stat;
       
   824 	t.Logon(stat);
       
   825 	t.Resume();
       
   826 	User::WaitForRequest(stat);
       
   827 
       
   828 	// get the test result
       
   829 	ret =  stat.Int();
       
   830 
       
   831 	TExitType exitVal = t.ExitType();	
       
   832 	TEST( exitVal == EExitKill );
       
   833 		
       
   834 	// done with the test thread
       
   835 	t.Close();
       
   836 
       
   837 	return ret;
       
   838 	}
       
   839 
       
   840 
       
   841 
       
   842 TVerdict CCommDbTest015_08::doTestStepL( )
       
   843 	{
       
   844 	INFO_PRINTF1(_L("Step 015.08 called "));
       
   845 
       
   846 	if ( executeStepL() == KErrLocked )
       
   847 		SetTestStepResult(EPass);	else
       
   848 		SetTestStepResult(EFail);
       
   849 	return TestStepResult();
       
   850 	}
       
   851 
       
   852 
       
   853 /////////////////////
       
   854 //	Test step 015.09
       
   855 /////////////////////
       
   856 
       
   857 // constructor
       
   858 CCommDbTest015_09::CCommDbTest015_09()
       
   859 	{
       
   860 	// store the name of this test case
       
   861 	SetTestStepName(_L("step_015_09"));
       
   862 	}
       
   863 
       
   864 // destructor
       
   865 CCommDbTest015_09::~CCommDbTest015_09()
       
   866 	{
       
   867 	}
       
   868 
       
   869 TInt CCommDbTest015_09::executeStepL()
       
   870 	{
       
   871 	TInt ret=KErrGeneral;
       
   872 
       
   873 
       
   874 	TPtrC tableName(MODEM_BEARER);
       
   875 
       
   876 	iTheDb=CCommsDatabase::NewL();
       
   877 
       
   878 
       
   879 	TUint32 recordToInsert;
       
   880 	TUint32 recordToUpdate;
       
   881 	TUint32 recordToDelete;
       
   882 	TBuf8<128> fieldValue1, fieldValue2;
       
   883 	_LIT8(KModemInitString, "ABCDE");
       
   884 
       
   885 	////////////////////////////////////////////////////////////////////////////////
       
   886 	// rollback transaction test
       
   887 
       
   888 	// open view, insert record, delete view
       
   889 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   890 		{
       
   891 		iTheView=iTheDb->OpenTableLC(tableName);
       
   892 		CleanupStack::Pop(iTheView);
       
   893 
       
   894 		CDBLEAVE( iTheView->InsertRecord(recordToInsert), KErrNone );
       
   895 		CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   896 		
       
   897 		delete  iTheView ;
       
   898 		iTheView=0;
       
   899 		}
       
   900 	iTheDb->RollbackTransaction();
       
   901 
       
   902 	// the inserted record must be rolled back
       
   903 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   904 		{
       
   905 		iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToInsert);
       
   906 		CleanupStack::Pop(iTheView);
       
   907 
       
   908 		// there must be no records found
       
   909 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound );
       
   910 		
       
   911 		delete  iTheView ;
       
   912 		iTheView=0;
       
   913 		}
       
   914 	iTheDb->RollbackTransaction();
       
   915 
       
   916 	// open view, update record, delete view
       
   917 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   918 		{
       
   919 		iTheView=iTheDb->OpenTableLC(tableName);
       
   920 		CleanupStack::Pop(iTheView);
       
   921 
       
   922 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   923 		iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToUpdate);
       
   924 		iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue1);
       
   925 		CDBLEAVE( iTheView->UpdateRecord(), KErrNone );
       
   926 		iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING), KModemInitString);
       
   927 		CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   928 		
       
   929 		delete  iTheView ;
       
   930 		iTheView=0;
       
   931 		}
       
   932 	iTheDb->RollbackTransaction();
       
   933 
       
   934 	// the updated record must be rolled back
       
   935 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   936 		{
       
   937 		iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToUpdate);
       
   938 		CleanupStack::Pop(iTheView);
       
   939 
       
   940 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   941 		iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue2);
       
   942 		
       
   943 		if (fieldValue1 != fieldValue2)
       
   944 			{
       
   945 			User::Leave(KErrGeneral);
       
   946 			}
       
   947 		
       
   948 		delete  iTheView ;
       
   949 		iTheView=0;
       
   950 		}
       
   951 	iTheDb->RollbackTransaction();
       
   952 
       
   953 	// open view, delete record, delete view
       
   954 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   955 		{
       
   956 		iTheView=iTheDb->OpenTableLC(tableName);
       
   957 		CleanupStack::Pop(iTheView);
       
   958 
       
   959 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   960 		iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToDelete);
       
   961 		CDBLEAVE( iTheView->DeleteRecord(), KErrNone );
       
   962 		
       
   963 		delete  iTheView ;
       
   964 		iTheView=0;
       
   965 		}
       
   966 	iTheDb->RollbackTransaction();
       
   967 
       
   968 	// the deleted record must be rolled back
       
   969 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   970 		{
       
   971 		iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToDelete);
       
   972 		CleanupStack::Pop(iTheView);
       
   973 
       
   974 		// the record must still be there
       
   975 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
   976 		CDBLEAVE( iTheView->GotoNextRecord(), KErrNotFound );
       
   977 		
       
   978 		delete  iTheView ;
       
   979 		iTheView=0;
       
   980 		}
       
   981 	iTheDb->RollbackTransaction();
       
   982 
       
   983 
       
   984 
       
   985 	////////////////////////////////////////////////////////////////////////////////
       
   986 	// commit transaction test
       
   987 
       
   988 	// open view, insert record, delete view
       
   989 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
   990 		{
       
   991 		iTheView=iTheDb->OpenTableLC(tableName);
       
   992 		CleanupStack::Pop(iTheView);
       
   993 
       
   994 		CDBLEAVE( iTheView->InsertRecord(recordToInsert), KErrNone );
       
   995 		CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
   996 		
       
   997 		delete  iTheView ;
       
   998 		iTheView=0;
       
   999 		}
       
  1000 	iTheDb->CommitTransaction();
       
  1001 
       
  1002 	// the inserted records must be commited
       
  1003 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
  1004 		{
       
  1005 		iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToInsert);
       
  1006 		CleanupStack::Pop(iTheView);
       
  1007 
       
  1008 		// the record must have been inserted
       
  1009 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
  1010 		CDBLEAVE( iTheView->GotoNextRecord(), KErrNotFound );
       
  1011 		
       
  1012 		delete  iTheView ;
       
  1013 		iTheView=0;
       
  1014 		}
       
  1015 	iTheDb->RollbackTransaction();
       
  1016 
       
  1017 
       
  1018 	// open view, update record, delete view
       
  1019 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
  1020 		{
       
  1021 		iTheView=iTheDb->OpenTableLC(tableName);
       
  1022 		CleanupStack::Pop(iTheView);
       
  1023 
       
  1024 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
  1025 		iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToUpdate);
       
  1026 		iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue1);
       
  1027 		CDBLEAVE( iTheView->UpdateRecord(), KErrNone );
       
  1028 		iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING), KModemInitString);
       
  1029 		CDBLEAVE( iTheView->PutRecordChanges(), KErrNone );
       
  1030 		
       
  1031 		delete  iTheView ;
       
  1032 		iTheView=0;
       
  1033 		}
       
  1034 	iTheDb->CommitTransaction();
       
  1035 
       
  1036 	// the updated record must be rolled back
       
  1037 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
  1038 		{
       
  1039 		iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToUpdate);
       
  1040 		CleanupStack::Pop(iTheView);
       
  1041 
       
  1042 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
  1043 		iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue2);
       
  1044 		
       
  1045 		if (fieldValue2 != KModemInitString)
       
  1046 			{
       
  1047 			User::Leave(KErrGeneral);
       
  1048 			}
       
  1049 		
       
  1050 		delete  iTheView ;
       
  1051 		iTheView=0;
       
  1052 		}
       
  1053 	iTheDb->RollbackTransaction();
       
  1054 
       
  1055 
       
  1056 	// open view, delete record, delete view
       
  1057 	// unfortunately we cannot do heap marking here because of commsdtat notifications
       
  1058 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
  1059 		{
       
  1060 		iTheView=iTheDb->OpenTableLC(tableName);
       
  1061 		CleanupStack::Pop(iTheView);
       
  1062 
       
  1063 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone );
       
  1064 		iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToDelete);
       
  1065 		CDBLEAVE( iTheView->DeleteRecord(), KErrNone );
       
  1066 		
       
  1067 		delete  iTheView ;
       
  1068 		iTheView=0;
       
  1069 		}
       
  1070 	iTheDb->CommitTransaction();
       
  1071 
       
  1072 	// the deleted records must be commited
       
  1073 	CDBLEAVE( iTheDb->BeginTransaction(), KErrNone );
       
  1074 		{
       
  1075 		iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToDelete);
       
  1076 		CleanupStack::Pop(iTheView);
       
  1077 
       
  1078 		// the record must have been deleted
       
  1079 		CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound );
       
  1080 		
       
  1081 		delete  iTheView ;
       
  1082 		iTheView=0;
       
  1083 		}
       
  1084 	iTheDb->RollbackTransaction();
       
  1085 
       
  1086 	//Close the DB
       
  1087 	delete iTheDb;
       
  1088 	iTheDb = 0;
       
  1089 
       
  1090 	//NB Only get here if we didnt trap, so it must have passed
       
  1091 	ret = KErrNone;
       
  1092 	return ret;
       
  1093 	}
       
  1094 
       
  1095 
       
  1096 
       
  1097 TVerdict CCommDbTest015_09::doTestStepL( )
       
  1098 	{
       
  1099 	INFO_PRINTF1(_L("Step 015.09 called "));
       
  1100 
       
  1101 	if ( executeStepL() == KErrNone )
       
  1102 		SetTestStepResult(EPass);	else
       
  1103 		SetTestStepResult(EFail);
       
  1104 	return TestStepResult();
       
  1105 	}
       
  1106 
       
  1107 
       
  1108 
       
  1109 
       
  1110 
       
  1111 /////////////////////
       
  1112 //	Test step 015.10
       
  1113 /////////////////////
       
  1114 
       
  1115 // constructor
       
  1116 CCommDbTest015_10::CCommDbTest015_10()
       
  1117 	{
       
  1118 	// store the name of this test case
       
  1119 	SetTestStepName(_L("step_015_10"));
       
  1120 	}
       
  1121 
       
  1122 // destructor
       
  1123 CCommDbTest015_10::~CCommDbTest015_10()
       
  1124 	{
       
  1125 	}
       
  1126 
       
  1127 TVerdict CCommDbTest015_10::doTestStepL( )
       
  1128 	{
       
  1129 	INFO_PRINTF1(_L("Step 015.10 called "));
       
  1130 
       
  1131 	SetTestStepResult(EPass);	
       
  1132 	// Have backup of Database in c:\default1.dat
       
  1133 
       
  1134 		// Heap test for 015.01
       
  1135 
       
  1136 	CCommDbTest015_01* step015_01 = new(ELeave) CCommDbTest015_01;
       
  1137 	CleanupStack::PushL(step015_01);
       
  1138 	doTestStepWithHeapFailureL( *step015_01, KErrNone);
       
  1139 	if ( step015_01->TestStepResult() == EFail )
       
  1140 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step015_01);
       
  1141 
       
  1142 
       
  1143 
       
  1144 	return TestStepResult();	
       
  1145 
       
  1146 }
       
  1147 
       
  1148 /////////////////////
       
  1149 //	Test step 015.11
       
  1150 /////////////////////
       
  1151 
       
  1152 // constructor
       
  1153 CCommDbTest015_11::CCommDbTest015_11()
       
  1154 	{
       
  1155 	// store the name of this test case
       
  1156 	SetTestStepName(_L("step_015_11"));
       
  1157 	}
       
  1158 
       
  1159 // destructor
       
  1160 CCommDbTest015_11::~CCommDbTest015_11()
       
  1161 	{
       
  1162 	}
       
  1163 
       
  1164 TVerdict CCommDbTest015_11::doTestStepL( )
       
  1165 	{
       
  1166 	INFO_PRINTF1(_L("Step 015.11 called "));
       
  1167 
       
  1168 	SetTestStepResult(EPass);	
       
  1169 			// Heap test for 015.02
       
  1170 	CCommDbTest015_02* step015_02 = new CCommDbTest015_02;
       
  1171 	CleanupStack::PushL(step015_02);
       
  1172 	doTestStepWithHeapFailureL( *step015_02, KErrNone);
       
  1173 	if ( step015_02->TestStepResult() == EFail )
       
  1174 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step015_02);
       
  1175 	
       
  1176 	return TestStepResult();
       
  1177 	}
       
  1178 	
       
  1179 /////////////////////
       
  1180 //	Test step 015.12
       
  1181 /////////////////////
       
  1182 
       
  1183 // constructor
       
  1184 CCommDbTest015_12::CCommDbTest015_12()
       
  1185 	{
       
  1186 	// store the name of this test case
       
  1187 	SetTestStepName(_L("step_015_12"));
       
  1188 	}
       
  1189 
       
  1190 // destructor
       
  1191 CCommDbTest015_12::~CCommDbTest015_12()
       
  1192 	{
       
  1193 	}
       
  1194 
       
  1195 TVerdict CCommDbTest015_12::doTestStepL( )
       
  1196 	{
       
  1197 	INFO_PRINTF1(_L("Step 015.12 called "));
       
  1198 
       
  1199 	SetTestStepResult(EPass);	
       
  1200 		// Heap test for 015.03
       
  1201 
       
  1202 	CCommDbTest015_03* step015_03 = new CCommDbTest015_03;
       
  1203 	CleanupStack::PushL(step015_03);
       
  1204 	doTestStepWithHeapFailureL( *step015_03, KErrNone);
       
  1205 	if ( step015_03->TestStepResult() == EFail )
       
  1206 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step015_03);
       
  1207 	
       
  1208 	return TestStepResult();
       
  1209 	}	
       
  1210 	
       
  1211 /////////////////////
       
  1212 //	Test step 015.13
       
  1213 /////////////////////
       
  1214 
       
  1215 // constructor
       
  1216 CCommDbTest015_13::CCommDbTest015_13()
       
  1217 	{
       
  1218 	// store the name of this test case
       
  1219 	SetTestStepName(_L("step_015_13"));
       
  1220 	}
       
  1221 
       
  1222 // destructor
       
  1223 CCommDbTest015_13::~CCommDbTest015_13()
       
  1224 	{
       
  1225 	}
       
  1226 
       
  1227 TVerdict CCommDbTest015_13::doTestStepL( )
       
  1228 	{
       
  1229 	INFO_PRINTF1(_L("Step 015.13 called "));
       
  1230 
       
  1231 	SetTestStepResult(EPass);	
       
  1232 		// Heap test for 015.04
       
  1233 	copyTestDatabase( EDatabase_1 );
       
  1234 	CCommDbTest015_04* step015_04 = new CCommDbTest015_04;
       
  1235 	CleanupStack::PushL(step015_04);
       
  1236 	doTestStepWithHeapFailureL( *step015_04, KErrNone);
       
  1237 	if ( step015_04->TestStepResult() == EFail )
       
  1238 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step015_04);
       
  1239 	
       
  1240 	return TestStepResult();
       
  1241 	}	
       
  1242 	
       
  1243 /////////////////////
       
  1244 //	Test step 015.14
       
  1245 /////////////////////
       
  1246 
       
  1247 // constructor
       
  1248 CCommDbTest015_14::CCommDbTest015_14()
       
  1249 	{
       
  1250 	// store the name of this test case
       
  1251 	SetTestStepName(_L("step_015_14"));
       
  1252 	}
       
  1253 
       
  1254 // destructor
       
  1255 CCommDbTest015_14::~CCommDbTest015_14()
       
  1256 	{
       
  1257 	}
       
  1258 
       
  1259 TVerdict CCommDbTest015_14::doTestStepL( )
       
  1260 	{
       
  1261 	INFO_PRINTF1(_L("Step 015.14 called "));
       
  1262 
       
  1263 	SetTestStepResult(EPass);	
       
  1264 		// Heap test for 015.07
       
  1265 
       
  1266 	CCommDbTest015_07* step015_07 = new CCommDbTest015_07;
       
  1267 	CleanupStack::PushL(step015_07);
       
  1268 	doTestStepWithHeapFailureL( *step015_07, KErrNone);
       
  1269 	if ( step015_07->TestStepResult() == EFail )
       
  1270 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step015_07);
       
  1271 	
       
  1272 	return TestStepResult();
       
  1273 	}	
       
  1274 	
       
  1275 /////////////////////
       
  1276 //	Test step 015.15
       
  1277 /////////////////////
       
  1278 
       
  1279 // constructor
       
  1280 CCommDbTest015_15::CCommDbTest015_15()
       
  1281 	{
       
  1282 	// store the name of this test case
       
  1283 	SetTestStepName(_L("step_015_15"));
       
  1284 	}
       
  1285 
       
  1286 // destructor
       
  1287 CCommDbTest015_15::~CCommDbTest015_15()
       
  1288 	{
       
  1289 	}
       
  1290 
       
  1291 TVerdict CCommDbTest015_15::doTestStepL( )
       
  1292 	{
       
  1293 	INFO_PRINTF1(_L("Step 015.15 called "));
       
  1294 
       
  1295 	SetTestStepResult(EPass);	
       
  1296 		// Heap test for 015.08
       
  1297 
       
  1298 	CCommDbTest015_08* step015_08 = new CCommDbTest015_08;
       
  1299 	CleanupStack::PushL(step015_08);
       
  1300 	doTestStepWithHeapFailureL( *step015_08, KErrLocked);
       
  1301 	if ( step015_08->TestStepResult() == EFail )
       
  1302 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step015_08);
       
  1303 	
       
  1304 	return TestStepResult();
       
  1305 	}	
       
  1306 
       
  1307 
       
  1308 
       
  1309 /////////////////////
       
  1310 //	Test step 015.16
       
  1311 /////////////////////
       
  1312 
       
  1313 // constructor
       
  1314 CCommDbTest015_16::CCommDbTest015_16()
       
  1315 	{
       
  1316 	// store the name of this test case
       
  1317 	SetTestStepName(_L("step_015_16"));
       
  1318 	}
       
  1319 
       
  1320 // destructor
       
  1321 CCommDbTest015_16::~CCommDbTest015_16()
       
  1322 	{
       
  1323 	}
       
  1324 
       
  1325 TVerdict CCommDbTest015_16::doTestStepL( )
       
  1326 	{
       
  1327 	INFO_PRINTF1(_L("Step 015.16 called "));
       
  1328 
       
  1329 	SetTestStepResult(EPass);	
       
  1330 		// Heap test for 015.09
       
  1331 		
       
  1332 	CCommDbTest015_09* step015_09 = new CCommDbTest015_09;
       
  1333 	CleanupStack::PushL(step015_09);
       
  1334 	doTestStepWithHeapFailureL( *step015_09, KErrNone);
       
  1335 	if ( step015_09->TestStepResult() == EFail )
       
  1336 		SetTestStepResult(EFail);	CleanupStack::PopAndDestroy(step015_09);
       
  1337 	
       
  1338 	return TestStepResult();
       
  1339 	}