serviceapifw_plat/liw_criteria_api/tsrc/src/liwtestcasesasync.cpp
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:       
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 // INCLUDE FILES
       
    25 #include  <aknViewAppUi.h>
       
    26 #include  <liwservicehandler.h>
       
    27 #include  "liw_async_testcase.h"
       
    28 //#include  "liwtestapp.hrh"
       
    29 //#include  <liwtestapp.rsg>
       
    30 
       
    31 TInt success;
       
    32 
       
    33 using namespace LIW;
       
    34 
       
    35 //_LIT8(KAsyncService,"S60.MultiMetaData");
       
    36 //_LIT8(KSyncService,"S60.SyncServices");
       
    37 //_LIT8(KInvalidService,"S60.InvalidService");
       
    38 //_LIT8(KSecurityService,"S60.SecurityServices");
       
    39 //_LIT8(KInvalidSecurityService,"S60.InvalidSecurityServices");
       
    40 
       
    41 _LIT8(KAsyncSrv,"Test.AsyncServices");
       
    42 _LIT8(KAsyncContent,"Test/Data");
       
    43 
       
    44 //_LIT8(KTestPARAMNanmeTC2,"TestResult");
       
    45 //_LIT8(KSecurityParameter,"SecurityParam");
       
    46 
       
    47 //_LIT8(KResult_Pass, "Test Provider replied with <tt>EGenericParamError = KErrorNone</tt>");
       
    48 //_LIT8(KResult_Fail,"Test Provider replied with Error : <tt>KErrNotFound</tt>");
       
    49 
       
    50 //_LIT8(KAsyn_TestCmt, "These Test cases are designed to test LIW support for Asynchronous Invocation.\
       
    51                           <br><br><b>Test:-<b></br>\
       
    52                           <li>Attaching and Detaching service providers through string based service command</li>\
       
    53                           <li>Execute the service with callback</li>\
       
    54                           <li>After checking the event state, next Test Case is invoked</li>\
       
    55                           <br><b>Check - </b></br> \
       
    56                           Appropriate State of the event in the HandleNotify Method");
       
    57        
       
    58 TInt IncomingEventCmdID=1000;
       
    59 TInt XmlDataReaderCmdID=2000;
       
    60 
       
    61 const TInt32 LIWASYNC001=100;
       
    62 //const TInt32 LIWASYNC002=200;
       
    63 const TInt32 LIWASYNC003=300;
       
    64 const TInt32 LIWASYNC004=400;
       
    65 //const TInt32 LIWASYNC005=500;
       
    66 //const TInt32 LIWASYNC006=600;
       
    67 
       
    68 const TInt32 KAsyncMaxCount=10;
       
    69 
       
    70 const TUid KViewId4 = {4};
       
    71 
       
    72 // ---------------------------------------------------------
       
    73 // TUid CLiwtcbase::Id()
       
    74 // ?implementation_description
       
    75 // ---------------------------------------------------------
       
    76 //
       
    77 TUid CLiw_AsyncTC::Id() const
       
    78     {
       
    79     return KViewId4;
       
    80     }
       
    81 
       
    82 //Async event states. New state could be added
       
    83 enum TAsyncState
       
    84 {
       
    85 	eAsyncStarted=0,
       
    86 	eAsyncStopped
       
    87 };
       
    88 
       
    89 // ================= MEMBER FUNCTIONS =======================
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CLiw_AsyncTC::CLiw_AsyncTC
       
    93 // Description: CLiw_AsyncTC constructer
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 CLiw_AsyncTC::CLiw_AsyncTC( CLiwServiceHandler *aServiceHandler, TRequestType aRequest, TInt aPriority): CActive(aPriority)
       
    97     {
       
    98     iCount = 0;
       
    99     iResult = 1;
       
   100     iIncrementCount = 1; 
       
   101     iRequest = aRequest;
       
   102     iServiceHandler = aServiceHandler;
       
   103     iAsyncCount = 0;
       
   104     tcNo = -1;
       
   105     CActiveScheduler::Add( this );
       
   106     }
       
   107 
       
   108 TInt CLiw_AsyncTC::AsyncCase(TInt aTcNo)
       
   109 {
       
   110     tcNo = aTcNo;
       
   111     //setactive, user::requestcomplete
       
   112         
       
   113      SetActive();
       
   114     
       
   115      iStatus=KRequestPending;
       
   116      TRequestStatus* temp=&iStatus;
       
   117      User::RequestComplete(temp,KErrNone);
       
   118      
       
   119      //wait
       
   120      CActiveScheduler::Start();
       
   121      
       
   122      return iResult;
       
   123 }
       
   124 
       
   125 //
       
   126 //-----------------------------------------------------------------------------
       
   127 // CLiw_AsyncTC::RequestFunction
       
   128 // Description: Request Function for CLiw_AsyncTC
       
   129 // ----------------------------------------------------------------------------
       
   130 //
       
   131 void CLiw_AsyncTC::RequestFunction( TRequestType aRequest )
       
   132 {
       
   133  iRequest = aRequest;
       
   134  iStatus = KRequestPending;
       
   135  if( !IsActive() )
       
   136     SetActive();
       
   137 }
       
   138 
       
   139 //
       
   140 //-----------------------------------------------------------------------------
       
   141 // CLiw_AsyncTC::ReadyToGo
       
   142 // Description: This calls CLiw_AsyncTC's RunL
       
   143 //-----------------------------------------------------------------------------
       
   144 //
       
   145 void CLiw_AsyncTC::ReadyToGo()
       
   146 {
       
   147  TRequestStatus* status = &iStatus;
       
   148  User::RequestComplete( status, KErrNone );
       
   149 }
       
   150 
       
   151 
       
   152 //
       
   153 //-----------------------------------------------------------------------------
       
   154 // CLiw_AsyncTC::DoCancel
       
   155 // Description: This calls CActive's Cancel
       
   156 //-----------------------------------------------------------------------------
       
   157 //
       
   158 void CLiw_AsyncTC::DoCancel()
       
   159 {
       
   160 }
       
   161 
       
   162 //
       
   163 //-----------------------------------------------------------------------------
       
   164 // CLiw_AsyncTC::SetIncrementCounter
       
   165 // Description: Sets Increment Counter of CLiw_AsyncTC
       
   166 //-----------------------------------------------------------------------------
       
   167 //
       
   168 void CLiw_AsyncTC::SetIncrementCounter( TInt aCount)
       
   169 {
       
   170 iIncrementCount = aCount;
       
   171 }
       
   172 
       
   173 //
       
   174 //-----------------------------------------------------------------------------
       
   175 // CLiw_AsyncTC::CountValue
       
   176 // Description: Returns Count Value of CLiw_AsyncTC
       
   177 //-----------------------------------------------------------------------------
       
   178 //
       
   179 TUint CLiw_AsyncTC::CountValue () const
       
   180 {
       
   181 return iCount;
       
   182 }
       
   183 
       
   184 // ---------------------------------------------------------
       
   185 // CLiw_AsyncTC::ConstructL(const TRect& aRect)
       
   186 // EPOC two-phased constructor
       
   187 // ---------------------------------------------------------
       
   188 //
       
   189 /*void CLiw_AsyncTC::ConstructL(CLiwTestLogHandler& aLogger, CLiwTestAppContainer& aContainer)
       
   190     {
       
   191      iLogger = &aLogger;
       
   192     iContainer = &aContainer;
       
   193     
       
   194     // Create service handler instance.   
       
   195     CLiwServiceHandler* serviceHandler = CLiwServiceHandler::NewLC(); 
       
   196     iServiceHandler = serviceHandler;    
       
   197     CleanupStack::Pop(serviceHandler);
       
   198     }
       
   199 */
       
   200 
       
   201 // ---------------------------------------------------------
       
   202 // CLiw_AsyncTC::~CLiw_AsyncTC()
       
   203 // ?implementation_description
       
   204 // ---------------------------------------------------------
       
   205 //
       
   206 CLiw_AsyncTC::~CLiw_AsyncTC()
       
   207     {
       
   208     delete iServiceHandler;
       
   209     iServiceHandler = NULL;
       
   210     
       
   211     Cancel();
       
   212     }
       
   213 
       
   214 void CLiw_AsyncTC::RunL()
       
   215     {
       
   216         switch(tcNo)
       
   217         {
       
   218         case 1:
       
   219             LIW_ASYNC_001();
       
   220             break;
       
   221         case 2:
       
   222             LIW_ASYNC_002();
       
   223             break;
       
   224         case 3:
       
   225             LIW_ASYNC_003();
       
   226             break;
       
   227         case 4:
       
   228             LIW_ASYNC_004();
       
   229             break;
       
   230         default:
       
   231             break;
       
   232         }
       
   233     }
       
   234 
       
   235 
       
   236 // ---------------------------------------------------------
       
   237 // CLiw_AsyncTC::HandleCommandL
       
   238 // From MLiwNotifyCallback
       
   239 // ---------------------------------------------------------
       
   240 //   
       
   241 TInt CLiw_AsyncTC::HandleNotifyL(
       
   242     TInt aCmdId,
       
   243     TInt aEventId,
       
   244     CLiwGenericParamList& /*aEventParamList*/,
       
   245     const CLiwGenericParamList& /*aInParamList*/)
       
   246     {
       
   247     
       
   248     if(LIWASYNC001==aCmdId)
       
   249     {
       
   250     	if( (KLiwEventCompleted==aEventId) || 
       
   251     		(KLiwEventCanceled==aEventId) || 
       
   252     		(KLiwEventStopped==aEventId) ||
       
   253     		(KLiwEventError==aEventId) )
       
   254     	{
       
   255 	    	//_LIT8(testCmt,"<b>LIW_ASYNC_001:</b> <br> Create a CLiwCriteriaItem with string command \
       
   256 	    	    The provider with the same command must be attached with LIW FW.\
       
   257 	            and call <tt>ExecuteServiceCmdL</tt>.</br>\
       
   258 	            <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
       
   259 	            <br><b>Check - </b></br> Provider returns asynchronously : <tt>LiwEventCompleted</tt>");
       
   260 	
       
   261 			if(KLiwEventCompleted==aEventId)
       
   262 			{
       
   263 			    iResult = 0;
       
   264 	            //iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);
       
   265 			    //Venkat : return true as testcase passed
       
   266 	        }
       
   267 			else
       
   268             {
       
   269                 iResult = 1;
       
   270                 //iLogger->AddTestItem(testCmt,KResult_Fail,ETrue, EFalse);
       
   271                 //Venkat : Test fails
       
   272     		}
       
   273 
       
   274             CActiveScheduler::Stop();
       
   275 			//LIW_ASYNC_002();
       
   276     	}
       
   277     }
       
   278     else if(LIWASYNC003==aCmdId)
       
   279     {
       
   280     	//if the counter reaches 
       
   281     	//event notification should be cancelled
       
   282     	++iAsyncCount;
       
   283     	
       
   284     	if( (KLiwEventCompleted==aEventId) || 
       
   285     		(KLiwEventCanceled==aEventId) || 
       
   286     		(KLiwEventStopped==aEventId) ||
       
   287     		(KLiwEventError==aEventId) )
       
   288     	{
       
   289     		//_LIT8(testCmt,"<b>LIW_ASYNC_003:</b> <br> Create a CLiwCriteriaItem with string command \
       
   290                 The provider with the same command must be attached with LIW FW.\
       
   291                 and call <tt>ExecuteServiceCmdL</tt>.</br>\
       
   292                 <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
       
   293                 <br><b>Check - </b></br> Provider returns asynchronously : <tt>LiwEventStopped</tt>");
       
   294   
       
   295     		if(KLiwEventStopped==aEventId)
       
   296     		{
       
   297     		    iResult = 0;
       
   298                 //iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);
       
   299             }
       
   300             else
       
   301             {
       
   302                 iResult = 1;
       
   303                 //iLogger->AddTestItem(testCmt,KResult_Fail,EFalse, EFalse);
       
   304     		}
       
   305     			
       
   306     		//LIW_ASYNC_003((TInt32)eAsyncStopped);
       
   307     		iAsyncCount=0;    		
       
   308     		iTransID=0;
       
   309     		
       
   310     		return KErrNone;
       
   311     	}
       
   312     	    	
       
   313     	if(iAsyncCount >= KAsyncMaxCount)
       
   314     	{
       
   315     		LIW_ASYNC_003((TInt32)eAsyncStopped);
       
   316     		iAsyncCount=0;
       
   317     		iTransID=0;
       
   318     		//LIW_ASYNC_004();
       
   319 
       
   320             CActiveScheduler::Stop();
       
   321     	}
       
   322     }
       
   323     else if(LIWASYNC004==aCmdId)
       
   324     {
       
   325     	if( (KLiwEventCanceled==aEventId) || 
       
   326     		(KLiwEventStopped==aEventId) ||
       
   327     		(KLiwEventError==aEventId) )
       
   328     	{
       
   329 	    	//_LIT8(testCmt,"<b>LIW_ASYNC_004:</b> <br> Create a CLiwCriteriaItem with string command \
       
   330 	            The provider with the same command must be attached with LIW FW.\
       
   331 	            and call <tt>ExecuteServiceCmdL</tt>.</br>\
       
   332 	            <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
       
   333 	            <br><b>Check - </b></br> Provider returns asynchronously : <tt>LiwEventError</tt>");
       
   334 	    	
       
   335 	    	if(KLiwEventError==aEventId)
       
   336 			{
       
   337 			    iResult = 0;
       
   338 				//iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);
       
   339 			}
       
   340 	    	else
       
   341 	    	{
       
   342 	    	    iResult = 1;
       
   343 		        //iLogger->AddTestItem(testCmt,KResult_Fail,EFalse, EFalse);
       
   344 	    	}
       
   345 
       
   346             CActiveScheduler::Stop();
       
   347     	}
       
   348     }
       
   349     return KErrNone;    
       
   350     }
       
   351 
       
   352 // ---------------------------------------------------------
       
   353 /*LIW Asynchronous service Test Cases are Defined here*/
       
   354 // ---------------------------------------------------------
       
   355 
       
   356 void CLiw_AsyncTC::LIW_ASYNC_004()
       
   357 {
       
   358 
       
   359 	/*Detached all the service provider and reset all the Entries of previous test case*/
       
   360     iServiceHandler->Reset();
       
   361     
       
   362     RCriteriaArray interest;
       
   363     CleanupClosePushL(interest);
       
   364     
       
   365     const TDesC8* cmd = &KAsyncSrv;
       
   366     
       
   367     //Define Criteria Item Dynamically with string based command 
       
   368     CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
       
   369     criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   370     interest.AppendL(criteria1);
       
   371    
       
   372     /*Attach the base provider*/
       
   373 	iServiceHandler->AttachL(interest);
       
   374 	CleanupStack::PopAndDestroy(criteria1);
       
   375     CleanupStack::PopAndDestroy(&interest);
       
   376 
       
   377 	TLiwGenericParam asyncSrvCmdIDParam;
       
   378 	TLiwGenericParam asyncStateParam;
       
   379 	TLiwGenericParam asyncTransIDParam;
       
   380 	TLiwGenericParam testCaseIDParam;
       
   381 
       
   382 	_LIT8(KAsyncCmdID, "AsyncCmdID");
       
   383 //	_LIT8(KAsyncCmdName, "IncomingEvents");
       
   384 	_LIT8(KAsyncEventState, "AsyncEventState");
       
   385 	//_LIT8(KAsyncTransID, "TransactionID");
       
   386 	_LIT8(KTestCaseID, "TestCaseID");
       
   387 	
       
   388 	//_LIT8(KLIW_ASYNC_001, "LIW_ASYNC_001");
       
   389 	TInt32 testCaseID=LIWASYNC004;
       
   390 
       
   391 	CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   392 	inps->Reset();
       
   393 
       
   394 	asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)XmlDataReaderCmdID));
       
   395 	asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)eAsyncStarted));
       
   396 	testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
       
   397 		
       
   398 	inps->AppendL(asyncSrvCmdIDParam);
       
   399 	inps->AppendL(asyncStateParam);	            		  		
       
   400 	inps->AppendL(testCaseIDParam);
       
   401 	      		
       
   402 	CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
       
   403 	crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   404 
       
   405 	CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   406 
       
   407 	iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous,this); 
       
   408 	
       
   409 	asyncSrvCmdIDParam.Reset();
       
   410 	asyncStateParam.Reset();
       
   411 	asyncTransIDParam.Reset();
       
   412 	testCaseIDParam.Reset();
       
   413 	CleanupStack::PopAndDestroy(crit); // crit
       
   414 }
       
   415 
       
   416 void CLiw_AsyncTC::LIW_ASYNC_003(TInt aEventState)
       
   417 {
       
   418 
       
   419 	const TDesC8* cmd = &KAsyncSrv;
       
   420 
       
   421 	if(eAsyncStarted==aEventState)
       
   422 	{
       
   423 		/*Detached all the service provider and reset all the Entries of previous test case*/
       
   424 	    iServiceHandler->Reset();
       
   425 	    
       
   426 	    RCriteriaArray interest;
       
   427 	    CleanupClosePushL(interest);
       
   428 	    
       
   429 	    
       
   430 	    
       
   431 	    //Define Criteria Item Dynamically with string based command 
       
   432 	    CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
       
   433 	    criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   434 	    interest.AppendL(criteria1);
       
   435 	   
       
   436 	    /*Attach the base provider*/
       
   437 		iServiceHandler->AttachL(interest);
       
   438 		CleanupStack::PopAndDestroy(criteria1);
       
   439 	    CleanupStack::PopAndDestroy(&interest);
       
   440 	}
       
   441 	
       
   442 
       
   443 	TLiwGenericParam asyncSrvCmdIDParam;
       
   444 	TLiwGenericParam asyncStateParam;
       
   445 	TLiwGenericParam asyncTransIDParam;
       
   446 	TLiwGenericParam testCaseIDParam;
       
   447 
       
   448 	_LIT8(KAsyncCmdID, "AsyncCmdID");
       
   449 //	_LIT8(KAsyncCmdName, "IncomingEvents");
       
   450 	_LIT8(KAsyncEventState, "AsyncEventState");
       
   451 	//_LIT8(KAsyncTransID, "TransactionID");
       
   452 	_LIT8(KTestCaseID, "TestCaseID");
       
   453 	
       
   454 	TInt32 testCaseID=LIWASYNC003;
       
   455 
       
   456 	CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   457 	inps->Reset();
       
   458 
       
   459 	asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)IncomingEventCmdID));
       
   460 	asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)aEventState));
       
   461 	testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
       
   462 		
       
   463 	inps->AppendL(asyncSrvCmdIDParam);
       
   464 	inps->AppendL(asyncStateParam);	            		  		
       
   465 	inps->AppendL(testCaseIDParam);
       
   466 
       
   467 	if(eAsyncStopped==aEventState)
       
   468 	{
       
   469 		TLiwGenericParam asyncTransIDParam;					
       
   470 		_LIT8(KAsyncTransID, "TransactionID");
       
   471 		asyncTransIDParam.SetNameAndValueL(KAsyncTransID, TLiwVariant((TInt32)iTransID));					
       
   472 		inps->AppendL(asyncTransIDParam);
       
   473 		asyncTransIDParam.Reset();
       
   474 	}
       
   475 	      		
       
   476 	CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
       
   477 	crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   478 
       
   479 	CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   480 
       
   481 	iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous,this); 
       
   482 	
       
   483 	asyncSrvCmdIDParam.Reset();
       
   484 	asyncStateParam.Reset();
       
   485 	asyncTransIDParam.Reset();
       
   486 	testCaseIDParam.Reset();
       
   487 	CleanupStack::PopAndDestroy(crit); // crit
       
   488 	
       
   489 	if(eAsyncStarted==aEventState)
       
   490 	{
       
   491 		TInt pos = 0;
       
   492 		_LIT8(KAsyncTransID, "TransactionID");
       
   493 		outps->FindFirst(pos, KAsyncTransID);
       
   494 
       
   495 		TLiwGenericParam transIDParam = outps->operator[](pos);
       
   496 		iTransID = transIDParam.Value().AsTInt32();
       
   497 	}
       
   498 
       
   499 	//LIW_ASYNC_004();
       
   500 }
       
   501 
       
   502 void CLiw_AsyncTC::LIW_ASYNC_002()
       
   503 {
       
   504 
       
   505 	/*Detached all the service provider and reset all the Entries of previous test case*/
       
   506     iServiceHandler->Reset();
       
   507     
       
   508     RCriteriaArray interest;
       
   509     CleanupClosePushL(interest);
       
   510     
       
   511     const TDesC8* cmd = &KAsyncSrv;
       
   512     
       
   513     //Define Criteria Item Dynamically with string based command 
       
   514     CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
       
   515     criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   516     interest.AppendL(criteria1);
       
   517    
       
   518     /*Attach the base provider*/
       
   519 	iServiceHandler->AttachL(interest);
       
   520 	CleanupStack::PopAndDestroy(criteria1);
       
   521     CleanupStack::PopAndDestroy(&interest);
       
   522 
       
   523 	TLiwGenericParam asyncSrvCmdIDParam;
       
   524 	TLiwGenericParam asyncStateParam;
       
   525 	TLiwGenericParam asyncTransIDParam;
       
   526 	TLiwGenericParam testCaseIDParam;
       
   527 
       
   528 	_LIT8(KAsyncCmdID, "AsyncCmdID");
       
   529 //	_LIT8(KAsyncCmdName, "IncomingEvents");
       
   530 	_LIT8(KAsyncEventState, "AsyncEventState");
       
   531 	//_LIT8(KAsyncTransID, "TransactionID");
       
   532 	_LIT8(KTestCaseID, "TestCaseID");
       
   533 	
       
   534 	//_LIT8(KLIW_ASYNC_001, "LIW_ASYNC_001");
       
   535 	TInt32 testCaseID=LIWASYNC001;
       
   536 
       
   537 	CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   538 	inps->Reset();
       
   539 
       
   540 	asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)XmlDataReaderCmdID));
       
   541 	asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)eAsyncStarted));
       
   542 	testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
       
   543 		
       
   544 	inps->AppendL(asyncSrvCmdIDParam);
       
   545 	inps->AppendL(asyncStateParam);	            		  		
       
   546 	inps->AppendL(testCaseIDParam);
       
   547 	      		
       
   548 	CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, *cmd, KAsyncContent);
       
   549 	crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   550 
       
   551 	CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   552 
       
   553 	iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous); 
       
   554 	
       
   555 	//Since there is no callback, the control returns here
       
   556 	//Checking for the success of this testcase
       
   557 	
       
   558 	TInt pos=0;
       
   559 	
       
   560 	outps->FindFirst(pos, EGenericParamError);
       
   561 	    
       
   562     if(pos != KErrNotFound)
       
   563     {
       
   564 		//_LIT8(testCmt,"<b>LIW_ASYNC_001:</b> <br> Create a CLiwCriteriaItem with string command \
       
   565 	    The provider with the same command must be attached with LIW FW.\
       
   566         and call <tt>ExecuteServiceCmdL</tt>.</br>\
       
   567         <br><b>Test -</b></br> <li>Attaching provider Programmatically</li> <li>string based serviceName</li>\
       
   568         <li>No CallBack is mentioned</li><br><b>Check - </b></br>\
       
   569         Provider returns control immediately (Synchronous) <tt>EGenericParamError = KErrCancel</tt>");
       
   570 
       
   571 		if ((*outps)[pos].Value().AsTInt32() == KErrCancel)
       
   572 		{
       
   573 		    iResult = 0;
       
   574 		    //iLogger->AddTestItem(testCmt,KResult_Pass,ETrue, EFalse);	            
       
   575         }
       
   576 		else
       
   577         {
       
   578             iResult = 1;
       
   579             //iLogger->AddTestItem(testCmt,KResult_Fail,ETrue, EFalse);
       
   580 		}	
       
   581 	}	
       
   582 	asyncSrvCmdIDParam.Reset();
       
   583 	asyncStateParam.Reset();
       
   584 	asyncTransIDParam.Reset();
       
   585 	testCaseIDParam.Reset();
       
   586 	CleanupStack::PopAndDestroy(crit); // crit
       
   587 	
       
   588 	CActiveScheduler::Stop();
       
   589 	//LIW_ASYNC_003();
       
   590 }
       
   591 
       
   592 
       
   593 void CLiw_AsyncTC::LIW_ASYNC_001()
       
   594 {
       
   595     /*Detached all the service provider and reset all the Entries of previous test case*/
       
   596     iServiceHandler->Reset();
       
   597     
       
   598     RCriteriaArray interest;
       
   599     CleanupClosePushL(interest);
       
   600     
       
   601     //Define Criteria Item Dynamically with string based command 
       
   602     CLiwCriteriaItem* criteria1 = CLiwCriteriaItem::NewLC(1, KAsyncSrv, KAsyncContent);
       
   603     criteria1->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   604     interest.AppendL(criteria1);
       
   605     
       
   606     /*Attach the base provider*/
       
   607     TInt status = iServiceHandler->AttachL(interest);
       
   608     CleanupStack::PopAndDestroy(criteria1);
       
   609     CleanupStack::PopAndDestroy(&interest);
       
   610     
       
   611     TLiwGenericParam asyncSrvCmdIDParam;
       
   612     TLiwGenericParam asyncStateParam;
       
   613     TLiwGenericParam asyncTransIDParam;
       
   614     TLiwGenericParam testCaseIDParam;
       
   615     
       
   616     _LIT8(KAsyncCmdID, "AsyncCmdID");
       
   617     //_LIT8(KAsyncCmdName, "IncomingEvents");
       
   618     _LIT8(KAsyncEventState, "AsyncEventState");
       
   619     //_LIT8(KAsyncTransID, "TransactionID");
       
   620     _LIT8(KTestCaseID, "TestCaseID");
       
   621     
       
   622     //_LIT8(KLIW_ASYNC_001, "LIW_ASYNC_001");
       
   623     TInt32 testCaseID=LIWASYNC001;
       
   624     
       
   625     CLiwGenericParamList* inps = &(iServiceHandler->InParamListL());
       
   626     inps->Reset();
       
   627     
       
   628     asyncSrvCmdIDParam.SetNameAndValueL(KAsyncCmdID, TLiwVariant((TInt32)XmlDataReaderCmdID));
       
   629     asyncStateParam.SetNameAndValueL(KAsyncEventState, TLiwVariant((TInt32)eAsyncStarted));
       
   630     testCaseIDParam.SetNameAndValueL(KTestCaseID, TLiwVariant((TInt32)testCaseID));
       
   631         
       
   632     inps->AppendL(asyncSrvCmdIDParam);
       
   633     inps->AppendL(asyncStateParam);                             
       
   634     inps->AppendL(testCaseIDParam);
       
   635                 
       
   636     CLiwCriteriaItem* crit = CLiwCriteriaItem::NewLC(1, KAsyncSrv, KAsyncContent);
       
   637     crit->SetServiceClass(TUid::Uid(KLiwClassBase));
       
   638     
       
   639     CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL());
       
   640     
       
   641     iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps,KLiwOptASyncronous,this); 
       
   642     
       
   643     asyncSrvCmdIDParam.Reset();
       
   644     asyncStateParam.Reset();
       
   645     asyncTransIDParam.Reset();
       
   646     testCaseIDParam.Reset();
       
   647     
       
   648     CleanupStack::PopAndDestroy(crit); // crit
       
   649 }