traceservices/tracefw/integ_test/ulogger/TEF/te_ulogger/src/te_uloggerfilepluginstep.cpp
changeset 0 08ec8eefde2f
child 23 26645d81f48d
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     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 te_uloggerfilepluginstep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "te_uloggerfilepluginstep.h"
       
    23 #include "te_uloggermclsuitedefs.h"
       
    24 
       
    25 using namespace Ulogger;
       
    26 
       
    27 CULoggerFilePluginStep::~CULoggerFilePluginStep()
       
    28 /**
       
    29  * Destructor
       
    30  */
       
    31 	{
       
    32 	}
       
    33 
       
    34 CULoggerFilePluginStep::CULoggerFilePluginStep()
       
    35 /**
       
    36  * Constructor
       
    37  */
       
    38 	{
       
    39 		SetTestStepName(KULoggerFilePluginStep);
       
    40 	}
       
    41 
       
    42 TVerdict CULoggerFilePluginStep::doTestStepPreambleL()
       
    43 /**
       
    44  * @return - TVerdict code
       
    45  * Override of base class virtual
       
    46  */
       
    47 	{
       
    48 		INFO_PRINTF1(_L("Please delete this line or modify it. I am in Test Step Preamble in Class CULoggerFilePluginStep"));
       
    49 		SetTestStepResult(EPass);
       
    50 		return TestStepResult();
       
    51 	}
       
    52 
       
    53 
       
    54 TVerdict CULoggerFilePluginStep::doTestStepL()
       
    55 /**
       
    56  * @return - TVerdict code
       
    57  * Override of base class pure virtual
       
    58  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
    59  * not leave. That being the case, the current test result value will be EPass.
       
    60  */
       
    61 	{
       
    62 	  if (TestStepResult()==EPass)
       
    63 	  {
       
    64 		//  ************** Delete the Block, the block start ****************
       
    65 		TInt Result=0;
       
    66 		SetTestStepResult(EPass);
       
    67 		INFO_PRINTF1(_L("About to test file plugin"));  //Block start
       
    68 		RULogger logger;
       
    69 		logger.Connect();
       
    70 		CClearConfig configIni;
       
    71 		configIni.Clear(logger);
       
    72 		_LIT8(KTextmedia,"uloggerfileplugin");
       
    73 		const TPtrC8 mediaptr(KTextmedia);
       
    74 		if(Result==0||Result==-11)	
       
    75 		{	
       
    76 			INFO_PRINTF1(_L("File Plugin active"));
       
    77 			_LIT(KTextsetting, "output_path");
       
    78 			_LIT(KTextvalue, "C:\\logs\\ULoggerFileLoggingTest.log");
       
    79 			// test setting the plugin settings
       
    80 			TPluginConfiguration pluginConfig;
       
    81 			pluginConfig.SetKey(KTextsetting);
       
    82 			pluginConfig.SetValue(KTextvalue);			
       
    83 			Result=logger.SetPluginConfigurations(mediaptr,pluginConfig);
       
    84 			if(Result==0)	
       
    85 			{
       
    86 				INFO_PRINTF1(_L("File Plugin Settings set correctly"));
       
    87 				// test that the plugging settings can be retrieved
       
    88 				RPointerArray<TPluginConfiguration> getPluginConfigs;
       
    89 				Result=logger.GetPluginConfigurations(mediaptr, getPluginConfigs);
       
    90 				if(Result==0)	
       
    91 				{
       
    92 					INFO_PRINTF1(_L("File Plugin Settings got correctly"));
       
    93 				}
       
    94 				else
       
    95 				{
       
    96 					INFO_PRINTF1(_L("Failed to get File Plugin Settings"));
       
    97 					SetTestStepResult(EFail);
       
    98 				}
       
    99 				getPluginConfigs.ResetAndDestroy();
       
   100 			}
       
   101 			else
       
   102 			{
       
   103 				INFO_PRINTF1(_L("File Plugin Settings error"));
       
   104 				SetTestStepResult(EFail);
       
   105 			}
       
   106 		}
       
   107 		else
       
   108 		{
       
   109 			INFO_PRINTF1(_L("File Plugin error when activated"));
       
   110 			SetTestStepResult(EFail);
       
   111 		}		
       
   112 		TBuf8<32>activeplugins;		
       
   113 		_LIT8(KTextmedia1,"uloggerfileplugin");
       
   114 		TBuf8<32> checkplugins(KTextmedia1);
       
   115 		// test the active plugin name can be retrieved
       
   116 		logger.GetActiveOutputPlugin(activeplugins);
       
   117 		if (activeplugins.Compare(checkplugins)==0)
       
   118 			INFO_PRINTF1(_L("Got correct active file plugin"));
       
   119 		else
       
   120 		{
       
   121 			INFO_PRINTF1(_L("Got incorrect active file plugin"));
       
   122 			SetTestStepResult(EFail);
       
   123 		}
       
   124 		// test activating the second plugin
       
   125 		_LIT8(KTextmedia2,"te_fileplugin");
       
   126 		const TPtrC8 mediaptr2(KTextmedia2);
       
   127 		Result=logger.ActivateOutputPlugin(mediaptr2);	
       
   128 		if(Result==0||Result==-11)			
       
   129 			INFO_PRINTF1(_L("Second plugin activated correctly"));
       
   130 		else
       
   131 		{
       
   132 			INFO_PRINTF1(_L("Second plugin activation error"));
       
   133 			SetTestStepResult(EFail);
       
   134 		}
       
   135 		// test the remove plugin settings method
       
   136 		Result=logger.RemovePluginConfigurations(mediaptr);
       
   137 		if(Result==0)
       
   138 		{	
       
   139 			INFO_PRINTF1(_L("Removed File Plugin correctly"));
       
   140 		}
       
   141 		else
       
   142 		{
       
   143 			INFO_PRINTF1(_L("Failed to remove File Plugin"));
       
   144 			SetTestStepResult(EFail);
       
   145 		}
       
   146 		// test the second plugin can be deactivated
       
   147 		// This test should fail because the plugin has no settings to remove
       
   148 		Result=logger.RemovePluginConfigurations(mediaptr2);	
       
   149 		if(Result==0)
       
   150 		{	
       
   151 			INFO_PRINTF1(_L("Failed as somehow removed settings when there were none."));
       
   152 			SetTestStepResult(EFail);
       
   153 		}
       
   154 		else
       
   155 		{
       
   156 			INFO_PRINTF1(_L("Passed no settings to remove"));
       
   157 		}
       
   158 		
       
   159 		//  **************   Block end ****************
       
   160 	
       
   161 		logger.Close();
       
   162 		INFO_PRINTF1(_L("file plugin tests complete!"));
       
   163 		}
       
   164 	  return TestStepResult();
       
   165 	}
       
   166 
       
   167 
       
   168 
       
   169 TVerdict CULoggerFilePluginStep::doTestStepPostambleL()
       
   170 /**
       
   171  * @return - TVerdict code
       
   172  * Override of base class virtual
       
   173  */
       
   174 	{
       
   175 		INFO_PRINTF1(_L("Please delete this line or modify it. I am in Test Step Postamble in Class CULoggerFilePluginStep"));
       
   176 		return TestStepResult();
       
   177 	}
       
   178 
       
   179 
       
   180