backupandrestore/backuptest/burtestserver/TestSteps/src/t_burteststepbase.cpp
branchRCL_3
changeset 20 4a793f564d72
parent 19 0aa8cc770c8a
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
    61 		{
    61 		{
    62 		iDataOwners.ResetAndDestroy();
    62 		iDataOwners.ResetAndDestroy();
    63 		iDataOwners.Close();
    63 		iDataOwners.Close();
    64 			
    64 			
    65 		iSidArray.Close();
    65 		iSidArray.Close();
    66 		
       
    67 		iExcludeSidArray.Close();
       
    68 		
       
    69 		iJidArray.Close();
    66 		iJidArray.Close();
    70 		iPublicFileNames.Close();
    67 		iPublicFileNames.Close();
    71 		iPrivateFileNames.Close();
    68 		iPrivateFileNames.Close();
    72 		iPrivateFileSizes.Close();
    69 		iPrivateFileSizes.Close();
    73 		
    70 		
   388 		ReadListIntoStringArray(KExpectPrivateFiles, delimiter, iPrivateFileNames);		
   385 		ReadListIntoStringArray(KExpectPrivateFiles, delimiter, iPrivateFileNames);		
   389 		
   386 		
   390 		/** Read private file sizes into array */
   387 		/** Read private file sizes into array */
   391 		_LIT(KExpectPrivateFileSizes, "ExpectPrivateFileSizes");
   388 		_LIT(KExpectPrivateFileSizes, "ExpectPrivateFileSizes");
   392 		ReadListIntoIntArray(KExpectPrivateFileSizes, delimiter, iPrivateFileSizes);
   389 		ReadListIntoIntArray(KExpectPrivateFileSizes, delimiter, iPrivateFileSizes);
   393 	
       
   394 		// Read Exclude IDs LIST //
       
   395 		TSecureId sid;           
       
   396 	    TChar ch;
       
   397 	    TPtrC list;
       
   398 	
       
   399 	    // clear the array
       
   400 	    iExcludeSidArray.Reset();
       
   401 	    // read the string
       
   402         _LIT(KExcludeSIDList, "ExcludeIDs");
       
   403         GetStringFromConfig(ConfigSection(), KExcludeSIDList, list);
       
   404         TLex sidLex(list);
       
   405         // parse the string
       
   406         while (!sidLex.Eos())
       
   407             {
       
   408             sidLex.Mark();
       
   409             ch=sidLex.Peek();
       
   410 
       
   411             while(!sidLex.Eos() && ( ch=sidLex.Peek() ) != TChar(','))
       
   412                 sidLex.Inc();
       
   413 
       
   414             if(!sidLex.TokenLength())
       
   415                 continue;
       
   416             
       
   417             TPtrC pToken = sidLex.MarkedToken();
       
   418             TLex token(pToken);
       
   419             
       
   420             if (pToken.Length() <= KMaxHexLength && token.Val(sid.iId, EHex) == KErrNone)
       
   421                 {
       
   422                 iExcludeSidArray.Append(sid);
       
   423                 _LIT(KFound, "Exclude ID Found in ini file: ");
       
   424                 LogWithSID(LOG_LEVEL4, KFound, sid);        
       
   425                 } //if
       
   426                     
       
   427             if(ch==TChar(','))
       
   428                 sidLex.Inc();
       
   429             
       
   430             sidLex.SkipSpace();
       
   431     
       
   432             } //while
       
   433                     
       
   434 		
       
   435 		}
   390 		}
   436 		
   391 		
   437 	void CBURTestStepBase::ReadListIntoStringArray(const TDesC& aSectionName, const TChar& aDelimiter, RArray<TPtrC>& aResultList)
   392 	void CBURTestStepBase::ReadListIntoStringArray(const TDesC& aSectionName, const TChar& aDelimiter, RArray<TPtrC>& aResultList)
   438 		{
   393 		{
   439 		TChar ch;
   394 		TChar ch;
   501 			{
   456 			{
   502 			_LIT(KTempText1, "Error getting list of data owners: ");
   457 			_LIT(KTempText1, "Error getting list of data owners: ");
   503 			LogWithNum(LOG_LEVEL2,KTempText1, err);
   458 			LogWithNum(LOG_LEVEL2,KTempText1, err);
   504 			iFailures++;
   459 			iFailures++;
   505 			}
   460 			}
       
   461 
   506 		// Log
   462 		// Log
   507 		if (iDataOwners.Count() == 0)
   463 		if (iDataOwners.Count() == 0)
   508 			{
   464 			{
   509 			_LIT(KTempText3, "No data owners found.");
   465 			_LIT(KTempText3, "No data owners found.");
   510 			Log(LOG_LEVEL3, KTempText3);
   466 			Log(LOG_LEVEL3, KTempText3);
   512 		else
   468 		else
   513 			{
   469 			{
   514 			_LIT(KTempText4, "Number of data owners found on device: ");
   470 			_LIT(KTempText4, "Number of data owners found on device: ");
   515 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   471 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   516 			}
   472 			}
   517 			
       
   518 		//filter the dataowners per the exclude SID list
       
   519 		for (TInt index = 0; index < iDataOwners.Count(); index++)
       
   520             {
       
   521             TSecureId sid = NULL;
       
   522             sid = ExtractIDL(*iDataOwners[index]);
       
   523             
       
   524             if (sid != NULL)
       
   525                 {
       
   526                 TInt position = iExcludeSidArray.Find(sid);
       
   527                 if (position != KErrNotFound)
       
   528                     {
       
   529                     _LIT(KTempText2, "ExcludeID found in list of data owners: ");
       
   530                     LogWithSID(LOG_LEVEL3, KTempText2, sid);
       
   531                     
       
   532                     delete iDataOwners[index];
       
   533                     iDataOwners[index] = NULL;
       
   534                     iDataOwners.Remove(index);
       
   535                     index--;
       
   536                     }            
       
   537                 }
       
   538             }
       
   539 		       
       
   540 		
       
   541 		}
   473 		}
   542 		
   474 		
   543 	void CBURTestStepBase::PopulateListOfDataOwnersAsyncL()
   475 	void CBURTestStepBase::PopulateListOfDataOwnersAsyncL()
   544 		/**
   476 		/**
   545 		Uses CSBEClient::ListOfDataOwnersL() to extract a list of data owners that have 
   477 		Uses CSBEClient::ListOfDataOwnersL() to extract a list of data owners that have 
   576 		else
   508 		else
   577 			{
   509 			{
   578 			_LIT(KTempText4, "Number of data owners found on device: ");
   510 			_LIT(KTempText4, "Number of data owners found on device: ");
   579 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   511 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   580 			}
   512 			}
   581 		
       
   582         //filter the dataowners per the exclude SID list
       
   583         for (TInt index = 0; index < iDataOwners.Count(); index++)
       
   584             {
       
   585             TSecureId sid = NULL;
       
   586             sid = ExtractIDL(*iDataOwners[index]);
       
   587             
       
   588             if (sid != NULL)
       
   589                 {
       
   590                 TInt position = iExcludeSidArray.Find(sid);
       
   591                 if (position != KErrNotFound)
       
   592                     {
       
   593                     _LIT(KTempText2, "ExcludeID found in list of data owners: ");
       
   594                     LogWithSID(LOG_LEVEL3, KTempText2, sid);
       
   595                     
       
   596                     delete iDataOwners[index];
       
   597                     iDataOwners[index] = NULL;
       
   598                     iDataOwners.Remove(index);
       
   599                     index--;
       
   600                     }            
       
   601                 }
       
   602             }
       
   603 		}
   513 		}
   604 	
   514 	
   605 	void CBURTestStepBase::SetBURModeL(TBURPartType aBURPartType, TBackupIncType aBackupIncType)
   515 	void CBURTestStepBase::SetBURModeL(TBURPartType aBURPartType, TBackupIncType aBackupIncType)
   606 		/**
   516 		/**
   607 		Uses CSBEClient::SetBURModeL() to set backup and restore settings
   517 		Uses CSBEClient::SetBURModeL() to set backup and restore settings
   645 		
   555 		
   646 		// go through list of pids and sids
   556 		// go through list of pids and sids
   647 		for (TInt index = 0; index < iDataOwners.Count(); index++)
   557 		for (TInt index = 0; index < iDataOwners.Count(); index++)
   648 			{
   558 			{
   649 			TBool notFound = ETrue;
   559 			TBool notFound = ETrue;
   650 			sid = ExtractIDL(*iDataOwners[index]);	
   560 			sid = ExtractIDL(*iDataOwners[index]);
   651 			                    
   561 			
   652 			if (sid != NULL)
   562 			if (sid != NULL)
   653 				{
   563 				{
   654 				TInt position = iSidArray.Find(sid);
   564 				TInt position = iSidArray.Find(sid);
   655 				if (position != KErrNotFound)
   565 				if (position != KErrNotFound)
   656 					{
   566 					{
   664 					} // if else
   574 					} // if else
   665 				} // if
   575 				} // if
   666 			else // possibly jid
   576 			else // possibly jid
   667 				{
   577 				{
   668 				HBufC* pSuiteHash = ExtractJavaIDL(*iDataOwners[index]);
   578 				HBufC* pSuiteHash = ExtractJavaIDL(*iDataOwners[index]);
   669 				if (pSuiteHash != NULL)
   579 				TPtrC suiteHash = pSuiteHash->Des();
   670 				    {
   580 				if (iJidArray.Find(suiteHash) != KErrNotFound)
   671                     TPtrC suiteHash = pSuiteHash->Des();
   581 					{
   672                     if (iJidArray.Find(suiteHash) != KErrNotFound)
   582 					_LIT(KTempText3, "Java ID found in list of data owners: ");
   673                         {
   583 					LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
   674                         _LIT(KTempText3, "Java ID found in list of data owners: ");
   584 					notFound = EFalse;
   675                         LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
   585 					}
   676                         notFound = EFalse;
   586 				else // not found 
   677                         }
   587 					{
   678                     else // not found 
   588 					notFound = ETrue;
   679                         {
   589 					}
   680                         notFound = ETrue;
   590 				delete pSuiteHash;
   681                         }
   591 				pSuiteHash = NULL;
   682                     delete pSuiteHash;
       
   683                     pSuiteHash = NULL;
       
   684 				    }
       
   685 				}
   592 				}
   686 			if (notFound)
   593 			if (notFound)
   687 				{
   594 				{
   688 				delete iDataOwners[index];
   595 				delete iDataOwners[index];
   689 				iDataOwners[index] = NULL;
   596 				iDataOwners[index] = NULL;
  1314 					aTransferTypes[j] = NULL;
  1221 					aTransferTypes[j] = NULL;
  1315 					aTransferTypes.Remove(j);
  1222 					aTransferTypes.Remove(j);
  1316 					j--;
  1223 					j--;
  1317 					total--;
  1224 					total--;
  1318 					}
  1225 					}
  1319 				else
       
  1320 				    {
       
  1321                     // print the status
       
  1322                     LogWithSID(LOG_LEVEL3, _L("---The unexpected dataowner status-SID: "),statusArray[j].iSID.iId);
       
  1323                     LogWithNum(LOG_LEVEL3,_L("---The unexpected dataowner status-status: "),statusArray[j].iStatus) ;
       
  1324 				    }
       
  1325 				} //for	
  1226 				} //for	
  1326 			statusArray.Reset();
  1227 			statusArray.Reset();
  1327 			CleanupStack::PopAndDestroy(&statusArray);
  1228 			CleanupStack::PopAndDestroy(&statusArray);
  1328 			} // if
  1229 			} // if
  1329 		}
  1230 		}
  1464 				RTransferTypeArray readyArray;
  1365 				RTransferTypeArray readyArray;
  1465 				CleanupClosePushL(readyArray);
  1366 				CleanupClosePushL(readyArray);
  1466 					
  1367 					
  1467 				for (TInt i=0; i < KRetries;)
  1368 				for (TInt i=0; i < KRetries;)
  1468 					{
  1369 					{
  1469 				
       
  1470                   
       
  1471                     LogWithNum(LOG_LEVEL3,_L("retryies :"), i);
       
  1472 				
       
  1473 					CheckSIDStatusL(iTransferTypes, readyArray);
  1370 					CheckSIDStatusL(iTransferTypes, readyArray);
  1474 								
  1371 											
  1475 					
       
  1476 					LogWithNum(LOG_LEVEL3,_L("readyArray count :"), readyArray.Count());
       
  1477 					
       
  1478 					// print all the ready array
       
  1479 					for(TInt jj = 0 ; jj < readyArray.Count(); jj++)
       
  1480 					    {
       
  1481                          CSBSIDTransferType* type = CSBSIDTransferType::NewL(readyArray[jj]);
       
  1482 					     CleanupStack::PushL(type);
       
  1483 					     
       
  1484 					     LogWithSID(LOG_LEVEL3, _L("readyArray SIDs : ") , type->SecureIdL());
       
  1485 					     CleanupStack::PopAndDestroy(type);
       
  1486 					    }
       
  1487 					
       
  1488 					if (readyArray.Count()) // dataowners ready
  1372 					if (readyArray.Count()) // dataowners ready
  1489 						{
  1373 						{
  1490 						// ========= Supply Data ================
  1374 						// ========= Supply Data ================
  1491 						SupplyDataL(readyArray);		
  1375 						SupplyDataL(readyArray);		
  1492 						} 
  1376 						} 
  1503 				if (iTransferTypes.Count())
  1387 				if (iTransferTypes.Count())
  1504 					{
  1388 					{
  1505 					iFailures++;
  1389 					iFailures++;
  1506 					_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
  1390 					_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
  1507 					Log(LOG_LEVEL3, KLogNoTrans);
  1391 					Log(LOG_LEVEL3, KLogNoTrans);
  1508 					
       
  1509 					// print the remenan sids
       
  1510 					for( TInt kk = 0 ; kk <iTransferTypes.Count() ; kk++)
       
  1511 					    {
       
  1512                         
       
  1513                         CSBSIDTransferType* sidType = CSBSIDTransferType::NewL(iTransferTypes[kk]);
       
  1514 					    CleanupStack::PushL(sidType);
       
  1515 					    TSecureId id = NULL;
       
  1516 					    id = sidType->SecureIdL();
       
  1517 					    CleanupStack::PopAndDestroy(sidType);
       
  1518                         LogWithSID(LOG_LEVEL3, _L("--iTransferTypes, remanent SIDs : "),id.iId);
       
  1519 					    }
       
  1520 					//
       
  1521 					}
  1392 					}
  1522 				readyArray.ResetAndDestroy();
  1393 				readyArray.ResetAndDestroy();
  1523 				CleanupStack::PopAndDestroy(&readyArray);
  1394 				CleanupStack::PopAndDestroy(&readyArray);
  1524 				} //if
  1395 				} //if
  1525 			else 
  1396 			else 
  1609 		{
  1480 		{
  1610 		if (IsActive())
  1481 		if (IsActive())
  1611 			{
  1482 			{
  1612 			User::Leave(KErrInUse);
  1483 			User::Leave(KErrInUse);
  1613 			}
  1484 			}
       
  1485 		iStatus = KRequestPending;
  1614 		SetActive();
  1486 		SetActive();
  1615 		iActiveScheduler->Start();
  1487 		iActiveScheduler->Start();
  1616 		}
  1488 		}
  1617 	/**
  1489 	/**
  1618 	Returns an error/completing code of the iStatus
  1490 	Returns an error/completing code of the iStatus