applicationmanagement/tsrc/tarmappmng/src/dmatest.cpp
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 "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: Implementation of applicationmanagement components
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "dmatest.h"
       
    22 
       
    23 #include <StifParser.h>
       
    24 #include <Stiftestinterface.h>
       
    25 #include <S32FILE.H>
       
    26 
       
    27 #include <s32mem.h>
       
    28 #include <apgcli.h>
       
    29 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
    30 	#include "nsmldmtreedtd.h"
       
    31 #else
       
    32 	//nothing
       
    33 #endif
       
    34 //#include "nsmldmtreedtd.h"
       
    35 #include "TestDmDDFObject.h"
       
    36 
       
    37 
       
    38 #include <e32svr.h>
       
    39 #include "applicationmanagementclient.h"
       
    40 #include <e32math.h>
       
    41 #include <f32file.h>
       
    42 #include <swinstapi.h>
       
    43 
       
    44 using namespace NApplicationManagement;
       
    45 
       
    46 _LIT8( KEmptyType, "" );
       
    47 _LIT8( KDefaultType, "text/plain" );
       
    48 _LIT( KMappingTableFile, "c:\\TestFramework\\dmtestmappings.txt" );
       
    49 //_LIT8( KNSmlDMSeparator8, "/" );
       
    50 
       
    51 //Newly added
       
    52 _LIT8( KAMInstallOptsNodeName, "InstallOpts" );
       
    53 _LIT8( KAMDataNodeName, "Data" );
       
    54 //Newly ended
       
    55 const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash
       
    56 
       
    57 #define LEAVE_IF_ERROR(x,msg) \
       
    58 	{ TInt __xres = (x); if ( __xres < 0 ) { if ( iLog ) iLog->Log( (msg), __xres ); User::Leave( __xres );	} }
       
    59 
       
    60 
       
    61 // ============================ MEMBER FUNCTIONS ===============================
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // Cdmatest::Cdmatest
       
    65 // C++ default constructor can NOT contain any code, that
       
    66 // leave.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 Cdmatest::Cdmatest(CTestModuleIf& aTestModuleIf, TUid aUid ):
       
    70         CScriptBase( aTestModuleIf ), iMappingTable(2), iUid( aUid )
       
    71     {
       
    72     
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // Cdmatest::ConstructL
       
    77 // Symbian 2nd phase constructor can leave.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 void Cdmatest::ConstructL()
       
    81     {
       
    82     
       
    83     
       
    84     Adapter();
       
    85   	iEmptyMappingInfoArray = new ( ELeave ) CArrayFixFlat<TSmlDmMappingInfo>(1);
       
    86 	
       
    87 	TRAPD( err, LoadMappingsL() );
       
    88 	if (err != KErrEof && err != KErrNone && err != KErrNotFound)
       
    89 		{
       
    90 		User::Leave( err );
       
    91 		}
       
    92     }
       
    93     
       
    94 CSmlDmAdapter *Cdmatest::Adapter() 
       
    95 	{
       
    96 	if ( iAdapter == NULL )
       
    97 		{
       
    98 		if ( iLog )
       
    99 			{
       
   100 			iLog->Log( _L( "Loading Adapter" ) );
       
   101 			}
       
   102   			
       
   103   		TRAPD( err, iAdapter = CSmlDmAdapter::NewL( iUid, *this ) );
       
   104 	if ( err == KErrNone )
       
   105 		{
       
   106 		if (iLog )
       
   107 			{
       
   108 			iLog->Log( _L( "Loaded" ) );	
       
   109 			}
       
   110 		}
       
   111 	else
       
   112 		{
       
   113 		if (iLog)
       
   114 			{
       
   115 			iLog->Log( _L( "Failed to load adapter: %d" ), err );
       
   116 			}
       
   117 	//	User::Leave( err ); 
       
   118 		iAdapter = NULL;
       
   119 		}
       
   120 		}
       
   121 	return iAdapter;
       
   122 	}
       
   123     
       
   124     
       
   125 void Cdmatest::LoadMappingsL()
       
   126 	{
       
   127 	TDataType type; 
       
   128 	HBufC8 *data = LoadFileLC( KMappingTableFile,  type );
       
   129 	RDesReadStream buf( *data );
       
   130 	CleanupClosePushL( buf );
       
   131 	//buf.Set( aChilds)
       
   132 	TInt len( data->Length() );
       
   133 	while (buf.Source()->TellL( MStreamBuf::ERead ).Offset() < len)
       
   134 		{
       
   135 		TUint32 val = buf.ReadUint32L();
       
   136 		TBuf8<256> uri;
       
   137 		TBuf8<64> luid;
       
   138 		buf.ReadL(uri, val);
       
   139 		val = buf.ReadUint32L();
       
   140 		buf.ReadL(luid, val);
       
   141 		TMapping m( uri, luid ) ;
       
   142 		TInt err( iMappingTable.Append( m )	);
       
   143 		if ( err == KErrNone )
       
   144 			{
       
   145 			iLog->Log( _L8( "Loaded mapping: '%S' : '%S'"), &m.iURI, &m.iLuid );
       
   146 			}
       
   147 		else
       
   148 			{
       
   149 			iLog->Log( _L8( "FAILED TO Load mapping: '%d' "), err );
       
   150 			}
       
   151 		}
       
   152 	CleanupStack::PopAndDestroy( &buf); // buf
       
   153 	CleanupStack::PopAndDestroy( data ); // data
       
   154 	}
       
   155 
       
   156 void Cdmatest::SaveMappingsL()
       
   157     {
       
   158 	TInt c( iMappingTable.Count() );
       
   159 	if ( c > 0 )
       
   160 	{
       
   161     	RFs fs;
       
   162     	User::LeaveIfError( fs.Connect() );
       
   163     	CleanupClosePushL( fs );
       
   164     	RFileWriteStream buf;
       
   165     	User::LeaveIfError( buf.Replace( fs, KMappingTableFile, EFileWrite ) );
       
   166     	CleanupClosePushL( buf );
       
   167 		
       
   168 		TInt i( 0 ) ;
       
   169 		do 
       
   170 			{
       
   171 			buf.WriteUint32L( iMappingTable[i].iURI.Length() );
       
   172 			buf.WriteL( iMappingTable[i].iURI );
       
   173 			buf.WriteUint32L( iMappingTable[i].iLuid.Length() );
       
   174 			buf.WriteL( iMappingTable[i].iLuid );
       
   175 			}
       
   176 		while ( ++i < c )	;
       
   177 		buf.CommitL();
       
   178 		buf.Close();
       
   179 	
       
   180 		CleanupStack::PopAndDestroy(); // buf
       
   181 		CleanupStack::PopAndDestroy(); // fs
       
   182 		}
       
   183     }
       
   184     	
       
   185    
       
   186 // Destructor
       
   187 Cdmatest::~Cdmatest()
       
   188     {
       
   189     // Delete resources allocated from test methods
       
   190     TRAPD(err, SaveMappingsL() );
       
   191     if ( err != KErrNone )
       
   192     	{
       
   193     		if(iLog)
       
   194     			iLog->Log( _L8( "Failed to save mappings!: %d"), err );
       
   195     	}
       
   196     Delete();
       
   197     
       
   198     // Delete logger
       
   199     delete iLog;  
       
   200     delete iEmptyMappingInfoArray;
       
   201     delete iAdapter;
       
   202     delete iURI;
       
   203     iMappingTable.Reset();
       
   204     REComSession::FinalClose();
       
   205     }
       
   206 
       
   207 
       
   208 // -----------------------------------------------------------------------------
       
   209 // Camatest::Delete
       
   210 // Delete here all resources allocated and opened from test methods. 
       
   211 // Called from destructor. 
       
   212 // -----------------------------------------------------------------------------
       
   213 //
       
   214 void Cdmatest::Delete() 
       
   215     {
       
   216     
       
   217     }
       
   218 
       
   219 // -----------------------------------------------------------------------------
       
   220 // Cdmatest::?member_function
       
   221 // ?implementation_description
       
   222 // (other items were commented in a header).
       
   223 // -----------------------------------------------------------------------------
       
   224 
       
   225 
       
   226         
       
   227 HBufC8 *Cdmatest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName )
       
   228 	{
       
   229 	TPtrC nodename( KNullDesC );
       
   230 
       
   231     TInt i( aItem.GetNextString ( nodename ) );
       
   232     if ( i != KErrNone ) 
       
   233 	    {
       
   234 	    iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i );
       
   235 	    }
       
   236 	else
       
   237 		{
       
   238 		iLog->Log( _L("%S: %S"), &aName, &nodename);
       
   239 		}
       
   240 	
       
   241 	HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ;
       
   242 	buf->Des().Copy( nodename );
       
   243 	return buf;
       
   244 	}
       
   245 	
       
   246 TInt Cdmatest::FetchNodeL( CStifItemParser& aItem )	
       
   247 	{
       
   248 
       
   249     TInt ret( KErrNone );
       
   250     // Print to UI
       
   251     TestModuleIf().Printf( 0, _L("Cdmatest"), _L("FetchNodeL") );
       
   252 
       
   253 	iResultsFunction = FetchNodeResultsL;
       
   254 	
       
   255     TPtrC8 nodename( GetNextStringLC( aItem, _L(" nodename" ) )->Des() ) ;
       
   256 //    TPtrC8 datafile( GetNextStringLC( aItem, _L("outputfile" )->Des() ) ;
       
   257 		
       
   258 	SetURIL(nodename) ;
       
   259 	HBufC8 *luid = GetLuidAllocLC( *iURI );
       
   260 	Adapter()->ChildURIListL( *iURI, *luid, *iEmptyMappingInfoArray, 4, 5) ;
       
   261 	if ( iStatus == MSmlDmAdapter::EOk )
       
   262 		{
       
   263 		}
       
   264 	else
       
   265 		{
       
   266 		iLog->Log( _L("FetchNodeL: ChildUriList Error ! %d" ), iStatus );	
       
   267 		ret = KErrGeneral ;
       
   268 		}
       
   269 	CleanupStack::PopAndDestroy( luid ) ; 
       
   270 	CleanupStack::PopAndDestroy() ; // nodename
       
   271 	iLog->Log( _L("FetchNodeL: Test Complete with status %d" ), ret );	
       
   272 
       
   273     return ret;
       
   274 	}
       
   275 	
       
   276 TInt Cdmatest::StartAtomicL( CStifItemParser& /*aItem*/ )	
       
   277 	{
       
   278 	TRAPD( err, Adapter()->StartAtomicL() ) ;
       
   279 	iLog->Log( _L("StartAtomicL: Atomic started resulting error %d" ), err );	
       
   280     return err;
       
   281 	}
       
   282 
       
   283 TInt Cdmatest::RollbackAtomicL( CStifItemParser& /*aItem*/ )	
       
   284 	{
       
   285 	TRAPD( err, Adapter()->RollbackAtomicL() ) ;
       
   286 	iLog->Log( _L("RollbackAtomicL: Atomic rolled back resulting error %d" ), err );	
       
   287     return err;
       
   288 	}
       
   289 	
       
   290 TInt Cdmatest::CommitAtomicL( CStifItemParser& /*aItem*/ )	
       
   291 	{
       
   292 	TRAPD( err, Adapter()->CommitAtomicL() ) ;
       
   293 	iLog->Log( _L("RollbackAtomicL: Atomic commited resulting error %d" ), err );	
       
   294     return err;
       
   295 	}
       
   296 	
       
   297 
       
   298 TInt Cdmatest::DDFStructureL( CStifItemParser& /*aItem*/ )	
       
   299 	{
       
   300 	CTestDmDDFObject* ddfRoot = CTestDmDDFObject::NewLC( iLog ); //, aNodeName );
       
   301 
       
   302 
       
   303 	TRAPD( err, iAdapter->DDFStructureL( *ddfRoot ) ) ;
       
   304 	CleanupStack::PopAndDestroy( ddfRoot );
       
   305 
       
   306 	iLog->Log( _L("DDFStructureL: method called resulting error %d" ), err );	
       
   307     return err;
       
   308 	}
       
   309 		
       
   310 		
       
   311 TInt Cdmatest::AddNodeL( CStifItemParser& aItem )	
       
   312 	{
       
   313 
       
   314     TInt ret( KErrNone );
       
   315     // Print to UI
       
   316     TestModuleIf().Printf( 0, _L("Cdmatest"), _L("AddNodeL") );
       
   317 
       
   318     
       
   319     TPtrC8 nodename( GetNextStringLC ( aItem, _L("nodename" ) )->Des() ) ;
       
   320     SetURIL( nodename );
       
   321 
       
   322 	Adapter()->AddNodeObjectL( *iURI, KEmptyType, 8 ) ;
       
   323 	if ( iStatus == MSmlDmAdapter::EOk )
       
   324 		{
       
   325 		iLog->Log( _L("AddNodeL: AddNodeObjectL Successful! %d" ), iStatus );	
       
   326 		}
       
   327 	else
       
   328 		{
       
   329 		iLog->Log( _L("AddNodeL: AddNodeObjectL Error ! %d" ), iStatus );	
       
   330 		ret = KErrGeneral ;
       
   331 		}
       
   332 		
       
   333 	CleanupStack::PopAndDestroy() ; // nodename
       
   334 	iLog->Log( _L("AddNodeL Test Complete with status %d" ), ret );	
       
   335 
       
   336     return ret;
       
   337 	}
       
   338 		
       
   339 TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem )	
       
   340 	{
       
   341 
       
   342     TInt ret( KErrNone );
       
   343     // Print to UI
       
   344     TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") );
       
   345 
       
   346     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ;
       
   347     TPtrC8 datafile (GetNextStringLC( aItem, _L("datafile"))->Des() );
       
   348     
       
   349 	HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ;
       
   350     //SetURIL( nodename );
       
   351     
       
   352     TPtrC8 last( LastURISeg( nodename ) );
       
   353  	HBufC8 *luid = GetLuidAllocLC( *iURI );
       
   354     
       
   355     TDataType type;
       
   356     TPtrC8 data;
       
   357     if ((last == KAMInstallOptsNodeName) ||(last == KAMDataNodeName))
       
   358     {
       
   359     	 
       
   360     HBufC8*	bufdata =  LoadFileLC( datafile, type );//->Des() ;
       
   361     data.Set(bufdata->Des());
       
   362     }
       
   363     
       
   364 	TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() );
       
   365 	if ((last == KAMInstallOptsNodeName) ||(last == KAMDataNodeName))
       
   366 	{
       
   367 		Adapter()->UpdateLeafObjectL( nodename , *luid, data, mimePtr, 3);
       
   368 	}
       
   369 	else
       
   370 	{
       
   371 		Adapter()->UpdateLeafObjectL( nodename , *luid, datafile, mimePtr, 3);	
       
   372 	}
       
   373 	
       
   374 	
       
   375 		if ( iStatus == MSmlDmAdapter::EOk )
       
   376 		{
       
   377 		iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus );	
       
   378 		}
       
   379 	else
       
   380 		{
       
   381 		iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus );	
       
   382 		ret = KErrGeneral ;
       
   383 		}
       
   384 	if ((last == KAMInstallOptsNodeName) ||(last == KAMDataNodeName))
       
   385 	{
       
   386 		CleanupStack::PopAndDestroy(); // loadfile	
       
   387 	}
       
   388 	CleanupStack::PopAndDestroy(); // luid
       
   389 	CleanupStack::PopAndDestroy(); // mime
       
   390 	CleanupStack::PopAndDestroy(); // datafile
       
   391 	CleanupStack::PopAndDestroy(); // nodename
       
   392 	iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret );	
       
   393 
       
   394     return ret;
       
   395 	}
       
   396 /*		
       
   397 TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem )	
       
   398 	{
       
   399 
       
   400     TInt ret( KErrNone );
       
   401     // Print to UI
       
   402     TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") );
       
   403 
       
   404     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ;
       
   405     TPtrC8 datafile (GetNextStringLC( aItem, _L("datafile"))->Des() );
       
   406     
       
   407 	HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ;
       
   408     SetURIL( nodename );
       
   409     
       
   410     
       
   411  	HBufC8 *luid = GetLuidAllocLC( *iURI );
       
   412     
       
   413     TDataType type; 
       
   414     TPtrC8 data( LoadFileLC( datafile, type )->Des() );
       
   415 	TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() );
       
   416 
       
   417 	Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3);
       
   418 		if ( iStatus == MSmlDmAdapter::EOk )
       
   419 		{
       
   420 		iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus );	
       
   421 		}
       
   422 	else
       
   423 		{
       
   424 		iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus );	
       
   425 		ret = KErrGeneral ;
       
   426 		}
       
   427 	CleanupStack::PopAndDestroy(); // loadfile
       
   428 	CleanupStack::PopAndDestroy(); // luid
       
   429 	CleanupStack::PopAndDestroy(); // mime
       
   430 	CleanupStack::PopAndDestroy(); // datafile
       
   431 	CleanupStack::PopAndDestroy(); // nodename
       
   432 	iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret );	
       
   433 
       
   434     return ret;
       
   435 	}	
       
   436 	
       
   437 */
       
   438 TInt Cdmatest::UpdateLeafDataURLL( CStifItemParser& aItem )	
       
   439 	{
       
   440 
       
   441     TInt ret( KErrNone );
       
   442     // Print to UI
       
   443     TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafDataL") );
       
   444 
       
   445     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ;
       
   446     TPtrC8 http (GetNextStringLC( aItem, _L("http"))->Des() );
       
   447     TPtrC8 url (GetNextStringLC( aItem, _L("rest of url"))->Des() );
       
   448 	HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ;
       
   449     SetURIL( nodename );
       
   450     
       
   451     _LIT8( KTag, "://" );
       
   452     
       
   453     HBufC8 *fullurl = HBufC8::NewLC( http.Length() + KTag().Length() + url.Length() );
       
   454     TPtr8 pfullurl( fullurl->Des() );
       
   455     pfullurl.Copy( http ) ;
       
   456     pfullurl.Append( KTag );
       
   457     pfullurl.Append( url );
       
   458     TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() );
       
   459     
       
   460     TPtrC8 parentURI(RemoveLastSeg(nodename));
       
   461     HBufC8 *luid = GetLuidAllocLC( parentURI );
       
   462 
       
   463 	Adapter()->UpdateLeafObjectL( *iURI , *luid, pfullurl, mimePtr, 3);
       
   464 	if ( iStatus == MSmlDmAdapter::EOk )
       
   465 		{
       
   466 		iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus );	
       
   467 		}
       
   468 	else
       
   469 		{
       
   470 		iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus );	
       
   471 		ret = KErrGeneral ;
       
   472 		}
       
   473 	CleanupStack::PopAndDestroy( luid ); // 
       
   474 	CleanupStack::PopAndDestroy( mime ); // mime
       
   475 	CleanupStack::PopAndDestroy(); // url
       
   476 	CleanupStack::PopAndDestroy(); // http
       
   477 	CleanupStack::PopAndDestroy(); // nodename
       
   478 	iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret );	
       
   479 
       
   480     return ret;
       
   481 	}
       
   482     
       
   483 TInt Cdmatest::UpdateLeafDataL( CStifItemParser& aItem )	
       
   484 	{
       
   485 
       
   486     TInt ret( KErrNone );
       
   487     // Print to UI
       
   488    TestModuleIf().Printf( 0, _L("Camtest"), _L("UpdateLeafDataL") );
       
   489 
       
   490     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ;
       
   491     TPtrC8 data (GetNextStringLC( aItem, _L("data"))->Des() );
       
   492 
       
   493 	HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ;
       
   494 	
       
   495     SetURIL( nodename );
       
   496     
       
   497         
       
   498     TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() );
       
   499     
       
   500      
       
   501     HBufC8 *luid = GetLuidAllocLC( *iURI );
       
   502 //    
       
   503 //    virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
       
   504 //									const TDesC8& aObject, const TDesC8& aType,
       
   505 //									TInt aStatusRef ) = 0;
       
   506 //   
       
   507 	Adapter()->UpdateLeafObjectL( *iURI, *luid, data, mimePtr, 3);
       
   508 	if ( iStatus == MSmlDmAdapter::EOk )
       
   509 		{
       
   510 		iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus );	
       
   511 		}
       
   512 	else
       
   513 		{
       
   514 		iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus );	
       
   515 		ret = KErrGeneral ;
       
   516 		}
       
   517 	
       
   518 	CleanupStack::PopAndDestroy(); // mime
       
   519 	CleanupStack::PopAndDestroy(); // luid
       
   520 	CleanupStack::PopAndDestroy(); // data
       
   521 	CleanupStack::PopAndDestroy(); // nodename
       
   522 	iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret );	
       
   523 
       
   524     return ret;
       
   525 	}	
       
   526 			
       
   527 TInt Cdmatest::FetchLeafL( CStifItemParser& aItem )	
       
   528 	{
       
   529 
       
   530     TInt ret( KErrNone );
       
   531     // Print to UI
       
   532     TestModuleIf().Printf( 0, _L("Camtest"), _L("FetchLeafL") );
       
   533 
       
   534 	iResultsFunction = NULL;
       
   535 	
       
   536     TInt i( 0 );
       
   537     TPtrC8 nodename ( GetNextStringLC( aItem, _L( "nodename" ) )->Des() ) ;
       
   538     
       
   539     //TPtrC datafile;
       
   540     TPtrC datafile( KNullDesC );
       
   541     i = aItem.GetNextString ( datafile ) ;
       
   542     if ( i != KErrNone ) 
       
   543 	    {
       
   544 	    iLog->Log(_L("FetchLeafL: ERROR Reading outfile argument: 0x%X"), i );
       
   545 	    //return i;
       
   546 	    }
       
   547 	else
       
   548 		{
       
   549 		iSaveFileName = datafile;
       
   550 		iLog->Log( _L( " Save file nameis '%S'" ), &iSaveFileName );
       
   551 		iResultsFunction = SaveDataL;
       
   552 		}
       
   553     
       
   554 	SetURIL(nodename) ;
       
   555 		
       
   556 		/*
       
   557 			void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
       
   558 								   const TDesC8& aType, TInt aResultsRef,
       
   559 								   TInt aStatusRef );
       
   560 		*/
       
   561 
       
   562 	HBufC8 *luid = GetLuidAllocLC( *iURI );
       
   563 	Adapter()->FetchLeafObjectL( *iURI, *luid, KEmptyType, 7, 8 ) ;
       
   564 	if ( iStatus == MSmlDmAdapter::EOk )
       
   565 		{
       
   566 		iLog->Log( _L("FetchLeafL: FetchLeafObjectL Successful! %d" ), iStatus );	
       
   567 		}
       
   568 	else
       
   569 		{
       
   570 		iLog->Log( _L("FetchLeafL: FetchLeafObjectL Error ! %d" ), iStatus );	
       
   571 		ret = KErrGeneral ;
       
   572 		}
       
   573 	CleanupStack::PopAndDestroy( luid );
       
   574 	CleanupStack::PopAndDestroy(  ); // nodename
       
   575 	iLog->Log( _L("FetchLeafL Test Complete with status %d" ), ret );	
       
   576     return ret;
       
   577 	}	
       
   578 
       
   579 
       
   580 TInt Cdmatest::ExecuteLeafL( CStifItemParser& aItem )		
       
   581 	{
       
   582 	TInt ret( KErrNone );
       
   583     // Print to UI
       
   584     TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") );
       
   585 
       
   586 	iResultsFunction = NULL;
       
   587 	
       
   588     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ;
       
   589     TPtrC8 datafile( GetNextStringLC ( aItem, _L("Input file") )->Des() ) ;
       
   590 	
       
   591 	SetURIL(nodename) ;
       
   592 
       
   593 		/*
       
   594 			virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
       
   595 							      const TDesC8& aArgument, const TDesC8& aType,
       
   596 								  TInt aStatusRef ) = 0;
       
   597 		*/
       
   598 	TDataType type;
       
   599 	TPtrC8 data( LoadFileLC( datafile, type )->Des() );
       
   600 	
       
   601     TPtrC8 parentURI(RemoveLastSeg(nodename));
       
   602     HBufC8 *luid = GetLuidAllocLC( parentURI );
       
   603 
       
   604 	Adapter()->ExecuteCommandL( *iURI, data, data, KEmptyType, 11 ) ;
       
   605 	if ( iStatus == MSmlDmAdapter::EOk )
       
   606 		{
       
   607 		iLog->Log( _L("ExecuteLeafL: ExecuteCommandL Successful! %d" ), iStatus );	
       
   608 		}
       
   609 	else
       
   610 		{
       
   611 		iLog->Log( _L("ExecuteLeafL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus );	
       
   612 		ret = KErrGeneral ;
       
   613 		}
       
   614 	CleanupStack::PopAndDestroy( luid ); // luid
       
   615 	CleanupStack::PopAndDestroy(); // data
       
   616 	CleanupStack::PopAndDestroy(); // datafile
       
   617 	CleanupStack::PopAndDestroy(); // nodename
       
   618 	
       
   619 	iLog->Log( _L("ExecuteLeafL: Test Complete with status %d" ), ret );	
       
   620 
       
   621     return ret;
       
   622 	}
       
   623 	
       
   624 TInt Cdmatest::CompleteCommandsL( CStifItemParser& /*aItem*/ )
       
   625 	{
       
   626 	TRAPD( err, Adapter()->CompleteOutstandingCmdsL() );
       
   627 	delete iAdapter;
       
   628 	iAdapter = NULL;
       
   629 	return err;
       
   630 	}
       
   631 TInt Cdmatest::DeleteObjectL( CStifItemParser& aItem )
       
   632 {
       
   633 	TInt ret( KErrNone );
       
   634     // Print to UI
       
   635     TestModuleIf().Printf( 0, _L("Camtest"), _L("DeleteObjectL") );
       
   636 
       
   637     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ;
       
   638 
       
   639 	SetURIL(nodename) ;
       
   640 
       
   641 	HBufC8 *luid = GetLuidAllocLC( *iURI );
       
   642 	Adapter()->DeleteObjectL( *iURI, *luid, 11 ) ;
       
   643 	if ( iStatus == MSmlDmAdapter::EOk )
       
   644 		{
       
   645 		iLog->Log( _L("DeleteObjectL: DeleteObjectL Successful! %d" ), iStatus );	
       
   646 		}
       
   647 	else
       
   648 		{
       
   649 		iLog->Log( _L("DeleteObjectL: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus );	
       
   650 		ret = KErrGeneral ;
       
   651 		}
       
   652 	CleanupStack::PopAndDestroy( luid ); // luid
       
   653 	CleanupStack::PopAndDestroy(); // nodename	
       
   654 	iLog->Log( _L("DeleteObjectL Test Complete with status %d" ), ret );	
       
   655 
       
   656     return ret;	
       
   657 }
       
   658 	
       
   659 TInt Cdmatest::ExecuteLeafDataL( CStifItemParser& aItem )		
       
   660 	{
       
   661 	TInt ret( KErrNone );
       
   662     // Print to UI
       
   663     TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") );
       
   664 
       
   665 	iResultsFunction = NULL;
       
   666 	
       
   667     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ;
       
   668     TPtrC8 data( GetNextStringLC ( aItem, _L("Input data") )->Des() ) ;
       
   669     
       
   670 	SetURIL(nodename) ;
       
   671 
       
   672 		/*
       
   673 			virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
       
   674 							      const TDesC8& aArgument, const TDesC8& aType,
       
   675 								  TInt aStatusRef ) = 0;
       
   676 		*/
       
   677 
       
   678     TPtrC8 parentURI(RemoveLastSeg(nodename));
       
   679     HBufC8 *luid = GetLuidAllocLC( parentURI );
       
   680     
       
   681 	//Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ;
       
   682 	Adapter()->ExecuteCommandL( *iURI, data, data, KEmptyType, 11 ) ;
       
   683 	if ( iStatus == MSmlDmAdapter::EOk )
       
   684 		{
       
   685 		iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL Successful! %d" ), iStatus );	
       
   686 		}
       
   687 	else
       
   688 		{
       
   689 		iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus );	
       
   690 		ret = KErrGeneral ;
       
   691 		}
       
   692 	CleanupStack::PopAndDestroy(); // luid
       
   693 	CleanupStack::PopAndDestroy(); // data		
       
   694 	CleanupStack::PopAndDestroy(); // nodename	
       
   695 	iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret );	
       
   696 
       
   697     return ret;
       
   698 	}
       
   699 	
       
   700 	
       
   701 	//Newly added
       
   702 TInt Cdmatest::AddLeafNode( CStifItemParser& aItem )			
       
   703 {
       
   704 	return KErrNone;
       
   705 }
       
   706 	
       
   707 TInt Cdmatest::InstallActivate( CStifItemParser& aItem )			
       
   708 {
       
   709 	return KErrNone;	
       
   710 }	
       
   711 	
       
   712 	//Newly ended
       
   713 
       
   714 
       
   715 HBufC8 *Cdmatest::LoadFileLC( const TDesC &aFileName, TDataType &aType )	
       
   716 	{
       
   717 	RFs fs ;
       
   718 	LEAVE_IF_ERROR( fs.Connect(), _L( "Could not connect fileserver: %d"  ) );
       
   719 	
       
   720 	CleanupClosePushL( fs );
       
   721 	RFile file ;
       
   722 	LEAVE_IF_ERROR( file.Open(fs,aFileName,EFileRead), _L( "Could not open file: %d" ) );
       
   723 	
       
   724 	
       
   725 	
       
   726 	CleanupClosePushL( file );
       
   727 	TInt dataSize ;
       
   728 	LEAVE_IF_ERROR( file.Size( dataSize ), _L( "Could not get file size: %d" ) );
       
   729 	HBufC8 *nodedata = HBufC8::NewL ( dataSize );
       
   730 	CleanupStack::PushL( nodedata );
       
   731 	TPtr8 nodedataptr( nodedata->Des() );
       
   732 	LEAVE_IF_ERROR( file.Read( nodedataptr ), _L( "Could not read file: %d" ) );
       
   733 	TDataRecognitionResult aDataType;
       
   734 	RApaLsSession ls ;
       
   735 	TInt err( ls.Connect() );
       
   736 	if ( err == KErrNone )
       
   737 		{
       
   738 		CleanupClosePushL( ls );
       
   739 		err = ls.RecognizeData(aFileName, nodedataptr, aDataType)  ;
       
   740 		if ( err == KErrNone )
       
   741 			{
       
   742 			aType = aDataType.iDataType;
       
   743 			}
       
   744 		else
       
   745 			{
       
   746 			iLog->Log( _L("LoadFileLC: WARNING Failed to get type: %d" ), err );
       
   747 			aType = TDataType( KDefaultType );
       
   748 			}	
       
   749 		CleanupStack::PopAndDestroy( &ls ); 
       
   750 		}
       
   751 	else
       
   752 		{
       
   753 		iLog->Log( _L("LoadFileLC: WARNING Failed to connect rapalssession: %d" ), err );
       
   754 		}	
       
   755 	CleanupStack::Pop( nodedata );
       
   756 	CleanupStack::PopAndDestroy( &file ); 
       
   757 	CleanupStack::PopAndDestroy( &fs ); 
       
   758 	CleanupStack::PushL( nodedata );
       
   759 	return nodedata ;
       
   760 	}
       
   761 
       
   762 HBufC8 *Cdmatest::LoadFileLC( const TDesC8 &aFileName, TDataType &aType )	
       
   763 	{
       
   764 	TFileName fn ;
       
   765 	fn.Copy( aFileName );
       
   766 	return LoadFileLC( fn, aType );
       
   767 	}
       
   768 	
       
   769 
       
   770 void Cdmatest::SaveDataL( TInt /*aResultsRef*/, CBufBase& aObject,
       
   771 							  const TDesC8& aType ) 
       
   772 	{
       
   773 	iLog->Log( _L8( "Saving data of type: '%S'" ), &aType );
       
   774 	RFs fs;
       
   775 	User::LeaveIfError( fs.Connect() );
       
   776 	CleanupClosePushL( fs );
       
   777 	RFile file;
       
   778 	User::LeaveIfError( file.Replace ( fs, iSaveFileName, EFileWrite ) );
       
   779 	CleanupClosePushL( file );
       
   780 	TPtrC8 p( aObject.Ptr( 0 ) );
       
   781 	User::LeaveIfError( file.Write( p ) );
       
   782 	CleanupStack::PopAndDestroy( 2 ); // file, fs
       
   783 	}
       
   784 							  
       
   785 		
       
   786 	
       
   787 void Cdmatest::FetchNodeResultsL( TInt /*aResultsRef*/, CBufBase& aObject,
       
   788 							  const TDesC8& /*aType*/ )
       
   789 	{
       
   790 	TPtrC8 ptr( aObject.Ptr( 0 ) );	
       
   791 	iLog->Log( _L8("FetchNodeResultsL for '%S': '%S'" ), iURI, &ptr );
       
   792 	
       
   793 	if ( ptr.Length() > 0 )
       
   794 		{
       
   795 		TPtrC8 last( LastURISeg( ptr ) );
       
   796 		HBufC8 *oldUri = HBufC8::NewL( iURI->Length() );
       
   797 		(*oldUri) = *iURI; 
       
   798 		do 
       
   799 			{
       
   800 			iLog->Log ( _L8( " Node: '%S' "), &last );
       
   801 			HBufC8 *nUri = HBufC8::NewLC( oldUri->Length() + 1 + last.Length() );
       
   802 			nUri->Des().Copy( *oldUri ) ;
       
   803 			nUri->Des().Append( '/' );
       
   804 			nUri->Des().Append( last );
       
   805 			
       
   806 			SetURIL( nUri );
       
   807 					
       
   808 //		    TPtrC8 parentURI(RemoveLastSeg(*nUri));
       
   809 //		    HBufC8 *luid = GetLuidAllocLC( parentURI );
       
   810 			HBufC8 *luid = GetLuidAllocLC( *iURI );
       
   811 			
       
   812 			if(*luid != KNullDesC8)
       
   813 			{
       
   814 			Adapter()->ChildURIListL( *nUri, *luid, *iEmptyMappingInfoArray, 4, 5 );	
       
   815 			}
       
   816 			else
       
   817 			{
       
   818 			Adapter()->FetchLeafObjectL( *nUri, KNullDesC8, KEmptyType, 7, 8 ) ;	
       
   819 			}
       
   820 			//Adapter()->ChildURIListL( *nUri, KNullDesC8, *iEmptyMappingInfoArray, 4, 5 );
       
   821 			
       
   822 			
       
   823 
       
   824 			CleanupStack::PopAndDestroy( luid ); 
       
   825 			CleanupStack::Pop( nUri );			
       
   826 			
       
   827 			ptr.Set( RemoveLastURISeg( ptr ) );
       
   828 			last.Set( LastURISeg( ptr ) );
       
   829 			
       
   830 			}
       
   831 		while (last != KNullDesC8);	
       
   832 		}
       
   833 	
       
   834 	}
       
   835 	
       
   836 
       
   837 	
       
   838 TPtrC8 Cdmatest::LastURISeg( const TDesC8& aURI )
       
   839 	{
       
   840 	TInt i;
       
   841 	for( i = aURI.Length() - 1; i >= 0; i-- ) 
       
   842 		{
       
   843 		if( aURI[i] == '/' )
       
   844 			{
       
   845 			break;
       
   846 			}
       
   847 		}
       
   848 
       
   849 	if( i == 0 )
       
   850 		{
       
   851 		return aURI;
       
   852 		}
       
   853 	else
       
   854 		{
       
   855 		return aURI.Mid( i+1 );
       
   856 		}
       
   857 	}
       
   858 TPtrC8 Cdmatest::RemoveLastSeg(const TDesC8& aURI)
       
   859 	{
       
   860 	TInt i;
       
   861 	for(i=aURI.Length()-1;i>=0;i--)
       
   862 		{
       
   863 		if(aURI[i]==KNSmlDMUriSeparator)
       
   864 			{
       
   865 			break;
       
   866 			}
       
   867 		}
       
   868 
       
   869 	if(i>0)
       
   870 		{
       
   871 		return aURI.Left(i);
       
   872 		}
       
   873 	else
       
   874 		{
       
   875 		return KNullDesC8();
       
   876 		}
       
   877 	}
       
   878 
       
   879 // ------------------------------------------------------------------------------------------------
       
   880 // TPtrC8 Cdmatest::RemoveLastURISeg(const TDesC8& aURI)
       
   881 // returns parent uri, i.e. removes last uri segment
       
   882 // ------------------------------------------------------------------------------------------------
       
   883 TPtrC8 Cdmatest::RemoveLastURISeg( const TDesC8& aURI )
       
   884 	{
       
   885 	TInt i;
       
   886 	for ( i = aURI.Length() - 1; i >= 0 ; i-- )
       
   887 		{
       
   888 		if( aURI[i] == '/' )
       
   889 			{
       
   890 			break;
       
   891 			}
       
   892 		}
       
   893 	if ( i > -1 )
       
   894 		{
       
   895 		return aURI.Left( i );	
       
   896 		}
       
   897 	else
       
   898 		{
       
   899 		return KNullDesC8();
       
   900 		}
       
   901 	}	
       
   902 	
       
   903 TPtrC Cdmatest::RemoveLastURISeg( const TDesC& aURI )
       
   904 	{
       
   905 	TInt i;
       
   906 	for ( i = aURI.Length() - 1; i >= 0 ; i-- )
       
   907 		{
       
   908 		if( aURI[i] == '/' )
       
   909 			{
       
   910 			break;
       
   911 			}
       
   912 		}
       
   913 	if ( i > -1 )
       
   914 		{
       
   915 		return aURI.Left( i );	
       
   916 		}
       
   917 	else
       
   918 
       
   919 		{
       
   920 		return KNullDesC();
       
   921 		}
       
   922 	}		
       
   923 	
       
   924 void Cdmatest::SetURIL( const TDesC& aURI )
       
   925 	{
       
   926 	if ( iURI != NULL )
       
   927 		{
       
   928 		delete iURI ;
       
   929 		iURI = NULL;
       
   930 		}
       
   931 	iURI = HBufC8::NewL( aURI.Length() ) ;
       
   932 	iURI->Des().Copy( aURI );
       
   933 	}
       
   934 	
       
   935 void Cdmatest::SetURIL( const TDesC8& aURI )
       
   936 	{
       
   937 	if ( iURI != NULL )
       
   938 		{
       
   939 		delete iURI ;
       
   940 		iURI = NULL;
       
   941 		}
       
   942 	iURI = HBufC8::NewL( aURI.Length() ) ;
       
   943 	iURI->Des().Copy( aURI );
       
   944 	}	
       
   945 
       
   946 void Cdmatest::SetURIL( HBufC8* aURI )
       
   947 	{
       
   948 	if ( iURI != NULL )
       
   949 		{
       
   950 		delete iURI ;
       
   951 		iURI = NULL;
       
   952 		}
       
   953 	iURI = aURI ;
       
   954 	}
       
   955 		
       
   956 		
       
   957 		
       
   958 void Cdmatest::SetResultsL( 
       
   959 	TInt aResultsRef, 
       
   960 	CBufBase& aObject,
       
   961 	const TDesC8& aType )
       
   962 	{
       
   963 	TPtrC8 ptr( aObject.Ptr(0) );
       
   964 	iLog->Log( _L8( "SetResults, ref=%d, object='%S', type='%S'" ), aResultsRef, &ptr, &aType );
       
   965 	if ( iResultsFunction )
       
   966 		{
       
   967 		(this->*iResultsFunction)( aResultsRef, aObject, aType );
       
   968 		iResultsFunction = NULL ;
       
   969 		}
       
   970 	
       
   971 	}
       
   972 
       
   973 
       
   974 void Cdmatest::SetStatusL( TInt aStatusRef,
       
   975 							 MSmlDmAdapter::TError aErrorCode ) 
       
   976 	{
       
   977 	iStatus = aErrorCode ;
       
   978 	iLog->Log( _L( "SetStatusL, ref=%d, code=%d" ), aStatusRef, aErrorCode );
       
   979 	
       
   980 	
       
   981 	}
       
   982 	
       
   983 void Cdmatest::SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ) 
       
   984 	{
       
   985 	iLog->Log( _L8( "SetMappingL, aURI='%s', aLUID='%s'" ), aURI.Ptr(), aLUID.Ptr() );	
       
   986 	
       
   987 	iMappingTable.Append(TMapping( aURI, aLUID ) )	;
       
   988 	}
       
   989 	
       
   990 HBufC8* Cdmatest::GetLuidAllocL( const TDesC8& aURI ) 
       
   991 	{
       
   992 	iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI );		
       
   993 	HBufC8 *res = NULL;		
       
   994 	for( TInt i(0); i < iMappingTable.Count(); i++ )	
       
   995 		{
       
   996 		if ( aURI == iMappingTable[i].iURI )
       
   997 			{
       
   998 			res = iMappingTable[i].iLuid.AllocL();
       
   999 			}
       
  1000 		}
       
  1001 	if ( res == NULL )
       
  1002 		{
       
  1003 		res = HBufC8::NewL( 0 );
       
  1004 		}
       
  1005 	iLog->Log( _L8( "GetLuidAllocL, response='%S'" ), res );
       
  1006 	return res;
       
  1007 	}	    
       
  1008     
       
  1009 HBufC8* Cdmatest::GetLuidAllocLC( const TDesC8& aURI ) 
       
  1010 	{
       
  1011 	iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI );
       
  1012 	HBufC8 *res = NULL;		
       
  1013 	for( TInt i(0); i < iMappingTable.Count(); i++ )	
       
  1014 		{
       
  1015 		if ( aURI == iMappingTable[i].iURI )
       
  1016 			{
       
  1017 			res = iMappingTable[i].iLuid.AllocLC();
       
  1018 			break;
       
  1019 			}
       
  1020 		}
       
  1021 	if ( res == NULL )
       
  1022 		{
       
  1023 		res = HBufC8::NewLC( 0 );
       
  1024 		}
       
  1025 	iLog->Log( _L8( "GetLuidAllocLC, response='%S'" ), res );
       
  1026 	return res ;
       
  1027 	}	
       
  1028     	
       
  1029 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
  1030     
       
  1031 void Cdmatest::GetMappingInfoListL( const TDesC8& /*aURI*/,
       
  1032 								CArrayFix<TSmlDmMappingInfo>& /*aSegmentList*/ )
       
  1033 	{
       
  1034 	// do nothing
       
  1035 	}								
       
  1036 
       
  1037 #else
       
  1038 // nothing
       
  1039 #endif
       
  1040 
       
  1041 TInt Cdmatest::FetchLeafObjectSizeL( CStifItemParser& aItem )
       
  1042 	{
       
  1043 		TInt ret( KErrNone );
       
  1044 	    // Print to UI
       
  1045 	    TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") );
       
  1046 
       
  1047 		iResultsFunction = NULL;
       
  1048 		
       
  1049 	    TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ;
       
  1050 	    
       
  1051 	    //TPtrC datafile;
       
  1052 	    TInt i( 0 );
       
  1053 	    TPtrC datafile( KNullDesC );
       
  1054 	    i = aItem.GetNextString ( datafile ) ;
       
  1055 	    if ( i != KErrNone ) 
       
  1056 		    {
       
  1057 		    iLog->Log(_L("FetchLeafL: ERROR Reading outfile argument: 0x%X"), i );
       
  1058 		    //return i;
       
  1059 		    }
       
  1060 		else
       
  1061 			{
       
  1062 			iSaveFileName = datafile;
       
  1063 			iLog->Log( _L( " Save file name is '%S'" ), &iSaveFileName );
       
  1064 			iResultsFunction = SaveDataL;
       
  1065 			}	    
       
  1066 		SetURIL(nodename) ;
       
  1067 
       
  1068 //		HBufC8 *luid = GetLuidAllocLC( *iURI );
       
  1069 	    TPtrC8 parentURI(RemoveLastSeg(nodename));
       
  1070 	    HBufC8 *luid = GetLuidAllocLC( parentURI );
       
  1071 
       
  1072 		CleanupStack::PushL( luid );
       
  1073 
       
  1074 //		void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef );
       
  1075 		iAdapter->FetchLeafObjectSizeL( *iURI, *luid, KEmptyType, 7, 8 );
       
  1076 		if ( iStatus == MSmlDmAdapter::EOk )
       
  1077 			{
       
  1078 			iLog->Log( _L("FetchLeafObjectSizeL: FetchLeafObjectSizeL Successful! %d" ), iStatus );	
       
  1079 			}
       
  1080 		else
       
  1081 			{
       
  1082 			iLog->Log( _L("FetchLeafObjectSizeL: FetchLeafObjectSizeL Error ! %d" ), iStatus );	
       
  1083 			ret = KErrGeneral ;
       
  1084 			}
       
  1085 
       
  1086 
       
  1087 
       
  1088 		// Cleanup
       
  1089 		CleanupStack::PopAndDestroy();
       
  1090 		CleanupStack::Pop( luid );
       
  1091 		CleanupStack::PopAndDestroy();//nodename
       
  1092 //		CleanupStack::PopAndDestroy();//nodename
       
  1093 		
       
  1094 		
       
  1095 			iLog->Log( _L("FetchLeafObjectSizeL Test Complete with status %d" ), ret );	
       
  1096 		return ret;
       
  1097 	}
       
  1098 
       
  1099 /*TInt Cdmatest::BareAppInstallL( CStifItemParser& aItem )
       
  1100     {
       
  1101     
       
  1102     // Print to UI
       
  1103     TestModuleIf().Printf( 0, _L("amtest"), _L("In InstallL") );
       
  1104     // Print to log file
       
  1105     iLog->Log(_L("In DetailsL"));
       
  1106 
       
  1107     TInt aluidi( 0 );
       
  1108     TUint32 aLuidInt;
       
  1109     aluidi = aItem.GetNextInt ( (TInt&)aLuidInt ) ;
       
  1110 	
       
  1111 	
       
  1112     TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ;
       
  1113     
       
  1114 	
       
  1115     SetURIL( nodename );
       
  1116     
       
  1117     HBufC8 *luid = GetLuidAllocLC( *iURI );
       
  1118     MSmlDmAdapter::TError ret( MSmlDmAdapter::EError );
       
  1119 	
       
  1120 	TRAPD( err, Adapter()->InstallL(aluidi,*iURI, *luid,3 ,ret));
       
  1121 
       
  1122     return err;
       
  1123 
       
  1124     }*/
       
  1125 
       
  1126 
       
  1127 //  End of File