os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/uloggerservertest1step.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Example CTestStep derived implementation
    15 // 
    16 //
    17 
    18 /**
    19  @file UloggerServerTest1Step.cpp
    20  @internalTechnology
    21 */
    22 #include "uloggerservertest1step.h"
    23 #include "te_uloggerservertestsuitedefs.h"
    24 #include "uloggerserver.h"
    25 #include <e32const.h>
    26 using namespace Ulogger;
    27 
    28 
    29 CUloggerServerTest1Step::~CUloggerServerTest1Step()
    30 /**
    31  * Destructor
    32  */
    33 	{
    34 	}
    35 
    36 CUloggerServerTest1Step::CUloggerServerTest1Step()
    37 /**
    38  * Constructor
    39  */
    40 	{
    41 	// **MUST** call SetTestStepName in the constructor as the controlling
    42 	// framework uses the test step name immediately following construction to set
    43 	// up the step's unique logging ID.
    44 	SetTestStepName(KUloggerServerTest1Step);
    45 	}
    46 
    47 TVerdict CUloggerServerTest1Step::doTestStepPreambleL()
    48 /**
    49  * @return - TVerdict code
    50  * Override of base class virtual
    51  */
    52 	{
    53 	iScheduler = new (ELeave) CActiveScheduler();
    54 	CActiveScheduler::Install(iScheduler);
    55 		
    56 	SetTestStepResult(EPass);
    57 	return TestStepResult();
    58 	}
    59 
    60 
    61 TVerdict CUloggerServerTest1Step::doTestStepL()
    62 	{
    63 	iErrors = 0;
    64 	  if (TestStepResult()==EPass)
    65 		{
    66 		  iErrors += Test1L();//CULoggerServer::NewLC
    67 		  iErrors += Test2L();//CULoggerServer::IncrementSessions
    68 		  iErrors += Test3L();//CULoggerServer::Stop
    69 		  iErrors += Test4L();//CULoggerServer::GetPrimaryFilters
    70 		  iErrors += Test5L();//CULoggerServer::GetSecondaryFilters
    71 		  iErrors += Test6L();//CULoggerServer::RemoveFilterfromConfig
    72 		  iErrors += Test7L();//CULoggerServer::EnablePrimaryFilter
    73 		  iErrors += Test8L();//CULoggerServer::SetSecondaryFilter
    74 		  iErrors += Test9L();//CULoggerServer::Start
    75 		  iErrors += Test12L();//CULoggerServer::SetActiveOutputMedia
    76 		  iErrors += Test13L();//CULoggerServer::SetOutputPluginSettings
    77 		  iErrors += Test14L();//CULoggerServer::GetActiveOutput
    78 		  iErrors += Test15L();//CULoggerServer::GetInstalledPlugins
    79 		  iMediaCount = 0;
    80 		  iErrors += Test16L();//CULoggerServer::GetOutputPluginSettingsL
    81 		  iErrors += Test18L();//CULoggerServer::SetBufferSizeL
    82 		  iErrors += Test19L();//CULoggerServer::SetDataNotificationSizeL
    83 		  iErrors += Test20L();//CULoggerServer::GetBufferSize
    84 		  iErrors += Test21L();// CULoggerServer::GetDataNotificationSize
    85 		  iErrors += Test22L();//CULoggerServer::SetGlobalSecondaryFilters
    86 		  iErrors += Test23L();//CULoggerServer::ReadBufferL
    87 		  iErrors += Test25L();//CULoggerServer::SetBufferMode
    88 		  iErrors += Test26L();//CULoggerServer::UnconfigureCurrentChannel
    89 		  iErrors += Test27L();//CULoggerServer::DoPostProcessing
    90 		  iErrors += Test28L();//CULoggerServer::RemoveOutputPluginSettingsL
    91 		  iErrors += Test29L();//CULoggerServer::GetInstalledControlPlugins
    92 		  iErrors += Test30L();//CULoggerServer::SetActiveControlMedia
    93 		  iErrors += Test31L();//CULoggerServer::ProcessCommandL
    94 		  
    95 		//display results
    96 		TBuf<128> res;
    97 		res.AppendFormat(_L("%d errors"), iErrors);
    98 		INFO_PRINTF1(_L("****Results****"));
    99 		INFO_PRINTF1(res);
   100 		if(iErrors == 0)  
   101 			SetTestStepResult(EPass);
   102 			else
   103 				SetTestStepResult(EFail);
   104 		}
   105 	  return TestStepResult();
   106 	}
   107 
   108 
   109 
   110 TVerdict CUloggerServerTest1Step::doTestStepPostambleL()
   111 /**
   112  * @return - TVerdict code
   113  * Override of base class virtual
   114  */
   115 	{
   116 	delete iScheduler;
   117 	iScheduler = NULL;
   118 	return TestStepResult();
   119 	}
   120 
   121 TInt CUloggerServerTest1Step::Test1L()
   122 {//CULoggerServer::NewLC
   123 	TInt errors = 0;
   124   	INFO_PRINTF1(_L("Testing - CULoggerServer::NewLC method"));
   125   	CULoggerServer *server = NULL;
   126   	server = CULoggerServer::NewLC(EPriorityBackground);
   127     if(server == NULL)
   128     	{
   129     	INFO_PRINTF1(_L("error"));
   130     	++errors;
   131     	}
   132     	else
   133     		CleanupStack::PopAndDestroy();
   134     return errors;
   135 }
   136 
   137 TInt CUloggerServerTest1Step::Test2L()
   138 {//CULoggerServer::IncrementSessions
   139 	TInt errors = 0;
   140 	INFO_PRINTF1(_L("Testing - CULoggerServer::IncrementSessions method"));
   141 	CULoggerServer *server = NULL;
   142 	server = CULoggerServer::NewLC(EPriorityBackground);
   143 	if(server == NULL)
   144 	    {
   145 	    INFO_PRINTF1(_L("error"));
   146 	    ++errors;
   147 	    }
   148 	    else
   149 	    {
   150 	    	server->IncrementSessions();
   151 	    	//note it's not possible to test method DecrementSessions without 
   152 	    	//previous connection as server always stop CActiveScheduler when last session will dissconnect.
   153 	    	//look for CULoggerServer::DecrementSessions() method
   154 	    	CleanupStack::PopAndDestroy();
   155 	    }
   156 	 return errors;
   157 }
   158   	
   159 TInt CUloggerServerTest1Step::Test3L()
   160 {//CULoggerServer::Stop
   161 	TInt errors = 0;
   162 	INFO_PRINTF1(_L("Testing - CULoggerServer::Stop method"));
   163 	CULoggerServer *server = NULL;
   164 	server = CULoggerServer::NewLC(EPriorityBackground);
   165 	if(server == NULL)
   166 	    {
   167 	    INFO_PRINTF1(_L("error"));
   168 	    ++errors;
   169 	    }
   170 	    else
   171 	    {
   172 	    	TInt e = server->Stop();
   173 	    	TBuf<128> buf;
   174 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   175 	    	INFO_PRINTF1(buf);
   176 	    	CleanupStack::PopAndDestroy();
   177 	    }
   178 	return errors;
   179 }
   180 
   181 TInt CUloggerServerTest1Step::Test4L()
   182 {//CULoggerServer::GetPrimaryFilters
   183 	TInt errors = 0;
   184 	INFO_PRINTF1(_L("Testing - CULoggerServer::GetPrimaryFilters method"));
   185 	CULoggerServer *server = NULL;
   186 	server = CULoggerServer::NewLC(EPriorityBackground);
   187 	if(server == NULL)
   188 	    {
   189 	    INFO_PRINTF1(_L("error"));
   190 	    ++errors;
   191 	    }
   192 	    else
   193 	    {
   194 	    	RArray<TUint32> array;
   195 	    	TInt e = server->GetActiveFilters(array,EPrimaryFilter);
   196 	    	if(e!=KErrNone) errors++;
   197 	    	TBuf<128> buf;
   198 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   199 	    	INFO_PRINTF1(buf);
   200 	    	buf.Zero();
   201 	    	buf.AppendFormat(_L("Num. of filters - %d"), array.Count());
   202 	    	INFO_PRINTF1(buf);
   203 	    	CleanupStack::PopAndDestroy(); //server
   204 	    	array.Close();
   205 	    }
   206 	return errors;
   207 }	
   208 
   209 TInt CUloggerServerTest1Step::Test5L()
   210 {//CULoggerServer::GetSecondaryFilters
   211 	TInt errors = 0;
   212     INFO_PRINTF1(_L("Testing - CULoggerServer::GetSecondaryFilters method"));
   213 	CULoggerServer *server = NULL;
   214 	server = CULoggerServer::NewLC(EPriorityBackground);
   215 	if(server == NULL)
   216 	    {
   217 	    INFO_PRINTF1(_L("error"));
   218 	    ++errors;
   219 	    }
   220 	    else
   221 	    {
   222 	    	RArray<TUint32> array;
   223 	    	TInt e = server->GetActiveFilters(array,ESecondaryFilter);
   224 	    	if(e!=KErrNone) errors++;
   225 	    	TBuf<128> buf;
   226 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   227 	    	INFO_PRINTF1(buf);
   228 	    	buf.Zero();
   229 	    	buf.AppendFormat(_L("Num. of filters - %d"), array.Count());
   230 	    	INFO_PRINTF1(buf);
   231 	    	CleanupStack::PopAndDestroy(); //server
   232 	    	array.Close();
   233 	    }
   234 	return errors;
   235 }	
   236 
   237 TInt CUloggerServerTest1Step::Test6L()
   238 {//CULoggerServer::RemoveFilterfromConfig
   239 	TInt errors = 0;
   240 	INFO_PRINTF1(_L("Testing - CULoggerServer::RemoveFilterfromConfig method"));
   241 	CULoggerServer *server = NULL;
   242 	server = CULoggerServer::NewLC(EPriorityBackground);
   243 	if(server == NULL)
   244 	    {
   245 	    INFO_PRINTF1(_L("error"));
   246 	    ++errors;
   247 	    }
   248 	    else
   249 	    {	RArray<TUint32> filters;
   250 			//CleanupClosePushL(filters);
   251 			for(TInt i=20;i<40;i++)
   252 			{
   253 				filters.AppendL(i);
   254 			}
   255 			//	filters->AppendL(i);
   256 	    	TInt e = server->RemoveActiveFilter(filters,EPrimaryFilter);
   257 	    	filters.Close();
   258 	    	TBuf<128> buf;
   259 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   260 	    	INFO_PRINTF1(buf);
   261 	    
   262 	    	//CleanupStack::PopAndDestroy(); //filters
   263 	    	CleanupStack::PopAndDestroy(); //server
   264 	//}
   265 	    }
   266 	return errors;
   267 }	
   268 
   269 TInt CUloggerServerTest1Step::Test6AL()
   270 {//CULoggerServer::RemoveFilterfromConfig
   271 	TInt errors = 0;
   272 	INFO_PRINTF1(_L("Testing - CULoggerServer::RemoveFilterfromConfig method"));
   273 	CULoggerServer *server = NULL;
   274 	server = CULoggerServer::NewLC(EPriorityBackground);
   275 	if(server == NULL)
   276 	    {
   277 	    INFO_PRINTF1(_L("error"));
   278 	    ++errors;
   279 	    }
   280 	    else
   281 	    {
   282 	    	RArray<TUint32> filters;
   283 			CleanupClosePushL(filters);
   284 			for(TUint32 i=321;i<400;i++)
   285 				filters.AppendL(i);
   286 	    	TInt e = server->RemoveActiveFilter(filters,ESecondaryFilter);;
   287 	    	filters.Close();
   288 	    	TBuf<128> buf;
   289 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   290 	    	INFO_PRINTF1(buf);
   291 	    
   292 	    	CleanupStack::PopAndDestroy(&filters); //server
   293 	    		CleanupStack::PopAndDestroy(); //server
   294 	    }
   295 	return errors;
   296 }	
   297 
   298 TInt CUloggerServerTest1Step::Test7L()
   299 {//CULoggerServer::EnablePrimaryFilter
   300 	TInt errors = 0;
   301 	INFO_PRINTF1(_L("Testing - CULoggerServer::SetPrimaryFilter method"));
   302 	CULoggerServer *server = NULL;
   303 	server=CULoggerServer::NewLC(EPriorityBackground);
   304 	if(server == NULL)
   305 	    {
   306 	    INFO_PRINTF1(_L("error"));
   307 	    ++errors;
   308 	    }
   309 	    else
   310 	    {
   311 	    	RArray<TUint32> aCategory;
   312 	   	    	
   313 	    	aCategory.Append(3);
   314 	    	aCategory.Append(14);
   315 	    	aCategory.Append(194);
   316 	    	
   317 	    	TInt e = KErrNone;
   318 	    	e = server->SetActiveFilterL(aCategory,EPrimaryFilter);
   319 	    	TBuf<128> buf;
   320 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   321 	    	INFO_PRINTF1(buf);
   322 	    	CleanupStack::PopAndDestroy(); //server
   323 	    }
   324 	return errors;
   325 }
   326 
   327 
   328 TInt CUloggerServerTest1Step::Test8L()
   329 {//CULoggerServer::SetSecondaryFilter
   330 	TInt errors = 0;
   331 	INFO_PRINTF1(_L("Testing - CULoggerServer::SetSecondaryFilter method"));
   332 	CULoggerServer *server = NULL;
   333 	server=CULoggerServer::NewLC(EPriorityBackground);
   334 	if(server == NULL)
   335 	    {
   336 	    INFO_PRINTF1(_L("error"));
   337 	    ++errors;
   338 	    }
   339 	    else
   340 	    {
   341 	    	RArray<TUint32> array;
   342 	    	array.Append(34);
   343 	    	TInt e = server->SetActiveFilterL(array,ESecondaryFilter);
   344 	    	TBuf<128> buf;
   345 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   346 	    	INFO_PRINTF1(buf);
   347 	    	CleanupStack::PopAndDestroy(); //server
   348 	    	array.Close();
   349 	    }
   350 	return errors;
   351  }
   352 
   353 TInt CUloggerServerTest1Step::Test9L()
   354 {//CULoggerServer::Start
   355 	TInt errors = 0;
   356 	CULoggerServer *server = NULL;
   357 	server = CULoggerServer::NewLC(EPriorityBackground);
   358 	if(server == NULL)
   359 	    {
   360 	    INFO_PRINTF1(_L("error"));
   361 	    ++errors;
   362 	    }
   363 	    else
   364 	    {
   365 	    	/*
   366 	    	 * here we are going to test sequence off methods
   367 	    	 * */
   368 	    	TBuf<128> buf;
   369 	    	INFO_PRINTF1(_L("Testing - CULoggerServer::Start method"));
   370 	    	TInt e = server->Start();
   371 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   372 	    	INFO_PRINTF1(buf);
   373 	    	INFO_PRINTF1(_L("Testing - CULoggerServer::SetGlobalSecondaryFilters method"));
   374 	    	e = server->SetSecondaryFiltering(_L8("current"));
   375 	    	buf.Zero();
   376 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   377 	    	INFO_PRINTF1(buf);
   378 	    	INFO_PRINTF1(_L("Testing - CULoggerServer::Stop method"));
   379 	    	e = server->Stop();
   380 	    	buf.Zero();
   381 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   382 	    	INFO_PRINTF1(buf);
   383 	    	CleanupStack::PopAndDestroy(); //server
   384 	    }
   385 	return errors;
   386  }
   387 
   388 
   389 
   390 TInt CUloggerServerTest1Step::Test12L()
   391 {//CULoggerServer::SetActiveOutputPlugin
   392 	TInt errors = 0;
   393 		INFO_PRINTF1(_L("Testing - CULoggerServer::SetActiveOutputPlugin method"));
   394 	CULoggerServer *server = NULL;
   395 	server = CULoggerServer::NewLC(EPriorityBackground);
   396 	if(server == NULL)
   397 	    {
   398 	    INFO_PRINTF1(_L("error"));
   399 	    ++errors;
   400 	    }
   401 	    else
   402 	    {
   403 	    	TInt e = server->SetActiveOutputPlugin(_L8("media1"));
   404 	    	TBuf<128> buf;
   405 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   406 	    	INFO_PRINTF1(buf);
   407 	    	CleanupStack::PopAndDestroy(); //server
   408 	    }
   409 	return errors;
   410  }
   411 
   412 TInt CUloggerServerTest1Step::Test13L()
   413 {//CULoggerServer::SetOutputPluginSettings
   414 	TInt errors = 0;
   415 		INFO_PRINTF1(_L("Testing - CULoggerServer::SetOutputPluginSettings method"));
   416 	CULoggerServer *server = NULL;
   417 	server = CULoggerServer::NewLC(EPriorityBackground);
   418 	if(server == NULL)
   419 	    {
   420 	    INFO_PRINTF1(_L("error"));
   421 	    ++errors;
   422 	    }
   423 	    else
   424 	    {
   425 	    	RArray<TPtrC8> value;
   426 	    	value.AppendL(_L8("output_path"));
   427 	    	value.AppendL(_L8("c:\\logs\\ulogger.log"));
   428 	    	TInt e = server->SetPluginSettings(_L8("media1"),value);// _L8("output_path"), _L8("c:\\logs\\ulogger.log"));
   429 	    	TBuf<128> buf;
   430 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   431 	    	INFO_PRINTF1(buf);
   432 	    	CleanupStack::PopAndDestroy(); //server
   433 	    }
   434 	return errors;
   435  }
   436 
   437 TInt CUloggerServerTest1Step::Test14L()
   438 {//CULoggerServer::GetActiveOutput
   439 	TInt errors = 0;
   440 	INFO_PRINTF1(_L("Testing - CULoggerServer::GetActiveOutputPlugin method"));
   441 	CULoggerServer *server = NULL;
   442 	server = CULoggerServer::NewLC(EPriorityBackground);
   443 	if(server == NULL)
   444 	    {
   445 	    INFO_PRINTF1(_L("error"));
   446 	    ++errors;
   447 	    }
   448 	    else
   449 	    {
   450 	    	RArray<TPtrC8> listBuffer;
   451 	    	TInt e = server->GetActiveOutputPlugin(listBuffer);
   452 	    	TBuf<128> buf;
   453 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   454 	    	INFO_PRINTF1(buf);
   455 	    	buf.Zero();
   456 	    	if(listBuffer.Count()>0)
   457 	    	{
   458 	    		INFO_PRINTF1(_L("values:"));
   459 	    		buf.Copy(listBuffer[0]);					    		
   460 	    		INFO_PRINTF1(buf);
   461 	    	}
   462 	    	listBuffer.Close();
   463 	    	CleanupStack::PopAndDestroy(); //server
   464 	    }
   465 	return errors;
   466  }
   467 
   468 TInt CUloggerServerTest1Step::Test15L()
   469 {//CULoggerServer::GetInstalledPlugins
   470 	TInt errors = 0;
   471 		INFO_PRINTF1(_L("Testing - CULoggerServer::GetInstalledOutputPlugins method"));
   472 	CULoggerServer *server = NULL;
   473 	server = CULoggerServer::NewLC(EPriorityBackground);
   474 	if(server == NULL)
   475 	    {
   476 	    INFO_PRINTF1(_L("error"));
   477 	    ++errors;
   478 	    }
   479 	    else
   480 	    {
   481 	    	RArray<TPtrC8> listBuffer;
   482 	    	TInt e = server->GetInstalledOutputPlugins(listBuffer);
   483 	    	TBuf<128> buf;
   484 	    	buf.AppendFormat(_L("Code returned from method - %d"), e);
   485 	    	INFO_PRINTF1(buf);
   486 	    	buf.Zero();
   487     		INFO_PRINTF1(_L("values:"));
   488 	    	for(TInt i=0; i<listBuffer.Count(); ++i)
   489 	    	{
   490 	    		buf.Copy(listBuffer[i]);					    		
   491 	    		INFO_PRINTF1(buf);
   492 	    	}
   493 	    	iMediaCount = listBuffer.Count()/2;
   494 	    	listBuffer.Close();
   495 	    	CleanupStack::PopAndDestroy(); //server
   496 	    }
   497 	return errors;
   498  }
   499 TInt CUloggerServerTest1Step::Test16L()
   500 {//CULoggerServer::GetOutputPluginSettingsL
   501 	TInt errors = 0;
   502 		INFO_PRINTF1(_L("Testing - CULoggerServer::GetOutputPluginSettingsL method"));
   503 	CULoggerServer *server = NULL;
   504 	server = CULoggerServer::NewLC(EPriorityBackground);
   505 	if(server == NULL)
   506 	    {
   507 	    INFO_PRINTF1(_L("error"));
   508 	    ++errors;
   509 	    }
   510 	    else
   511 	    {
   512 	    	for(TInt k=0; k<iMediaCount; k++)
   513 	    		{
   514 	    		TBuf8<32> mediaBuf;
   515 	    		mediaBuf.AppendFormat(_L8("media%d"),k+1);
   516 	    		RArray<TPtrC8> mediaList;
   517 	    		TInt e = server->GetOptionsSettingsL(mediaBuf, mediaList);
   518 	    		TBuf<128> buf;
   519 	    		buf.AppendFormat(_L("Code returned from method - %d"), e);
   520 	    		INFO_PRINTF1(buf);
   521 	    		buf.Zero();
   522 	    		INFO_PRINTF1(_L("values:"));
   523 	    		for(TInt i=0; i<mediaList.Count(); ++i)
   524 	    			{
   525 	    			buf.Copy(mediaList[i]);					    		
   526 	    			INFO_PRINTF1(buf);
   527 	    			}
   528 	    		mediaList.Close();
   529 	    		}
   530 	    	
   531 	    	CleanupStack::PopAndDestroy(); //server
   532 	    }
   533 	return errors;
   534  }
   535 
   536 
   537 
   538 TInt CUloggerServerTest1Step::Test18L()
   539 {//CULoggerServer::SetBufferSizeL
   540 	TInt errors = 0;
   541 		INFO_PRINTF1(_L("Testing - CULoggerServer::SetBufferSizeL method"));
   542 	CULoggerServer *server = NULL;
   543 	server = CULoggerServer::NewLC(EPriorityBackground);
   544 	if(server == NULL)
   545 	    {
   546 	    INFO_PRINTF1(_L("error"));
   547 	    ++errors;
   548 	    }
   549 	    else
   550 	    {
   551 	    	TInt e;
   552 	    	INFO_PRINTF1(_L("testing value: -1"));
   553 	    	e = server->SetBufferSizeL(-1);
   554 	    	TBuf<128> buf;
   555     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   556     		INFO_PRINTF1(buf);
   557     		buf.Zero();
   558 
   559 	    	INFO_PRINTF1(_L("testing value: 0"));
   560 	    	e = server->SetBufferSizeL(0);
   561     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   562     		INFO_PRINTF1(buf);
   563     		buf.Zero();
   564 
   565 	    	INFO_PRINTF1(_L("testing value: 100"));
   566 	    	e = server->SetBufferSizeL(100);
   567     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   568     		INFO_PRINTF1(buf);
   569     		buf.Zero();
   570 
   571 	    	INFO_PRINTF1(_L("testing value: 65535"));
   572 	    	e = server->SetBufferSizeL(65535);
   573     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   574     		INFO_PRINTF1(buf);
   575     		buf.Zero();
   576 
   577 	    	INFO_PRINTF1(_L("testing value: 65536"));
   578 	    	e = server->SetBufferSizeL(65536);
   579     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   580     		INFO_PRINTF1(buf);
   581     		buf.Zero();
   582     		
   583     		INFO_PRINTF1(_L("testing value: 165537"));
   584 	    	e = server->SetBufferSizeL(165537);
   585     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   586     		INFO_PRINTF1(buf);
   587     		buf.Zero();
   588     		CleanupStack::PopAndDestroy(); //server
   589 	    }
   590 	return errors;
   591  }
   592 
   593 
   594 TInt CUloggerServerTest1Step::Test19L()
   595 {//CULoggerServer::SetDataNotificationSizeL
   596 	TInt errors = 0;
   597 		INFO_PRINTF1(_L("Testing - CULoggerServer::SetDataNotificationSizeL method"));
   598 	CULoggerServer *server = NULL;
   599 	server = CULoggerServer::NewLC(EPriorityBackground);
   600 	if(server == NULL)
   601 	    {
   602 	    INFO_PRINTF1(_L("error"));
   603 	    ++errors;
   604 	    }
   605 	    else
   606 	    {
   607 	    	TInt e;
   608 	    	INFO_PRINTF1(_L("testing value: -1"));
   609 	    	e = server->SetDataNotificationSizeL(-1);
   610 	    	TBuf<128> buf;
   611     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   612     		INFO_PRINTF1(buf);
   613     		buf.Zero();
   614 
   615 	    	INFO_PRINTF1(_L("testing value: 0"));
   616 	    	e = server->SetDataNotificationSizeL(0);
   617     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   618     		INFO_PRINTF1(buf);
   619     		buf.Zero();
   620 
   621 	    	INFO_PRINTF1(_L("testing value: 100"));
   622 	    	e = server->SetDataNotificationSizeL(100);
   623     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   624     		INFO_PRINTF1(buf);
   625     		buf.Zero();
   626 
   627 	    	INFO_PRINTF1(_L("testing value: 65535"));
   628 	    	e = server->SetDataNotificationSizeL(65535);
   629     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   630     		INFO_PRINTF1(buf);
   631     		buf.Zero();
   632 
   633 	    	INFO_PRINTF1(_L("testing value: 65536"));
   634 	    	e = server->SetDataNotificationSizeL(65536);
   635     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   636     		INFO_PRINTF1(buf);
   637     		buf.Zero();
   638     		
   639     		INFO_PRINTF1(_L("testing value: 85536"));
   640 	    	e = server->SetDataNotificationSizeL(85536);
   641     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   642     		INFO_PRINTF1(buf);
   643     		buf.Zero();
   644     		
   645     		INFO_PRINTF1(_L("testing value: 165538"));
   646 	    	e = server->SetDataNotificationSizeL(165538);
   647     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   648     		INFO_PRINTF1(buf);
   649     		buf.Zero();
   650     		CleanupStack::PopAndDestroy(); //server
   651 	    }
   652 	return errors;
   653  }
   654 
   655 
   656 TInt CUloggerServerTest1Step::Test20L()
   657 {//CULoggerServer::GetBufferSize
   658 	TInt errors = 0;
   659 		INFO_PRINTF1(_L("Testing - CULoggerServer::GetBufferSize method"));
   660 	CULoggerServer *server = NULL;
   661 	server = CULoggerServer::NewLC(EPriorityBackground);
   662 	if(server == NULL)
   663 	    {
   664 	    INFO_PRINTF1(_L("error"));
   665 	    ++errors;
   666 	    }
   667 	    else
   668 	    {
   669 	    	TInt e;
   670 	    	INFO_PRINTF1(_L("testing value: -1"));
   671 	    	server->GetBufandDataNotifyValuesL(KBuffer,e);
   672 	    	TBuf<128> buf;
   673     		buf.AppendFormat(_L("Value - %d"), e);
   674     		INFO_PRINTF1(buf);
   675     		buf.Zero();
   676     		CleanupStack::PopAndDestroy(); //server
   677 	    }
   678 	return errors;
   679  }
   680 
   681 
   682 TInt CUloggerServerTest1Step::Test21L()
   683 {// CULoggerServer::GetDataNotificationSize
   684 	TInt errors = 0;
   685 		INFO_PRINTF1(_L("Testing - CULoggerServer::GetDataNotificationSize method"));
   686 	CULoggerServer *server = NULL;
   687 	server = CULoggerServer::NewLC(EPriorityBackground);
   688 	if(server == NULL)
   689 	    {
   690 	    INFO_PRINTF1(_L("error"));
   691 	    ++errors;
   692 	    }
   693 	    else
   694 	    {
   695 	    	TInt e;
   696 	    	INFO_PRINTF1(_L("testing value: -1"));
   697 	    	server->GetBufandDataNotifyValuesL(KDataNotification,e);
   698 	    	TBuf<128> buf;
   699     		buf.AppendFormat(_L("Value - %d"), e);
   700     		INFO_PRINTF1(buf);
   701     		buf.Zero();
   702     		CleanupStack::PopAndDestroy(); //server
   703 	    }
   704 	return errors;
   705  }
   706 
   707 TInt CUloggerServerTest1Step::Test22L()
   708 {//CULoggerServer::SetGlobalSecondaryFilters
   709 	TInt errors = 0;
   710 		INFO_PRINTF1(_L("Testing - CULoggerServer::SetSecondaryFiltering method"));
   711 	CULoggerServer *server = NULL;
   712 	server = CULoggerServer::NewLC(EPriorityBackground);
   713 	if(server == NULL)
   714 	    {
   715 	    INFO_PRINTF1(_L("error"));
   716 	    ++errors;
   717 	    }
   718 	    else
   719 	    {
   720 	    	_LIT8(KEnable,"enable");
   721 	  		_LIT8(KDisable,"disable");
   722 	    	TInt e;
   723 	    	TBuf<128> buf;
   724 	    	buf.Copy(KEnable);
   725 	    	INFO_PRINTF1(buf);
   726 	    	buf.Zero();
   727 	    	e = server->SetSecondaryFiltering(KEnable);
   728     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   729     		INFO_PRINTF1(buf);
   730     		buf.Zero();
   731     		
   732     		buf.Copy(KDisable);
   733 	    	INFO_PRINTF1(buf);
   734 	    	buf.Zero();
   735 	    	e = server->SetSecondaryFiltering(KDisable);
   736     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   737     		INFO_PRINTF1(buf);
   738     		buf.Zero();
   739     		CleanupStack::PopAndDestroy(); //server
   740 	    }
   741 	return errors;
   742  }
   743 
   744 TInt CUloggerServerTest1Step::Test23L()
   745 {//CULoggerServer::ReadBufferL
   746 	TInt errors = 0;
   747 		INFO_PRINTF1(_L("Testing - CULoggerServer::ReadBufferL method"));
   748 	CULoggerServer *server = NULL;
   749 	server = CULoggerServer::NewLC(EPriorityBackground);
   750 	if(server == NULL)
   751 	    {
   752 	    INFO_PRINTF1(_L("error"));
   753 	    ++errors;
   754 	    }
   755 	    else
   756 	    {
   757 	    	TBuf<128> buf;
   758 	    	TRAPD(err, server->ReadBufferL());
   759     		buf.AppendFormat(_L("Results of calling method - %d"), err);
   760     		INFO_PRINTF1(buf);
   761     		
   762     		CleanupStack::PopAndDestroy(); //server
   763 	    }
   764 	return errors;
   765  }
   766 
   767 TInt CUloggerServerTest1Step::Test24L()
   768 {//CULoggerServer::DataNotification
   769 	TInt errors = 0;
   770 		INFO_PRINTF1(_L("Testing - CULoggerServer::DataNotification method"));
   771 	CULoggerServer *server = NULL;
   772 	server = CULoggerServer::NewLC(EPriorityBackground);
   773 	if(server == NULL)
   774 	    {
   775 	    INFO_PRINTF1(_L("error"));
   776 	    ++errors;
   777 	    }
   778 	    else
   779 	    {
   780 	    	server->DataNotification();
   781     		INFO_PRINTF1(_L("OK"));	
   782     		CleanupStack::PopAndDestroy(); //server
   783 	    }
   784 	return errors;
   785  }
   786  
   787  
   788  TInt CUloggerServerTest1Step::Test25L()
   789 {//CULoggerServer::SetBufferMode
   790 	TInt errors = 0;
   791 		INFO_PRINTF1(_L("Testing - CULoggerServer::SetGlobalSecondaryFilters method"));
   792 	CULoggerServer *server = NULL;
   793 	server = CULoggerServer::NewLC(EPriorityBackground);
   794 	if(server == NULL)
   795 	    {
   796 	    INFO_PRINTF1(_L("error"));
   797 	    ++errors;
   798 	    }
   799 	    else
   800 	    {
   801 	    	_LIT8(KCircular,"circular");
   802 	  		_LIT8(KStraight,"straight");
   803 	    	TInt e;
   804 	    	TBuf<128> buf;
   805 	    	buf.Copy(KCircular);
   806 	    	INFO_PRINTF1(buf);
   807 	    	buf.Zero();
   808 	    	e = server->SetBufferMode(KCircular);
   809     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   810     		INFO_PRINTF1(buf);
   811     		buf.Zero();
   812     		
   813     		buf.Copy(KStraight);
   814 	    	INFO_PRINTF1(buf);
   815 	    	buf.Zero();
   816 	    	e = server->SetBufferMode(KStraight);
   817     		buf.AppendFormat(_L("Code returned from method - %d"), e);
   818     		INFO_PRINTF1(buf);
   819     		buf.Zero();
   820     		CleanupStack::PopAndDestroy(); //server
   821 	    }
   822 	return errors;
   823  }
   824  
   825 TInt CUloggerServerTest1Step::Test26L() //CULoggerServer::UnconfigureCurrentChannel
   826 	{
   827 	TInt errors = 0;
   828 	INFO_PRINTF1(_L("Testing - CULoggerServer::UnconfigureCurrentChannel method"));
   829 	/* //removed - method isn't used anywhere
   830 	CULoggerServer *server = NULL;
   831 	server = CULoggerServer::NewLC(EPriorityBackground);
   832 	if(server == NULL)
   833 		{
   834 		INFO_PRINTF1(_L("error"));
   835 		++errors;
   836 		}
   837 	else
   838 		{
   839     	server->UnconfigureCurrentChannel();
   840 		CleanupStack::PopAndDestroy(); //server
   841 		}
   842 	*/
   843 	return errors;
   844 	}
   845 
   846 
   847 TInt CUloggerServerTest1Step::Test27L()//CULoggerServer::DoPostProcessing
   848 	{
   849 	TInt errors = 0;
   850 	INFO_PRINTF1(_L("Testing - CULoggerServer::DoPostProcessing method"));
   851 	CULoggerServer *server = NULL;
   852 	server = CULoggerServer::NewLC(EPriorityBackground);
   853 	if(server == NULL)
   854 		{
   855 		INFO_PRINTF1(_L("error"));
   856 		++errors;
   857 		}
   858 	else
   859 		{
   860 		INFO_PRINTF1(_L("DoPostProcessing(EUnknown)"));
   861     	server->DoPostProcessing(EUnknown);
   862 		INFO_PRINTF1(_L("DoPostProcessing(ERestart)"));
   863     	server->DoPostProcessing(ERestart);
   864     	INFO_PRINTF1(_L("DoPostProcessing(EStop)"));
   865     	server->DoPostProcessing(EStop);
   866     	
   867     	CleanupStack::PopAndDestroy(); //server
   868 		}
   869 	return errors;
   870 	}
   871 
   872 
   873 TInt CUloggerServerTest1Step::Test28L()//CULoggerServer::RemoveOutputPluginSettingsL
   874 	{
   875 	TInt errors = 0;
   876 	INFO_PRINTF1(_L("Testing - CULoggerServer::RemoveOutputPluginSettingsL method"));
   877 	CULoggerServer *server = NULL;
   878 	server = CULoggerServer::NewLC(EPriorityBackground);
   879 	if(server == NULL)
   880 		{
   881 		INFO_PRINTF1(_L("error"));
   882 		++errors;
   883 		}
   884 	else
   885 		{
   886 		TInt errCode = KErrNone;
   887 		RArray<TPtrC8> set;
   888 		set.AppendL(_L8("testKey"));
   889 		set.AppendL(_L8("testVal"));
   890 		errCode = server->SetPluginSettings(_L8("uloggerserialplugin"), set);
   891 		set.Close();
   892 		if(errCode != KErrNone)
   893 			{
   894 			INFO_PRINTF1(_L("error"));
   895 			CleanupStack::PopAndDestroy(); //server
   896 			return ++errors;
   897 			}
   898 		
   899 		INFO_PRINTF1(_L("RemoveOutputPluginSettingsL - uloggerserialplugin)"));
   900     	errCode = server->RemovePluginSettingsL(_L8("uloggerserialplugin"));
   901     	if(errCode != KErrNone)
   902 			{
   903 			INFO_PRINTF1(_L("error"));
   904 			CleanupStack::PopAndDestroy(); //server
   905 			return ++errors;
   906 			}
   907 
   908     	INFO_PRINTF1(_L("RemoveOutputPluginSettingsL - dummyname)"));
   909     	server->RemovePluginSettingsL(_L8("dummyname"));
   910     	
   911     	CleanupStack::PopAndDestroy(); //server
   912 		}
   913 	return errors;
   914 	}
   915 	
   916 
   917 TInt CUloggerServerTest1Step::Test29L()//CULoggerServer::GetInstalledInputPluginsL
   918 	{
   919 	TInt errors = 0;
   920 	INFO_PRINTF1(_L("Testing - CULoggerServer::GetInstalledInputPluginsL method"));
   921 	CULoggerServer *server = NULL;
   922 	server = CULoggerServer::NewLC(EPriorityBackground);
   923 	if(server == NULL)
   924 		{
   925 		INFO_PRINTF1(_L("error"));
   926 		++errors;
   927 		}
   928 	else
   929 		{
   930 		RArray<TPtrC8> list;
   931     	server->GetInstalledInputPluginsL(list);
   932     	list.Close();
   933     	CleanupStack::PopAndDestroy(); //server
   934 		}
   935 	return errors;
   936 	}
   937 
   938 
   939 TInt CUloggerServerTest1Step::Test30L()//CULoggerServer::SetActiveInputPlugin  + DeActivateInputPlugin 
   940 	{
   941 	TInt errors = 0;
   942 	INFO_PRINTF1(_L("Testing - CULoggerServer::SetActiveInputPlugin  + DeActivateInputPlugin methods"));
   943 	CULoggerServer *server = NULL;
   944 	server = CULoggerServer::NewLC(EPriorityBackground);
   945 	
   946 	_LIT8(KUsbPlugin,"uloggerusbplugin");
   947 	server->DeActivateInputPlugin(KUsbPlugin);
   948 	TInt errCode = server->SetActiveInputPlugin(KUsbPlugin);
   949 	if(errCode != KErrNone && errCode != KErrNotFound)
   950 		{
   951 		INFO_PRINTF1(_L("error"));
   952 		return ++errors;
   953 		}
   954 	errCode = server->SetActiveInputPlugin(KUsbPlugin);
   955 	
   956 	errCode = server->DeActivateInputPlugin(KUsbPlugin);
   957 	TBuf<128> b;
   958 	b.AppendFormat(_L("err1 %d"), errCode);
   959 	INFO_PRINTF1(b);
   960 	if(errCode != KErrNone && errCode != KErrNotFound)
   961 		{
   962 		INFO_PRINTF1(_L("error"));
   963 		return ++errors;
   964 		}
   965 	errCode = server->DeActivateInputPlugin(KUsbPlugin);
   966 	b.Zero();
   967 	b.AppendFormat(_L("err2 %d"), errCode);
   968 	INFO_PRINTF1(b);
   969 	if(errCode != KErrNone && errCode != KErrNotFound && errCode != KErrAlreadyExists)
   970 		{
   971 		INFO_PRINTF1(_L("error"));
   972 		return ++errors;
   973 		}
   974 	
   975 	server->Stop();
   976     CleanupStack::PopAndDestroy(); //server
   977     User::After(1*1000*1000);
   978 	return errors;
   979 	}
   980 
   981 
   982 TInt CUloggerServerTest1Step::Test31L()//CULoggerServer::ProcessCommandL ver1
   983 	{
   984 	TInt errors = 0;
   985 	INFO_PRINTF1(_L("Testing - CULoggerServer::ProcessCommandL method"));
   986 	CULoggerServer *server = NULL;
   987 	server = CULoggerServer::NewLC(EPriorityBackground);
   988 	
   989 	RArray<TPtrC8> arguments;
   990 	//test all commands with empty array of arguments
   991 	for(TInt i=0; i<=EVersion; i++)
   992 		{
   993 		TBuf<32> buf;
   994 		buf.AppendFormat(_L("command number: %d"), i);
   995 		INFO_PRINTF1(buf);
   996 		ControlData *cd = server->ProcessCommandL((TCommand)i, arguments);
   997 		if(!cd)
   998 			{
   999 			++errors;
  1000 			break;
  1001 			}
  1002 		delete cd;
  1003 		cd = NULL;
  1004 		}
  1005 	server->Stop();
  1006 	CleanupStack::PopAndDestroy(); //server
  1007 	return errors;
  1008 	}