contentmgmt/cafstreamingsupport/test/tscaf/source/tsetuprightsobjects.cpp
branchRCL_3
changeset 43 2f10d260163b
equal deleted inserted replaced
42:eb9b28acd381 43:2f10d260163b
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implements the setup utility step for copying rights objects into the test stream agents
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "tsetuprightsobjects.h"
       
    19 
       
    20 using namespace StreamAccess;
       
    21 
       
    22 CScafSetupRightsObjects::CScafSetupRightsObjects(CScafServer& aParent): CScafStep(aParent)
       
    23 /**
       
    24  * Constructor
       
    25  */
       
    26 	{
       
    27 	SetTestStepName(KScafSetupRightsObjectsStep);
       
    28 	}
       
    29 
       
    30 CScafSetupRightsObjects::~CScafSetupRightsObjects()
       
    31 /**
       
    32  * Destructor
       
    33  */
       
    34 	{
       
    35 	}
       
    36 
       
    37 TVerdict CScafSetupRightsObjects::doTestStepL()
       
    38 	{
       
    39 	INFO_PRINTF1(_L("*** Setup Rights Objects ***"));
       
    40 	
       
    41 	TPtrC privateFolderPath;
       
    42 	
       
    43 	TName fPrivateFolderPath;
       
    44 	
       
    45 	fPrivateFolderPath.Format(KScafConfigPrivateFolderPath, 0);
       
    46 	
       
    47 	if(!GetStringFromConfig(ConfigSection(),fPrivateFolderPath,privateFolderPath))
       
    48 		{
       
    49 		privateFolderPath.Set(KStaPrivateFolder);
       
    50 		}
       
    51 	
       
    52 	//Clear the contents of the stream agents private directory
       
    53 	TRAPD(err,CleanAgentsPrivateFolderL(privateFolderPath));
       
    54 	
       
    55 	if(err != KErrNone)
       
    56 		{
       
    57 		ERR_PRINTF2(_L("*** CleanAgentsPrivateFolderL() Leave : %d  ***"),err);
       
    58 		User::Leave(err);
       
    59 		}
       
    60 	
       
    61 	/* Rights object identifier is formatted with the index in order to copy the list of rights
       
    62 	 * object files stated within the configuration, into the stream agents private
       
    63 	 * directory
       
    64 	 */
       
    65 	TInt index=0;
       
    66 	TName roIdentifier; 
       
    67 	roIdentifier.Format(KScafConfigRoName, index);
       
    68 	
       
    69 	// Filename of the current rights object
       
    70 	TPtrC roName;									
       
    71 	
       
    72 	while (GetStringFromConfig(ConfigSection(),roIdentifier,roName))
       
    73 		{
       
    74 		//Copy the rights object into the private directory of the stream agent
       
    75 		TRAP(err,CopyFile2AgentsPrivateFolderL(iParent.Fs(),roName, privateFolderPath));
       
    76 		
       
    77 		if(err != KErrNone)
       
    78 			{
       
    79 			ERR_PRINTF3(_L("*** PREAMBLE - CopyFile2AgentsPrivateFolderL() Leave: %S - %d  ***"),&roName,err);
       
    80 			User::Leave(err);
       
    81 			}
       
    82 		
       
    83 		// increment the index and reformat the identifier for the next filename
       
    84 		index++;
       
    85 		roIdentifier.Format(KScafConfigRoName, index);
       
    86 		}
       
    87 	
       
    88 	return TestStepResult();	
       
    89 	}