serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcasesblocks.cpp
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:       ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 // [INCLUDE FILES] - do not remove
       
    26 #include <e32svr.h>
       
    27 #include <StifParser.h>
       
    28 #include <StifTestInterface.h>
       
    29 #include "liwtestcases.h"
       
    30 
       
    31 #include  <aknViewAppUi.h>
       
    32 #include  <liwservicehandler.h>
       
    33 //#include  "liwTC1.h"
       
    34 //#include  "liwtestapp.hrh"
       
    35 //#include  <liwtestapp.rsg>
       
    36 #include  <s32mem.h> // for read write stream
       
    37 
       
    38 #include <rtsecmanager.h>
       
    39 #include <rtsecmgrutility.h>
       
    40 #include <rtsecmgrscriptsession.h>
       
    41 #include <rtsecmgrcommondef.h>
       
    42 #include "liwtestapplit.h"
       
    43 
       
    44 #include  "liw_async_testcase.h"
       
    45 
       
    46 using namespace LIW;
       
    47 
       
    48 // EXTERNAL DATA STRUCTURES
       
    49 //extern  ?external_data;
       
    50 
       
    51 // EXTERNAL FUNCTION PROTOTYPES  
       
    52 //extern ?external_function( ?arg_type,?arg_type );
       
    53 
       
    54 // CONSTANTS
       
    55 //const ?type ?constant_var = ?constant;
       
    56 
       
    57 // MACROS
       
    58 //#define ?macro ?macro_def
       
    59 
       
    60 // LOCAL CONSTANTS AND MACROS
       
    61 //const ?type ?constant_var = ?constant;
       
    62 //#define ?macro_name ?macro_def
       
    63 
       
    64 // MODULE DATA STRUCTURES
       
    65 //enum ?declaration
       
    66 //typedef ?declaration
       
    67 
       
    68 // LOCAL FUNCTION PROTOTYPES
       
    69 //?type ?function_name( ?arg_type, ?arg_type );
       
    70 
       
    71 // FORWARD DECLARATIONS
       
    72 //class ?FORWARD_CLASSNAME;
       
    73 
       
    74 // ============================= LOCAL FUNCTIONS ===============================
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // ?function_name ?description.
       
    78 // ?description
       
    79 // Returns: ?value_1: ?description
       
    80 //          ?value_n: ?description_line1
       
    81 //                    ?description_line2
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 /*
       
    85 ?type ?function_name(
       
    86     ?arg_type arg,  // ?description
       
    87     ?arg_type arg)  // ?description
       
    88     {
       
    89 
       
    90     ?code  // ?comment
       
    91 
       
    92     // ?comment
       
    93     ?code
       
    94     }
       
    95 */
       
    96 
       
    97 // ============================ MEMBER FUNCTIONS ===============================
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // Cliwtestcases::Delete
       
   101 // Delete here all resources allocated and opened from test methods. 
       
   102 // Called from destructor. 
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void Cliwtestcases::Delete() 
       
   106     {
       
   107 		if(iServiceHandler)
       
   108 		{
       
   109     	iServiceHandler->Reset();
       
   110     	delete iServiceHandler;	
       
   111     	iServiceHandler = NULL;
       
   112 		}
       
   113     
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------
       
   117 // CLiwtcbase::HandleNotifyL
       
   118 // From - MLiwNotifyCallback
       
   119 // ---------------------------------------------------------
       
   120 TInt Cliwtestcases::HandleNotifyL
       
   121     (
       
   122     TInt /*aCmdId*/,
       
   123     TInt /*aEventId*/,
       
   124     CLiwGenericParamList& /*aEventParamList*/,
       
   125     const CLiwGenericParamList& /*aInParamList*/)
       
   126     {
       
   127     return KErrNone;    
       
   128     }
       
   129     
       
   130 
       
   131 TInt Cliwtestcases::LoadL( )
       
   132     {
       
   133     RCriteriaArray interest;
       
   134     CleanupClosePushL(interest);
       
   135     
       
   136     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   137     criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   138     
       
   139     interest.AppendL(criteria);
       
   140     
       
   141     // Attach the MyServiceName provider to the LIW framework.
       
   142     TInt status = iServiceHandler->AttachL(interest);
       
   143 
       
   144     // Detach The MyServiceName Provider
       
   145     //iServiceHandler->DetachL(interest);    
       
   146     CleanupStack::PopAndDestroy(criteria);
       
   147     CleanupStack::PopAndDestroy(&interest);   
       
   148     return status;
       
   149     }   
       
   150         
       
   151 // -----------------------------------------------------------------------------
       
   152 // Cliwtestcases::RunMethodL
       
   153 // Run specified method. Contains also table of test mothods and their names.
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 TInt Cliwtestcases::RunMethodL( 
       
   157     CStifItemParser& aItem ) 
       
   158     {
       
   159         TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );
       
   160         
       
   161         static TStifFunctionInfo const KFunctions[] =
       
   162         {  
       
   163         // Copy this line for every implemented function.
       
   164         // First string is the function name used in TestScripter script file.
       
   165         // Second is the actual implementation member function. 
       
   166         ENTRY( "LIW_DATA_TYPES_001", Cliwtestcases::LIW_DATA_TYPES_001 ),
       
   167         ENTRY( "LIW_DATA_TYPES_002", Cliwtestcases::LIW_DATA_TYPES_002 ),
       
   168         ENTRY( "LIW_DATA_TYPES_003", Cliwtestcases::LIW_DATA_TYPES_003 ),
       
   169         ENTRY( "LIW_DATA_TYPES_004", Cliwtestcases::LIW_DATA_TYPES_004 ),
       
   170         ENTRY( "LIW_DATA_TYPES_005", Cliwtestcases::LIW_DATA_TYPES_005 ),
       
   171         ENTRY( "LIW_DATA_TYPES_006", Cliwtestcases::LIW_DATA_TYPES_006 ),
       
   172         ENTRY( "LIW_DATA_TYPES_007", Cliwtestcases::LIW_DATA_TYPES_007 ),
       
   173         ENTRY( "LIW_DATA_TYPES_008", Cliwtestcases::LIW_DATA_TYPES_008 ),
       
   174         ENTRY( "LIW_DATA_TYPES_009", Cliwtestcases::LIW_DATA_TYPES_009 ),
       
   175         ENTRY( "LIW_Map_AtL_New", Cliwtestcases::LIW_Map_AtL_New ),
       
   176         ENTRY( "LIW_DATA_TYPES_010", Cliwtestcases::LIW_DATA_TYPES_010 ),
       
   177         ENTRY( "LIW_DATA_TYPES_011", Cliwtestcases::LIW_DATA_TYPES_011 ),
       
   178         ENTRY( "LIW_DATA_TYPES_012", Cliwtestcases::LIW_DATA_TYPES_012 ),
       
   179         ENTRY( "LIW_DATA_TYPES_013", Cliwtestcases::LIW_DATA_TYPES_013 ),
       
   180         ENTRY( "LIW_DATA_TYPES_014", Cliwtestcases::LIW_DATA_TYPES_014 ),
       
   181         ENTRY( "LIW_DATA_TYPES_016", Cliwtestcases::LIW_DATA_TYPES_016 ),
       
   182         ENTRY( "LIW_DATA_TYPES_017", Cliwtestcases::LIW_DATA_TYPES_017 ),
       
   183         ENTRY( "LIW_DATA_TYPES_018", Cliwtestcases::LIW_DATA_TYPES_018 ),
       
   184         ENTRY( "LIW_DATA_TYPES_020", Cliwtestcases::LIW_DATA_TYPES_020 ),
       
   185         ENTRY( "LIW_DATA_TYPES_021", Cliwtestcases::LIW_DATA_TYPES_021 ),
       
   186         ENTRY( "LIW_DATA_TYPES_022", Cliwtestcases::LIW_DATA_TYPES_022 ),
       
   187         ENTRY( "LIW_DATA_TYPES_023", Cliwtestcases::LIW_DATA_TYPES_023 ),
       
   188         ENTRY( "LIW_DATA_TYPES_024", Cliwtestcases::LIW_DATA_TYPES_024 ),
       
   189         ENTRY( "LIW_DATA_TYPES_025", Cliwtestcases::LIW_DATA_TYPES_025 ),
       
   190         ENTRY( "LIW_DATA_TYPES_026", Cliwtestcases::LIW_DATA_TYPES_026 ),
       
   191         ENTRY( "LIW_DATA_TYPES_029", Cliwtestcases::LIW_DATA_TYPES_029 ),
       
   192         ENTRY( "LIW_DATA_TYPES_030", Cliwtestcases::LIW_DATA_TYPES_030 ),
       
   193         ENTRY( "LIW_DATA_TYPES_033", Cliwtestcases::LIW_DATA_TYPES_033 ),
       
   194         ENTRY( "LIW_DATA_TYPES_034", Cliwtestcases::LIW_DATA_TYPES_034 ),
       
   195         ENTRY( "LIW_DATA_TYPES_037", Cliwtestcases::LIW_DATA_TYPES_037 ),
       
   196         ENTRY( "LIW_DATA_TYPES_038", Cliwtestcases::LIW_DATA_TYPES_038 ),
       
   197         ENTRY( "LIW_DATA_TYPES_039", Cliwtestcases::LIW_DATA_TYPES_039 ),
       
   198         ENTRY( "LIW_DATA_TYPES_041", Cliwtestcases::LIW_DATA_TYPES_041 ),
       
   199         ENTRY( "LIW_DATA_TYPES_042", Cliwtestcases::LIW_DATA_TYPES_042 ),
       
   200         ENTRY( "LIW_DATA_TYPES_043", Cliwtestcases::LIW_DATA_TYPES_043 ),
       
   201         ENTRY( "LIW_DATA_TYPES_045", Cliwtestcases::LIW_DATA_TYPES_045 ),
       
   202         ENTRY( "LIW_DATA_TYPES_046", Cliwtestcases::LIW_DATA_TYPES_046 ),
       
   203         ENTRY( "LIW_DATA_TYPES_047", Cliwtestcases::LIW_DATA_TYPES_047 ),
       
   204         ENTRY( "LIW_DATA_TYPES_048", Cliwtestcases::LIW_DATA_TYPES_048 ),
       
   205         ENTRY( "LIW_DATA_TYPES_049", Cliwtestcases::LIW_DATA_TYPES_049 ),
       
   206         ENTRY( "LIW_MDAT_VER1", Cliwtestcases::LIW_MDAT_VER1 ),
       
   207         ENTRY( "LIW_MDAT_VER2", Cliwtestcases::LIW_MDAT_VER2 ),
       
   208         ENTRY( "LIW_MDAT_VER3", Cliwtestcases::LIW_MDAT_VER3 ),
       
   209         ENTRY( "LIW_MDAT_VER4", Cliwtestcases::LIW_MDAT_VER4 ),
       
   210         ENTRY( "LIW_MDAT_VER5", Cliwtestcases::LIW_MDAT_VER5 ),
       
   211         ENTRY( "LIW_MDAT_CAP1", Cliwtestcases::LIW_MDAT_CAP1 ),
       
   212         ENTRY( "LIW_ContainerCleanup", Cliwtestcases::LIW_ContainerCleanup ),
       
   213         ENTRY( "LIW_ParamCleanup", Cliwtestcases::LIW_ParamCleanup ),
       
   214         ENTRY( "LIW_VariantCleanup", Cliwtestcases::LIW_VariantCleanup ),
       
   215         ENTRY( "LIW_ASYNC_001", Cliwtestcases::LIW_ASYNC_001 ),
       
   216         ENTRY( "LIW_ASYNC_002", Cliwtestcases::LIW_ASYNC_002 ),
       
   217         ENTRY( "LIW_ASYNC_003", Cliwtestcases::LIW_ASYNC_003 ),
       
   218         ENTRY( "LIW_ASYNC_004", Cliwtestcases::LIW_ASYNC_004 ),
       
   219         ENTRY( "LIW_ASYNC_LongServiceCmd", Cliwtestcases::LIW_ASYNC_LongServiceCmd ),
       
   220         ENTRY( "LIW_ASYNC_LongInterface", Cliwtestcases::LIW_ASYNC_LongInterface ),
       
   221         ENTRY( "LIW_ASYNC_LongInterface1", Cliwtestcases::LIW_ASYNC_LongInterface1 ),
       
   222         ENTRY( "LIW_ASYNC_LongInvalidServiceCmd", Cliwtestcases::LIW_ASYNC_LongInvalidServiceCmd ),
       
   223         ENTRY( "LIW_ASYNC_LongInvalidInterface", Cliwtestcases::LIW_ASYNC_LongInvalidInterface ),
       
   224         ENTRY( "LIW_ParamCleanup1", Cliwtestcases::LIW_ParamCleanup1 ),
       
   225         ENTRY( "LIW_GetInterest", Cliwtestcases::LIW_GetInterest ),
       
   226         ENTRY( "LIW_Defaut_list_externalize", Cliwtestcases::LIW_Defaut_list_externalize ),
       
   227         ENTRY( "LIW_DATA_TYPES_013_A", Cliwtestcases::LIW_DATA_TYPES_013_A ),
       
   228         ENTRY( "LIW_DATA_TYPES_015_A", Cliwtestcases::LIW_DATA_TYPES_015_A ),
       
   229         ENTRY( "LIW_DATA_TYPES_015", Cliwtestcases::LIW_DATA_TYPES_015 ),
       
   230         ENTRY( "LIW_DATA_GenericParamList", Cliwtestcases::LIW_DATA_GenericParamList ),
       
   231         ENTRY( "LIW_DATA_NewLOverLoad", Cliwtestcases::LIW_DATA_NewLOverLoad )
       
   232                         
       
   233         //ADD NEW ENTRY HERE
       
   234         // [test cases entries] - Do not remove
       
   235 
       
   236         };
       
   237 
       
   238     const TInt count = sizeof( KFunctions ) / 
       
   239                         sizeof( TStifFunctionInfo );
       
   240 
       
   241     return RunInternalL( KFunctions, count, aItem );
       
   242 
       
   243     }
       
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // Cliwtestcases::ExampleL
       
   247 // Example test method function.
       
   248 // (other items were commented in a header).
       
   249 // -----------------------------------------------------------------------------
       
   250 //
       
   251 TInt Cliwtestcases::ExampleL( CStifItemParser& aItem )
       
   252     {
       
   253 
       
   254     // Print to UI
       
   255     _LIT( Kliwtestcases, "liwtestcases" );
       
   256     _LIT( KExample, "In Example" );
       
   257     TestModuleIf().Printf( 0, Kliwtestcases, KExample );
       
   258     // Print to log file
       
   259     iLog->Log( KExample );
       
   260 
       
   261     TInt i = 0;
       
   262     TPtrC string;
       
   263     _LIT( KParam, "Param[%i]: %S" );
       
   264     while ( aItem.GetNextString ( string ) == KErrNone )
       
   265         {
       
   266         TestModuleIf().Printf( i, Kliwtestcases, 
       
   267                                 KParam, i, &string );
       
   268         i++;
       
   269         }
       
   270 
       
   271     return KErrNone;
       
   272 
       
   273     }
       
   274 
       
   275 // ---------------------------------------------------------
       
   276 // Test Case Deffinition for LIW Data Types
       
   277 // 
       
   278 // ---------------------------------------------------------
       
   279 TBool Cliwtestcases::LIW_DATA_TYPES_001()
       
   280     {
       
   281 	    TBool flag = 0;
       
   282 	    /*Testing String Based Command*/
       
   283 	    //LoadL();
       
   284 	    TLiwGenericParam param;
       
   285 	    param.Value().Set(KLIW_DATA_TYPES_001);
       
   286 	    param.SetNameL(KTestPARAMNanmeTC1);
       
   287 	    CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   288 	    CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   289 	    inps->AppendL(param);
       
   290 	    param.Reset();
       
   291 	    
       
   292 	    // Get the Test result from MyServiceName provider "ExecuteServiceCmdL"
       
   293 	    CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   294 	    crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   295 	    iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
       
   296 	    CleanupStack::PopAndDestroy(crit); // crit
       
   297 	    
       
   298 	    TInt pos = 0;
       
   299 	    outps->FindFirst(pos, EGenericParamError);
       
   300 	    if(pos != KErrNotFound)
       
   301 	        if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
   302 	        {
       
   303 	            flag = 1;
       
   304 	        }
       
   305 	        else
       
   306 	        {
       
   307 	            flag = 0;
       
   308 	        }
       
   309 		else
       
   310 		{
       
   311 	        flag = 0;
       
   312 		}
       
   313 		
       
   314         // Detach The MyServiceName Provider
       
   315 	    //iServiceHandler->DetachL(interest);    
       
   316     	//CleanupStack::PopAndDestroy(criteria);
       
   317     	//CleanupStack::PopAndDestroy(&interest);   
       
   318 		return !flag;
       
   319     }
       
   320    
       
   321 TBool Cliwtestcases::LIW_DATA_TYPES_002()
       
   322     {
       
   323         TBool flag = 0;
       
   324         /*Testing Boolean data Type*/
       
   325         
       
   326         //LoadL();
       
   327         
       
   328         TLiwGenericParam param;
       
   329         param.Value().Set(KLIW_DATA_TYPES_002);
       
   330         param.SetNameL(KTestPARAMNanmeTC1);
       
   331         CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   332         CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   333         inps->AppendL(param);
       
   334         param.Reset();
       
   335         
       
   336         // Set up Tbool varient and append TBool parameter (EGenericParamError).
       
   337         // One Argument constructer 
       
   338         TLiwVariant boolVarient(ETrue);
       
   339         // Test TLiwVariant::SetL(TLiwVariant&)
       
   340         TLiwGenericParam boolParam(EGenericParamError);
       
   341         boolParam.Value().SetL(boolVarient);
       
   342         
       
   343         inps->AppendL(boolParam);
       
   344         
       
   345         boolVarient.Reset();
       
   346         boolParam.Reset();
       
   347         
       
   348         // Call ExecuteServiceCmdL TO GET THE RESULT
       
   349         CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   350         crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   351         iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
       
   352         CleanupStack::PopAndDestroy(crit); // crit
       
   353         
       
   354         // CHECK RESULT 
       
   355         TInt pos = 0;
       
   356         outps->FindFirst(pos, EGenericParamError);
       
   357         
       
   358         if(pos != KErrNotFound)
       
   359             if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
   360                 flag = 1;
       
   361             else
       
   362                 flag = 0;
       
   363          else
       
   364             flag = 0;
       
   365          
       
   366         return !flag;
       
   367     }
       
   368 
       
   369 TBool Cliwtestcases::LIW_DATA_TYPES_003( )
       
   370     {
       
   371         TBool flag = 0;
       
   372         CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   373         CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   374         
       
   375         //LoadL();
       
   376         
       
   377         /*Testing List Data Type for TLiwVariant interface and container interface*/
       
   378         TLiwGenericParam param;
       
   379         param.Value().Set(KLIW_DATA_TYPES_003);
       
   380         param.SetNameL(KTestPARAMNanmeTC1);
       
   381         inps->AppendL(param);
       
   382         param.Reset();
       
   383         /*Checks Default constructer "CLiwDefaultList" Creation*/
       
   384         CLiwList* listType = CLiwDefaultList::NewL();
       
   385         
       
   386         /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
       
   387         TLiwVariant intVairent;
       
   388         for (TInt32 index = 100; index < 110; index++)
       
   389             {
       
   390             intVairent.Set(index);
       
   391             listType->AppendL(intVairent);    
       
   392             }
       
   393             
       
   394         /*Checks CLiwList::TLiwVariant.Set(CLiwList*)*/  
       
   395         param.Value().Set(listType);
       
   396         param.SetNameL(_L8("IntegerList"));
       
   397         inps->AppendL(param);
       
   398         
       
   399         intVairent.Reset();
       
   400         param.Reset();
       
   401         
       
   402         CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   403         crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   404         iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
       
   405         CleanupStack::PopAndDestroy(crit); // crit
       
   406 
       
   407         TInt pos = 0;
       
   408         TBool result = FALSE;
       
   409         listType->Remove(listType->Count() - 1);
       
   410         outps->FindFirst(pos, _L8("IntegerList"));
       
   411         if(pos != KErrNotFound)
       
   412             {
       
   413                const CLiwList* resultList = (*outps)[pos].Value().AsList();
       
   414                if(resultList != NULL )
       
   415                {
       
   416                if(resultList->Count() == listType->Count() && listType->Size() == resultList->Size())
       
   417                    {
       
   418                    result = TRUE;
       
   419                    } 
       
   420                }
       
   421             }
       
   422         /*Decrement count to delete the instance of list its self managed memory allocation*/      
       
   423         if (listType) listType->DecRef();
       
   424         pos = 0;
       
   425         outps->FindFirst(pos, EGenericParamError);
       
   426         
       
   427         if(pos != KErrNotFound)
       
   428             if ((*outps)[pos].Value().AsTInt32() == KErrNone && result)
       
   429                 flag = 1;
       
   430             else
       
   431                 flag = 0;
       
   432         else
       
   433             flag = 0;
       
   434         
       
   435         // Detach The MyServiceName Provider
       
   436         //iServiceHandler->DetachL(interest);    
       
   437         //CleanupStack::PopAndDestroy(criteria);
       
   438         //CleanupStack::PopAndDestroy(&interest);   
       
   439         
       
   440         return !flag;
       
   441     }
       
   442     
       
   443 TBool Cliwtestcases::LIW_DATA_TYPES_004( )
       
   444     {
       
   445         TBool flag = 0;
       
   446         CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   447         CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   448         
       
   449         /*Testing List Data Type for TLiwVariant interface and container interface*/
       
   450         TLiwGenericParam param;
       
   451         param.Value().Set(KLIW_DATA_TYPES_004);
       
   452         param.SetNameL(KTestPARAMNanmeTC1);
       
   453         inps->AppendL(param);
       
   454         param.Reset();
       
   455         /*Checks Default constructer "CLiwDefaultMap" Creation*/
       
   456         CLiwMap* mapType = CLiwDefaultMap::NewL();
       
   457         
       
   458         /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
       
   459         TLiwVariant contactNbr;
       
   460         TBuf8<32> contactName;
       
   461         for (TInt32 index = 100; index < 110; index++)
       
   462             {
       
   463             contactName.Format(KContact, index - 99);
       
   464             contactNbr.Set(index);
       
   465             mapType->InsertL(contactName, contactNbr);    
       
   466             }
       
   467             
       
   468         /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
       
   469         param.Value().Set(mapType);
       
   470         param.SetNameL(_L8("ContactNumbers"));
       
   471         inps->AppendL(param);
       
   472         
       
   473         contactNbr.Reset();
       
   474         param.Reset();
       
   475         
       
   476         CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   477         crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   478         iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
       
   479         CleanupStack::PopAndDestroy(crit); // crit
       
   480 
       
   481         TInt pos = 0;
       
   482         TBool result = FALSE;
       
   483         mapType->Remove(_L8("Contact 10"));
       
   484         outps->FindFirst(pos, _L8("ContactNumbers"));
       
   485         if(pos != KErrNotFound)
       
   486             {
       
   487                const CLiwMap* resultMap = (*outps)[pos].Value().AsMap();
       
   488                if(resultMap != NULL )
       
   489                    {
       
   490                    if( resultMap->Count() == mapType->Count() && mapType->Size() == resultMap->Size())
       
   491                        {
       
   492                        result = TRUE;
       
   493                        } 
       
   494                    }
       
   495             }
       
   496         /*Decrement count to delete the instance of Map its self managed memory allocation*/      
       
   497         if (mapType) mapType->DecRef();
       
   498         
       
   499         pos = 0;
       
   500         outps->FindFirst(pos, EGenericParamError);
       
   501         
       
   502         if(pos != KErrNotFound)
       
   503             if ((*outps)[pos].Value().AsTInt32() == KErrNone && result)
       
   504                 flag = 1;
       
   505             else
       
   506                 flag = 0;
       
   507         else
       
   508             flag = 0;
       
   509         
       
   510         return !flag;
       
   511     }
       
   512     
       
   513 TBool Cliwtestcases::LIW_DATA_TYPES_005( )
       
   514     {
       
   515     TBool flag = 0;
       
   516     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   517     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   518     
       
   519     /*Testing List Data Type for TLiwVariant interface and container interface*/
       
   520     TLiwGenericParam param;
       
   521     param.Value().Set(KLIW_DATA_TYPES_005);
       
   522     param.SetNameL(KTestPARAMNanmeTC1);
       
   523     inps->AppendL(param);
       
   524     param.Reset();
       
   525     
       
   526     /*Checks Default constructer "CLiwDefaultMap" and "CLiwDefaultMap" Creation*/
       
   527     CLiwMap* mapType = CLiwDefaultMap::NewL();
       
   528     CLiwList* listType = CLiwDefaultList::NewL();
       
   529     
       
   530     /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
       
   531     TLiwVariant intVairent;
       
   532     for (TInt32 index2 = 100; index2 < 110; index2++)
       
   533         {
       
   534         intVairent.Set(index2);
       
   535         listType->AppendL(intVairent);    
       
   536         }
       
   537         
       
   538     TBuf8<32> listName;
       
   539     TLiwVariant listVarient;
       
   540     listVarient.Set(listType);
       
   541     
       
   542     for (TInt32 index = 1; index < 11; index++)
       
   543         {
       
   544         listName.Format(KContact, index);
       
   545         mapType->InsertL(listName, listVarient);
       
   546         }
       
   547         
       
   548     listVarient.Reset();    
       
   549     /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
       
   550     param.Value().Set(mapType);
       
   551     param.SetNameL(_L8("MapOfLists"));
       
   552     
       
   553     inps->AppendL(param);
       
   554     
       
   555     param.Reset();
       
   556         
       
   557     
       
   558     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   559     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   560     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
       
   561     CleanupStack::PopAndDestroy(crit); // crit
       
   562 
       
   563     //remove the last list (10) and remove the last entry (9)in first List (0)
       
   564     mapType->Remove(_L8("Contact 10"));
       
   565     mapType->FindL(_L8("Contact 1"), listVarient);
       
   566     listVarient.Get(*listType);
       
   567     listType->Remove(9);
       
   568     
       
   569     listVarient.Reset();
       
   570     
       
   571     TInt pos = 0;
       
   572     TBool result = FALSE;
       
   573     outps->FindFirst(pos, _L8("MapOfLists"));
       
   574     if(pos != KErrNotFound)
       
   575         {
       
   576            const CLiwMap* resultMap = (*outps)[pos].Value().AsMap();
       
   577            if(resultMap != NULL && resultMap->Count() == mapType->Count() && mapType->Size() == resultMap->Size())
       
   578            {
       
   579            TBuf8<32> mapKey;
       
   580            resultMap->AtL(0, mapKey);
       
   581            resultMap->FindL(mapKey, listVarient);
       
   582            if(listVarient.AsList() != NULL )
       
   583                {
       
   584                if (listVarient.AsList()->Count() == listType->Count() && listType->Size() == listVarient.AsList()->Size())
       
   585                    {
       
   586                    result = TRUE; 
       
   587                    }
       
   588                }
       
   589            }
       
   590            listVarient.Reset();
       
   591         }
       
   592     
       
   593     
       
   594     pos = 0;
       
   595     outps->FindFirst(pos, EGenericParamError);
       
   596     
       
   597     if(pos != KErrNotFound)
       
   598         if ((*outps)[pos].Value().AsTInt32() == KErrNone && result)
       
   599             flag = 1;
       
   600         else
       
   601             flag = 0;
       
   602     else
       
   603         flag = 0;
       
   604     
       
   605     //Decrement count to delete the instance of Map its self managed memory allocation
       
   606     inps->Reset();
       
   607     outps->Reset();
       
   608     if (mapType) mapType->DecRef();
       
   609     if (listType) listType->DecRef();
       
   610     
       
   611     return !flag;
       
   612     }
       
   613 
       
   614 TBool Cliwtestcases::LIW_DATA_TYPES_006( )
       
   615     {
       
   616     TBool flag = 0;    
       
   617     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   618     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   619     TLiwGenericParam param;
       
   620     param.Value().Set(KLIW_DATA_TYPES_006);
       
   621     param.SetNameL(KTestPARAMNanmeTC1);
       
   622     inps->AppendL(param);
       
   623     param.Reset();
       
   624       
       
   625     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   626     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   627     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
       
   628     CleanupStack::PopAndDestroy(crit); // crit
       
   629     
       
   630     TInt pos = 0;
       
   631     MLiwInterface* ifp = NULL;
       
   632     outps->FindFirst(pos, KLIW_DATA_TYPES_006);
       
   633     if(pos != KErrNotFound)
       
   634         {
       
   635         ifp = (*outps)[pos].Value().AsInterface();
       
   636         outps->Reset();
       
   637         ifp->ExecuteCmdL(KLIW_DATA_TYPES_006, *inps, *outps);      
       
   638         }
       
   639     else
       
   640         {
       
   641         flag = 0;
       
   642         }
       
   643     pos = 0;
       
   644     outps->FindFirst(pos, EGenericParamError);
       
   645     if(pos != KErrNotFound)
       
   646         if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
   647             flag = 1;
       
   648         else
       
   649             flag = 0;
       
   650     else
       
   651         flag = 0;
       
   652     
       
   653     if(ifp) ifp->Close();
       
   654     inps->Reset();
       
   655     outps->Reset();
       
   656     return !flag;
       
   657     }
       
   658 
       
   659 TBool Cliwtestcases::LIW_DATA_TYPES_007( )
       
   660     {
       
   661     TBool flag = 0;
       
   662     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   663     TLiwGenericParam param;
       
   664     CLiwList* listType = CLiwDefaultList::NewL();
       
   665     CLiwMap* mapType = CLiwDefaultMap::NewL();
       
   666     listType->AppendL(TLiwVariant(_L8("Testing Stream Operations")));  
       
   667     mapType->InsertL(KLIW_DATA_TYPES_007, TLiwVariant(listType));
       
   668     param.Value().Set(mapType);
       
   669     param.SetNameL(KTestPARAMNanmeTC1);
       
   670     inps->AppendL(param);
       
   671     
       
   672     param.Reset();
       
   673     if (listType) listType->DecRef();
       
   674     if (mapType) mapType->DecRef();
       
   675     
       
   676     TInt sz = inps->Size();
       
   677     TAny* buf = User::AllocL(sz);
       
   678     RMemWriteStream ws(buf, sz);
       
   679     inps->ExternalizeL(ws);
       
   680     RMemReadStream rs(buf, sz);
       
   681     CLiwGenericParamList* ltmp = &(iServiceHandler->OutParamListL());
       
   682     ltmp->InternalizeL(rs);
       
   683     if ((ltmp->Count() == inps->Count()) && ((*inps)[0] == (*ltmp)[0]))
       
   684         flag = 1;
       
   685     else
       
   686         flag = 0;
       
   687     User::Free(buf);
       
   688     return !flag;
       
   689     }
       
   690 
       
   691 TBool Cliwtestcases::LIW_DATA_TYPES_008( )
       
   692     {
       
   693     TBool flag = 0;
       
   694     /*Checks Default constructer "CLiwDefaultList" Creation*/
       
   695     CLiwList* listType = CLiwDefaultList::NewL();
       
   696     CLiwList* resultList;
       
   697     
       
   698     /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
       
   699     TLiwVariant intVairent;
       
   700     for (TInt32 index = 100; index < 110; index++)
       
   701         {
       
   702         intVairent.Set(index);
       
   703         listType->AppendL(intVairent);    
       
   704         }
       
   705     
       
   706     intVairent.Reset();    
       
   707     TBool result = TRUE;
       
   708     
       
   709     // Checking Bound conditions
       
   710     resultList = listType;
       
   711     resultList->Remove(listType->Count() + 1);
       
   712     resultList->Remove(-1);
       
   713     if (resultList != listType)
       
   714         result = FALSE;
       
   715     result ? result = !(listType->AtL(listType->Count() + 1, intVairent)): result = FALSE;
       
   716     result ? result = !(listType->AtL(-1, intVairent)) : result = FALSE;      
       
   717     
       
   718     if(result == TRUE)
       
   719         {
       
   720         flag = 1;
       
   721         }
       
   722     else
       
   723         {
       
   724         flag = 0;
       
   725         }
       
   726     /*Decrement count to delete the instance of list its self managed memory allocation*/      
       
   727     if (listType) listType->DecRef(); 
       
   728     return !flag;
       
   729     }
       
   730     
       
   731 TBool Cliwtestcases::LIW_DATA_TYPES_009( )
       
   732     {
       
   733     TBool flag = 0;
       
   734     /*Checks Default constructer "CLiwDefaultMap" Creation*/
       
   735     CLiwMap* mapType = CLiwDefaultMap::NewL();
       
   736     CLiwMap* resultMap;
       
   737     
       
   738     /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
       
   739     TLiwVariant contactNbr;
       
   740     TBuf8<32> contactName;
       
   741     for (TInt32 index = 100; index < 110; index++)
       
   742         {
       
   743         contactName.Format(KContact, index - 99);
       
   744         contactNbr.Set(index);
       
   745         mapType->InsertL(contactName, contactNbr);    
       
   746         }
       
   747         
       
   748     /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
       
   749        
       
   750     contactNbr.Reset();
       
   751     contactName.FillZ();
       
   752     contactName.Zero();
       
   753     TBool result = TRUE;
       
   754         
       
   755     // Checking Bound conditions
       
   756     resultMap = mapType;
       
   757     resultMap->Remove(_L8("Contact 11"));
       
   758     if (resultMap != mapType)
       
   759         result = FALSE;
       
   760     result ? result = !(mapType->AtL(mapType->Count() + 1, contactName)) : result = FALSE;
       
   761     result ? result = !(mapType->AtL(-1, contactName) ): result = FALSE;
       
   762     
       
   763     
       
   764     if(result == TRUE)
       
   765         {
       
   766         flag = 1;
       
   767         }
       
   768     else
       
   769         {
       
   770         flag = 0;
       
   771         }
       
   772     /*Decrement count to delete the instance of list its self managed memory allocation*/      
       
   773     if (mapType) mapType->DecRef();
       
   774     return !flag;
       
   775     }
       
   776     
       
   777 TBool Cliwtestcases::LIW_Map_AtL_New( )
       
   778     {
       
   779     TBool flag = 0;
       
   780     /*Checks Default constructer "CLiwDefaultMap" Creation*/
       
   781     CLiwDefaultMap* mapType = CLiwDefaultMap::NewL();
       
   782     CLiwDefaultMap* resultMap;
       
   783     
       
   784     /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
       
   785     TLiwVariant contactNbr;
       
   786     TBuf8<32> contactName;
       
   787     for (TInt32 index = 100; index < 110; index++)
       
   788         {
       
   789         contactName.Format(KContact, index - 99);
       
   790         contactNbr.Set(index);
       
   791         mapType->InsertL(contactName, contactNbr);    
       
   792         }
       
   793         
       
   794     /*Checks CLiwList::TLiwVariant.Set(CLiwMap*)*/  
       
   795        
       
   796     contactNbr.Reset();
       
   797     contactName.FillZ();
       
   798     contactName.Zero();
       
   799     TBool result = TRUE;
       
   800         
       
   801     // Checking Bound conditions
       
   802     resultMap = mapType;
       
   803     resultMap->Remove(_L8("Contact 11"));
       
   804     if (resultMap != mapType)
       
   805         result = FALSE;
       
   806     
       
   807     TRAPD(err1, contactName = mapType->AtL(mapType->Count() + 1));
       
   808     
       
   809     //result ? result = !(contactName.operator==(KNullDesC8)) : result = FALSE;
       
   810     
       
   811     TRAPD(err2, contactName = mapType->AtL(-1));
       
   812     
       
   813     //result ? result = !(contactName.operator==(KNullDesC8)): result = FALSE;
       
   814     
       
   815     if(err1 && err2)
       
   816         flag = 1;
       
   817     else
       
   818         flag = 0;
       
   819     
       
   820     
       
   821     /*
       
   822     if(err)
       
   823         flag = 0;
       
   824     
       
   825     if(result == TRUE)
       
   826         {
       
   827         flag = 1;
       
   828         }
       
   829     else
       
   830         {
       
   831         flag = 0;
       
   832         }
       
   833     */
       
   834     
       
   835     //Decrement count to delete the instance of list its self managed memory allocation
       
   836     if (mapType) mapType->DecRef();
       
   837     return !flag;
       
   838     }
       
   839 
       
   840 TBool Cliwtestcases::LIW_DATA_TYPES_010()
       
   841     {
       
   842     TBool flag = 0;
       
   843     /*Testing Unsigned Integer data Type*/
       
   844     TLiwGenericParam param;
       
   845     param.Value().Set(KLIW_DATA_TYPES_010);
       
   846     param.SetNameL(KTestPARAMNanmeTC1);
       
   847     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   848     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   849     inps->AppendL(param);
       
   850     param.Reset();
       
   851     
       
   852     // Set up Tbool varient and append Unsigned Integer parameter (EGenericParamError).
       
   853     // One Argument constructer
       
   854     TUint arg = 10; 
       
   855     TLiwVariant uIntVarient(arg);
       
   856     // Test TLiwVariant::SetL(TLiwVariant&)
       
   857     TLiwGenericParam uIntParam(EGenericParamError);
       
   858     uIntParam.Value().SetL(uIntVarient);
       
   859     
       
   860     inps->AppendL(uIntParam);
       
   861     
       
   862     uIntVarient.Reset();
       
   863     uIntParam.Reset();
       
   864     
       
   865     // Call ExecuteServiceCmdL TO GET THE RESULT
       
   866     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   867     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   868     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
       
   869     CleanupStack::PopAndDestroy(crit); // crit
       
   870     
       
   871     // CHECK RESULT 
       
   872     TInt pos = 0;
       
   873     outps->FindFirst(pos, EGenericParamError);
       
   874     
       
   875     if(pos != KErrNotFound)
       
   876         {
       
   877             if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
   878                 {
       
   879                 flag = 1;
       
   880                 }
       
   881             else
       
   882                 {
       
   883                 
       
   884                 flag = 0;
       
   885                 }
       
   886         }
       
   887      else
       
   888         {
       
   889         
       
   890         flag = 0;
       
   891         }
       
   892     return !flag;
       
   893     }   
       
   894  
       
   895 //CHECK FROM HERE
       
   896 
       
   897 TBool Cliwtestcases::LIW_DATA_TYPES_011()
       
   898     {
       
   899     TBool flag = 0;
       
   900     TLiwGenericParam param;
       
   901     param.Value().Set(KLIW_DATA_TYPES_011);
       
   902     param.SetNameL(KTestPARAMNanmeTC1);
       
   903     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   904     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   905     inps->AppendL(param);
       
   906     param.Reset();
       
   907     
       
   908     // Call ExecuteServiceCmdL TO GET THE RESULT
       
   909     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   910     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   911     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
       
   912     CleanupStack::PopAndDestroy(crit); // crit
       
   913     
       
   914     // CHECK RESULT 
       
   915     TInt pos = 0;
       
   916     outps->FindFirst(pos, EGenericParamError);
       
   917     
       
   918     if(pos != KErrNotFound)
       
   919         {
       
   920             if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
   921                 {
       
   922                 
       
   923                 _LIT8(KIter,"Iterator");
       
   924                 TInt iterPos=0;
       
   925                 outps->FindFirst(iterPos, KIter);
       
   926                 if(pos != KErrNotFound)
       
   927                 {
       
   928                     CLiwIterable* pIter=(*outps)[iterPos].Value().AsIterable();
       
   929                     
       
   930                     //Iterate over the list
       
   931                     TLiwVariant var;
       
   932                     
       
   933                     while(EFalse != pIter->NextL(var))
       
   934                     {       
       
   935                         TPtrC8 entry;
       
   936                         var.Get(entry);
       
   937                         
       
   938                         if(0==entry.Length())
       
   939                         {
       
   940                             flag = 0;                               
       
   941                         }                       
       
   942                     }
       
   943                     
       
   944                     var.Reset();
       
   945                     
       
   946                 }
       
   947                 else
       
   948                 {
       
   949                     flag = 0;
       
   950                 }
       
   951                 
       
   952                 flag = 1;
       
   953                 }
       
   954             else
       
   955                 {
       
   956                 flag = 0;
       
   957                 }
       
   958         }
       
   959      else
       
   960         {
       
   961         
       
   962         flag = 0;
       
   963         }
       
   964     return !flag;
       
   965     }   
       
   966     
       
   967  TBool Cliwtestcases::LIW_DATA_TYPES_012()
       
   968     {
       
   969     TBool flag = 0;
       
   970     TLiwGenericParam param;
       
   971     param.Value().Set(KLIW_DATA_TYPES_012);
       
   972     param.SetNameL(KTestPARAMNanmeTC1);
       
   973     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   974     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   975     inps->AppendL(param);
       
   976     param.Reset();
       
   977     
       
   978     // Call ExecuteServiceCmdL TO GET THE RESULT
       
   979     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
   980     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   981     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
       
   982     CleanupStack::PopAndDestroy(crit); // crit
       
   983     
       
   984     // CHECK RESULT 
       
   985     TInt pos = 0;
       
   986     outps->FindFirst(pos, EGenericParamError);
       
   987     
       
   988     if(pos != KErrNotFound)
       
   989         {
       
   990             if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
   991                 {                
       
   992                 flag = 1;
       
   993                 }
       
   994             else
       
   995                 {
       
   996                 flag = 0;
       
   997                 }
       
   998         }
       
   999      else
       
  1000         {
       
  1001         
       
  1002         flag = 0;
       
  1003         }
       
  1004     return !flag;
       
  1005     }   
       
  1006     
       
  1007     
       
  1008  TBool Cliwtestcases::LIW_DATA_TYPES_013()
       
  1009     {
       
  1010         TBool flag = 0;    
       
  1011         CLiwList* pList = CLiwDefaultList::NewL();
       
  1012         
       
  1013         {
       
  1014             TLiwVariant intVairent;
       
  1015             for (TInt32 index = 100; index < 110; index++)
       
  1016                 {
       
  1017                 intVairent.Set(index);
       
  1018                 pList->AppendL(intVairent);    
       
  1019                 }   
       
  1020         }
       
  1021         
       
  1022         if(EFalse == (pList->operator==(*pList)))
       
  1023         {   
       
  1024             flag = 0;
       
  1025         }
       
  1026         
       
  1027         CLiwList* pAnotherList = CLiwDefaultList::NewL();
       
  1028         
       
  1029         {
       
  1030             TLiwVariant intVairent;
       
  1031             for (TInt32 index = 100; index < 110; index++)
       
  1032                 {
       
  1033                 intVairent.Set(index);
       
  1034                 pAnotherList->AppendL(intVairent);    
       
  1035                 }
       
  1036         }
       
  1037         
       
  1038         
       
  1039         if(EFalse == (pList->operator==(*pAnotherList)))
       
  1040         {
       
  1041              flag = 0;
       
  1042         }
       
  1043                 
       
  1044         pAnotherList->Remove(0);
       
  1045         
       
  1046         if(EFalse == (pList->operator==(*pAnotherList)))
       
  1047         {
       
  1048             flag = 1;
       
  1049         }
       
  1050         else
       
  1051         {
       
  1052             flag = 0;
       
  1053         }   
       
  1054     if(pList) pList->DecRef();
       
  1055     if(pAnotherList) pAnotherList->DecRef();
       
  1056     return !flag;
       
  1057    }
       
  1058     
       
  1059 TBool Cliwtestcases::LIW_DATA_TYPES_014()
       
  1060     {
       
  1061         TBool flag = 0; 
       
  1062         CLiwMap* pMap = CLiwDefaultMap::NewL();
       
  1063         
       
  1064         {
       
  1065             /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
       
  1066             TLiwVariant contactNbr;
       
  1067             TBuf8<32> contactName;
       
  1068             for (TInt32 index = 100; index < 110; index++)
       
  1069                 {
       
  1070                 contactName.Format(KContact, index - 99);
       
  1071                 contactNbr.Set(index);
       
  1072                 pMap->InsertL(contactName, contactNbr);    
       
  1073                 }
       
  1074         }
       
  1075         
       
  1076         if(EFalse == (pMap->operator==(*pMap)))
       
  1077         {   
       
  1078             flag = 0;
       
  1079         }
       
  1080         
       
  1081         CLiwMap* pAnotherMap = CLiwDefaultMap::NewL();
       
  1082         TBuf8<32> keyToRem;
       
  1083         
       
  1084         {
       
  1085             /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
       
  1086             TLiwVariant contactNbr;
       
  1087             TBuf8<32> contactName;
       
  1088             for (TInt32 index = 100; index < 110; index++)
       
  1089                 {
       
  1090                 contactName.Format(KContact, index - 99);
       
  1091                 contactNbr.Set(index);
       
  1092                 pAnotherMap->InsertL(contactName, contactNbr);  
       
  1093                 
       
  1094                 if(100==index)
       
  1095                     keyToRem.Copy(contactName);
       
  1096                 }
       
  1097         }
       
  1098         
       
  1099         if(EFalse == (pMap->operator==(*pAnotherMap)))
       
  1100         {
       
  1101              flag = 0;
       
  1102         }
       
  1103         
       
  1104         pAnotherMap->Remove(keyToRem);
       
  1105         
       
  1106         if(EFalse == (pMap->operator==(*pAnotherMap)))
       
  1107         {
       
  1108             flag = 1;
       
  1109         }
       
  1110         else
       
  1111         {
       
  1112             flag = 0;
       
  1113         }   
       
  1114         if(pMap) pMap->DecRef();
       
  1115         if(pAnotherMap) pAnotherMap->DecRef();
       
  1116         return !flag;
       
  1117     }
       
  1118     
       
  1119 TBool Cliwtestcases::LIW_DATA_TYPES_015()
       
  1120     {
       
  1121          
       
  1122          TBool flag = 1;
       
  1123          TInt32 intVal=10;
       
  1124          TLiwVariant intVar((TInt32)intVal);
       
  1125          
       
  1126          {//integer check
       
  1127             TInt32 intRet;
       
  1128             intVar.Get(intRet);
       
  1129             
       
  1130             Dump(intVar);
       
  1131             
       
  1132             if(intRet!=intVal)
       
  1133             {
       
  1134                 flag = 0;
       
  1135             }       
       
  1136             
       
  1137          }
       
  1138          
       
  1139          {//RFile check
       
  1140             RFile fileRet;
       
  1141             if(EFalse!=intVar.Get(fileRet))
       
  1142             {
       
  1143                 flag = 0;
       
  1144             }           
       
  1145             fileRet.Close();            
       
  1146          }
       
  1147          
       
  1148          {//Uid check
       
  1149             TUid uidRet;
       
  1150             if(EFalse!=intVar.Get(uidRet))
       
  1151             {
       
  1152                 flag = 0;
       
  1153             }           
       
  1154          }
       
  1155          
       
  1156          {//TUint check
       
  1157             TUint uintRet;
       
  1158             if(EFalse==intVar.Get(uintRet))
       
  1159             {
       
  1160                 flag = 0;
       
  1161             }           
       
  1162          }
       
  1163          
       
  1164          {//TBool check
       
  1165             TBool boolRet=EFalse;
       
  1166             if(EFalse!=intVar.Get(boolRet))
       
  1167             {
       
  1168                 flag = 0;
       
  1169             }           
       
  1170          }
       
  1171          
       
  1172          {//TPtrC check
       
  1173             TPtrC ptrcRet;
       
  1174             if(EFalse!=intVar.Get(ptrcRet))
       
  1175             {
       
  1176                 flag = 0;
       
  1177             }           
       
  1178          }
       
  1179          
       
  1180          {//TTime check
       
  1181             TTime timeRet;
       
  1182             if(EFalse!=intVar.Get(timeRet))
       
  1183             {
       
  1184                 flag = 0;
       
  1185             }           
       
  1186          }
       
  1187          
       
  1188          {//TPtrC8 check
       
  1189             TPtrC8 ptrcRet;
       
  1190             if(EFalse!=intVar.Get(ptrcRet))
       
  1191             {
       
  1192                 flag = 0;
       
  1193             }           
       
  1194          }
       
  1195          
       
  1196          {
       
  1197             TLiwVariant boolVar((TBool)EFalse);
       
  1198             
       
  1199             /*TInt32 intRet;
       
  1200             if(EFalse!=boolVar.Get((TInt32)intRet))
       
  1201             {
       
  1202                 flag = 0;
       
  1203             }*/
       
  1204          }
       
  1205          
       
  1206          {//TInt64 check
       
  1207                      TInt64 int64Ret;
       
  1208                      if(EFalse==intVar.Get(int64Ret))
       
  1209                      {
       
  1210                          flag = 0;
       
  1211                      }           
       
  1212          }
       
  1213          
       
  1214          {//TReal check
       
  1215                      TReal realRet;
       
  1216                      if(EFalse==intVar.Get(realRet))
       
  1217                      {
       
  1218                          flag = 0;
       
  1219                      }           
       
  1220          }
       
  1221          return !flag;           
       
  1222     }
       
  1223     
       
  1224 TBool Cliwtestcases::LIW_DATA_TYPES_016()
       
  1225 {
       
  1226      TBool flag = 1;
       
  1227      TInt32 intVal=10;
       
  1228      TLiwVariant intVar((TInt32)intVal);
       
  1229      
       
  1230      {//AsList check
       
  1231         const CLiwList* pRetList=intVar.AsList();
       
  1232         
       
  1233         if(NULL!=pRetList)
       
  1234         {
       
  1235             flag = 0;
       
  1236         }
       
  1237      }
       
  1238      
       
  1239      {//AsMap check
       
  1240         const CLiwMap* pRetMap=intVar.AsMap();
       
  1241         
       
  1242         if(NULL!=pRetMap)
       
  1243         {
       
  1244             flag = 0;
       
  1245         }
       
  1246      }
       
  1247      
       
  1248      {//AsIterable check
       
  1249         CLiwIterable* pRet=intVar.AsIterable();
       
  1250         
       
  1251         if(NULL!=pRet)
       
  1252         {
       
  1253             flag = 0;
       
  1254         }
       
  1255      }
       
  1256      
       
  1257      {//AsInterface check
       
  1258         MLiwInterface* pRet=intVar.AsInterface();
       
  1259         
       
  1260         if(NULL!=pRet)
       
  1261         {
       
  1262             flag = 0;
       
  1263         }
       
  1264      }
       
  1265      
       
  1266      {//AsFileHandle check
       
  1267         RFile pRet=intVar.AsFileHandle();
       
  1268         
       
  1269         //Don't check pRet for RFile
       
  1270      }
       
  1271      
       
  1272      {
       
  1273          CLiwBuffer* pRet = intVar.AsBuffer();
       
  1274          if(NULL!=pRet)
       
  1275                  {
       
  1276                      flag = 0;
       
  1277                  }
       
  1278      }
       
  1279      
       
  1280      {
       
  1281          TInt64 pRet = intVar.AsTInt64();
       
  1282          if(pRet != NULL)
       
  1283              flag = 1;
       
  1284      }
       
  1285      
       
  1286      {
       
  1287          const TTime pRet = intVar.AsTTime();
       
  1288      }
       
  1289      
       
  1290      {
       
  1291          TUid pRet = intVar.AsTUid();
       
  1292      }
       
  1293      
       
  1294      {
       
  1295          TBool pRet = intVar.AsTBool();
       
  1296      }
       
  1297      return !flag;           
       
  1298 }
       
  1299 
       
  1300 TBool Cliwtestcases::LIW_DATA_TYPES_017()
       
  1301 {
       
  1302     TBool flag = 0;
       
  1303     TInt intServiceCmd=100;
       
  1304     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, intServiceCmd, KContentTypeTxt);
       
  1305     
       
  1306     TBuf8<8> retStr=criteria->ServiceCmdStr();
       
  1307     if(0!=retStr.Length())
       
  1308     {
       
  1309         CleanupStack::PopAndDestroy(criteria);
       
  1310         flag = 0;
       
  1311     }
       
  1312     
       
  1313     if(intServiceCmd==criteria->ServiceCmd())
       
  1314     {
       
  1315         CleanupStack::PopAndDestroy(criteria);
       
  1316         flag = 1;
       
  1317     }
       
  1318     return !flag;
       
  1319 }
       
  1320 
       
  1321 TBool Cliwtestcases::LIW_DATA_TYPES_018()
       
  1322 {
       
  1323     TBool flag = 1;
       
  1324     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL();
       
  1325     CleanupStack::PushL(criteria);
       
  1326     
       
  1327     
       
  1328     TBuf8<8> retStr=criteria->ServiceCmdStr();
       
  1329     if(0!=retStr.Length())
       
  1330     {
       
  1331         flag = 0;
       
  1332     }
       
  1333     
       
  1334     if(0!=criteria->ServiceCmd())
       
  1335     {
       
  1336         flag = 0;
       
  1337     }
       
  1338     
       
  1339     CleanupStack::PopAndDestroy(criteria);
       
  1340     
       
  1341     return !flag;
       
  1342 }
       
  1343 
       
  1344 TBool Cliwtestcases::LIW_DATA_TYPES_019()
       
  1345 {
       
  1346     TBool flag = 0;
       
  1347     /*Testing String Based Command*/
       
  1348     RCriteriaArray interest;
       
  1349     CleanupClosePushL(interest);
       
  1350     
       
  1351     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
  1352     
       
  1353     criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  1354 
       
  1355     interest.AppendL(criteria);
       
  1356     
       
  1357    // Attach the MyServiceName provider to the LIW framework.
       
  1358     TInt status = iServiceHandler->AttachL(interest);
       
  1359         
       
  1360     TLiwGenericParam param;
       
  1361     param.Value().Set(KLIW_DATA_TYPES_019);
       
  1362     param.SetNameL(KTestPARAMNanmeTC1);
       
  1363     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
  1364     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
  1365     inps->AppendL(param);
       
  1366     param.Reset();
       
  1367     
       
  1368     // Get the Test result from MyServiceName provider "ExecuteServiceCmdL"
       
  1369     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
  1370     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  1371     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps);  
       
  1372     CleanupStack::PopAndDestroy(crit); // crit
       
  1373  
       
  1374     
       
  1375     TInt pos = 0;
       
  1376     outps->FindFirst(pos, EGenericParamError);
       
  1377     
       
  1378     if(pos != KErrNotFound)
       
  1379         {
       
  1380             if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
  1381                 {
       
  1382                 flag = 1;
       
  1383                 }
       
  1384             else
       
  1385                 {
       
  1386                 
       
  1387                 flag = 0;
       
  1388                 }
       
  1389         }
       
  1390      else
       
  1391         {
       
  1392         flag = 0;
       
  1393         }
       
  1394 
       
  1395     // Detach The MyServiceName Provider
       
  1396     iServiceHandler->DetachL(interest);    
       
  1397     
       
  1398     CleanupStack::PopAndDestroy(criteria);
       
  1399     CleanupStack::PopAndDestroy(&interest);   
       
  1400     return !flag;
       
  1401 }
       
  1402 
       
  1403 TBool Cliwtestcases::LIW_DATA_TYPES_020()
       
  1404 {
       
  1405     TBool flag = 1;
       
  1406     TLiwVariant lhsVar;
       
  1407     TLiwVariant rhsVar;
       
  1408     
       
  1409     if(EFalse == (lhsVar==rhsVar))
       
  1410     {
       
  1411         //Not matching - test case fails        
       
  1412         flag = 0;        
       
  1413     }
       
  1414     
       
  1415     
       
  1416     {//For TUint check
       
  1417         lhsVar.Set(TUint(10));
       
  1418         rhsVar.Set(TUint(0));
       
  1419         
       
  1420         if(EFalse != (lhsVar==rhsVar))
       
  1421         {
       
  1422             //Not matching - test case fails        
       
  1423             flag = 0;        
       
  1424         }
       
  1425         
       
  1426         rhsVar.Set(TUint(10));
       
  1427         
       
  1428         //should match this time
       
  1429         if(EFalse == (lhsVar==rhsVar))
       
  1430         {
       
  1431             flag = 0;        
       
  1432         }
       
  1433     
       
  1434     }
       
  1435     
       
  1436     {//For TInt32 check
       
  1437         lhsVar.Set(TInt32(10));
       
  1438         rhsVar.Set(TInt32(0));
       
  1439         
       
  1440         if(EFalse != (lhsVar==rhsVar))
       
  1441         {
       
  1442             //Not matching - test case fails        
       
  1443             flag = 0;        
       
  1444         }
       
  1445         
       
  1446         rhsVar.Set(TInt32(10));
       
  1447         
       
  1448         //should match this time
       
  1449         if(EFalse == (lhsVar==rhsVar))
       
  1450         {
       
  1451             //Not matching - test case fails        
       
  1452             flag = 0;        
       
  1453         }
       
  1454     
       
  1455     }
       
  1456     
       
  1457     {//For  TBool check
       
  1458         lhsVar.Set(TBool(EFalse));
       
  1459         rhsVar.Set(TBool(ETrue));
       
  1460         
       
  1461         if(EFalse != (lhsVar==rhsVar))
       
  1462         {
       
  1463             //Not matching - test case fails        
       
  1464             flag = 0;        
       
  1465         }
       
  1466         
       
  1467         rhsVar.Set(TBool(EFalse));
       
  1468         
       
  1469         //should match this time
       
  1470         if(EFalse == (lhsVar==rhsVar))
       
  1471         {
       
  1472             //Not matching - test case fails        
       
  1473             flag = 0;        
       
  1474         }
       
  1475     
       
  1476     }
       
  1477     
       
  1478     {//For  TTime check
       
  1479         lhsVar.Set(TTime(100));
       
  1480         rhsVar.Set(TTime(200));
       
  1481         
       
  1482         if(EFalse != (lhsVar==rhsVar))
       
  1483         {
       
  1484             //Not matching - test case fails        
       
  1485             flag = 0;        
       
  1486         }
       
  1487         
       
  1488         rhsVar.Set(TTime(100));
       
  1489         
       
  1490         //should match this time
       
  1491         if(EFalse == (lhsVar==rhsVar))
       
  1492         {
       
  1493             //Not matching - test case fails        
       
  1494             flag = 0;        
       
  1495         }
       
  1496     
       
  1497     }
       
  1498     return !flag;
       
  1499 }
       
  1500 
       
  1501 TBool Cliwtestcases::LIW_DATA_TYPES_021()
       
  1502 {
       
  1503     TBool flag = 1;
       
  1504     /*
       
  1505     TLiwGenericParam param;
       
  1506     param.Value().Set(KLIW_DATA_TYPES_001);
       
  1507     param.SetNameL(KTestPARAMNanmeTC1);
       
  1508     */
       
  1509     
       
  1510     //CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
  1511     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
  1512     
       
  1513     //inps->AppendL(param);
       
  1514     //param.Reset();
       
  1515     
       
  1516     TInt pos = -1;
       
  1517     outps->FindFirst(pos, EGenericParamError);
       
  1518     
       
  1519     
       
  1520     if(pos != KErrNotFound)
       
  1521         {
       
  1522             flag = 0;            
       
  1523         }
       
  1524 
       
  1525     pos = 0;
       
  1526     outps->FindFirst(pos, EGenericParamError);
       
  1527     if(pos != KErrNotFound)
       
  1528         {
       
  1529             flag = 0;            
       
  1530         }  
       
  1531         
       
  1532     pos = -1;
       
  1533     outps->FindNext(pos, EGenericParamError);
       
  1534     
       
  1535     if(pos != KErrNotFound)
       
  1536         {
       
  1537             flag = 0;            
       
  1538         }
       
  1539 
       
  1540     pos = 0;
       
  1541     outps->FindNext(pos, EGenericParamError);
       
  1542     if(pos != KErrNotFound)
       
  1543         {
       
  1544             flag = 0;            
       
  1545         }               
       
  1546     return !flag;
       
  1547 }
       
  1548 
       
  1549 TBool Cliwtestcases::LIW_DATA_TYPES_022()
       
  1550 {
       
  1551     TBool flag = 0; 
       
  1552     TLiwGenericParam param;
       
  1553     param.Value().Set(TInt32(100));
       
  1554     
       
  1555     Dump(param.Value());
       
  1556     
       
  1557     param.SetNameL(KTestPARAMNanmeTC1);
       
  1558     
       
  1559     CLiwGenericParamList* pParamList = CLiwGenericParamList::NewLC();
       
  1560     pParamList->AppendL(param);
       
  1561     
       
  1562     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
  1563     
       
  1564     inps->AppendL(*pParamList);
       
  1565     
       
  1566     TInt cnt = inps->Count();
       
  1567 
       
  1568     if(cnt != 0)
       
  1569         {            
       
  1570             flag = 1;                        
       
  1571         }
       
  1572         else
       
  1573         {
       
  1574             flag = 0;
       
  1575         }
       
  1576     
       
  1577     param.Reset();
       
  1578     inps->Reset();
       
  1579     CleanupStack::PopAndDestroy(pParamList);
       
  1580     return !flag;
       
  1581 }
       
  1582 
       
  1583 TBool Cliwtestcases::LIW_DATA_TYPES_023()
       
  1584 {
       
  1585     TBool flag = 0;
       
  1586     //Reusing LIW_DATA_TYPES_011 test case
       
  1587     TLiwGenericParam param;
       
  1588     param.Value().Set(KLIW_DATA_TYPES_011);
       
  1589     
       
  1590     Dump(param.Value());
       
  1591     
       
  1592     param.SetNameL(KTestPARAMNanmeTC1);
       
  1593     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
  1594     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
  1595     inps->AppendL(param);
       
  1596     param.Reset();
       
  1597     
       
  1598     // Call ExecuteServiceCmdL TO GET THE RESULT
       
  1599     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
  1600     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  1601     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
       
  1602     CleanupStack::PopAndDestroy(crit); // crit
       
  1603     
       
  1604     // CHECK RESULT 
       
  1605     TInt pos = 0;
       
  1606     outps->FindFirst(pos, EGenericParamError);
       
  1607     
       
  1608     if(pos != KErrNotFound)
       
  1609         {
       
  1610             if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
  1611                 {
       
  1612                 
       
  1613                 _LIT8(KIter,"Iterator");
       
  1614                 TInt iterPos=0;
       
  1615                 outps->FindFirst(iterPos, KIter);
       
  1616                 if(pos != KErrNotFound)
       
  1617                 {
       
  1618                     CLiwIterable* pIter=(*outps)[iterPos].Value().AsIterable();
       
  1619                     
       
  1620                     RWriteStream wstream;
       
  1621                     TRAPD(err,pIter->ExternalizeL(wstream));
       
  1622                     
       
  1623                     if(KErrNotSupported!=err)
       
  1624                     {
       
  1625                         flag = 0;   
       
  1626                     }
       
  1627                     else
       
  1628                     {
       
  1629                         flag = 1;
       
  1630                     }
       
  1631                 }
       
  1632                 else
       
  1633                 {
       
  1634                     flag = 0;
       
  1635                 }
       
  1636                 }
       
  1637             else
       
  1638                 {
       
  1639                 flag = 0;
       
  1640                 }
       
  1641         }
       
  1642      else
       
  1643         {
       
  1644         flag = 0;
       
  1645         }
       
  1646      return !flag;        
       
  1647 }
       
  1648 
       
  1649 TBool Cliwtestcases::LIW_DATA_TYPES_024()
       
  1650 {
       
  1651     TBool flag = 1;
       
  1652     TLiwVariant intVar(TInt32(100));    
       
  1653     Dump(intVar);
       
  1654     
       
  1655     TLiwVariant nullVar;    
       
  1656     Dump(nullVar);
       
  1657     
       
  1658     Dump(TLiwVariant(TBool(ETrue)));    
       
  1659     
       
  1660     TLiwVariant uintVar(TUint(200));    
       
  1661     Dump(uintVar);
       
  1662     
       
  1663     Dump(TLiwVariant(TUid::Uid(0x00)));    
       
  1664     
       
  1665     TLiwVariant timeVar(TTime(100));    
       
  1666     Dump(timeVar);    
       
  1667 
       
  1668     RFile fHdl;
       
  1669     TLiwVariant fHdlVar;
       
  1670     fHdlVar.Set(fHdl);
       
  1671     
       
  1672     Dump(fHdlVar);  
       
  1673     
       
  1674     TBuf8<16> buff(_L8("Hello"));
       
  1675     TLiwVariant bufVar(buff);
       
  1676     
       
  1677     Dump(bufVar);
       
  1678     
       
  1679     CLiwList* listType = CLiwDefaultList::NewL();
       
  1680     
       
  1681     /*Create list of 10 integer Varient Checks CLiwList::AppendL*/
       
  1682     TLiwVariant intVairent;
       
  1683     for (TInt32 index = 100; index < 110; index++)
       
  1684         {
       
  1685         intVairent.Set(index);
       
  1686         listType->AppendL(intVairent);    
       
  1687         }
       
  1688         
       
  1689     Dump(TLiwVariant(listType));
       
  1690     
       
  1691     listType->DecRef();
       
  1692     
       
  1693     CLiwMap* mapType = CLiwDefaultMap::NewL();
       
  1694     
       
  1695     /*Create Map of 10 integer Varient Checks CLiwMap::InsertL*/
       
  1696     TLiwVariant contactNbr;
       
  1697     TBuf8<32> contactName;
       
  1698     for (TInt32 index = 100; index < 110; index++)
       
  1699         {
       
  1700         contactName.Format(KContact, index - 99);
       
  1701         contactNbr.Set(index);
       
  1702         mapType->InsertL(contactName, contactNbr);    
       
  1703         }
       
  1704         
       
  1705     Dump(TLiwVariant(mapType));
       
  1706     mapType->DecRef();
       
  1707     return !flag;     
       
  1708 }
       
  1709 
       
  1710 TBool Cliwtestcases::LIW_CLEANUP_LIW_001()
       
  1711 {
       
  1712     TBool flag = 1;
       
  1713     iServiceHandler->Reset();
       
  1714     delete iServiceHandler;
       
  1715     iServiceHandler=NULL;
       
  1716     return !flag;
       
  1717 }
       
  1718 
       
  1719 //for conversion utils
       
  1720 TBool Cliwtestcases::LIW_DATA_TYPES_025()
       
  1721 {
       
  1722     TLiwVariant a1;
       
  1723     TUint varUint;
       
  1724     TInt32 varInt;
       
  1725     TBool flag = 0;
       
  1726     
       
  1727     //conversion check
       
  1728     //set variant for one type and get it in other types 
       
  1729     varUint = 45;
       
  1730     a1.Set(varUint);    //set TUint
       
  1731         
       
  1732     varInt = a1.AsTInt32();
       
  1733     
       
  1734     if(varUint == varInt)
       
  1735         flag = 1;
       
  1736     
       
  1737     a1.Reset(); return !flag;    
       
  1738     
       
  1739 }
       
  1740 
       
  1741 TBool Cliwtestcases::LIW_DATA_TYPES_026()
       
  1742 {
       
  1743     TLiwVariant a1;
       
  1744     TUint varUint;
       
  1745     TReal varReal;
       
  1746     TBool flag = 0;
       
  1747     
       
  1748     //conversion check
       
  1749     //set variant for one type and get it in other types 
       
  1750     varUint = 45;
       
  1751     a1.Set(varUint);    //set TUint
       
  1752         
       
  1753     varReal = a1.AsTReal();
       
  1754     
       
  1755     if(varUint == varReal)
       
  1756         flag = 1;
       
  1757     
       
  1758     a1.Reset(); return !flag;    
       
  1759 }
       
  1760 
       
  1761 /*TBool Cliwtestcases::LIW_DATA_TYPES_027()
       
  1762 {
       
  1763     TLiwVariant a1;
       
  1764     TUint varUint;
       
  1765     TBuf<255> varBuf;
       
  1766     _LIT(KResult, "45");
       
  1767     TBool flag = 0;
       
  1768     
       
  1769     //conversion check
       
  1770     //set variant for one type and get it in other types 
       
  1771     varUint = 45;
       
  1772     a1.Set(varUint);    //set TUint
       
  1773         
       
  1774     //varBuf = a1.AsDes();  //Does not work. Use Get method   
       
  1775     a1.Get(varBuf);   
       
  1776     
       
  1777     if(0 == varBuf.Compare(KResult))
       
  1778         flag = 1;
       
  1779     
       
  1780     a1.Reset(); return !flag;    
       
  1781 }
       
  1782 
       
  1783 TBool Cliwtestcases::LIW_DATA_TYPES_028()
       
  1784 {
       
  1785     TLiwVariant a1;
       
  1786     TUint varUint;
       
  1787     TBuf8<255> varBuf8;
       
  1788     _LIT8(KResult, "45");
       
  1789     TBool flag = 0;
       
  1790     
       
  1791     //conversion check
       
  1792     //set variant for one type and get it in other types 
       
  1793     varUint = 45;
       
  1794     a1.Set(varUint);    //set TUint
       
  1795         
       
  1796     //varBuf8 = a1.AsData();
       
  1797     a1.Get(varBuf8 );
       
  1798     
       
  1799     if(0 == varBuf8.Compare(KResult))
       
  1800         flag = 1;
       
  1801     
       
  1802     a1.Reset(); return !flag;    
       
  1803 }
       
  1804 */
       
  1805 
       
  1806 TBool Cliwtestcases::LIW_DATA_TYPES_029()
       
  1807 {
       
  1808     TLiwVariant a1;
       
  1809     TBool flag = 0;
       
  1810     TUint varUint;
       
  1811     TInt32 varInt;
       
  1812     
       
  1813     //conversion check
       
  1814     //set variant for one type and get it in other types 
       
  1815     varInt = 55;
       
  1816     a1.Set(varInt);     //set TInt
       
  1817         
       
  1818     varUint = a1.AsTUint();
       
  1819     
       
  1820     if(varUint == varInt)
       
  1821         flag = 1;
       
  1822     
       
  1823     a1.Reset(); return !flag;    
       
  1824 }
       
  1825 
       
  1826 TBool Cliwtestcases::LIW_DATA_TYPES_030()
       
  1827 {
       
  1828     TLiwVariant a1;
       
  1829     TInt32 varInt;
       
  1830     TReal varReal;
       
  1831     TBool flag = 0;
       
  1832     
       
  1833     //conversion check
       
  1834     //set variant for one type and get it in other types 
       
  1835     varInt = 55;
       
  1836     a1.Set(varInt);     //set TInt
       
  1837     varReal = a1.AsTReal();
       
  1838     
       
  1839     if(varInt == varReal)
       
  1840         flag = 1;
       
  1841     
       
  1842     a1.Reset(); return !flag;    
       
  1843 }
       
  1844 
       
  1845 /*
       
  1846 TBool Cliwtestcases::LIW_DATA_TYPES_031()
       
  1847 {
       
  1848     TLiwVariant a1;
       
  1849     TInt32 varInt;
       
  1850     TBuf<255> varBuf;
       
  1851     
       
  1852     _LIT(KResult, "55");
       
  1853     TBool flag = 0;
       
  1854     
       
  1855     //conversion check
       
  1856     //set variant for one type and get it in other types 
       
  1857     varInt = 55;
       
  1858     a1.Set(varInt);     //set TInt
       
  1859     
       
  1860     //varBuf = a1.AsDes();  //Does not work. Use Get method
       
  1861     a1.Get(varBuf);
       
  1862     
       
  1863     if(0 == varBuf.Compare(KResult))
       
  1864         flag = 1;
       
  1865     
       
  1866     a1.Reset(); return !flag;    
       
  1867 }
       
  1868 
       
  1869 TBool Cliwtestcases::LIW_DATA_TYPES_032()
       
  1870 {
       
  1871     TLiwVariant a1;
       
  1872     TInt32 varInt;
       
  1873     TBuf8<255> varBuf8;
       
  1874     _LIT8(KResult, "55");
       
  1875     TBool flag = 0;
       
  1876     
       
  1877     //conversion check
       
  1878     //set variant for one type and get it in other types 
       
  1879     varInt = 55;
       
  1880     a1.Set(varInt);     //set TInt
       
  1881         
       
  1882     //varBuf8 = a1.AsData();
       
  1883     a1.Get(varBuf8 );  a1.Get(varBuf8 );
       
  1884     
       
  1885     if(0 == varBuf8.Compare(KResult))
       
  1886         flag = 1;
       
  1887     
       
  1888     a1.Reset(); return !flag;    
       
  1889 }
       
  1890 */
       
  1891 
       
  1892 TBool Cliwtestcases::LIW_DATA_TYPES_033()
       
  1893 {
       
  1894     TLiwVariant a1;
       
  1895     TUint varUint;
       
  1896     TReal varReal;
       
  1897     TBool flag = 0;
       
  1898     
       
  1899     //conversion check
       
  1900     //set variant for one type and get it in other types 
       
  1901     varReal = 65.2345;
       
  1902     a1.Set(varReal);    //set TReal     
       
  1903     varUint = a1.AsTUint();
       
  1904     
       
  1905     if(65 == varUint)
       
  1906         flag = 1;
       
  1907     
       
  1908     a1.Reset(); return !flag;    
       
  1909 }
       
  1910 
       
  1911 TBool Cliwtestcases::LIW_DATA_TYPES_034()
       
  1912 {
       
  1913     TLiwVariant a1;
       
  1914     TInt32 varInt;
       
  1915     TReal varReal;
       
  1916     TBool flag = 0;
       
  1917     
       
  1918     //conversion check
       
  1919     //set variant for one type and get it in other types 
       
  1920     varReal = 65.2345;
       
  1921     a1.Set(varReal);    //set TReal
       
  1922     varInt = a1.AsTInt32();
       
  1923     
       
  1924     if(65 == varInt)
       
  1925         flag = 1;
       
  1926     
       
  1927     a1.Reset(); return !flag;    
       
  1928 }
       
  1929 
       
  1930 /*
       
  1931 TBool Cliwtestcases::LIW_DATA_TYPES_035()
       
  1932 {
       
  1933     TLiwVariant a1;
       
  1934     TReal varReal;
       
  1935     TBuf<255> varBuf;
       
  1936     _LIT(KResult, "65.2345");
       
  1937     TBool flag = 0;
       
  1938     
       
  1939     //conversion check
       
  1940     //set variant for one type and get it in other types 
       
  1941     varReal = 65.2345;
       
  1942     a1.Set(varReal);    //set TReal
       
  1943     
       
  1944     //varBuf = a1.AsDes();  //Does not work. Use Get method 
       
  1945     a1.Get(varBuf);
       
  1946     
       
  1947     if(0 == varBuf.Compare(KResult))
       
  1948         flag = 1;
       
  1949     
       
  1950     a1.Reset(); return !flag;    
       
  1951 }
       
  1952 
       
  1953 TBool Cliwtestcases::LIW_DATA_TYPES_036()
       
  1954 {
       
  1955     TLiwVariant a1;
       
  1956     TReal varReal;
       
  1957     TBuf8<255> varBuf8;
       
  1958     _LIT8(KResult, "65.2345");
       
  1959     TBool flag = 0;
       
  1960     
       
  1961     //conversion check
       
  1962     //set variant for one type and get it in other types 
       
  1963     varReal = 65.2345;
       
  1964     a1.Set(varReal);    //set TReal
       
  1965     //varBuf8 = a1.AsData();
       
  1966     a1.Get(varBuf8 );
       
  1967     
       
  1968     if(0 == varBuf8.Compare(KResult))
       
  1969         flag = 1;
       
  1970     
       
  1971     a1.Reset(); return !flag;    
       
  1972 }
       
  1973 */
       
  1974 
       
  1975 TBool Cliwtestcases::LIW_DATA_TYPES_037()
       
  1976 {
       
  1977     TLiwVariant a1;
       
  1978     TReal varUint;
       
  1979     TBuf8<255> varBuf8;
       
  1980     _LIT8(KTest, "75");
       
  1981     TBool flag = 0;
       
  1982     varBuf8 = KTest;
       
  1983     
       
  1984     //conversion check
       
  1985     //set variant for one type and get it in other types 
       
  1986     a1.Set(varBuf8);    //set TDes8
       
  1987     varUint = a1.AsTUint();
       
  1988     
       
  1989     if(75 == varUint)
       
  1990         flag = 1;
       
  1991     
       
  1992     a1.Reset(); return !flag;    
       
  1993 }
       
  1994 
       
  1995 TBool Cliwtestcases::LIW_DATA_TYPES_038()
       
  1996 {
       
  1997     TLiwVariant a1;
       
  1998     TInt32 varInt;
       
  1999     TBuf8<255> varBuf8;
       
  2000     _LIT8(KTest, "75");
       
  2001     TBool flag = 0;
       
  2002     varBuf8 = KTest;
       
  2003     
       
  2004     //conversion check
       
  2005     //set variant for one type and get it in other types 
       
  2006     a1.Set(varBuf8);    //set TDes8
       
  2007     varInt = a1.AsTInt32();
       
  2008     
       
  2009     if(75 == varInt)
       
  2010         flag = 1;
       
  2011     
       
  2012     a1.Reset(); return !flag;    
       
  2013 }
       
  2014 
       
  2015 TBool Cliwtestcases::LIW_DATA_TYPES_039()
       
  2016 {
       
  2017     TLiwVariant a1;
       
  2018     TReal varReal;
       
  2019     TBuf8<255> varBuf8;
       
  2020     _LIT8(KTest, "75.897");
       
  2021     TBool flag = 0;
       
  2022     varBuf8 = KTest;
       
  2023     
       
  2024     //conversion check
       
  2025     //set variant for one type and get it in other types 
       
  2026     a1.Set(varBuf8);    //set TDes8
       
  2027     varReal = a1.AsTReal();
       
  2028     
       
  2029     if(75.897 == varReal)
       
  2030         flag = 1;
       
  2031     
       
  2032     a1.Reset(); return !flag;    
       
  2033 }
       
  2034 
       
  2035 /*
       
  2036 TBool Cliwtestcases::LIW_DATA_TYPES_040()
       
  2037 {
       
  2038     TLiwVariant a1;
       
  2039     TBuf<255> varBuf;
       
  2040     TBuf8<255> varBuf8;
       
  2041     _LIT8(KTest, "test");
       
  2042     _LIT(KResult, "test");
       
  2043     TBool flag = 0;
       
  2044     
       
  2045     varBuf8 = KTest;
       
  2046     //conversion check
       
  2047     //set variant for one type and get it in other types 
       
  2048     a1.Set(varBuf8);    //set TDes8
       
  2049     //varBuf = a1.AsDes();  //Does not work. Use Get method
       
  2050     a1.Get(varBuf);
       
  2051     
       
  2052     if(0 == varBuf.Compare(KResult))
       
  2053         flag = 1;
       
  2054     
       
  2055     a1.Reset(); return !flag;    
       
  2056 }
       
  2057 */
       
  2058 
       
  2059 TBool Cliwtestcases::LIW_DATA_TYPES_041()
       
  2060 {
       
  2061     TLiwVariant a1;
       
  2062     TReal varUint;
       
  2063     TBuf<255> varBuf;
       
  2064     _LIT(KTest, "75");
       
  2065     TBool flag = 0;
       
  2066     varBuf = KTest;
       
  2067     
       
  2068     //conversion check
       
  2069     //set variant for one type and get it in other types 
       
  2070     a1.Set(varBuf);     //set TDes
       
  2071     varUint = a1.AsTUint();
       
  2072     
       
  2073     if(75 == varUint)
       
  2074         flag = 1;
       
  2075     
       
  2076     a1.Reset(); return !flag;    
       
  2077 }
       
  2078 
       
  2079 TBool Cliwtestcases::LIW_DATA_TYPES_042()
       
  2080 {
       
  2081     TLiwVariant a1;
       
  2082     TInt32 varInt;
       
  2083     TBuf<255> varBuf;
       
  2084     _LIT(KTest, "75");
       
  2085     TBool flag = 0;
       
  2086     varBuf = KTest;
       
  2087     
       
  2088     //conversion check
       
  2089     //set variant for one type and get it in other types 
       
  2090     a1.Set(varBuf);     //set TDes
       
  2091     varInt = a1.AsTInt32();
       
  2092     
       
  2093     if(75 == varInt)
       
  2094         flag = 1;
       
  2095     
       
  2096     a1.Reset(); return !flag;    
       
  2097 }
       
  2098 
       
  2099 TBool Cliwtestcases::LIW_DATA_TYPES_043()
       
  2100 {
       
  2101     TLiwVariant a1;
       
  2102     TReal varReal;
       
  2103     TBuf<255> varBuf;
       
  2104     _LIT(KTest, "75.897");
       
  2105     TBool flag = 0;
       
  2106     varBuf = KTest;
       
  2107     
       
  2108     //conversion check
       
  2109     //set variant for one type and get it in other types 
       
  2110     a1.Set(varBuf);     //set TDes
       
  2111     varReal = a1.AsTReal();
       
  2112     
       
  2113     if(75.897 == varReal)
       
  2114         flag = 1;
       
  2115     
       
  2116     a1.Reset(); return !flag;    
       
  2117 }
       
  2118 
       
  2119 /*
       
  2120 TBool Cliwtestcases::LIW_DATA_TYPES_044()
       
  2121 {
       
  2122     TLiwVariant a1;
       
  2123     TBuf<255> varBuf;
       
  2124     TBuf8<255> varBuf8;
       
  2125     _LIT(KTest, "test");
       
  2126     _LIT8(KResult, "test");
       
  2127     TBool flag = 0;
       
  2128     varBuf = KTest;
       
  2129 
       
  2130     //conversion check
       
  2131     //set variant for one type and get it in other types 
       
  2132     a1.Set(varBuf);     //set TDes
       
  2133     //varBuf8 = a1.AsData();
       
  2134     a1.Get(varBuf8 );
       
  2135     
       
  2136     if(0 == varBuf8.Compare(KResult))
       
  2137         flag = 1;
       
  2138     
       
  2139     a1.Reset(); return !flag;    
       
  2140 }
       
  2141 */
       
  2142 
       
  2143 TBool Cliwtestcases::LIW_DATA_TYPES_045()
       
  2144 {
       
  2145     TBool flag = 0;
       
  2146     /*Testing String Based Command*/
       
  2147     RCriteriaArray interest, providerList;
       
  2148     
       
  2149     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KTestCommandTC1, KContentTypeTxt);
       
  2150     criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2151     
       
  2152     interest.AppendL(criteria);
       
  2153     
       
  2154     iServiceHandler->QueryImplementationL(interest, providerList);
       
  2155 
       
  2156     if(providerList.Count())
       
  2157     {
       
  2158         if(0 == ((*(providerList[0])).ServiceCmdStr().Compare((*criteria).ServiceCmdStr())))
       
  2159         {
       
  2160             if(0 == ((*(providerList[0])).ContentType().Compare((*criteria).ContentType())))
       
  2161             {
       
  2162                 providerList.ResetAndDestroy();
       
  2163                 interest.ResetAndDestroy();   
       
  2164                 flag = 1;       
       
  2165             }
       
  2166             
       
  2167         }         
       
  2168     }
       
  2169     else
       
  2170     {
       
  2171         providerList.ResetAndDestroy();
       
  2172         interest.ResetAndDestroy();   
       
  2173         flag = 0;
       
  2174     }
       
  2175     
       
  2176     return !flag;
       
  2177 }
       
  2178     
       
  2179 TBool Cliwtestcases::LIW_DATA_TYPES_046()
       
  2180 {
       
  2181     TBool flag = 0;
       
  2182     /*Testing String Based Command*/
       
  2183     RCriteriaArray interest, providerList;
       
  2184     _LIT8(KJunkContentTypeTxt, "text");
       
  2185     
       
  2186     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KTestCommandTC1, KJunkContentTypeTxt);
       
  2187     criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2188 
       
  2189     interest.AppendL(criteria);
       
  2190     
       
  2191     iServiceHandler->QueryImplementationL(interest, providerList);
       
  2192     
       
  2193     
       
  2194      
       
  2195      
       
  2196     if(!providerList.Count())
       
  2197     {
       
  2198          flag = 1;
       
  2199     }
       
  2200     else
       
  2201     {
       
  2202         flag = 0;
       
  2203     }
       
  2204 
       
  2205     providerList.ResetAndDestroy();
       
  2206     interest.ResetAndDestroy();   
       
  2207     return !flag;
       
  2208 }
       
  2209 
       
  2210 TBool Cliwtestcases::LIW_DATA_TYPES_047()
       
  2211 {
       
  2212     TBool flag = 0;
       
  2213     /*Testing String Based Command*/
       
  2214     RCriteriaArray interest, providerList;
       
  2215     
       
  2216     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KWild, KContentTypeTxt);
       
  2217     criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2218 
       
  2219     interest.AppendL(criteria);
       
  2220     
       
  2221     iServiceHandler->QueryImplementationL(interest, providerList);
       
  2222     
       
  2223     
       
  2224      
       
  2225      
       
  2226     if(providerList.Count())
       
  2227     {
       
  2228         if(0 == ((*(providerList[0])).ContentType().Compare((*criteria).ContentType())))
       
  2229         {
       
  2230             providerList.ResetAndDestroy();
       
  2231             interest.ResetAndDestroy();   
       
  2232             flag = 1;       
       
  2233         }       
       
  2234     }
       
  2235     else
       
  2236     {
       
  2237         providerList.ResetAndDestroy();
       
  2238         interest.ResetAndDestroy();   
       
  2239         flag = 0;
       
  2240     }
       
  2241     
       
  2242     return !flag;
       
  2243 }
       
  2244 
       
  2245 TBool Cliwtestcases::LIW_DATA_TYPES_048()
       
  2246 {
       
  2247     TBool flag = 0;
       
  2248     /*Testing String Based Command*/
       
  2249     RCriteriaArray interest, providerList;
       
  2250     
       
  2251     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KTestCommandTC1, KWild);
       
  2252     criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2253 
       
  2254     interest.AppendL(criteria);
       
  2255     
       
  2256     iServiceHandler->QueryImplementationL(interest, providerList);
       
  2257     
       
  2258     
       
  2259      
       
  2260      
       
  2261     if(providerList.Count())
       
  2262     {
       
  2263         if(0 == ((*(providerList[0])).ServiceCmdStr().Compare((*criteria).ServiceCmdStr())))
       
  2264         {
       
  2265             providerList.ResetAndDestroy();
       
  2266             interest.ResetAndDestroy();
       
  2267             flag = 1;       
       
  2268         }         
       
  2269     }
       
  2270     else
       
  2271     {
       
  2272         providerList.ResetAndDestroy();
       
  2273         interest.ResetAndDestroy();
       
  2274         flag = 0;
       
  2275     }
       
  2276     return !flag;
       
  2277 }
       
  2278 
       
  2279 TBool Cliwtestcases::LIW_DATA_TYPES_049()
       
  2280 {
       
  2281     TBool flag = 0;
       
  2282     /*Testing String Based Command*/
       
  2283     RCriteriaArray interest, providerList;
       
  2284     
       
  2285     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, KWild, KWild);     //Queries for a list of all the LIW providers present
       
  2286     criteria->SetServiceClass(TUid::Uid(KLiwClassBase));          //Presently this value is changed to differentiate LIW Providers from other Ecom plug-ins
       
  2287     
       
  2288     TReal mini = 2.0;
       
  2289     TReal maxi = 3.0;
       
  2290     TLiwVariant mdOption;
       
  2291     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2292     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2293     _LIT8(KVersion,"ver");
       
  2294     _LIT8(KRange,"range");
       
  2295     
       
  2296     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2297     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2298     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2299     
       
  2300     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2301     mdOption.Set(pMetaDataMap);
       
  2302     criteria->SetMetaDataOptions(mdOption);
       
  2303 
       
  2304     pRangeList->DecRef();
       
  2305     pMetaDataMap->DecRef();
       
  2306     mdOption.Reset();
       
  2307     
       
  2308     interest.AppendL(criteria);
       
  2309     
       
  2310     iServiceHandler->QueryImplementationL(interest, providerList);      //providerList contains the list of all the LIW providers with metadata information being loaded for each
       
  2311     
       
  2312     RCriteriaArray loadCritArray;                        
       
  2313       
       
  2314     for(TInt idx = 0; idx < providerList.Count(); ++idx)         // for each provider
       
  2315     {
       
  2316       CLiwCriteriaItem* provInfo = providerList[idx];      
       
  2317       
       
  2318       TUid interfaceId = provInfo->ServiceClass();      //retrieving the service class (interface Id) of the provider
       
  2319       TPtrC8 intfName = provInfo->ServiceCmdStr();      //retrieving the content type or the interface name of the provider (e.g IDataSource)
       
  2320       TPtrC8 servName = provInfo->ContentType();        //retrieving the service command name of the provider (e.g s60.Messaging)
       
  2321       TReal provVersion = 1.0;                          //since Default version is 1.0 for all the providers
       
  2322       
       
  2323       //Creating a criteria using the above extracted information
       
  2324       CLiwCriteriaItem* item = CLiwCriteriaItem::NewL(1, intfName, servName);
       
  2325       item->SetServiceClass(interfaceId);
       
  2326                          
       
  2327       TLiwVariant provMetadata;
       
  2328       provInfo->GetMetaDataOptions(provMetadata);      //getting metadata from the provider (contains version information)
       
  2329       
       
  2330       const CLiwMap* metaDataMap = provMetadata.AsMap(); 
       
  2331             
       
  2332       if(metaDataMap)
       
  2333       {
       
  2334          _LIT8(KVersionKey,"ver");         //Key name in the metadata map is "ver" (as specified in the provider RSS File)
       
  2335          TLiwVariant versionVar;
       
  2336          
       
  2337          if(metaDataMap->FindL(KVersionKey, versionVar))    //This should be true. If false this means that there is no version information in the provider metadata
       
  2338          {
       
  2339          /*   ------------------------------------
       
  2340             |   key   |        value      |
       
  2341             |         |                   |
       
  2342             |   ver   |      (List) 2.2   |
       
  2343             -------------------------------------
       
  2344 
       
  2345          */ 
       
  2346             const CLiwList* pVersionList = versionVar.AsList();
       
  2347             if(pVersionList)
       
  2348             {
       
  2349                TLiwVariant verCheck;
       
  2350                for(TInt idx=0; idx < pVersionList->Count(); ++idx)         //the count is always ZERO. But to be on safer side, I have given the loop
       
  2351                {
       
  2352                   if(pVersionList->AtL(idx,verCheck))      //Ideally the index should only be Zero. But the version, if exists in any index will be returned now
       
  2353                   {
       
  2354                      provVersion = verCheck.AsTReal();   //The provider version is retrieved from the metadata
       
  2355                      
       
  2356                      //using switch case or if stmts further. This implementation is left to the Consumer's logic. But just a sample is shown below
       
  2357                      if(2.5 == provVersion || 2.4 == provVersion)         
       
  2358                      {
       
  2359                         TLiwVariant mdOption1;      //Setting the metadata option with the version information. 
       
  2360                         CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2361                         CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2362                         _LIT8(KVersion,"ver");      //Key in metadata for version is "version"
       
  2363                         _LIT8(KRange,"range");      //Since this is an exact version match done in AttachL, hence the key "exact"
       
  2364                         
       
  2365                         pRangeList->AppendL(TLiwVariant(KVersion));
       
  2366                         pRangeList->AppendL(TLiwVariant(provVersion));
       
  2367                         pRangeList->AppendL(TLiwVariant(provVersion));
       
  2368                         
       
  2369                         pMetaDataMap->InsertL(KRange,pRangeList);
       
  2370                         mdOption1.Set(pMetaDataMap);
       
  2371                         item->SetMetaDataOptions(mdOption1); //metadata is set with the version information
       
  2372 
       
  2373                         pRangeList->DecRef();
       
  2374                         pMetaDataMap->DecRef();
       
  2375                         mdOption1.Reset();
       
  2376                         
       
  2377                         loadCritArray.AppendL(item);
       
  2378                         
       
  2379                         iServiceHandler->DetachL(loadCritArray);
       
  2380                         
       
  2381                         TInt retVal = iServiceHandler->AttachL(loadCritArray); // This just loads the provider sent as input. No version range is to be sent here,
       
  2382                         
       
  2383                         if(retVal >= 0)
       
  2384                         {
       
  2385                             flag = 1;
       
  2386                         }
       
  2387         
       
  2388                         iServiceHandler->DetachL(loadCritArray);
       
  2389                      }
       
  2390                      else if(2.6 == provVersion)
       
  2391                      {
       
  2392                         // statements
       
  2393                      }
       
  2394                   }
       
  2395                   
       
  2396                   verCheck.Reset();
       
  2397                }
       
  2398             }
       
  2399          }
       
  2400          versionVar.Reset();
       
  2401       }
       
  2402       provMetadata.Reset();
       
  2403    }
       
  2404    
       
  2405     loadCritArray.ResetAndDestroy(); 
       
  2406     providerList.ResetAndDestroy();
       
  2407     interest.ResetAndDestroy();
       
  2408 
       
  2409     return !flag;
       
  2410 }
       
  2411 
       
  2412 TBool Cliwtestcases::LIW_MDAT_VER1()
       
  2413 {
       
  2414     TBool flag = 0;
       
  2415     CLiwCriteriaItem* item1 = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
  2416     item1->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2417     
       
  2418     TReal mini = 2.0;
       
  2419     TReal maxi = 3.0;
       
  2420     TLiwVariant mdOption1;
       
  2421     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2422     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2423     _LIT8(KVersion,"ver");
       
  2424     _LIT8(KRange,"range");
       
  2425     
       
  2426     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2427     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2428     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2429     
       
  2430     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2431     mdOption1.Set(pMetaDataMap);
       
  2432     item1->SetMetaDataOptions(mdOption1);
       
  2433 
       
  2434     pRangeList->DecRef();
       
  2435     pMetaDataMap->DecRef();
       
  2436     mdOption1.Reset();
       
  2437     
       
  2438     RCriteriaArray critArray, providerList;
       
  2439     
       
  2440     critArray.AppendL(item1);
       
  2441     
       
  2442     iServiceHandler->QueryImplementationL(critArray, providerList);
       
  2443     
       
  2444     TInt status = iServiceHandler->AttachL(providerList);
       
  2445     
       
  2446     
       
  2447     if(status > 0)
       
  2448         {
       
  2449         flag = 1;
       
  2450         }
       
  2451     else
       
  2452         {
       
  2453         flag = 0;
       
  2454         }
       
  2455     
       
  2456     CleanupStack::Pop();
       
  2457     iServiceHandler->DetachL(providerList);
       
  2458     critArray.ResetAndDestroy();
       
  2459     providerList.ResetAndDestroy();
       
  2460     return !flag;
       
  2461 }
       
  2462 
       
  2463 
       
  2464 TBool Cliwtestcases::LIW_MDAT_VER2()
       
  2465 {
       
  2466     TBool flag = 0;
       
  2467     CLiwCriteriaItem* item2 = CLiwCriteriaItem::NewLC(2, KTestCommandTC1, KContentTypeTxt);
       
  2468     item2->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2469     
       
  2470     TReal mini = 0.0;
       
  2471     TReal maxi = 3.0;
       
  2472     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2473     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2474     TLiwVariant mdOption1;
       
  2475     _LIT8(KVersion,"ver");
       
  2476     _LIT8(KRange,"range");
       
  2477     
       
  2478     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2479     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2480     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2481     
       
  2482     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2483     mdOption1.Set(pMetaDataMap);
       
  2484     item2->SetMetaDataOptions(mdOption1);
       
  2485     
       
  2486     pRangeList->DecRef();
       
  2487     pMetaDataMap->DecRef();
       
  2488     mdOption1.Reset();
       
  2489         
       
  2490     RCriteriaArray critArray, providerList;
       
  2491     
       
  2492     critArray.AppendL(item2);
       
  2493     
       
  2494     iServiceHandler->QueryImplementationL(critArray, providerList);
       
  2495     
       
  2496     iServiceHandler->AttachL(providerList);
       
  2497     
       
  2498     
       
  2499     if(providerList.Count() >= 0)
       
  2500         {
       
  2501         flag = 1;
       
  2502         }
       
  2503     else
       
  2504         {
       
  2505         flag = 0;
       
  2506         }
       
  2507     
       
  2508     CleanupStack::Pop();
       
  2509     iServiceHandler->DetachL(providerList);
       
  2510     critArray.ResetAndDestroy();
       
  2511     providerList.ResetAndDestroy();
       
  2512     return !flag;
       
  2513 }
       
  2514 
       
  2515 
       
  2516 TBool Cliwtestcases::LIW_MDAT_VER3()
       
  2517 {
       
  2518     TBool flag = 0;
       
  2519     CLiwCriteriaItem* item3 = CLiwCriteriaItem::NewLC(3, KTestCommandTC1, KContentTypeTxt);
       
  2520     item3->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2521     
       
  2522     TReal mini = 2.0;
       
  2523     TReal maxi = 0.0;
       
  2524     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2525     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2526     TLiwVariant mdOption1;
       
  2527     _LIT8(KVersion,"ver");
       
  2528     _LIT8(KRange,"range");
       
  2529     
       
  2530     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2531     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2532     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2533     
       
  2534     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2535     mdOption1.Set(pMetaDataMap);
       
  2536     item3->SetMetaDataOptions(mdOption1);
       
  2537     
       
  2538     pRangeList->DecRef();
       
  2539     pMetaDataMap->DecRef();
       
  2540     mdOption1.Reset();
       
  2541         
       
  2542     RCriteriaArray critArray, providerList;
       
  2543     
       
  2544     critArray.AppendL(item3);
       
  2545     
       
  2546     iServiceHandler->QueryImplementationL(critArray, providerList);
       
  2547     
       
  2548     iServiceHandler->AttachL(providerList);
       
  2549     
       
  2550     if(providerList.Count() >= 0)
       
  2551         {
       
  2552         flag = 1;
       
  2553         }
       
  2554     else
       
  2555         {
       
  2556         flag = 0;
       
  2557         }
       
  2558 
       
  2559     CleanupStack::Pop();
       
  2560     iServiceHandler->DetachL(providerList);
       
  2561     critArray.ResetAndDestroy();
       
  2562     providerList.ResetAndDestroy();
       
  2563     return !flag;
       
  2564 }
       
  2565 
       
  2566 
       
  2567 TBool Cliwtestcases::LIW_MDAT_VER4()
       
  2568 {   
       
  2569     TBool flag = 0;
       
  2570    CLiwCriteriaItem* item4 = CLiwCriteriaItem::NewLC(4, KTestCommandTC1, KContentTypeTxt);
       
  2571     item4->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2572     
       
  2573     TReal mini = 0.0;
       
  2574     TReal maxi = 0.0;
       
  2575     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2576     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2577     TLiwVariant mdOption1;
       
  2578     _LIT8(KVersion,"ver");
       
  2579     _LIT8(KRange,"range");
       
  2580     
       
  2581     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2582     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2583     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2584     
       
  2585     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2586     mdOption1.Set(pMetaDataMap);
       
  2587     item4->SetMetaDataOptions(mdOption1);
       
  2588     
       
  2589     pRangeList->DecRef();
       
  2590     pMetaDataMap->DecRef();
       
  2591     mdOption1.Reset();
       
  2592         
       
  2593     RCriteriaArray critArray, providerList;
       
  2594     
       
  2595     critArray.AppendL(item4);
       
  2596     
       
  2597     iServiceHandler->QueryImplementationL(critArray, providerList);
       
  2598     
       
  2599     iServiceHandler->AttachL(providerList);
       
  2600     
       
  2601     
       
  2602     if(providerList.Count() >= 0)
       
  2603         {
       
  2604         flag = 1;
       
  2605         }
       
  2606     else
       
  2607         {
       
  2608         flag = 0;
       
  2609         }
       
  2610     
       
  2611     CleanupStack::Pop();
       
  2612     iServiceHandler->DetachL(providerList);
       
  2613     critArray.ResetAndDestroy();
       
  2614     providerList.ResetAndDestroy();
       
  2615     return !flag;
       
  2616 }
       
  2617 
       
  2618 TBool Cliwtestcases::LIW_MDAT_VER5()
       
  2619 {
       
  2620     TBool flag = 0;
       
  2621     CLiwCriteriaItem* item5 = CLiwCriteriaItem::NewL();
       
  2622     item5->SetId(5);
       
  2623     item5->SetServiceCmdL(KTestCommandTC1);
       
  2624     item5->SetContentTypeL(KContentTypeTxt);
       
  2625     item5->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2626     
       
  2627     TReal mini = 3.0;
       
  2628     TReal maxi = 2.0;
       
  2629     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2630     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2631     TLiwVariant mdOption1;
       
  2632     _LIT8(KVersion,"ver");
       
  2633     _LIT8(KRange,"range");
       
  2634     
       
  2635     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2636     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2637     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2638     
       
  2639     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2640     mdOption1.Set(pMetaDataMap);
       
  2641     item5->SetMetaDataOptions(mdOption1);
       
  2642     
       
  2643     pRangeList->DecRef();
       
  2644     pMetaDataMap->DecRef();
       
  2645     mdOption1.Reset();
       
  2646         
       
  2647     RCriteriaArray critArray, providerList;
       
  2648     
       
  2649     critArray.AppendL(item5);
       
  2650     
       
  2651     iServiceHandler->QueryImplementationL(critArray, providerList);
       
  2652     
       
  2653     iServiceHandler->AttachL(providerList);
       
  2654     
       
  2655     if(providerList.Count() >= 0) 
       
  2656         {
       
  2657         flag = 1;
       
  2658         }
       
  2659     else
       
  2660         {
       
  2661         flag = 0;
       
  2662         }
       
  2663     
       
  2664     iServiceHandler->DetachL(providerList);
       
  2665     critArray.ResetAndDestroy();
       
  2666     providerList.ResetAndDestroy();
       
  2667     return !flag;
       
  2668 }
       
  2669 
       
  2670 TBool Cliwtestcases::LIW_MDAT_CAP1()
       
  2671 {
       
  2672     TBool flag = 1;
       
  2673     //TInt status = 0;
       
  2674     iServiceHandler->Reset();
       
  2675     CLiwCriteriaItem* item1 = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
  2676     item1->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2677     
       
  2678     TReal mini = 2.0;
       
  2679     TReal maxi = 5.0;
       
  2680     TLiwVariant mdOption1;
       
  2681     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2682     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2683     _LIT8(KVersion,"ver");
       
  2684     _LIT8(KRange,"range");
       
  2685     
       
  2686     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2687     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2688     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2689     
       
  2690     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2691     mdOption1.Set(pMetaDataMap);
       
  2692     item1->SetMetaDataOptions(mdOption1);
       
  2693 
       
  2694     pRangeList->DecRef();
       
  2695     pMetaDataMap->DecRef();
       
  2696     mdOption1.Reset();
       
  2697     
       
  2698     RCriteriaArray critArray, providerList;
       
  2699     
       
  2700     critArray.AppendL(item1);
       
  2701     iServiceHandler->QueryImplementationL(critArray, providerList);
       
  2702                         
       
  2703     
       
  2704     // beginning of securitymanager code
       
  2705     
       
  2706     CRTSecManager* iSession = CRTSecManager::NewL();
       
  2707     CTrustInfo* iTrust = CTrustInfo::NewL();
       
  2708     
       
  2709     RFs fileSession;
       
  2710     if(KErrNone==fileSession.Connect())
       
  2711     {
       
  2712         CleanupClosePushL(fileSession);
       
  2713         if(KErrNone==fileSession.ShareProtected())
       
  2714         {
       
  2715             RFile secPolicyFile;    
       
  2716             if(KErrNone == secPolicyFile.Open(fileSession, _L("c:\\data\\others\\liwaccesspolicy.xml"), EFileShareAny ))
       
  2717             {
       
  2718                 CleanupClosePushL(secPolicyFile);
       
  2719                 TPolicyID iPolicyId = iSession->SetPolicy(secPolicyFile);
       
  2720                 
       
  2721                 if(iPolicyId>KErrNone)
       
  2722                 {
       
  2723                     TInt32 exId = iSession->RegisterScript(iPolicyId, *iTrust);
       
  2724                     
       
  2725                     CRTSecMgrScriptSession* scriptSession = NULL;
       
  2726                     
       
  2727                     //#ifdef  AUTO_TESTING
       
  2728                                         scriptSession = iSession->GetScriptSessionL(iPolicyId, exId, this);
       
  2729                     //#else
       
  2730                       //                  scriptSession = iSession->GetScriptSessionL(iPolicyId, exId);
       
  2731                     //#endif
       
  2732 
       
  2733                     //CRTSecMgrScriptSession* scriptSession = iSession->GetScriptSession(iPolicyId,exId);
       
  2734 
       
  2735                     TInt status = iServiceHandler->AttachL(critArray,*scriptSession);
       
  2736                     
       
  2737                     delete scriptSession;
       
  2738                     
       
  2739                 }
       
  2740                 
       
  2741                 CleanupStack::PopAndDestroy();//secPolicyFile
       
  2742             }       
       
  2743         }
       
  2744         
       
  2745         CleanupStack::PopAndDestroy();//fileSession
       
  2746         
       
  2747     }
       
  2748 
       
  2749     delete iTrust;
       
  2750     delete iSession;
       
  2751     // end of securitymanager code
       
  2752     
       
  2753      
       
  2754     if(providerList.Count())
       
  2755         {
       
  2756         flag = 1;
       
  2757         }
       
  2758     else
       
  2759         {
       
  2760         flag = 0;
       
  2761         }
       
  2762 
       
  2763     CleanupStack::Pop(item1); 
       
  2764     critArray.ResetAndDestroy();
       
  2765     providerList.ResetAndDestroy();
       
  2766     return !flag;
       
  2767 }
       
  2768 
       
  2769 TBool Cliwtestcases::LIW_MDAT_CAP2()
       
  2770 {
       
  2771     TBool flag = 0;
       
  2772     TInt status = 0;
       
  2773     iServiceHandler->Reset();
       
  2774     CLiwCriteriaItem* item1 = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
  2775     item1->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  2776     
       
  2777     TReal mini = 5.0;
       
  2778     TReal maxi = 7.0;
       
  2779     TLiwVariant mdOption1;
       
  2780     CLiwMap* pMetaDataMap = CLiwDefaultMap::NewL();
       
  2781     CLiwList* pRangeList = CLiwDefaultList::NewL();
       
  2782     _LIT8(KVersion,"ver");
       
  2783     _LIT8(KRange,"range");
       
  2784     
       
  2785     pRangeList->AppendL(TLiwVariant(KVersion));
       
  2786     pRangeList->AppendL(TLiwVariant(TReal(mini)));
       
  2787     pRangeList->AppendL(TLiwVariant(TReal(maxi)));
       
  2788     
       
  2789     pMetaDataMap->InsertL(KRange,pRangeList);
       
  2790     mdOption1.Set(pMetaDataMap);
       
  2791     item1->SetMetaDataOptions(mdOption1);
       
  2792 
       
  2793     pRangeList->DecRef();
       
  2794     pMetaDataMap->DecRef();
       
  2795     mdOption1.Reset();
       
  2796     
       
  2797     RCriteriaArray critArray, providerList;
       
  2798     
       
  2799     critArray.AppendL(item1);
       
  2800     
       
  2801     // beginning of securitymanager code
       
  2802     
       
  2803     CRTSecManager* iSession = CRTSecManager::NewL();
       
  2804     CTrustInfo* iTrust = CTrustInfo::NewL();
       
  2805     
       
  2806     RFs fileSession;
       
  2807     if(KErrNone==fileSession.Connect())
       
  2808     {
       
  2809         CleanupClosePushL(fileSession);
       
  2810         if(KErrNone==fileSession.ShareProtected())
       
  2811         {
       
  2812             RFile secPolicyFile;    
       
  2813             if(KErrNone == secPolicyFile.Open(fileSession, _L("c:\\data\\Others\\AccessPolicy_V1.xml"), EFileShareAny ))
       
  2814             {
       
  2815                 CleanupClosePushL(secPolicyFile);
       
  2816                 TPolicyID iPolicyId = iSession->SetPolicy(secPolicyFile);
       
  2817                 
       
  2818                 if(iPolicyId>KErrNone)
       
  2819                 {
       
  2820                     TInt32 exId = iSession->RegisterScript(iPolicyId, *iTrust);
       
  2821                     CRTSecMgrScriptSession* scriptSession = iSession->GetScriptSessionL(iPolicyId,exId);
       
  2822 
       
  2823                     iServiceHandler->QueryImplementationL(critArray, providerList);
       
  2824                     
       
  2825                     status = iServiceHandler->AttachL(critArray,*scriptSession);
       
  2826                     
       
  2827                     delete scriptSession;
       
  2828                 }
       
  2829                 
       
  2830                 CleanupStack::PopAndDestroy();//secPolicyFile
       
  2831             }       
       
  2832         }
       
  2833         
       
  2834         CleanupStack::PopAndDestroy();//fileSession
       
  2835     }
       
  2836 
       
  2837     delete iTrust;
       
  2838     delete iSession;
       
  2839     // end of securitymanager code
       
  2840 
       
  2841     if(!status > 0)
       
  2842         {
       
  2843         flag = 1;
       
  2844         }
       
  2845     else
       
  2846         {
       
  2847         flag = 0;
       
  2848         }
       
  2849 
       
  2850     CleanupStack::Pop(item1); 
       
  2851     critArray.ResetAndDestroy();
       
  2852     providerList.ResetAndDestroy();
       
  2853     return !flag;
       
  2854 }
       
  2855 
       
  2856 TBool Cliwtestcases::LIW_ContainerCleanup()
       
  2857 {
       
  2858    
       
  2859     __UHEAP_MARK;
       
  2860     _LIT(KName,"Name");
       
  2861     TLiwVariant variant(KName());
       
  2862     CLiwMap* map = CLiwDefaultMap::NewL();
       
  2863     CLiwList *listTemp = CLiwDefaultList::NewL(); 
       
  2864     map->PushL();
       
  2865     listTemp->PushL();    
       
  2866     //CleanupClosePushL(*map);
       
  2867     //CleanupClosePushL(*listTemp);
       
  2868     map->InsertL(KNullDesC8,variant);
       
  2869     TRAP_IGNORE(TestL(map));
       
  2870     CleanupStack::PopAndDestroy(listTemp);
       
  2871     CleanupStack::PopAndDestroy(map);
       
  2872     __UHEAP_MARKEND;
       
  2873     
       
  2874     return KErrNone;   
       
  2875 }
       
  2876 
       
  2877 void Cliwtestcases::TestL(CLiwMap *map)
       
  2878 {
       
  2879     CLiwGenericParamList* param = CLiwGenericParamList::NewLC();
       
  2880     param->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(map)));
       
  2881     User::Leave(KErrGeneral);
       
  2882     param->Reset();
       
  2883     CleanupStack::Pop(param);
       
  2884 }
       
  2885 
       
  2886 TBool Cliwtestcases::LIW_ParamCleanup()
       
  2887 {
       
  2888     __UHEAP_MARK;
       
  2889     CLiwGenericParamList* param = CLiwGenericParamList::NewLC();
       
  2890     //CLiwMap* map = CLiwDefaultMap::NewL();
       
  2891     //CleanupClosePushL(*map);
       
  2892     //map->InsertL(KNullDesC8,variant);
       
  2893     TLiwGenericParam par;
       
  2894     TLiwVariant var;
       
  2895     par.SetNameAndValueL(KNullDesC8, var);
       
  2896     //param->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(map)));
       
  2897     param->AppendL(par);
       
  2898     //CleanupStack::PopAndDestroy(map);
       
  2899     
       
  2900     TRAP_IGNORE(TestParamL(param));
       
  2901     
       
  2902     par.Reset();
       
  2903     CleanupStack::PopAndDestroy(param);
       
  2904     __UHEAP_MARKEND;
       
  2905     
       
  2906     return KErrNone;
       
  2907 }
       
  2908 
       
  2909 void Cliwtestcases::TestParamL(CLiwGenericParamList *param)
       
  2910 {
       
  2911     TLiwGenericParam outParam;
       
  2912     outParam.PushL();
       
  2913     //Pushing the TLiwGenericParam into the CleanupStack
       
  2914     //CleanupStack::PushL( TCleanupItem( TLiwGenericParam::ParamCleanup , &outParam ) ); 
       
  2915     
       
  2916     param->AtL(0,outParam);
       
  2917     const CLiwMap* outMap = outParam.Value().AsMap();
       
  2918     
       
  2919     //Leaves before CleanupStack::Pop and reset is called
       
  2920     User::Leave(KErrGeneral);
       
  2921     
       
  2922     //CleanupStack::Pop(&outParam);
       
  2923     outParam.Reset();
       
  2924 }
       
  2925 
       
  2926 TBool Cliwtestcases::LIW_VariantCleanup()
       
  2927 {
       
  2928     
       
  2929     __UHEAP_MARK;
       
  2930     _LIT(KName,"Name");
       
  2931     TLiwVariant variant(KName());
       
  2932     CLiwMap* map = CLiwDefaultMap::NewL();
       
  2933     map->PushL();
       
  2934     //CleanupClosePushL(*map);
       
  2935     //map->InsertL(KNullDesC8,variant);
       
  2936     
       
  2937     TRAP_IGNORE(TestVariantL(map));
       
  2938     
       
  2939     CleanupStack::Pop(map);                 
       
  2940     map->DecRef();                      //map is destroyed
       
  2941     __UHEAP_MARKEND;            //There is no memory Leak since the TLiwVariant "var" is destroyed by the CleanupStack during User::Leave
       
  2942 
       
  2943     
       
  2944     return KErrNone;               
       
  2945 } 
       
  2946 
       
  2947 void Cliwtestcases::TestVariantL(CLiwMap* map)
       
  2948 {
       
  2949   
       
  2950     TLiwVariant var;
       
  2951     var.PushL();
       
  2952     //CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &var) );
       
  2953     
       
  2954     map->FindL(KNullDesC8,var);         //This makes a copy of TLiwVariant "variant" to "var"
       
  2955     User::Leave(KErrNoMemory);          //The TLiwVariant "var" is popped from the CleanupStack and VariantCleanup method is called
       
  2956     
       
  2957     CleanupStack::Pop(&var);        //These statements are not executed
       
  2958     var.Reset();                                            //This statement is not executed resulting in memory leak
       
  2959 }
       
  2960 
       
  2961 
       
  2962 TBool Cliwtestcases::LIW_DATA_TYPES_050()
       
  2963 {
       
  2964     TLiwVariant a1;
       
  2965     TInt32 varInt32;
       
  2966     TInt64 varInt64 = 0xaaaaaaa;
       
  2967     TBool flag = 0;
       
  2968     
       
  2969     //First checking the TInt64 datatype
       
  2970     a1.Set(varInt64);
       
  2971     
       
  2972     Dump(a1);
       
  2973     //conversion check
       
  2974     //set variant for TInt64 and get it in TInt32
       
  2975     varInt32 = a1.AsTInt32();   //get TInt32
       
  2976     
       
  2977     if(varInt32 == varInt64)
       
  2978         flag = 0;
       
  2979     
       
  2980     TUint varUint;
       
  2981     varUint = a1.AsTUint();     //get TUint
       
  2982     
       
  2983     if(varUint == varInt64)
       
  2984         flag = 0;
       
  2985     
       
  2986     TReal varReal;
       
  2987     varReal = a1.AsTReal();     //get TReal
       
  2988     
       
  2989     if(varReal == varInt64)
       
  2990         flag = 0;
       
  2991     
       
  2992     TBuf<20> varBuf;
       
  2993     //varBuf = a1.AsDes();  //Does not work. Use Get method    
       
  2994     a1.Get(varBuf);     //get TDes
       
  2995     
       
  2996     TBuf8<20> varBuf8;
       
  2997     //varBuf8 = a1.AsData();
       
  2998     a1.Get(varBuf8 );   //get TDes8
       
  2999         
       
  3000     a1.Reset(); 
       
  3001     
       
  3002     flag = 1;
       
  3003     return !flag;    
       
  3004 }
       
  3005 
       
  3006 TInt Cliwtestcases::LIW_ASYNC_001()
       
  3007     {
       
  3008     return asyObj->AsyncCase(1);
       
  3009     }
       
  3010 
       
  3011 TInt Cliwtestcases::LIW_ASYNC_002()
       
  3012     {
       
  3013     return asyObj->AsyncCase(2);
       
  3014     }
       
  3015 
       
  3016 TInt Cliwtestcases::LIW_ASYNC_003()
       
  3017     {
       
  3018     return asyObj->AsyncCase(3);
       
  3019     }
       
  3020 
       
  3021 TInt Cliwtestcases::LIW_ASYNC_004()
       
  3022     {
       
  3023     return asyObj->AsyncCase(4);
       
  3024     }
       
  3025 
       
  3026 TInt Cliwtestcases::LIW_ASYNC_LongServiceCmd()
       
  3027     {
       
  3028         TBool flag = 0;
       
  3029         /*Testing String Based Command*/
       
  3030         RCriteriaArray interest;
       
  3031         CleanupClosePushL(interest);
       
  3032         _LIT8(KLongCmd,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
       
  3033         _LIT8(KNoCmd,"");
       
  3034        
       
  3035         /******For a different test************/
       
  3036         CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, KLongCmd, KNoCmd);
       
  3037         criteria1->SetServiceCmd(1);
       
  3038         CleanupStack::PopAndDestroy(criteria1);
       
  3039         /******End For a different test************/
       
  3040         
       
  3041         
       
  3042         
       
  3043         
       
  3044         
       
  3045         CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KLongCmd, KNoCmd);
       
  3046         
       
  3047         criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  3048         
       
  3049         
       
  3050 
       
  3051         interest.AppendL(criteria);
       
  3052         TInt status;
       
  3053         // Attach the MyServiceName provider to the LIW framework.
       
  3054         TRAPD(status1,status = iServiceHandler->AttachL(interest));
       
  3055          
       
  3056         if(!status || status1)
       
  3057             {
       
  3058             iServiceHandler->DetachL(interest);    
       
  3059             CleanupStack::PopAndDestroy(criteria);
       
  3060             CleanupStack::PopAndDestroy(&interest);   
       
  3061             return KErrGeneral;
       
  3062             }
       
  3063 
       
  3064         
       
  3065         // Detach The MyServiceName Provider
       
  3066         iServiceHandler->DetachL(interest);    
       
  3067         CleanupStack::PopAndDestroy(criteria);
       
  3068         CleanupStack::PopAndDestroy(&interest);   
       
  3069         return KErrNone;
       
  3070     }
       
  3071     
       
  3072 
       
  3073 TInt Cliwtestcases::LIW_ASYNC_LongInvalidServiceCmd()
       
  3074     {
       
  3075         TBool flag = 0;
       
  3076         /*Testing String Based Command*/
       
  3077         RCriteriaArray interest;
       
  3078         CleanupClosePushL(interest);
       
  3079         _LIT8(KLongCmd,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
       
  3080         _LIT8(KNoCmd,"");
       
  3081        
       
  3082         CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KLongCmd, KNoCmd);
       
  3083        
       
  3084         criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  3085 
       
  3086         interest.AppendL(criteria);
       
  3087        
       
  3088         // Attach the MyServiceName provider to the LIW framework.
       
  3089         TRAPD(status1,iServiceHandler->AttachL(interest));
       
  3090        
       
  3091         TInt status = status1;
       
  3092        
       
  3093         
       
  3094         //iServiceHandler->DetachL(interest);    
       
  3095         CleanupStack::PopAndDestroy(criteria);
       
  3096         CleanupStack::PopAndDestroy(&interest);
       
  3097         if(status == KLiwUnknown)
       
  3098             {
       
  3099        
       
  3100             return KErrNone;
       
  3101             }
       
  3102         
       
  3103         else
       
  3104             return KErrGeneral;
       
  3105 
       
  3106        
       
  3107     }
       
  3108     
       
  3109 
       
  3110 TInt Cliwtestcases::LIW_ASYNC_LongInterface()
       
  3111     {
       
  3112         TBool flag = 0;
       
  3113         /*Testing String Based Command*/
       
  3114         RCriteriaArray interest;
       
  3115         CleanupClosePushL(interest);
       
  3116         _LIT8(KNoCmd,"");
       
  3117         _LIT8(KLongCmd,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
       
  3118         CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KNoCmd, KLongCmd);
       
  3119         criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  3120 
       
  3121         interest.AppendL(criteria);
       
  3122         TInt status ;
       
  3123         // Attach the MyServiceName provider to the LIW framework.
       
  3124         TRAPD(status1,status  = iServiceHandler->AttachL(interest));
       
  3125        
       
  3126 
       
  3127        // Detach The MyServiceName Provider
       
  3128        iServiceHandler->DetachL(interest);    
       
  3129        CleanupStack::PopAndDestroy(criteria);
       
  3130        CleanupStack::PopAndDestroy(&interest);
       
  3131        
       
  3132        if(!status || status1)
       
  3133            {
       
  3134            return KErrGeneral;
       
  3135            }
       
  3136        
       
  3137           
       
  3138        return KErrNone;
       
  3139     }
       
  3140     
       
  3141 
       
  3142 TInt Cliwtestcases::LIW_ASYNC_LongInvalidInterface()
       
  3143     {
       
  3144         TBool flag = 0;
       
  3145         /*Testing String Based Command*/
       
  3146         RCriteriaArray interest;
       
  3147         CleanupClosePushL(interest);
       
  3148         _LIT8(KNoCmd,"");
       
  3149         _LIT8(KLongCmd,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
       
  3150         CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KNoCmd, KLongCmd);
       
  3151         criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  3152 
       
  3153         interest.AppendL(criteria);
       
  3154         TInt status ;
       
  3155         // Attach the MyServiceName provider to the LIW framework.
       
  3156         TRAPD(status1,status = iServiceHandler->AttachL(interest));
       
  3157        
       
  3158 
       
  3159        // Detach The MyServiceName Provider
       
  3160        //iServiceHandler->DetachL(interest);    
       
  3161        CleanupStack::PopAndDestroy(criteria);
       
  3162        CleanupStack::PopAndDestroy(&interest);
       
  3163        
       
  3164        if(status1 == KLiwUnknown)
       
  3165            {
       
  3166            return KErrNone;
       
  3167            }
       
  3168        
       
  3169           
       
  3170        return KErrGeneral;
       
  3171     }
       
  3172 
       
  3173 
       
  3174 TInt Cliwtestcases::LIW_ASYNC_LongInterface1()
       
  3175     {
       
  3176         TBool flag = 0;
       
  3177         /*Testing String Based Command*/
       
  3178         RCriteriaArray interest;
       
  3179         CleanupClosePushL(interest);
       
  3180         _LIT8(KNoCmd,"aaaaaaaaaaaaaaaaaa"); //18
       
  3181         _LIT8(KLongCmd,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); //220
       
  3182         CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, KNoCmd, KLongCmd);
       
  3183         criteria->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  3184 
       
  3185         interest.AppendL(criteria);
       
  3186         TInt status ;
       
  3187         // Attach the MyServiceName provider to the LIW framework.
       
  3188         TRAPD(status1,status = iServiceHandler->AttachL(interest));
       
  3189        
       
  3190 
       
  3191        // Detach The MyServiceName Provider
       
  3192        iServiceHandler->DetachL(interest);    
       
  3193        CleanupStack::PopAndDestroy(criteria);
       
  3194        CleanupStack::PopAndDestroy(&interest);
       
  3195        
       
  3196        if(!status || status1)
       
  3197            {
       
  3198            return KErrGeneral;
       
  3199            
       
  3200            }
       
  3201        
       
  3202        return KErrNone; 
       
  3203       
       
  3204     }
       
  3205 
       
  3206 TInt Cliwtestcases::LIW_ParamCleanup1()
       
  3207 {
       
  3208     TRAP_IGNORE(TestParam1L());
       
  3209     
       
  3210     return KErrNone;
       
  3211 }
       
  3212 
       
  3213 void Cliwtestcases::TestParam1L()
       
  3214 {    
       
  3215     TLiwGenericParam param;
       
  3216     CleanupStack::PushL( TCleanupItem( TLiwGenericParam::ParamCleanup , &param ) ); 
       
  3217     User::Leave(KErrGeneral);  //This calls the ParamCleanup method which cleans up TLiwGenericParam 
       
  3218     CleanupStack::Pop(&param);
       
  3219     param.Reset();
       
  3220     //Leaves before CleanupStack::Pop and reset is called
       
  3221     User::Leave(KErrGeneral);
       
  3222     
       
  3223 }
       
  3224 
       
  3225 
       
  3226 TInt Cliwtestcases::LIW_GetInterest()
       
  3227 {
       
  3228 
       
  3229         RCriteriaArray interest1;
       
  3230         
       
  3231         iServiceHandler->GetInterest(interest1);
       
  3232         CLiwCriteriaItem* item1 = CLiwCriteriaItem::NewLC();
       
  3233         for(TInt i = 0; i < interest1.Count(); i++)
       
  3234                {
       
  3235                
       
  3236                    
       
  3237                item1->SetId(interest1[i]->Id());
       
  3238                if (interest1[i]->ServiceCmd() == KLiwCmdAsStr)
       
  3239                  item1->SetServiceCmdL(    interest1[i]->ServiceCmdStr()         );
       
  3240                else
       
  3241                  item1->SetServiceCmd(interest1[i]->ServiceCmd());
       
  3242                
       
  3243                item1->SetContentTypeL(     interest1[i]->ContentType()           );
       
  3244                item1->SetServiceClass(     interest1[i]->ServiceClass()          );
       
  3245                 
       
  3246                }
       
  3247         CleanupStack::PopAndDestroy(item1);
       
  3248         return KErrNone;
       
  3249         
       
  3250 }
       
  3251 
       
  3252 
       
  3253 
       
  3254 TBool Cliwtestcases::LIW_Defaut_list_externalize()
       
  3255 {
       
  3256 
       
  3257     _LIT8(KText,"Test");
       
  3258     _LIT8(KExamplekey,"key");
       
  3259     CLiwGenericParamList* pList = CLiwGenericParamList::NewLC();
       
  3260     RBuf8 binaryData;
       
  3261     binaryData.Create(100);
       
  3262     binaryData.Append(KText);
       
  3263     TLiwGenericParam param;
       
  3264     TPtrC8 ptrVar(KExamplekey);
       
  3265     param.SetNameAndValueL(ptrVar, TLiwVariant( binaryData ));
       
  3266     
       
  3267     pList->AppendL(param);
       
  3268     //stringsMap->InsertL( KExamplekey, TLiwVariant( binaryData ));
       
  3269     
       
  3270     RBuf8 datadesc;
       
  3271     CleanupClosePushL( datadesc );
       
  3272     datadesc.CreateL( pList->Size() );
       
  3273     RDesWriteStream datastrm(datadesc);
       
  3274     CleanupClosePushL( datastrm );
       
  3275     TRAPD(err,pList->ExternalizeL( datastrm ));
       
  3276     
       
  3277     datastrm.CommitL( );
       
  3278     CleanupStack::PopAndDestroy( &datastrm );
       
  3279     CleanupStack::PopAndDestroy( &datadesc );
       
  3280     binaryData.Close();
       
  3281     CleanupStack::PopAndDestroy( pList );
       
  3282     
       
  3283     if(KErrNone==err)
       
  3284         {
       
  3285             return err;
       
  3286             
       
  3287         }
       
  3288         
       
  3289     return KErrGeneral;   
       
  3290          
       
  3291 }
       
  3292 
       
  3293 
       
  3294 TBool Cliwtestcases::LIW_DATA_TYPES_013_A()
       
  3295    {
       
  3296        
       
  3297        TBool flag = 1;
       
  3298           //Reusing LIW_DATA_TYPES_011 test case
       
  3299           TLiwGenericParam param;
       
  3300           param.Value().Set(KLIW_DATA_TYPES_011);
       
  3301           
       
  3302           Dump(param.Value());
       
  3303           
       
  3304           param.SetNameL(KTestPARAMNanmeTC1);
       
  3305           CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
  3306           CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
  3307           inps->AppendL(param);
       
  3308           param.Reset();
       
  3309           
       
  3310           // Call ExecuteServiceCmdL TO GET THE RESULT
       
  3311           CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KTestCommandTC1, KContentTypeTxt);
       
  3312           crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
  3313           iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); 
       
  3314           CleanupStack::PopAndDestroy(crit); // crit
       
  3315           
       
  3316           // CHECK RESULT 
       
  3317           TInt pos = 0;
       
  3318           outps->FindFirst(pos, EGenericParamError);
       
  3319           
       
  3320           if(pos != KErrNotFound)
       
  3321               {
       
  3322                   if ((*outps)[pos].Value().AsTInt32() == KErrNone)
       
  3323                       {
       
  3324                       
       
  3325                           _LIT8(KIter,"Iterator");
       
  3326                           TInt iterPos=0;
       
  3327                           outps->FindFirst(iterPos, KIter);
       
  3328                           if(pos != KErrNotFound)
       
  3329                           {
       
  3330                               CLiwIterable* pIter=(*outps)[iterPos].Value().AsIterable();
       
  3331                                       
       
  3332                                       if((pIter->operator==(*pIter)))
       
  3333                                       {   
       
  3334                                           flag = 0;
       
  3335                                       }
       
  3336                           }
       
  3337                       }
       
  3338                  
       
  3339               }
       
  3340            
       
  3341            return flag;        
       
  3342   }
       
  3343    
       
  3344 
       
  3345 TBool Cliwtestcases::LIW_DATA_TYPES_015_A()
       
  3346     {
       
  3347          
       
  3348          TBool flag = 1;
       
  3349          TInt32 intVal=10;
       
  3350          TLiwVariant intVar;
       
  3351          
       
  3352          {//integer check
       
  3353             TInt32 intRet=12;
       
  3354             intVar.Set(intRet);
       
  3355             
       
  3356             if(intVar.AsTInt32() == 12)
       
  3357                 flag = 0;
       
  3358            
       
  3359          }
       
  3360          
       
  3361          {//RFile check
       
  3362             RFile fileRet;
       
  3363             intVar.Set(fileRet);                   
       
  3364             fileRet.Close();            
       
  3365          }
       
  3366          
       
  3367          {//Uid check
       
  3368             TUid uidRet;
       
  3369             intVar.Set(uidRet);
       
  3370                        
       
  3371          }
       
  3372          
       
  3373          {//TUint check
       
  3374             TUint uintRet=12;
       
  3375             intVar.Set(uintRet);
       
  3376             
       
  3377          }
       
  3378          
       
  3379          {//TBool check
       
  3380             TBool boolRet=EFalse;
       
  3381             intVar.Set(boolRet);
       
  3382                        
       
  3383          }
       
  3384          
       
  3385          {//TPtrC check
       
  3386             TPtrC ptrcRet;
       
  3387             intVar.Set(ptrcRet);
       
  3388                 
       
  3389          }
       
  3390          
       
  3391          {//TTime check
       
  3392             TTime timeRet;
       
  3393             intVar.Set(timeRet);
       
  3394                        
       
  3395          }
       
  3396          
       
  3397          {//TPtrC8 check
       
  3398             TPtrC8 ptrcRet;
       
  3399             intVar.Set(ptrcRet);
       
  3400                        
       
  3401          }
       
  3402          
       
  3403          
       
  3404          {//TInt64 check
       
  3405                      TInt64 int64Ret = 13;
       
  3406                      intVar.Set(int64Ret);
       
  3407                                
       
  3408          }
       
  3409          
       
  3410          {//TReal check
       
  3411                      TReal realRet = 14.5;
       
  3412                      intVar.Set(realRet);
       
  3413         }
       
  3414          
       
  3415          {
       
  3416              CLiwBuffer *buf = NULL;
       
  3417              intVar.Set(buf);
       
  3418          }
       
  3419                   
       
  3420          return flag;           
       
  3421     }
       
  3422    
       
  3423 
       
  3424 TInt Cliwtestcases::LIW_DATA_GenericParamList()
       
  3425 {
       
  3426         
       
  3427       _LIT8(KText,"Test");
       
  3428       
       
  3429       _LIT8(KExamplekey,"key");
       
  3430        RBuf8 binaryData;
       
  3431       binaryData.Create(100);
       
  3432       binaryData.Append(KText);
       
  3433       
       
  3434       TLiwGenericParam param;
       
  3435       TPtrC8 ptrVar(KExamplekey);
       
  3436       param.SetNameAndValueL(ptrVar, TLiwVariant( binaryData ));
       
  3437       TGenericParamId SemId = 12;
       
  3438       param.SetSemanticId(SemId);
       
  3439       
       
  3440    /*   
       
  3441       CBufFlat *flatBuf = CBufFlat::NewL(10);
       
  3442       //flatBuf->SetReserveL(10);
       
  3443       flatBuf->ExpandL(0,101);
       
  3444       //flatBuf->DoInsertL(0,&ptrVar,ptrVar.Length());
       
  3445       TBuf8<5> buf23(KExamplekey);
       
  3446       flatBuf->Write(0,&param,100);
       
  3447       RBufReadStream buf1(*flatBuf);
       
  3448       //strmBuf->WriteL(&binaryData,binaryData.Size());
       
  3449      */     
       
  3450       CLiwGenericParamList* pList = CLiwGenericParamList::NewLC();
       
  3451       pList->AppendL(param);
       
  3452       
       
  3453       
       
  3454       _LIT8(KText1,"Test1");
       
  3455       _LIT8(KExamplekey1,"key1");
       
  3456       RBuf8 binaryData1;
       
  3457       binaryData1.Create(100);
       
  3458       binaryData1.Append(KText1);
       
  3459       
       
  3460       TLiwGenericParam param1;
       
  3461       TPtrC8 ptrVar1(KExamplekey1);
       
  3462       param1.SetNameAndValueL(ptrVar1, TLiwVariant( binaryData1 ));
       
  3463       
       
  3464       pList->AppendL(param1);
       
  3465       TInt flag = 1;
       
  3466       TInt index = 0;
       
  3467       pList->FindFirst(index,ptrVar,LIW::EVariantTypeAny);
       
  3468       
       
  3469       if(index == KErrNotFound)
       
  3470           flag = 0;
       
  3471       
       
  3472       index = 0;
       
  3473       pList->FindNext(index,ptrVar1,LIW::EVariantTypeAny);
       
  3474       if(index == KErrNotFound)
       
  3475                 flag = 0;
       
  3476       
       
  3477       TInt cnt = 0;
       
  3478       cnt = pList->Count(SemId,LIW::EVariantTypeAny);
       
  3479       
       
  3480       if(cnt != 2)
       
  3481                 flag = 0;
       
  3482       
       
  3483       pList->Remove(SemId);
       
  3484       cnt = pList->Count(SemId,LIW::EVariantTypeAny);
       
  3485       
       
  3486       binaryData.Close();
       
  3487       CleanupStack::PopAndDestroy( pList );
       
  3488       
       
  3489       if(cnt == 1 && flag == 1)
       
  3490           return KErrNone;
       
  3491       
       
  3492       return KErrGeneral;
       
  3493         
       
  3494 }
       
  3495 
       
  3496 
       
  3497 TInt Cliwtestcases::LIW_DATA_NewLOverLoad()
       
  3498 {
       
  3499           
       
  3500     CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewLC(1, 12, KContentTypeTxt);
       
  3501     CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, 13, KContentTypeTxt);
       
  3502     CleanupStack::PopAndDestroy( criteria1 );
       
  3503     CleanupStack::PopAndDestroy( criteria );
       
  3504     return KErrNone;
       
  3505 }
       
  3506 // -----------------------------------------------------------------------------
       
  3507 // Cliwtestcases::?member_function
       
  3508 // ?implementation_description
       
  3509 // (other items were commented in a header).
       
  3510 // -----------------------------------------------------------------------------
       
  3511 //
       
  3512 /*
       
  3513 TInt Cliwtestcases::?member_function(
       
  3514    CItemParser& aItem )
       
  3515    {
       
  3516 
       
  3517    ?code
       
  3518 
       
  3519    }
       
  3520 */
       
  3521 
       
  3522 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  3523 // None
       
  3524 
       
  3525 //  [End of File] - Do not remove
       
  3526