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