os/security/contentmgmt/cafstreamingsupport/test/tscaf/source/tsetuprightsobjects.cpp
First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Implements the setup utility step for copying rights objects into the test stream agents
18 #include "tsetuprightsobjects.h"
20 using namespace StreamAccess;
22 CScafSetupRightsObjects::CScafSetupRightsObjects(CScafServer& aParent): CScafStep(aParent)
27 SetTestStepName(KScafSetupRightsObjectsStep);
30 CScafSetupRightsObjects::~CScafSetupRightsObjects()
37 TVerdict CScafSetupRightsObjects::doTestStepL()
39 INFO_PRINTF1(_L("*** Setup Rights Objects ***"));
41 TPtrC privateFolderPath;
43 TName fPrivateFolderPath;
45 fPrivateFolderPath.Format(KScafConfigPrivateFolderPath, 0);
47 if(!GetStringFromConfig(ConfigSection(),fPrivateFolderPath,privateFolderPath))
49 privateFolderPath.Set(KStaPrivateFolder);
52 //Clear the contents of the stream agents private directory
53 TRAPD(err,CleanAgentsPrivateFolderL(privateFolderPath));
57 ERR_PRINTF2(_L("*** CleanAgentsPrivateFolderL() Leave : %d ***"),err);
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
67 roIdentifier.Format(KScafConfigRoName, index);
69 // Filename of the current rights object
72 while (GetStringFromConfig(ConfigSection(),roIdentifier,roName))
74 //Copy the rights object into the private directory of the stream agent
75 TRAP(err,CopyFile2AgentsPrivateFolderL(iParent.Fs(),roName, privateFolderPath));
79 ERR_PRINTF3(_L("*** PREAMBLE - CopyFile2AgentsPrivateFolderL() Leave: %S - %d ***"),&roName,err);
83 // increment the index and reformat the identifier for the next filename
85 roIdentifier.Format(KScafConfigRoName, index);
88 return TestStepResult();