installationservices/swcomponentregistry/test/tscr/source/componentmanagementsteps.cpp
changeset 24 84a16765cd86
child 25 98b66e4fb0be
equal deleted inserted replaced
6:aba6b8104af3 24:84a16765cd86
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Implements the test steps for component management APIs in the SCR 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "componentmanagementsteps.h"
       
    21 #include "tscrdefs.h"
       
    22 #include <scs/cleanuputils.h>
       
    23 
       
    24 using namespace Usif;
       
    25 
       
    26 
       
    27 // -----------CScrAddComponentStep-----------------
       
    28 
       
    29 CScrAddComponentStep::CScrAddComponentStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
    30 	{
       
    31 	}
       
    32 
       
    33 void CScrAddComponentStep::ImplTestStepPreambleL()
       
    34 	{
       
    35 	CScrTestStep::ImplTestStepPreambleL();
       
    36 	}
       
    37 
       
    38 Usif::TComponentId CScrAddComponentStep::AddLocalisableComponentL()
       
    39 	{
       
    40 	RPointerArray<CLocalizableComponentInfo> componentInfo;
       
    41 	CleanupResetAndDestroyPushL(componentInfo);
       
    42 	GetLocalisedComponentsFromConfigL(componentInfo);
       
    43 	
       
    44 	TPtrC swTypeName;
       
    45 	GetSoftwareTypeNameL(swTypeName);
       
    46 	
       
    47 	TScrComponentOperationType operationType(EScrCompInstall);
       
    48 	TInt opTypeInt(0);
       
    49 	if(GetIntFromConfig(ConfigSection(), KOperationType, opTypeInt))
       
    50 		{
       
    51 		operationType = static_cast<TScrComponentOperationType>(opTypeInt);
       
    52 		}
       
    53 		
       
    54 	TComponentId componentId;
       
    55 	TPtrC globalIdName;
       
    56 	if(GetGlobalIdNameL(globalIdName))
       
    57 		componentId = iScrSession.AddComponentL(componentInfo, swTypeName, &globalIdName,operationType);
       
    58 	else
       
    59 		componentId = iScrSession.AddComponentL(componentInfo, swTypeName,NULL,operationType);
       
    60 	
       
    61 	CleanupStack::PopAndDestroy(&componentInfo);
       
    62 	return componentId;
       
    63 	}
       
    64 
       
    65 void CScrAddComponentStep::ImplTestStepL()
       
    66 	{		
       
    67 	TBool isLocalisable(EFalse);
       
    68 	GetBoolFromConfig(ConfigSection(), _L("IsLocalisable"), isLocalisable);
       
    69 	TComponentId componentId(0);
       
    70 	
       
    71 	if (isLocalisable)
       
    72 		componentId = AddLocalisableComponentL();
       
    73 	else
       
    74 		componentId = AddNonLocalisableComponentL();
       
    75 	
       
    76 	TPtrC version;
       
    77 	if (GetStringFromConfig(ConfigSection(), KVersionName, version))
       
    78 		{
       
    79 		// Version param is provided. Set the version of the component.
       
    80 		iScrSession.SetComponentVersionL(componentId, version);
       
    81 		}
       
    82 			
       
    83 	AppendSharedComponentIdL(componentId);
       
    84 	}
       
    85 
       
    86 
       
    87 void CScrAddComponentStep::ImplTestStepPostambleL()
       
    88 	{
       
    89 	CScrTestStep::ImplTestStepPostambleL();
       
    90 	}
       
    91 
       
    92 // -----------CScrSetComponentPropertyStep-----------------
       
    93 
       
    94 CScrSetComponentPropertyStep::CScrSetComponentPropertyStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
    95 	{
       
    96 	}
       
    97 
       
    98 void CScrSetComponentPropertyStep::ImplTestStepPreambleL()
       
    99 	{
       
   100 	CScrTestStep::ImplTestStepPreambleL();
       
   101 	}
       
   102 
       
   103 void CScrSetComponentPropertyStep::ImplTestStepL()
       
   104 	{
       
   105 	TInt componentId = GetComponentIdL();
       
   106 
       
   107 	RPointerArray<CPropertyEntry> properties;
       
   108 	CleanupResetAndDestroyPushL(properties);
       
   109 	GetPropertiesFromConfigL(properties, ETrue); // ETrue means that the localizable properties are supported.
       
   110 	TInt count = properties.Count();
       
   111 	for(TInt i=0; i<count; ++i)
       
   112 		{
       
   113 		CPropertyEntry::TPropertyType propertyType = properties[i]->PropertyType();
       
   114 		switch(propertyType)
       
   115 			{
       
   116 			case CPropertyEntry::EBinaryProperty:
       
   117 				{
       
   118 				CBinaryPropertyEntry* binaryProperty = dynamic_cast<CBinaryPropertyEntry*>(properties[i]);
       
   119 				iScrSession.SetComponentPropertyL(componentId, binaryProperty->PropertyName(), binaryProperty->BinaryValue());
       
   120 				break;
       
   121 				}
       
   122 			case CPropertyEntry::ELocalizedProperty:
       
   123 				{
       
   124 				CLocalizablePropertyEntry *locProperty = static_cast<CLocalizablePropertyEntry*>(properties[i]);
       
   125 				iScrSession.SetComponentPropertyL(componentId, locProperty->PropertyName(), locProperty->StrValue(), locProperty->LocaleL());
       
   126 				break;
       
   127 				}
       
   128 			case CPropertyEntry::EIntProperty:
       
   129 				{
       
   130 				CIntPropertyEntry *intProperty = dynamic_cast<CIntPropertyEntry*>(properties[i]);
       
   131 				iScrSession.SetComponentPropertyL(componentId, intProperty->PropertyName(), intProperty->Int64Value());
       
   132 				}
       
   133 			}// switch
       
   134 		}// for
       
   135 	
       
   136 	CleanupStack::PopAndDestroy(&properties);
       
   137 	}
       
   138 
       
   139 void CScrSetComponentPropertyStep::ImplTestStepPostambleL()
       
   140 	{
       
   141 	CScrTestStep::ImplTestStepPostambleL();
       
   142 	}
       
   143 
       
   144 // -----------CScrRegisterFileStep-----------------
       
   145 
       
   146 CScrRegisterFileStep::CScrRegisterFileStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   147 	{
       
   148 	}
       
   149 
       
   150 void CScrRegisterFileStep::ImplTestStepPreambleL()
       
   151 	{
       
   152 	CScrTestStep::ImplTestStepPreambleL();
       
   153 	}
       
   154 
       
   155 void CScrRegisterFileStep::ImplTestStepL()
       
   156 	{
       
   157 	RPointerArray<HBufC> fileList;
       
   158 	CleanupResetAndDestroyPushL(fileList);
       
   159 	GetFileNameListFromConfigL(fileList);
       
   160 	
       
   161 	TInt componentId = GetComponentIdL();
       
   162 	
       
   163 	TInt fileCount = fileList.Count();
       
   164 	
       
   165 	for(TInt i=0; i<fileCount; ++i)
       
   166 		{
       
   167 		// Fetch the Boolean flag which would tell SCR that the registered file needn't affect the drive list used by the component. The flag is optional with default ETrue
       
   168 		_LIT(KConsiderDrivesPrefix, "ConsiderDrives");
       
   169 		TBuf<MAX_SCR_PARAM_LENGTH> considerDrivesParamName = KConsiderDrivesPrefix();
       
   170 		GenerateIndexedAttributeNameL(considerDrivesParamName, i);
       
   171 		TBool considerFileInDriveList(ETrue);
       
   172 		(void)GetBoolFromConfig(ConfigSection(), considerDrivesParamName, considerFileInDriveList);
       
   173 		
       
   174 		iScrSession.RegisterComponentFileL(componentId, *fileList[i], considerFileInDriveList);
       
   175 		}
       
   176 	CleanupStack::PopAndDestroy(&fileList);
       
   177 	}
       
   178 
       
   179 void CScrRegisterFileStep::ImplTestStepPostambleL()
       
   180 	{
       
   181 	CScrTestStep::ImplTestStepPostambleL();
       
   182 	}
       
   183 
       
   184 // -----------CScrAddFilePropertyStep-----------------
       
   185 CScrAddFilePropertyStep::CScrAddFilePropertyStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   186 	{
       
   187 	}
       
   188 
       
   189 void CScrAddFilePropertyStep::ImplTestStepPreambleL()
       
   190 	{
       
   191 	CScrTestStep::ImplTestStepPreambleL();
       
   192 	}
       
   193 
       
   194 void CScrAddFilePropertyStep::ImplTestStepL()
       
   195 	{
       
   196 	TInt componentId = GetComponentIdL();
       
   197 	
       
   198 	TPtrC fileName;
       
   199 	GetFileNameFromConfigL(fileName);	
       
   200 	
       
   201 	RPointerArray<CPropertyEntry> propertiesAdded;
       
   202 	CleanupResetAndDestroyPushL(propertiesAdded);
       
   203 	GetPropertiesFromConfigL(propertiesAdded);
       
   204 	
       
   205 	TInt count = propertiesAdded.Count();
       
   206 	for(TInt i=0; i<count; ++i)
       
   207 		{
       
   208 		CPropertyEntry::TPropertyType propertyType = propertiesAdded[i]->PropertyType();
       
   209 		switch(propertyType)
       
   210 			{
       
   211 			case CPropertyEntry::EBinaryProperty:
       
   212 				{
       
   213 				CBinaryPropertyEntry *binaryProperty = dynamic_cast<CBinaryPropertyEntry*>(propertiesAdded[i]);
       
   214 				iScrSession.SetFilePropertyL(componentId, fileName, binaryProperty->PropertyName(), binaryProperty->BinaryValue());
       
   215 				break;
       
   216 				}
       
   217 			case CPropertyEntry::EIntProperty:
       
   218 				{
       
   219 				CIntPropertyEntry *intProperty = dynamic_cast<CIntPropertyEntry*>(propertiesAdded[i]);
       
   220 				iScrSession.SetFilePropertyL(componentId, fileName, intProperty->PropertyName(), intProperty->IntValue());
       
   221 				break;
       
   222 				}
       
   223 			case CPropertyEntry::ELocalizedProperty:
       
   224 				{
       
   225 				PrintErrorL(_L("Localizable properties are not supported for files!"), KErrAbort);
       
   226 				}								
       
   227 			}// switch
       
   228 		}// for
       
   229 	
       
   230 	CleanupStack::PopAndDestroy(&propertiesAdded);
       
   231 	}
       
   232 
       
   233 void CScrAddFilePropertyStep::ImplTestStepPostambleL()
       
   234 	{
       
   235 	CScrTestStep::ImplTestStepPostambleL();
       
   236 	}
       
   237 
       
   238 // -----------CScrSetCommonPropertyStep-----------------
       
   239 CScrSetCommonPropertyStep::CScrSetCommonPropertyStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   240 	{
       
   241 	}
       
   242 
       
   243 void CScrSetCommonPropertyStep::ImplTestStepPreambleL()
       
   244 	{
       
   245 	CScrTestStep::ImplTestStepPreambleL();
       
   246 	}
       
   247 
       
   248 void CScrSetCommonPropertyStep::ImplTestStepL()
       
   249 	{
       
   250 	TInt componentId = GetComponentIdL();
       
   251 	
       
   252 	TPtrC version;
       
   253 	if(!GetStringFromConfig(ConfigSection(), KVersionName, version))
       
   254 		PrintErrorL(_L("Version was not found!"), KErrNotFound);
       
   255 
       
   256 	TBool isRemovable;
       
   257 	if(!GetBoolFromConfig(ConfigSection(), KRemovableName, isRemovable))
       
   258 		PrintErrorL(_L("Removable was not found!"), KErrNotFound);
       
   259 
       
   260 	TBool isDrmProtected;
       
   261 	if(!GetBoolFromConfig(ConfigSection(), KDrmProtectedName, isDrmProtected))
       
   262 		PrintErrorL(_L("DrmProtected flag was not found!"), KErrNotFound);
       
   263 
       
   264 	TBool isHidden;
       
   265 	if(!GetBoolFromConfig(ConfigSection(), KHiddenName, isHidden))
       
   266 		PrintErrorL(_L("Hidden flag was not found!"), KErrNotFound);
       
   267 
       
   268 	TBool isKnownRevoked;
       
   269 	if(!GetBoolFromConfig(ConfigSection(), KKnownRevokedName, isKnownRevoked))
       
   270 		PrintErrorL(_L("KnownRevoked flag was not found!"), KErrNotFound);
       
   271 
       
   272 	TBool isOriginVerified;
       
   273 	if(!GetBoolFromConfig(ConfigSection(), KOriginVerifiedName, isOriginVerified))
       
   274 		PrintErrorL(_L("OriginVerified flag was not found!"), KErrNotFound);
       
   275 
       
   276 	TInt64 componentSize(0);
       
   277 	if(!Get64BitIntegerFromConfigL(KComponentSizeName(), componentSize))
       
   278 		PrintErrorL(_L("ComponentSize was not found!"), KErrNotFound);
       
   279 	
       
   280 	TLanguage locale(ELangNone);
       
   281 	if(!GetLocaleFromConfigL(locale))
       
   282 		PrintErrorL(_L("Locale was not found!"), KErrNotFound);
       
   283 	
       
   284 	TPtrC componentName;
       
   285 	GetComponentNameFromConfigL(componentName);
       
   286 
       
   287 	TPtrC vendorName;
       
   288 	GetVendorNameFromConfigL(vendorName);
       
   289 
       
   290 	StartTimer();
       
   291     iScrSession.SetComponentVersionL(componentId, version);
       
   292     iScrSession.SetIsComponentRemovableL(componentId, isRemovable);
       
   293     iScrSession.SetIsComponentDrmProtectedL(componentId, isDrmProtected);
       
   294     iScrSession.SetIsComponentHiddenL(componentId, isHidden);
       
   295     iScrSession.SetIsComponentKnownRevokedL(componentId, isKnownRevoked);
       
   296     iScrSession.SetIsComponentOriginVerifiedL(componentId, isOriginVerified);
       
   297     iScrSession.SetComponentSizeL(componentId, componentSize);
       
   298     iScrSession.SetComponentNameL(componentId, componentName, locale);
       
   299     iScrSession.SetVendorNameL(componentId, vendorName, locale);	
       
   300 	
       
   301 	}
       
   302 
       
   303 void CScrSetCommonPropertyStep::ImplTestStepPostambleL()
       
   304 	{
       
   305 	CScrTestStep::ImplTestStepPostambleL();
       
   306 	}
       
   307 
       
   308 // -----------CScrDeleteComponentPropertyStep-----------------
       
   309 CScrDeleteComponentPropertyStep::CScrDeleteComponentPropertyStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   310 	{
       
   311 	}
       
   312 
       
   313 void CScrDeleteComponentPropertyStep::ImplTestStepPreambleL()
       
   314 	{
       
   315 	CScrTestStep::ImplTestStepPreambleL();
       
   316 	}
       
   317 
       
   318 void CScrDeleteComponentPropertyStep::ImplTestStepL()
       
   319 	{
       
   320 	TInt componentId = GetComponentIdL();		
       
   321 	RPointerArray<CPropertyEntry> propertiesToBeDeleted;
       
   322 	CleanupResetAndDestroyPushL(propertiesToBeDeleted);
       
   323 	GetPropertiesFromConfigL(propertiesToBeDeleted);
       
   324 	
       
   325 	TInt propCount = propertiesToBeDeleted.Count();
       
   326 	for(TInt i=0; i<propCount; ++i)
       
   327 		{
       
   328 		iScrSession.DeleteComponentPropertyL(componentId, propertiesToBeDeleted[i]->PropertyName());
       
   329 		}
       
   330 	CleanupStack::PopAndDestroy(&propertiesToBeDeleted);
       
   331 	}
       
   332 
       
   333 void CScrDeleteComponentPropertyStep::ImplTestStepPostambleL()
       
   334 	{
       
   335 	CScrTestStep::ImplTestStepPostambleL();
       
   336 	}
       
   337 
       
   338 // -----------CScrDeleteFilePropertyStep-----------------
       
   339 CScrDeleteFilePropertyStep::CScrDeleteFilePropertyStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   340 	{
       
   341 	}
       
   342 
       
   343 void CScrDeleteFilePropertyStep::ImplTestStepPreambleL()
       
   344 	{
       
   345 	CScrTestStep::ImplTestStepPreambleL();
       
   346 	}
       
   347 
       
   348 void CScrDeleteFilePropertyStep::ImplTestStepL()
       
   349 	{
       
   350 	TInt componentId = GetComponentIdL();
       
   351 
       
   352 	TPtrC propertyName;
       
   353 	if (!GetStringFromConfig(ConfigSection(), KPropertyNameParam, propertyName))
       
   354 		PrintErrorL(_L("Property was not found!"), KErrNotFound);	
       
   355 	
       
   356 	TPtrC fileName;
       
   357 	GetFileNameFromConfigL(fileName);			
       
   358 
       
   359 	iScrSession.DeleteFilePropertyL(componentId, fileName, propertyName);
       
   360 	}
       
   361 
       
   362 void CScrDeleteFilePropertyStep::ImplTestStepPostambleL()
       
   363 	{
       
   364 	CScrTestStep::ImplTestStepPostambleL();
       
   365 	}
       
   366 
       
   367 // -----------CScrUnregisterFileStep-----------------
       
   368 CScrUnregisterFileStep::CScrUnregisterFileStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   369 	{
       
   370 	}
       
   371 
       
   372 void CScrUnregisterFileStep::ImplTestStepPreambleL()
       
   373 	{
       
   374 	CScrTestStep::ImplTestStepPreambleL();
       
   375 	}
       
   376 
       
   377 void CScrUnregisterFileStep::ImplTestStepL()
       
   378 	{
       
   379 	TInt componentId = GetComponentIdL();
       
   380 	
       
   381 	TPtrC fileName;
       
   382 	GetFileNameFromConfigL(fileName);			
       
   383 
       
   384 	iScrSession.UnregisterComponentFileL(componentId, fileName);
       
   385 	}
       
   386 
       
   387 void CScrUnregisterFileStep::ImplTestStepPostambleL()
       
   388 	{
       
   389 	CScrTestStep::ImplTestStepPostambleL();
       
   390 	}
       
   391 
       
   392 // -----------CScrDeleteComponentStep-----------------
       
   393 CScrDeleteComponentStep::CScrDeleteComponentStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   394 	{
       
   395 	}
       
   396 
       
   397 void CScrDeleteComponentStep::ImplTestStepPreambleL()
       
   398 	{
       
   399 	CScrTestStep::ImplTestStepPreambleL();
       
   400 	}
       
   401 
       
   402 void CScrDeleteComponentStep::ImplTestStepL()
       
   403 	{
       
   404 	TInt componentId = GetComponentIdL();
       
   405 	iScrSession.DeleteComponentL(componentId);
       
   406 	}
       
   407 
       
   408 void CScrDeleteComponentStep::ImplTestStepPostambleL()
       
   409 	{
       
   410 	CScrTestStep::ImplTestStepPostambleL();
       
   411 	}
       
   412 
       
   413 // -----------CScrDeleteAllComponentsStep-----------------
       
   414 CScrDeleteAllComponentsStep::CScrDeleteAllComponentsStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   415 	{
       
   416 	}
       
   417 
       
   418 void CScrDeleteAllComponentsStep::ImplTestStepPreambleL()
       
   419 	{
       
   420 	CScrTestStep::ImplTestStepPreambleL();
       
   421 	}
       
   422 
       
   423 void CScrDeleteAllComponentsStep::ImplTestStepL()
       
   424 	{
       
   425 	RArray<TInt> componentList;
       
   426 	CleanupClosePushL(componentList);
       
   427 	ReadAllSharedComponentIdsL(componentList);
       
   428 	
       
   429 	TInt componentCount = componentList.Count();
       
   430 	for(TInt i=0; i<componentCount; ++i)
       
   431 		{
       
   432 		TRAPD(err,iScrSession.DeleteComponentL(componentList[i]));
       
   433 		if(KErrNone == err)
       
   434 			{
       
   435 			INFO_PRINTF2(_L("Component Id %d has been deleted."), componentList[i]);
       
   436 			}
       
   437 		else if(KErrNotFound == err)
       
   438 			{ // Since some components might have been deleted in the previous test cases, ignore this error.
       
   439 			INFO_PRINTF2(_L("Component Id %d has already been deleted."), componentList[i]);
       
   440 			}
       
   441 		else
       
   442 			{
       
   443 			ERR_PRINTF3(_L("Component Id %d couldn't be deleted. Error Number:%d"),componentList[i],err);
       
   444 			SetTestStepResult(EFail);
       
   445 			}
       
   446 		};
       
   447 	CleanupStack::PopAndDestroy(&componentList);
       
   448 	
       
   449 	TBuf<MAX_SCR_BUFFER_LENGTH> componentIdBuf = KNullDesC();
       
   450 	WriteSharedDataL(KComponentIdName, componentIdBuf, ESetText);
       
   451 	}
       
   452 
       
   453 void CScrDeleteAllComponentsStep::ImplTestStepPostambleL()
       
   454 	{
       
   455 	CScrTestStep::ImplTestStepPostambleL();
       
   456 	}
       
   457 
       
   458 // -----------CScrInstallComponentStep-----------------
       
   459 
       
   460 CScrInstallComponentStep::CScrInstallComponentStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   461 	{
       
   462 	}
       
   463 
       
   464 void CScrInstallComponentStep::ImplTestStepPreambleL()
       
   465 	{
       
   466 	CScrTestStep::ImplTestStepPreambleL();
       
   467 	}
       
   468 
       
   469 void CScrInstallComponentStep::ImplTestStepL()
       
   470 	{
       
   471 	// BEGIN transaction
       
   472 	iScrSession.CreateTransactionL();
       
   473 	
       
   474 	// Add component record with localizable names
       
   475 	RPointerArray<CLocalizableComponentInfo> localNames;
       
   476 	CleanupResetAndDestroyPushL(localNames);
       
   477 	CLocalizableComponentInfo *localName1 = CLocalizableComponentInfo::NewLC(_L("name1"), _L("vendor1"),ELangEnglish);
       
   478 	localNames.AppendL(localName1);
       
   479 	CleanupStack::Pop(localName1);
       
   480 	CLocalizableComponentInfo *localName2 = CLocalizableComponentInfo::NewLC(_L("name2"), _L("vendor2"),ELangAmerican);
       
   481 	localNames.AppendL(localName2);
       
   482 	CleanupStack::Pop(localName2);
       
   483 	TComponentId compId = iScrSession.AddComponentL(localNames, _L("plain"));
       
   484 	CleanupStack::PopAndDestroy(&localNames);
       
   485 	
       
   486 	// Set common component attributes
       
   487 	iScrSession.SetComponentVersionL(compId, _L("2.1.3"));
       
   488 	iScrSession.SetComponentSizeL(compId, 2346);
       
   489 	iScrSession.SetIsComponentRemovableL(compId, EFalse);
       
   490 	
       
   491 	// Set custom component attributes
       
   492 	TBuf<10> propName;
       
   493 	for(TInt i=0; i<27; ++i)
       
   494 		{
       
   495 		propName.Copy(_L("intprop"));
       
   496 		propName.AppendNum(i);
       
   497 		iScrSession.SetComponentPropertyL(compId, propName, i);
       
   498 		}
       
   499 	for(TInt i=0; i<6; ++i)
       
   500 		{
       
   501 		propName.Copy(_L("strprop"));
       
   502 		propName.AppendNum(i);
       
   503 		iScrSession.SetComponentPropertyL(compId, propName, propName);
       
   504 		}
       
   505 	
       
   506 	// Register files
       
   507 	TBuf<50> fileName;
       
   508 	for(TInt i=0; i<10; ++i)
       
   509 		{
       
   510 		fileName.Copy(_L("c:\\file"));
       
   511 		fileName.AppendNum(i);
       
   512 		fileName.Append(_L(".txt"));
       
   513 		iScrSession.RegisterComponentFileL(compId, fileName);
       
   514 		}
       
   515 	
       
   516 	// Set file properties
       
   517 	for(TInt i=0; i<6; ++i)
       
   518 		{
       
   519 		propName.Copy(_L("fintprop"));
       
   520 		propName.AppendNum(i);
       
   521 		iScrSession.SetFilePropertyL(compId, fileName, propName, i);
       
   522 		}
       
   523 	TBuf8<50> propValue;
       
   524 	for(TInt i=0; i<3; ++i)
       
   525 		{
       
   526 		propName.Copy(_L("fstrprop"));
       
   527 		propName.AppendNum(i);
       
   528 		propValue.Copy(_L8("propValue"));
       
   529 		propValue.AppendNum(i);
       
   530 		iScrSession.SetFilePropertyL(compId, fileName, propName, propValue);
       
   531 		}
       
   532 		
       
   533 	// Commit transaction
       
   534 	iScrSession.CommitTransactionL();
       
   535 	}
       
   536 	
       
   537 void CScrInstallComponentStep::ImplTestStepPostambleL()
       
   538 	{
       
   539 	CScrTestStep::ImplTestStepPostambleL();
       
   540 	}
       
   541 
       
   542 // -----------CScrAddComponentDependencyStep-----------------
       
   543 
       
   544 CScrAddComponentDependencyStep::CScrAddComponentDependencyStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   545 	{
       
   546 	}
       
   547 
       
   548 void CScrAddComponentDependencyStep::ImplTestStepPreambleL()
       
   549 	{
       
   550 	CScrTestStep::ImplTestStepPreambleL();
       
   551 	}
       
   552 
       
   553 void CScrAddComponentDependencyStep::ImplTestStepL()
       
   554 	{		
       
   555 	CGlobalComponentId *supplierGlobalId  = GetGlobalComponentIdLC(KSupplierGlobalIdName(), KSupplierSwTypeName());
       
   556 	
       
   557 	HBufC *versionFrom = GetVersionFromConfigL(KVersionFrom);
       
   558 	if(versionFrom)
       
   559 		CleanupStack::PushL(versionFrom);
       
   560 	HBufC *versionTo = GetVersionFromConfigL(KVersionTo);
       
   561 	if(versionTo)
       
   562 		CleanupStack::PushL(versionTo);
       
   563 	CVersionedComponentId *supplierVersionedId = CVersionedComponentId::NewL(*supplierGlobalId, versionFrom, versionTo);
       
   564 	if(versionTo)
       
   565 		CleanupStack::PopAndDestroy(versionTo);
       
   566 	if(versionFrom)
       
   567 		CleanupStack::PopAndDestroy(versionFrom);
       
   568 	CleanupStack::PopAndDestroy(supplierGlobalId);
       
   569 	CleanupStack::PushL(supplierVersionedId);
       
   570 	
       
   571 	CGlobalComponentId *dependantGlobalId = GetGlobalComponentIdLC(KDependantGlobalIdName(), KDependantSwTypeName());
       
   572 	iScrSession.AddComponentDependencyL(*supplierVersionedId, *dependantGlobalId);
       
   573 	CleanupStack::PopAndDestroy(2, supplierVersionedId); // supplierVersionedId, dependantGlobalId
       
   574 	}
       
   575 
       
   576 
       
   577 void CScrAddComponentDependencyStep::ImplTestStepPostambleL()
       
   578 	{
       
   579 	CScrTestStep::ImplTestStepPostambleL();
       
   580 	}
       
   581 
       
   582 // -----------CScrDeleteComponentDependencyStep-----------------
       
   583 
       
   584 CScrDeleteComponentDependencyStep::CScrDeleteComponentDependencyStep(CScrTestServer& aParent)	: CScrTestStep(aParent)
       
   585 	{
       
   586 	}
       
   587 
       
   588 void CScrDeleteComponentDependencyStep::ImplTestStepPreambleL()
       
   589 	{
       
   590 	CScrTestStep::ImplTestStepPreambleL();
       
   591 	}
       
   592 
       
   593 void CScrDeleteComponentDependencyStep::ImplTestStepL()
       
   594 	{		
       
   595 	CGlobalComponentId *supplierGlobalId  = GetGlobalComponentIdLC(KSupplierGlobalIdName(), KSupplierSwTypeName());
       
   596 	CGlobalComponentId *dependantGlobalId = GetGlobalComponentIdLC(KDependantGlobalIdName(), KDependantSwTypeName());
       
   597 	iScrSession.DeleteComponentDependencyL(*supplierGlobalId, *dependantGlobalId);
       
   598 	CleanupStack::PopAndDestroy(2, supplierGlobalId); // supplierGlobalId, dependantGlobalId
       
   599 	}
       
   600 
       
   601 
       
   602 void CScrDeleteComponentDependencyStep::ImplTestStepPostambleL()
       
   603 	{
       
   604 	CScrTestStep::ImplTestStepPostambleL();
       
   605 	}