backupandrestore/backuptest/burtestserver/TestSteps/src/t_burteststepbase.cpp
branchRCL_3
changeset 19 0aa8cc770c8a
parent 0 d0791faffa3f
child 20 4a793f564d72
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
    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 		
    66 		iJidArray.Close();
    69 		iJidArray.Close();
    67 		iPublicFileNames.Close();
    70 		iPublicFileNames.Close();
    68 		iPrivateFileNames.Close();
    71 		iPrivateFileNames.Close();
    69 		iPrivateFileSizes.Close();
    72 		iPrivateFileSizes.Close();
    70 		
    73 		
   385 		ReadListIntoStringArray(KExpectPrivateFiles, delimiter, iPrivateFileNames);		
   388 		ReadListIntoStringArray(KExpectPrivateFiles, delimiter, iPrivateFileNames);		
   386 		
   389 		
   387 		/** Read private file sizes into array */
   390 		/** Read private file sizes into array */
   388 		_LIT(KExpectPrivateFileSizes, "ExpectPrivateFileSizes");
   391 		_LIT(KExpectPrivateFileSizes, "ExpectPrivateFileSizes");
   389 		ReadListIntoIntArray(KExpectPrivateFileSizes, delimiter, iPrivateFileSizes);
   392 		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 		
   390 		}
   435 		}
   391 		
   436 		
   392 	void CBURTestStepBase::ReadListIntoStringArray(const TDesC& aSectionName, const TChar& aDelimiter, RArray<TPtrC>& aResultList)
   437 	void CBURTestStepBase::ReadListIntoStringArray(const TDesC& aSectionName, const TChar& aDelimiter, RArray<TPtrC>& aResultList)
   393 		{
   438 		{
   394 		TChar ch;
   439 		TChar ch;
   456 			{
   501 			{
   457 			_LIT(KTempText1, "Error getting list of data owners: ");
   502 			_LIT(KTempText1, "Error getting list of data owners: ");
   458 			LogWithNum(LOG_LEVEL2,KTempText1, err);
   503 			LogWithNum(LOG_LEVEL2,KTempText1, err);
   459 			iFailures++;
   504 			iFailures++;
   460 			}
   505 			}
   461 
       
   462 		// Log
   506 		// Log
   463 		if (iDataOwners.Count() == 0)
   507 		if (iDataOwners.Count() == 0)
   464 			{
   508 			{
   465 			_LIT(KTempText3, "No data owners found.");
   509 			_LIT(KTempText3, "No data owners found.");
   466 			Log(LOG_LEVEL3, KTempText3);
   510 			Log(LOG_LEVEL3, KTempText3);
   468 		else
   512 		else
   469 			{
   513 			{
   470 			_LIT(KTempText4, "Number of data owners found on device: ");
   514 			_LIT(KTempText4, "Number of data owners found on device: ");
   471 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   515 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   472 			}
   516 			}
       
   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 		
   473 		}
   541 		}
   474 		
   542 		
   475 	void CBURTestStepBase::PopulateListOfDataOwnersAsyncL()
   543 	void CBURTestStepBase::PopulateListOfDataOwnersAsyncL()
   476 		/**
   544 		/**
   477 		Uses CSBEClient::ListOfDataOwnersL() to extract a list of data owners that have 
   545 		Uses CSBEClient::ListOfDataOwnersL() to extract a list of data owners that have 
   508 		else
   576 		else
   509 			{
   577 			{
   510 			_LIT(KTempText4, "Number of data owners found on device: ");
   578 			_LIT(KTempText4, "Number of data owners found on device: ");
   511 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   579 			LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
   512 			}
   580 			}
       
   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             }
   513 		}
   603 		}
   514 	
   604 	
   515 	void CBURTestStepBase::SetBURModeL(TBURPartType aBURPartType, TBackupIncType aBackupIncType)
   605 	void CBURTestStepBase::SetBURModeL(TBURPartType aBURPartType, TBackupIncType aBackupIncType)
   516 		/**
   606 		/**
   517 		Uses CSBEClient::SetBURModeL() to set backup and restore settings
   607 		Uses CSBEClient::SetBURModeL() to set backup and restore settings
   555 		
   645 		
   556 		// go through list of pids and sids
   646 		// go through list of pids and sids
   557 		for (TInt index = 0; index < iDataOwners.Count(); index++)
   647 		for (TInt index = 0; index < iDataOwners.Count(); index++)
   558 			{
   648 			{
   559 			TBool notFound = ETrue;
   649 			TBool notFound = ETrue;
   560 			sid = ExtractIDL(*iDataOwners[index]);
   650 			sid = ExtractIDL(*iDataOwners[index]);	
   561 			
   651 			                    
   562 			if (sid != NULL)
   652 			if (sid != NULL)
   563 				{
   653 				{
   564 				TInt position = iSidArray.Find(sid);
   654 				TInt position = iSidArray.Find(sid);
   565 				if (position != KErrNotFound)
   655 				if (position != KErrNotFound)
   566 					{
   656 					{
   574 					} // if else
   664 					} // if else
   575 				} // if
   665 				} // if
   576 			else // possibly jid
   666 			else // possibly jid
   577 				{
   667 				{
   578 				HBufC* pSuiteHash = ExtractJavaIDL(*iDataOwners[index]);
   668 				HBufC* pSuiteHash = ExtractJavaIDL(*iDataOwners[index]);
   579 				TPtrC suiteHash = pSuiteHash->Des();
   669 				if (pSuiteHash != NULL)
   580 				if (iJidArray.Find(suiteHash) != KErrNotFound)
   670 				    {
   581 					{
   671                     TPtrC suiteHash = pSuiteHash->Des();
   582 					_LIT(KTempText3, "Java ID found in list of data owners: ");
   672                     if (iJidArray.Find(suiteHash) != KErrNotFound)
   583 					LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
   673                         {
   584 					notFound = EFalse;
   674                         _LIT(KTempText3, "Java ID found in list of data owners: ");
   585 					}
   675                         LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
   586 				else // not found 
   676                         notFound = EFalse;
   587 					{
   677                         }
   588 					notFound = ETrue;
   678                     else // not found 
   589 					}
   679                         {
   590 				delete pSuiteHash;
   680                         notFound = ETrue;
   591 				pSuiteHash = NULL;
   681                         }
       
   682                     delete pSuiteHash;
       
   683                     pSuiteHash = NULL;
       
   684 				    }
   592 				}
   685 				}
   593 			if (notFound)
   686 			if (notFound)
   594 				{
   687 				{
   595 				delete iDataOwners[index];
   688 				delete iDataOwners[index];
   596 				iDataOwners[index] = NULL;
   689 				iDataOwners[index] = NULL;
  1221 					aTransferTypes[j] = NULL;
  1314 					aTransferTypes[j] = NULL;
  1222 					aTransferTypes.Remove(j);
  1315 					aTransferTypes.Remove(j);
  1223 					j--;
  1316 					j--;
  1224 					total--;
  1317 					total--;
  1225 					}
  1318 					}
       
  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 				    }
  1226 				} //for	
  1325 				} //for	
  1227 			statusArray.Reset();
  1326 			statusArray.Reset();
  1228 			CleanupStack::PopAndDestroy(&statusArray);
  1327 			CleanupStack::PopAndDestroy(&statusArray);
  1229 			} // if
  1328 			} // if
  1230 		}
  1329 		}
  1365 				RTransferTypeArray readyArray;
  1464 				RTransferTypeArray readyArray;
  1366 				CleanupClosePushL(readyArray);
  1465 				CleanupClosePushL(readyArray);
  1367 					
  1466 					
  1368 				for (TInt i=0; i < KRetries;)
  1467 				for (TInt i=0; i < KRetries;)
  1369 					{
  1468 					{
       
  1469 				
       
  1470                   
       
  1471                     LogWithNum(LOG_LEVEL3,_L("retryies :"), i);
       
  1472 				
  1370 					CheckSIDStatusL(iTransferTypes, readyArray);
  1473 					CheckSIDStatusL(iTransferTypes, readyArray);
  1371 											
  1474 								
       
  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 					
  1372 					if (readyArray.Count()) // dataowners ready
  1488 					if (readyArray.Count()) // dataowners ready
  1373 						{
  1489 						{
  1374 						// ========= Supply Data ================
  1490 						// ========= Supply Data ================
  1375 						SupplyDataL(readyArray);		
  1491 						SupplyDataL(readyArray);		
  1376 						} 
  1492 						} 
  1387 				if (iTransferTypes.Count())
  1503 				if (iTransferTypes.Count())
  1388 					{
  1504 					{
  1389 					iFailures++;
  1505 					iFailures++;
  1390 					_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
  1506 					_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
  1391 					Log(LOG_LEVEL3, KLogNoTrans);
  1507 					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 					//
  1392 					}
  1521 					}
  1393 				readyArray.ResetAndDestroy();
  1522 				readyArray.ResetAndDestroy();
  1394 				CleanupStack::PopAndDestroy(&readyArray);
  1523 				CleanupStack::PopAndDestroy(&readyArray);
  1395 				} //if
  1524 				} //if
  1396 			else 
  1525 			else 
  1480 		{
  1609 		{
  1481 		if (IsActive())
  1610 		if (IsActive())
  1482 			{
  1611 			{
  1483 			User::Leave(KErrInUse);
  1612 			User::Leave(KErrInUse);
  1484 			}
  1613 			}
  1485 		iStatus = KRequestPending;
       
  1486 		SetActive();
  1614 		SetActive();
  1487 		iActiveScheduler->Start();
  1615 		iActiveScheduler->Start();
  1488 		}
  1616 		}
  1489 	/**
  1617 	/**
  1490 	Returns an error/completing code of the iStatus
  1618 	Returns an error/completing code of the iStatus