omadmadapters/syncmlds/tsrc/src/syncmldstestBlocks.cpp
author hgs
Tue, 13 Jul 2010 03:48:30 +0530
changeset 45 0f9fc722d255
parent 44 deviceupdatesui/omadmadapters/syncmlds/tsrc/src/syncmldstestBlocks.cpp@137912d1a556
permissions -rw-r--r--
201021_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Implementation of DM adapter test component
hgs
parents:
diff changeset
    15
* 	This is part of omadmextensions/adapter test application.
hgs
parents:
diff changeset
    16
*
hgs
parents:
diff changeset
    17
*/
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
// INCLUDE FILES
hgs
parents:
diff changeset
    25
#include <e32svr.h>
hgs
parents:
diff changeset
    26
#include <StifParser.h>
hgs
parents:
diff changeset
    27
#include <Stiftestinterface.h>
hgs
parents:
diff changeset
    28
#include "syncmldsTest.h"
hgs
parents:
diff changeset
    29
#include <e32math.h>
hgs
parents:
diff changeset
    30
#include <f32file.h>
hgs
parents:
diff changeset
    31
#include <swinstapi.h>
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
//using namespace NApplicationManagement;//Dipak
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
// ============================ MEMBER FUNCTIONS ===============================
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    39
// CsyncmldsTest::Delete
hgs
parents:
diff changeset
    40
// Delete here all resources allocated and opened from test methods. 
hgs
parents:
diff changeset
    41
// Called from destructor. 
hgs
parents:
diff changeset
    42
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    43
//
hgs
parents:
diff changeset
    44
void CsyncmldsTest::Delete() 
hgs
parents:
diff changeset
    45
    {
hgs
parents:
diff changeset
    46
    
hgs
parents:
diff changeset
    47
    }
hgs
parents:
diff changeset
    48
    
hgs
parents:
diff changeset
    49
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    50
// CsyncmldsTest::RunMethodL
hgs
parents:
diff changeset
    51
// Run specified method. Contains also table of test mothods and their names.
hgs
parents:
diff changeset
    52
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    53
//
hgs
parents:
diff changeset
    54
TInt CsyncmldsTest::RunMethodL( 
hgs
parents:
diff changeset
    55
    CStifItemParser& aItem ) 
hgs
parents:
diff changeset
    56
    {
hgs
parents:
diff changeset
    57
   
hgs
parents:
diff changeset
    58
    TStifFunctionInfo const KFunctions[] =
hgs
parents:
diff changeset
    59
        {  
hgs
parents:
diff changeset
    60
        // Copy this line for every implemented function.
hgs
parents:
diff changeset
    61
        // First string is the function name used in TestScripter script file.
hgs
parents:
diff changeset
    62
        // Second is the actual implementation member function. 
hgs
parents:
diff changeset
    63
        ENTRY( "DDFStructure", CsyncmldsTest::DDFStructureL),
hgs
parents:
diff changeset
    64
        ENTRY( "FetchNode", CsyncmldsTest::FetchNodeL ),
hgs
parents:
diff changeset
    65
        ENTRY( "FetchLeaf", CsyncmldsTest::FetchLeafL ),
hgs
parents:
diff changeset
    66
        ENTRY( "AddNode", CsyncmldsTest::AddNodeL ),
hgs
parents:
diff changeset
    67
        ENTRY( "UpdateLeaf", CsyncmldsTest::UpdateLeafL ),
hgs
parents:
diff changeset
    68
        ENTRY( "UpdateLeafData", CsyncmldsTest::UpdateLeafDataL ),
hgs
parents:
diff changeset
    69
        ENTRY( "Execute", CsyncmldsTest::ExecuteLeafL ),
hgs
parents:
diff changeset
    70
        ENTRY( "ExecuteData", CsyncmldsTest::ExecuteLeafDataL ),
hgs
parents:
diff changeset
    71
        ENTRY( "DeleteNode", CsyncmldsTest::DeleteObjectL ),
hgs
parents:
diff changeset
    72
        ENTRY( "StartAtomic", CsyncmldsTest::StartAtomicL),
hgs
parents:
diff changeset
    73
	    ENTRY( "CommitAtomic", CsyncmldsTest::CommitAtomicL),
hgs
parents:
diff changeset
    74
	    ENTRY( "RollbackAtomic", CsyncmldsTest::RollbackAtomicL),
hgs
parents:
diff changeset
    75
	    ENTRY( "CompleteCommands", CsyncmldsTest::CompleteCommandsL),
hgs
parents:
diff changeset
    76
        };
hgs
parents:
diff changeset
    77
hgs
parents:
diff changeset
    78
    const TInt count = sizeof( KFunctions ) / 
hgs
parents:
diff changeset
    79
                        sizeof( TStifFunctionInfo );
hgs
parents:
diff changeset
    80
hgs
parents:
diff changeset
    81
    return RunInternalL( KFunctions, count, aItem );
hgs
parents:
diff changeset
    82
hgs
parents:
diff changeset
    83
    }    
hgs
parents:
diff changeset
    84
hgs
parents:
diff changeset
    85
        
hgs
parents:
diff changeset
    86
        
hgs
parents:
diff changeset
    87
HBufC8 *CsyncmldsTest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName )
hgs
parents:
diff changeset
    88
	{
hgs
parents:
diff changeset
    89
	TPtrC nodename;
hgs
parents:
diff changeset
    90
	nodename.Set( KNullDesC );
hgs
parents:
diff changeset
    91
hgs
parents:
diff changeset
    92
    TInt i( aItem.GetNextString ( nodename ) );
hgs
parents:
diff changeset
    93
    if ( i != KErrNone ) 
hgs
parents:
diff changeset
    94
	    {
hgs
parents:
diff changeset
    95
	    iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i );
hgs
parents:
diff changeset
    96
	    }
hgs
parents:
diff changeset
    97
	else
hgs
parents:
diff changeset
    98
		{
hgs
parents:
diff changeset
    99
		iLog->Log( _L("%S: %S"), &aName, &nodename);
hgs
parents:
diff changeset
   100
		}
hgs
parents:
diff changeset
   101
	
hgs
parents:
diff changeset
   102
	HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ;
hgs
parents:
diff changeset
   103
	buf->Des().Copy( nodename );
hgs
parents:
diff changeset
   104
	
hgs
parents:
diff changeset
   105
	return buf;
hgs
parents:
diff changeset
   106
	}
hgs
parents:
diff changeset
   107
hgs
parents:
diff changeset
   108
//  End of File