os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-client/testruloggerapi_ext.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-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 testruloggerapi_ext.cpp
    20  @internalTechnology
    21 */
    22 #include "testruloggerapi_ext.h"
    23 #include "te_uloggerclientsuitedefs.h"
    24 #include <uloggerdatatypes.h>
    25 
    26 CTestRULoggerAPIStep::~CTestRULoggerAPIStep()
    27 /**
    28  * Destructor
    29  */
    30 	{
    31 	}
    32 
    33 CTestRULoggerAPIStep::CTestRULoggerAPIStep()
    34 /**
    35  * Constructor
    36  */
    37 	{
    38 	// **MUST** call SetTestStepName in the constructor as the controlling
    39 	// framework uses the test step name immediately following construction to set
    40 	// up the step's unique logging ID.
    41 		
    42 	SetTestStepName(KTestRULoggerAPIStep);
    43 	}
    44 
    45 TVerdict CTestRULoggerAPIStep::doTestStepPreambleL()
    46 /**
    47  * @return - TVerdict code
    48  * Override of base class virtual
    49  */
    50 	{
    51 	INFO_PRINTF1(_L("CTestRULoggerAPIStep -Extended API tests- started"));
    52 	
    53 	TInt errCode = iUlogger.Connect();
    54 	if(errCode != KErrNone)
    55 		{
    56 		TBuf<64> b;
    57 		b.AppendFormat(_L("connect error: %d"), errCode);
    58 		SetTestStepResult(EFail);
    59 		}
    60 	else
    61 		SetTestStepResult(EPass);
    62 	
    63 	CTestUloggerClientApiStepBase::doTestStepPreambleL();
    64 	return TestStepResult();
    65 	}
    66 
    67 
    68 TVerdict CTestRULoggerAPIStep::doTestStepL()
    69 /**
    70  * @return - TVerdict code
    71  * Override of base class pure virtual
    72  * Our implementation only gets called if the base class doTestStepPreambleL() did
    73  * not leave. That being the case, the current test result value will be EPass.
    74  */
    75 {
    76 	if (TestStepResult()==EPass)
    77 		{
    78 		TInt errors = 0;
    79 		errors += SetGetPrimaryFiletr_TestL();
    80 		errors += SetGetSecondaryFiletr_TestL();
    81 		errors += SetGetSecondaryFiltering_TestL();
    82 		errors += SetGetOutputPlugin_TestL();
    83 		errors += GetInstalledOutputPlugins_TestL();
    84 		errors += SetGetInputPlugin_TestL();
    85 		errors += GetInstalledInputPlugins_TestL();
    86 		errors += SetGetRemovePluginConf_TestL();
    87 		errors += SetGetTraceBuffer_TestL();
    88 		
    89 		//check errors
    90 		if(errors)
    91 			{
    92 			SetTestStepResult(EFail);
    93 			TBuf<64> b;
    94 			b.AppendFormat(_L("%d errors were found !!!!"), errors);
    95 			INFO_PRINTF1(b);
    96 			}
    97 		else
    98 			{
    99 			SetTestStepResult(EPass);
   100 			INFO_PRINTF1(_L("CTestRULoggerAPIStep completed without problems."));
   101 			}
   102 		}
   103 	
   104 	return TestStepResult();	
   105 }
   106 
   107 TVerdict CTestRULoggerAPIStep::doTestStepPostambleL()
   108 /**
   109  * @return - TVerdict code
   110  * Override of base class virtual
   111  */
   112 	{
   113 		INFO_PRINTF1(_L("CTestRULoggerAPIStep completed"));
   114 		CTestUloggerClientApiStepBase::doTestStepPostambleL();	
   115 		iUlogger.Close();
   116 		return TestStepResult();
   117 	}
   118 
   119 
   120 TInt CTestRULoggerAPIStep::SetGetPrimaryFiletr_TestL()
   121 {
   122 	TInt err = 0;
   123 	TInt i;
   124 	CArrayFixFlat<TUint8> *filters = new (ELeave) CArrayFixFlat<TUint8>(1);
   125 	CArrayFixFlat<TUint8> *gFilters = new (ELeave) CArrayFixFlat<TUint8>(1);
   126 	TInt test;
   127 	
   128 	//set 256 filters
   129 	for(i=0; i<256; i++)
   130 		filters->AppendL((TUint8)i);	
   131 	test = iUlogger.SetPrimaryFiltersEnabled(*filters, ETrue);
   132 	if(test != KErrNone)
   133 		{
   134 		INFO_PRINTF2(_L("err: %d"), test);
   135 		INFO_PRINTF1(_L("set 256 filters - failed"));
   136 		err++;
   137 		}
   138 
   139 	//get 256 filetrs
   140 	test = iUlogger.GetPrimaryFiltersEnabled(*gFilters);
   141 	if(test!=KErrNone && gFilters->Count()!=256)
   142 		{
   143 		INFO_PRINTF2(_L("err: %d"), test);
   144 		INFO_PRINTF1(_L("get 256 filters - failed!"));
   145 		err++;
   146 		}
   147 	
   148 	//set 257 filetrs
   149 	filters->AppendL((TUint8)257); //value doesn't matter
   150 	test = iUlogger.SetPrimaryFiltersEnabled(*filters, ETrue);
   151 	if(test != KErrArgument)
   152 		{
   153 		INFO_PRINTF2(_L("err: %d"), test);
   154 		INFO_PRINTF1(_L("set 257 filters - failed!"));
   155 		err++;
   156 		}
   157 
   158 	//get 257 filetrs (should be 256 vin array)
   159 	gFilters->Reset();
   160 	test = iUlogger.GetPrimaryFiltersEnabled(*gFilters);
   161 	if(test!=KErrNone && gFilters->Count()!=256)
   162 		{
   163 		INFO_PRINTF2(_L("err: %d"), test);
   164 		INFO_PRINTF1(_L("get 257 filters - failed!"));
   165 		err++;
   166 		}
   167 	
   168 	//remove 256 filetrs
   169 	test = iUlogger.SetPrimaryFiltersEnabled(*gFilters, EFalse);
   170 	if(test != KErrNone)
   171 		{
   172 		INFO_PRINTF2(_L("err: %d"), test);
   173 		INFO_PRINTF1(_L("remove 256 filetrs - failed!"));
   174 		err++;
   175 		}
   176 	
   177 	//remove 257 filetrs
   178 	test = iUlogger.SetPrimaryFiltersEnabled(*filters, EFalse);
   179 	if(test != KErrArgument)
   180 		{
   181 		INFO_PRINTF2(_L("err: %d"), test);
   182 		INFO_PRINTF1(_L("remove 257 filetrs - failed!"));
   183 		err++;
   184 		}
   185 
   186 	
   187 	filters->Reset();
   188 	gFilters->Reset();
   189 	//set empty array ETrue test
   190 	test = iUlogger.SetPrimaryFiltersEnabled(*filters, ETrue);
   191 	if(test != KErrArgument)
   192 		{
   193 		INFO_PRINTF2(_L("err: %d"), test);
   194 		INFO_PRINTF1(_L("set empty array ETrue test - failed!"));
   195 		err++;
   196 		}
   197 
   198 	//set empty array EFalse test
   199 	test = iUlogger.SetPrimaryFiltersEnabled(*filters, EFalse);
   200 	if(test != KErrArgument)
   201 		{
   202 		INFO_PRINTF2(_L("err: %d"), test);
   203 		INFO_PRINTF1(_L("set empty array EFalse test - failed!"));
   204 		err++;
   205 		}
   206 
   207 	//getting empty array
   208 	gFilters->Reset();
   209 	test = iUlogger.GetPrimaryFiltersEnabled(*gFilters);
   210 	if(test!=KErrNone && gFilters->Count()!=0)
   211 		{
   212 		INFO_PRINTF2(_L("err: %d"), test);
   213 		INFO_PRINTF1(_L("getting empty array - failed!"));
   214 		err++;
   215 		}
   216 	
   217 	//summary
   218 	TBuf<64> b;
   219 	if(err)
   220 		b.AppendFormat(_L("SetGetPrimaryFiletr_TestL failed with %d errors!!!"), err);
   221 	else
   222 		b.Append(_L("SetGetPrimaryFiletr_TestL passed"));
   223 			
   224 	
   225 	delete gFilters;
   226 	gFilters = NULL;
   227 	delete filters;
   228 	filters = NULL;
   229 	return err;
   230 }
   231 
   232 
   233 TInt CTestRULoggerAPIStep::SetGetSecondaryFiletr_TestL()
   234 {
   235 	TInt err = 0;
   236 	TInt i;
   237 	RArray<TUint32> filters;
   238 	RArray<TUint32> gFilters;
   239 	TInt test;
   240 
   241 	//clean
   242 	iUlogger.GetSecondaryFiltersEnabled(gFilters);
   243 	iUlogger.SetSecondaryFiltersEnabled(gFilters, EFalse);
   244 	gFilters.Reset();
   245 	
   246 	//set 4096 filters
   247 	for(i=0; i<4096; i++)
   248 		filters.AppendL((TUint32)i);	
   249 	test = iUlogger.SetSecondaryFiltersEnabled(filters, ETrue);
   250 	if(test != KErrNone)
   251 		{
   252 		INFO_PRINTF2(_L("err: %d"), test);
   253 		INFO_PRINTF1(_L("set 4096 filters - failed"));
   254 		err++;
   255 		}
   256 
   257 	//get 4096 filetrs
   258 	test = iUlogger.GetSecondaryFiltersEnabled(gFilters);
   259 	if(test!=KErrNone && gFilters.Count()!=4096)
   260 		{
   261 		INFO_PRINTF2(_L("err: %d"), test);
   262 		INFO_PRINTF1(_L("get 4096 filters - failed!"));
   263 		err++;
   264 		}
   265 	
   266 	//set 4096+1 filetrs
   267 	filters.AppendL(4097); //value doesn't matter
   268 	test = iUlogger.SetSecondaryFiltersEnabled(filters, ETrue);
   269 	if(test != KErrArgument)
   270 		{
   271 		INFO_PRINTF2(_L("err: %d"), test);
   272 		INFO_PRINTF1(_L("set 4096+1 filters - failed!"));
   273 		err++;
   274 		}
   275 
   276 	//get 4096+1 filetrs (should be 4096 in array)
   277 	gFilters.Reset();
   278 	test = iUlogger.GetSecondaryFiltersEnabled(gFilters);
   279 	if(test!=KErrNone && gFilters.Count()!=4096)
   280 		{
   281 		INFO_PRINTF2(_L("err: %d"), test);
   282 		INFO_PRINTF1(_L("get 4096+1 filters - failed!"));
   283 		err++;
   284 		}
   285 	
   286 	//remove 4096 filetrs
   287 	test = iUlogger.SetSecondaryFiltersEnabled(gFilters, EFalse);
   288 	if(test != KErrNone)
   289 		{
   290 		INFO_PRINTF2(_L("err: %d"), test);
   291 		INFO_PRINTF1(_L("remove 4096 filetrs - failed!"));
   292 		err++;
   293 		}
   294 	
   295 	//remove 4096+1 filetrs
   296 	test = iUlogger.SetSecondaryFiltersEnabled(filters, EFalse);
   297 	if(test != KErrArgument)
   298 		{
   299 		INFO_PRINTF2(_L("err: %d"), test);
   300 		INFO_PRINTF1(_L("remove 4096+1 filetrs - failed!"));
   301 		err++;
   302 		}
   303 
   304 	
   305 	filters.Reset();
   306 	gFilters.Reset();
   307 	//set empty array ETrue test
   308 	test = iUlogger.SetSecondaryFiltersEnabled(filters, ETrue);
   309 	if(test != KErrArgument)
   310 		{
   311 		INFO_PRINTF2(_L("err: %d"), test);
   312 		INFO_PRINTF1(_L("set empty array ETrue test - failed!"));
   313 		err++;
   314 		}
   315 
   316 	//set empty array EFalse test
   317 	test = iUlogger.SetSecondaryFiltersEnabled(filters, EFalse);
   318 	if(test != KErrArgument)
   319 		{
   320 		INFO_PRINTF2(_L("err: %d"), test);
   321 		INFO_PRINTF1(_L("set empty array EFalse test - failed!"));
   322 		err++;
   323 		}
   324 
   325 	//getting empty array
   326 	gFilters.Reset();
   327 	test = iUlogger.GetSecondaryFiltersEnabled(gFilters);
   328 	if(test!=KErrNone && gFilters.Count()!=0)
   329 		{
   330 		INFO_PRINTF2(_L("err: %d"), test);
   331 		INFO_PRINTF1(_L("getting empty array - failed!"));
   332 		err++;
   333 		}
   334 	
   335 	//summary
   336 	TBuf<64> b;
   337 	if(err)
   338 		b.AppendFormat(_L("SetGetSecondaryFiletr_TestL failed with %d errors!!!"), err);
   339 	else
   340 		b.Append(_L("SetGetSecondaryFiletr_TestL passed"));
   341 	INFO_PRINTF1(b);
   342 	
   343 	gFilters.Close();
   344 	filters.Close();
   345 	return err;
   346 }
   347 
   348 
   349 TInt CTestRULoggerAPIStep::SetGetSecondaryFiltering_TestL()
   350 {
   351 	TInt err = 0;
   352 	TInt test = 0;
   353 	TBool val = ETrue;
   354 	
   355 	//set secondary filtering as ETrue
   356 	iUlogger.SetSecondaryFilteringEnabled(EFalse);
   357 	test = iUlogger.SetSecondaryFilteringEnabled(ETrue);
   358 	if(test!=KErrNone)
   359 		{
   360 		INFO_PRINTF2(_L("err: %d"), test);
   361 		INFO_PRINTF1(_L("set secondary filtering as ETrue - failed!"));
   362 		err++;
   363 		}
   364 
   365 	//set secondary filtering as ETrue again
   366 	test = iUlogger.SetSecondaryFilteringEnabled(ETrue);
   367 	if(test != KErrNone)
   368 		{
   369 		INFO_PRINTF2(_L("err: %d"), test);
   370 		INFO_PRINTF1(_L("set secondary filtering as ETrue again - failed!"));
   371 		err++;
   372 		}
   373 
   374 	//get secondary filtering ETrue
   375 	test = iUlogger.GetSecondaryFilteringEnabled(val);
   376 	if(test != KErrNone || !val)
   377 		{
   378 		INFO_PRINTF2(_L("err: %d"), test);
   379 		INFO_PRINTF1(_L("get secondary filtering ETrue - failed!"));
   380 		err++;
   381 		}
   382 
   383 	//set secondary filtering as EFalse
   384 	test = iUlogger.SetSecondaryFilteringEnabled(EFalse);
   385 	if(test != KErrNone)
   386 		{
   387 		INFO_PRINTF2(_L("err: %d"), test);
   388 		INFO_PRINTF1(_L("set secondary filtering as EFalse - failed!"));
   389 		err++;
   390 		}
   391 	
   392 	//set secondary filtering as EFalse again
   393 	test = iUlogger.SetSecondaryFilteringEnabled(EFalse);
   394 	if(test != KErrNone)
   395 		{
   396 		INFO_PRINTF2(_L("err: %d"), test);
   397 		INFO_PRINTF1(_L("set secondary filtering as EFalse again - failed!"));
   398 		err++;
   399 		}
   400 	
   401 	//get secondary filtering EFalse
   402 	test = iUlogger.GetSecondaryFilteringEnabled(val);
   403 	if(test != KErrNone || val)
   404 		{
   405 		INFO_PRINTF2(_L("err: %d"), test);
   406 		INFO_PRINTF1(_L("get secondary filtering EFalse - failed!"));
   407 		err++;
   408 		}
   409 	
   410 	//summary
   411 	TBuf<64> b;
   412 	if(err)
   413 		b.AppendFormat(_L("SetGetSecondaryFiltering_TestL failed with %d errors!!!"), err);
   414 	else
   415 		b.Append(_L("SetGetSecondaryFiltering_TestL passed"));
   416 	INFO_PRINTF1(b);
   417 	return err;
   418 }
   419 
   420 TInt CTestRULoggerAPIStep::SetGetOutputPlugin_TestL()
   421 {
   422 	TInt err = 0;
   423 	TInt test = KErrNone;
   424 	TBuf8<256> plugin;
   425 	_LIT8(KFilePlugin, "uloggerfileplugin");
   426 	_LIT8(KSerialPlugin, "uloggerserialplugin");
   427 	iUlogger.ActivateOutputPlugin(KSerialPlugin); //initial settings
   428 	
   429 	//set uloggerfileplugin as output
   430 	test = iUlogger.ActivateOutputPlugin(KFilePlugin);
   431 	if(test!=KErrNone)
   432 		{
   433 		INFO_PRINTF2(_L("err: %d"), test);
   434 		INFO_PRINTF1(_L("set uloggerfileplugin as output - failed!"));
   435 		err++;
   436 		}
   437 	
   438 	//get uloggerfileplugin
   439 	test = iUlogger.GetActiveOutputPlugin(plugin);
   440 	if(plugin.Compare(KFilePlugin) != 0 || test!=KErrNone)
   441 		{
   442 		INFO_PRINTF2(_L("err: %d"), test);
   443 		INFO_PRINTF1(_L("get uloggerfileplugin - failed!"));
   444 		err++;
   445 		}
   446 	
   447 	//set uloggerfileplugin as output again
   448 	test = iUlogger.ActivateOutputPlugin(KFilePlugin);
   449 	if(test != KErrNone) //dont return an error although already exists isnt a "failure"
   450 		{
   451 		INFO_PRINTF2(_L("err: %d"), test);
   452 		INFO_PRINTF1(_L("set uloggerfileplugin as output again - failed!"));
   453 		err++;
   454 		}
   455 	
   456 	TBuf8<2> smallBuf;
   457 	//get uloggerfileplugin to small buf
   458 	test = iUlogger.GetActiveOutputPlugin(smallBuf);
   459 	if(test!=KErrOverflow)
   460 		{
   461 		INFO_PRINTF2(_L("err: %d"), test);
   462 		INFO_PRINTF1(_L("get uloggerfileplugin to small buf - failed!"));
   463 		err++;
   464 		}
   465 	
   466 	
   467 	//summary
   468 	TBuf<64> b;
   469 	if(err)
   470 		b.AppendFormat(_L("SetGetOutputPlugin_TestL failed with %d errors!!!"), err);
   471 	else
   472 		b.Append(_L("SetGetOutputPlugin_TestL passed"));
   473 	INFO_PRINTF1(b);
   474 	return err;
   475 }
   476 
   477 TInt CTestRULoggerAPIStep::GetInstalledOutputPlugins_TestL()
   478 {
   479 	TInt err = 0;
   480 	TInt test = KErrNone;
   481 	
   482 	CArrayPtrFlat<HBufC8>* plugins = new (ELeave) CArrayPtrFlat<HBufC8>(1);
   483 	test = iUlogger.GetInstalledOutputPlugins(*plugins);
   484 	if(test != KErrNone)
   485 		{
   486 		INFO_PRINTF2(_L("err: %d"), test);
   487 		INFO_PRINTF1(_L("GetInstalledOutputPlugins_TestL - failed!"));
   488 		err++;
   489 		}
   490 	
   491 	plugins->ResetAndDestroy();
   492 	delete plugins;
   493 	plugins = NULL;
   494 	
   495 	//summary
   496 	TBuf<64> b;
   497 	if(err)
   498 		b.AppendFormat(_L("GetInstalledOutputPlugins_TestL failed with %d errors!!!"), err);
   499 	else
   500 		b.Append(_L("GetInstalledOutputPlugins_TestL passed"));
   501 	INFO_PRINTF1(b);
   502 	return err;
   503 }
   504 
   505 TInt CTestRULoggerAPIStep::SetGetInputPlugin_TestL()
   506 	{
   507 	TInt err = 0;
   508 	TInt test = KErrNone;
   509 	
   510 	TBuf8<256> plugin;
   511 	_LIT8(KFilePlugin, "uloggerfileplugin");
   512 	_LIT8(KUsbPlugin, "uloggerusbplugin");
   513 	iUlogger.DeActivateInputPlugin(); //set initial state
   514 	
   515 	//set uloggerusbplugin as input
   516 	test = iUlogger.ActivateInputPlugin(KUsbPlugin);
   517 	if(test!=KErrNone && test!=KErrNotFound)
   518 		{
   519 		INFO_PRINTF2(_L("err: %d"), test);
   520 		INFO_PRINTF1(_L("set uloggerusbplugin as input - failed!"));
   521 		err++;
   522 		}
   523 	
   524 	//set uloggerusbplugin as input again
   525 	test = iUlogger.ActivateInputPlugin(KUsbPlugin);
   526 	if(test!=KErrAlreadyExists && test!=KErrNotFound)
   527 		{
   528 		INFO_PRINTF2(_L("err: %d"), test);
   529 		INFO_PRINTF1(_L("set uloggerusbplugin as input again - failed!"));
   530 		err++;
   531 		}
   532 	
   533 	//set uloggerfileplugin as input
   534 	test = iUlogger.ActivateInputPlugin(KFilePlugin);
   535 	if(test!=KErrNotFound)
   536 		{
   537 		INFO_PRINTF2(_L("err: %d"), test);
   538 		INFO_PRINTF1(_L("set uloggerfileplugin as input - failed!"));
   539 		err++;
   540 		}
   541 	
   542 	//set empty as input
   543 	test = iUlogger.ActivateInputPlugin(_L8(""));
   544 	if(test!=KErrArgument)
   545 		{
   546 		INFO_PRINTF2(_L("err: %d"), test);
   547 		INFO_PRINTF1(_L("set empty as inputt - failed!"));
   548 		err++;
   549 		}
   550 	
   551 	//get active input plugin
   552 	test = iUlogger.GetActiveInputPlugin(plugin);
   553 	if(test!=KErrNone && test != KErrNotFound)
   554 		{
   555 		INFO_PRINTF2(_L("err: %d"), test);
   556 		INFO_PRINTF1(_L("get active input plugin - failed!"));
   557 		err++;
   558 		}
   559 	
   560 	//deactivate input
   561 	test = iUlogger.DeActivateInputPlugin();
   562 	if(test!=KErrNone && test != KErrNotFound)
   563 		{
   564 		INFO_PRINTF2(_L("err: %d"), test);
   565 		INFO_PRINTF1(_L("deactivate input - failed!"));
   566 		err++;
   567 		}
   568 	
   569 	//deactivate input again
   570 	test = iUlogger.DeActivateInputPlugin();
   571 	if(test != KErrNotFound)
   572 		{
   573 		INFO_PRINTF2(_L("err: %d"), test);
   574 		INFO_PRINTF1(_L("deactivate input again - failed!"));
   575 		err++;
   576 		}
   577 	
   578 	//get active input plugin again
   579 	test = iUlogger.GetActiveInputPlugin(plugin);
   580 	if(test != KErrNotFound)
   581 		{
   582 		INFO_PRINTF2(_L("err: %d"), test);
   583 		INFO_PRINTF1(_L("get active input plugin again - failed!"));
   584 		err++;
   585 		}
   586 	
   587 	
   588 	//summary
   589 	TBuf<64> b;
   590 	if(err)
   591 		b.AppendFormat(_L("SetGetInputPlugin_TestL failed with %d errors!!!"), err);
   592 	else
   593 		b.Append(_L("SetGetInputPlugin_TestL passed"));
   594 	INFO_PRINTF1(b);
   595 	return err;
   596 	}
   597 
   598 TInt CTestRULoggerAPIStep::GetInstalledInputPlugins_TestL()
   599 {
   600 	TInt err = 0;
   601 	TInt test = KErrNone;
   602 
   603 	CArrayPtrFlat<HBufC8> *plugins = new (ELeave) CArrayPtrFlat<HBufC8>(1);
   604 	test = iUlogger.GetInstalledInputPlugins(*plugins);
   605 	if(test!=KErrNone)
   606 		{
   607 		INFO_PRINTF2(_L("err: %d"), test);
   608 		INFO_PRINTF1(_L("GetInstalledInputPlugins - failed!"));
   609 		err++;
   610 		}
   611 	
   612 	plugins->ResetAndDestroy();
   613 	delete plugins;
   614 	plugins = NULL;
   615 	
   616 	//summary
   617 	TBuf<64> b;
   618 	if(err)
   619 		b.AppendFormat(_L("GetInstalledInputPlugins_TestL failed with %d errors!!!"), err);
   620 	else
   621 		b.Append(_L("GetInstalledInputPlugins_TestL passed"));
   622 	INFO_PRINTF1(b);
   623 	return err;
   624 }
   625 
   626 TInt CTestRULoggerAPIStep::SetGetRemovePluginConf_TestL()
   627 	{
   628 	TInt err = 0;
   629 	TInt test = KErrNone;
   630 	_LIT8(KFilePlugin, "uloggerfileplugin");
   631 	_LIT8(KDummyPlugin, "uloggerdummyplugin");
   632 	_LIT(KTestKey, "testKey");
   633 	_LIT(KTestVal, "testVal");
   634 	
   635 	//set uloggerfileplugin settings
   636 	TPluginConfiguration conf;
   637 	conf.SetKey(KTestKey);
   638 	conf.SetValue(KTestVal);
   639 	test = iUlogger.SetPluginConfigurations(KFilePlugin, conf);
   640 	if(test != KErrNone)
   641 		{
   642 		INFO_PRINTF2(_L("err: %d"), test);
   643 		INFO_PRINTF1(_L("set uloggerfileplugin settings - failed!"));
   644 		err++;
   645 		}
   646 	
   647 	//check uloggerfileplugin settings
   648 	RPointerArray<TPluginConfiguration> confCheck;
   649 	test = iUlogger.GetPluginConfigurations(KFilePlugin, confCheck);
   650 	if(test != KErrNone)
   651 		{
   652 		INFO_PRINTF2(_L("err: %d"), test);
   653 		INFO_PRINTF1(_L("check uloggerfileplugin settings - failed!"));
   654 		err++;
   655 		}
   656 	else
   657 		{
   658 		TBool e = ETrue;
   659 		for(TInt i=0; i<confCheck.Count(); ++i)
   660 			{
   661 			TPluginConfiguration* check = confCheck[i];
   662 			INFO_PRINTF1(check->Key());
   663 			INFO_PRINTF1(check->Value());
   664 			if(!check->Key().Compare(KTestKey) && !check->Value().Compare(KTestVal))
   665 				{
   666 				e = EFalse;
   667 				break;
   668 				}
   669 			}
   670 		if(e)
   671 			{
   672 			INFO_PRINTF2(_L("err: %d"), test);
   673 			INFO_PRINTF1(_L("check uloggerfileplugin settings (wrong values) - failed!"));
   674 			err++;
   675 			}
   676 		}
   677 	confCheck.ResetAndDestroy();
   678 	confCheck.Close();
   679 	
   680 	
   681 	//set uloggerdummyplugin settings
   682 	test = iUlogger.SetPluginConfigurations(KDummyPlugin, conf);
   683 	if(test != KErrNotFound)
   684 		{
   685 		INFO_PRINTF2(_L("err: %d"), test);
   686 		INFO_PRINTF1(_L("set uloggerdummyplugin settings - failed!"));
   687 		err++;
   688 		}
   689 	
   690 	//pass empty descriptor
   691 	test = iUlogger.SetPluginConfigurations(_L8(""), conf);
   692 	if(test != KErrArgument)
   693 		{
   694 		INFO_PRINTF2(_L("err: %d"), test);
   695 		INFO_PRINTF1(_L("pass empty descriptor - failed!"));
   696 		err++;
   697 		}
   698 	
   699 	
   700 	//Get uloggerdummyplugin settings
   701 	RPointerArray<TPluginConfiguration> confCheck2;
   702 	test = iUlogger.GetPluginConfigurations(KDummyPlugin, confCheck2);
   703 	if(test != KErrNotFound)
   704 		{
   705 		INFO_PRINTF2(_L("err: %d"), test);
   706 		INFO_PRINTF1(_L("Get uloggerdummyplugin settings - failed!"));
   707 		err++;
   708 		}
   709 	confCheck2.ResetAndDestroy();
   710 	confCheck2.Close();
   711 	
   712 	
   713 	//Get emptyName settings
   714 	RPointerArray<TPluginConfiguration> confCheck3;
   715 	test = iUlogger.GetPluginConfigurations(_L8(""), confCheck3);
   716 	if(test != KErrArgument)
   717 		{
   718 		INFO_PRINTF2(_L("err: %d"), test);
   719 		INFO_PRINTF1(_L("Get emptyName settings - failed!"));
   720 		err++;
   721 		}
   722 	confCheck3.ResetAndDestroy();
   723 	confCheck3.Close();
   724 	
   725 	
   726 	//remove uloggerfileplugin settings
   727 	test = iUlogger.RemovePluginConfigurations(KFilePlugin);
   728 	if(test != KErrNone) //expected error
   729 		{
   730 		INFO_PRINTF2(_L("err: %d"), test);
   731 		INFO_PRINTF1(_L("remove uloggerfileplugin settings - failed!"));
   732 		err++;
   733 		}
   734 
   735 	//remove uloggerfileplugin settings again
   736 	test = iUlogger.RemovePluginConfigurations(KFilePlugin);
   737 	if(test != KErrNotFound) //expected error
   738 		{
   739 		INFO_PRINTF2(_L("err: %d"), test);
   740 		INFO_PRINTF1(_L("remove uloggerfileplugin settings again - failed!"));
   741 		err++;
   742 		}
   743 
   744 	//remove uloggerdummyplugin settings
   745 	test = iUlogger.RemovePluginConfigurations(KFilePlugin);
   746 	if(test != KErrNotFound) //expected error
   747 		{
   748 		INFO_PRINTF2(_L("err: %d"), test);
   749 		INFO_PRINTF1(_L("remove uloggerdummyplugin settings - failed!"));
   750 		err++;
   751 		}
   752 
   753 	//remove empty desc plugin settings
   754 	test = iUlogger.RemovePluginConfigurations(_L8(""));
   755 	if(test != KErrArgument) //expected error
   756 		{
   757 		INFO_PRINTF2(_L("err: %d"), test);
   758 		INFO_PRINTF1(_L("remove empty desc plugin settings - failed!"));
   759 		err++;
   760 		}
   761 	
   762 	
   763 	//summary
   764 	TBuf<64> b;
   765 	if(err)
   766 		b.AppendFormat(_L("SetGetRemovePluginConf_TestL failed with %d errors!!!"), err);
   767 	else
   768 		b.Append(_L("SetGetRemovePluginConf_TestL passed"));
   769 	INFO_PRINTF1(b);
   770 	return err;
   771 	}
   772 
   773 TInt CTestRULoggerAPIStep::SetGetTraceBuffer_TestL()
   774 	{
   775 	TInt err = 0;
   776 	TInt test = KErrNone;
   777 	TInt val = 0;
   778 	
   779 	//test SetBufferSize(-1)
   780 	test = iUlogger.SetBufferSize(-1);
   781 	if(test != KErrArgument)
   782 		{
   783 		INFO_PRINTF2(_L("err: %d"), test);
   784 		INFO_PRINTF1(_L("test SetBufferSize(-1) - failed!"));
   785 		err++;
   786 		}
   787 	
   788 	//test SetBufferSize(1025)
   789 	test = iUlogger.SetBufferSize(1025);
   790 	if(test != KErrArgument)
   791 		{
   792 		INFO_PRINTF2(_L("err: %d"), test);
   793 		INFO_PRINTF1(_L("test SetBufferSize(1025) - failed!"));
   794 		err++;
   795 		}
   796 	
   797 	//test SetBufferSize(1000)
   798 	test = iUlogger.SetBufferSize(1000);
   799 	if(test != KErrNone)
   800 		{
   801 		INFO_PRINTF2(_L("err: %d"), test);
   802 		INFO_PRINTF1(_L("test SetBufferSize(1000) - failed!"));
   803 		err++;
   804 		}
   805 	
   806 	test = iUlogger.GetBufferSize(val);
   807 	if(test!=KErrNone || val != 1000)
   808 		{
   809 		INFO_PRINTF2(_L("err: %d"), test);
   810 		INFO_PRINTF1(_L("test GetBufferSize(val) - failed!"));
   811 		err++;
   812 		}
   813 	
   814 	iUlogger.GetNotificationSize(val);
   815 	test = iUlogger.SetBufferSize(val-1);
   816 	if(test != KErrGeneral)
   817 		{
   818 		INFO_PRINTF2(_L("err: %d"), test);
   819 		INFO_PRINTF1(_L("test SetBufferSize(val-1) (less than dns)  - failed!"));
   820 		err++;
   821 		}
   822 	
   823 	//summary
   824 	TBuf<64> b;
   825 	if(err)
   826 		b.AppendFormat(_L("SetGetTraceBuffer_TestL failed with %d errors!!!"), err);
   827 	else
   828 		b.Append(_L("SetGetTraceBuffer_TestL passed"));
   829 	INFO_PRINTF1(b);
   830 	return err;
   831 	}
   832 
   833 TInt CTestRULoggerAPIStep::SetGetDnsBuffer_TestL()
   834 	{
   835 	TInt err = 0;
   836 	TInt test = KErrNone;
   837 	TInt val = 0;
   838 	
   839 	test = iUlogger.SetNotificationSize(-1);
   840 	if(test != KErrArgument)
   841 		{
   842 		INFO_PRINTF2(_L("err: %d"), test);
   843 		INFO_PRINTF1(_L("test SetNotificationSize(-1)  - failed!"));
   844 		err++;
   845 		}
   846 	
   847 	test = iUlogger.SetNotificationSize(1025);
   848 	if(test != KErrArgument)
   849 		{
   850 		INFO_PRINTF2(_L("err: %d"), test);
   851 		INFO_PRINTF1(_L("test SetNotificationSize(1025)  - failed!"));
   852 		err++;
   853 		}
   854 	
   855 	test = iUlogger.SetNotificationSize(32);
   856 	if(test != KErrNone)
   857 		{
   858 		INFO_PRINTF2(_L("err: %d"), test);
   859 		INFO_PRINTF1(_L("test SetNotificationSize(32)  - failed!"));
   860 		err++;
   861 		}
   862 	
   863 	iUlogger.GetBufferSize(val);
   864 	test = iUlogger.SetNotificationSize(val+1);
   865 	if(test != KErrNone)
   866 		{
   867 		INFO_PRINTF2(_L("err: %d"), test);
   868 		INFO_PRINTF1(_L("test SetNotificationSize(val+1) (greater than buffer)  - failed!"));
   869 		err++;
   870 		}
   871 	
   872 	
   873 	//summary
   874 	TBuf<64> b;
   875 	if(err)
   876 		b.AppendFormat(_L("SetGetDnsBuffer_TestL failed with %d errors!!!"), err);
   877 	else
   878 		b.Append(_L("SetGetDnsBuffer_TestL passed"));
   879 	INFO_PRINTF1(b);
   880 	return err;
   881 	}
   882 
   883 TInt CTestRULoggerAPIStep::SetGetBufferMode_TestL()
   884 	{
   885 	TInt err = 0;
   886 	TInt test = KErrNone;
   887 	TInt val = 0;
   888 	
   889 	iUlogger.SetBufferMode(0);
   890 	test = iUlogger.SetBufferMode(1);
   891 	if(test != KErrNone)
   892 		{
   893 		INFO_PRINTF2(_L("err: %d"), test);
   894 		INFO_PRINTF1(_L("test iUlogger.SetBufferMode(1) - failed!"));
   895 		err++;
   896 		}
   897 
   898 	test = iUlogger.SetBufferMode(1);
   899 	if(test != KErrNone)
   900 		{
   901 		INFO_PRINTF2(_L("err: %d"), test);
   902 		INFO_PRINTF1(_L("test iUlogger.SetBufferMode(1) again - failed!"));
   903 		err++;
   904 		}
   905 
   906 	test = iUlogger.SetBufferMode(3);
   907 	if(test != KErrArgument)
   908 		{
   909 		INFO_PRINTF2(_L("err: %d"), test);
   910 		INFO_PRINTF1(_L("test iUlogger.iUlogger.SetBufferMode(3) (wrong) - failed!"));
   911 		err++;
   912 		}
   913 		
   914 	test = iUlogger.GetBufferMode(val);
   915 	if(test != KErrNone || val != 1)
   916 		{
   917 		INFO_PRINTF2(_L("err: %d"), test);
   918 		INFO_PRINTF1(_L("test iUlogger.iUlogger.GetBufferMode(val) - failed!"));
   919 		err++;
   920 		}
   921 	
   922 	//summary
   923 	TBuf<64> b;
   924 	if(err)
   925 		b.AppendFormat(_L("SetGetBufferMode_TestL failed with %d errors!!!"), err);
   926 	else
   927 		b.Append(_L("SetGetBufferMode_TestL passed"));
   928 	INFO_PRINTF1(b);
   929 	return err;
   930 	}
   931