Merge
authorShabe Razvi <shaber@symbian.org>
Mon, 16 Nov 2009 14:47:25 +0000
changeset 761 3901909be1ab
parent 760 dca795714caa (current diff)
parent 759 862cab47b1ba (diff)
child 770 27a55a8e0baf
Merge
--- a/common/build.postbuild.xml	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/build.postbuild.xml	Mon Nov 16 14:47:25 2009 +0000
@@ -323,7 +323,8 @@
         </exec>
     </target>
 
-    <target name="sf-run-analysis-raptor">            
+    <target name="sf-run-analysis-raptor">
+      <!-- Process raptor logs to remove non-well-formedness  -->
       <echo message="Preprocessing *_compile.log files"/>
       <delete file="${build.log.dir}/analysis/${build.id}_preprocess.log"/>
       <for param="logfile">
@@ -343,6 +344,13 @@
         </sequential>
       </for>
       
+      <!-- Cook the processed raptor logs to produce something in the right format for the BRAG system -->
+      <mkdir dir="${build.log.dir}/summary/"/>
+      <exec executable="perl" output="${build.log.dir}/summary/sbs_BRAG.xml" logError="yes" failonerror="false">
+        <arg value="${sf.common.config.dir}/tools/brag/sbsToBRAG.pl"/>
+        <arg value="${build.log.dir}/analysis/*_compile_preprocessed.log"/>
+      </exec>
+      
       <echo message="Extracting whatlog information from *whatlog*_compile_preprocessed.log files"/>
       <for param="whatlogfile">
         <path>
--- a/common/tools/ats/smoketest/Group/bld.inf	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/ats/smoketest/Group/bld.inf	Mon Nov 16 14:47:25 2009 +0000
@@ -28,3 +28,5 @@
 #include "../appinstall/group/Bld.inf"
 #include "../lbs/group/bld.inf"
 #include "../uiresources/group/bld.inf"
+#include "../inputmethods/group/Bld.inf"
+#include "../IM/group/bld.inf"
--- a/common/tools/ats/smoketest/Group/smoketest.pl	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/ats/smoketest/Group/smoketest.pl	Mon Nov 16 14:47:25 2009 +0000
@@ -11,6 +11,7 @@
 mkpath "temp/smoketest/sms/general";
 mkpath "temp/smoketest/emailmessage/general";
 mkpath "temp/smoketest/emailsettings/general";
+mkpath "temp/smoketest/appinstall/general";
 
 my $epoc=$ENV{'EPOCROOT'} . "epoc32/";
 copy("smoketest.xml",												"temp/test.xml");
@@ -59,11 +60,16 @@
 copy($epoc . "winscw/c/smoketest/ProfileSmokeTestModule.cfg",       "temp/smoketest/general/ProfileSmokeTestModule.cfg");
 copy($epoc . "release/winscw/udeb/AppInstallSmokeTestModule.dll",   "temp/smoketest/winscw_udeb/AppInstallSmokeTestModule.dll");
 copy($epoc . "winscw/c/smoketest/AppInstallSmokeTestModule.cfg",    "temp/smoketest/general/AppInstallSmokeTestModule.cfg");
+copy($epoc . "winscw/c/smoketest/appinstall/sistest_winscw.sisx",   "temp/smoketest/appinstall/general/sistest_winscw.sisx");
 copy($epoc . "release/winscw/udeb/TestNpdApi.dll",					"temp/smoketest/winscw_udeb/TestNpdApi.dll");
 copy($epoc . "data/c/smoketest/smoketest_notepad.cfg",				"temp/smoketest/general/smoketest_notepad.cfg");
 copy($epoc . "data/c/smoketest/ui_TestNpdApi.cfg",					"temp/smoketest/general/ui_TestNpdApi.cfg");
 copy($epoc . "release/winscw/udeb/testsdkskins.dll",				"temp/smoketest/winscw_udeb/testsdkskins.dll");
 copy($epoc . "data/c/smoketest/smoketest_uiresources.cfg",			"temp/smoketest/general/smoketest_uiresources.cfg");
 copy($epoc . "data/c/smoketest/ui_testsdkskinsu.cfg",				"temp/smoketest/general/ui_testsdkskinsu.cfg");
+copy($epoc . "release/winscw/udeb/InputMethodSmokeTestModule.dll",   "temp/smoketest/winscw_udeb/InputMethodSmokeTestModule.dll");
+copy($epoc . "winscw/c/smoketest/InputMethodSmokeTestModule.cfg",    "temp/smoketest/general/InputMethodSmokeTestModule.cfg");
+copy($epoc . "release/winscw/udeb/IMApiTest.dll",					"temp/smoketest/winscw_udeb/IMApiTest.dll");
+copy($epoc . "data/c/smoketest/imapitest.ini",						"temp/smoketest/general/imapitest.ini");
 
 system("7z a -tzip smoketest.zip ./temp/*");
--- a/common/tools/ats/smoketest/Group/smoketest.xml	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/ats/smoketest/Group/smoketest.xml	Mon Nov 16 14:47:25 2009 +0000
@@ -383,6 +383,15 @@
 							<param component-path="smoketest" />
 						</params>
 					</step>
+                    <step id="" name="sistest_winscw.sisx (install)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="data"/>
+							<param src="sistest_winscw.sisx"/>
+							<param dst="c:\smoketest\appinstall\sistest_winscw.sisx"/>
+							<param component-path="smoketest\appinstall" />
+						</params>
+					</step>
 					<step id="" name="testsdkskins.dll (install)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="false">
 						<command>install</command>
 						<params>
@@ -410,6 +419,43 @@
 							<param component-path="smoketest" />
 						</params>
 					</step>
+                    <step id="" name="InputMethodSmokeTestModule.dll (install)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="binary"/>
+							<param src="InputMethodSmokeTestModule.dll"/>
+							<param dst="c:\sys\bin\InputMethodSmokeTestModule.dll"/>
+							<param component-path="smoketest" />
+						</params>
+					</step>
+                    <step id="" name="InputMethodSmokeTestModule.cfg (install)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="data"/>
+							<param src="InputMethodSmokeTestModule.cfg"/>
+							<param dst="c:\smoketest\InputMethodSmokeTestModule.cfg"/>
+							<param component-path="smoketest" />
+						</params>
+					</step>
+					
+					<step id="" name="IMApiTest.dll (install)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="binary"/>
+							<param src="IMApiTest.dll"/>
+							<param dst="c:\sys\bin\IMApiTest.dll"/>
+							<param component-path="smoketest" />
+						</params>
+					</step>
+                    <step id="" name="imapitest.ini (install)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="false">
+						<command>install</command>
+						<params>
+							<param type="data"/>
+							<param src="imapitest.ini"/>
+							<param dst="c:\smoketest\imapitest.ini"/>
+							<param component-path="smoketest" />
+						</params>
+					</step>
 					<step id="" name="ProfileSmokeTestModule (execute)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="true">
 						<command>execute</command>
 						<params>
@@ -446,6 +492,24 @@
 							<param timeout="600"/>
 						</params>
 					</step>
+					<step id="" name="InputMethodSmokeTestModule (execute)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="true">
+						<command>execute</command>
+						<params>
+							<param file="atsinterface.exe"/>
+							<param parameters="-testmodule testscripter -config c:\smoketest\InputMethodSmokeTestModule.cfg"/>
+							<param result-file="c:\spd_logs\xml\testscripter.xml"/>
+							<param timeout="600"/>
+						</params>
+					</step>					
+					<step id="" name="IMApiTest (execute)" harness="ATSINTERFACE" enabled="true" passrate="100" significant="true">
+						<command>execute</command>
+						<params>
+							<param file="atsinterface.exe"/>
+							<param parameters="-testmodule IMApiTest"/>
+							<param result-file="c:\spd_logs\xml\imapitest.xml"/>
+							<param timeout="600"/>
+						</params>
+					</step>
                 </case>
             </set>
 		</session>
@@ -495,8 +559,14 @@
 		<file>smoketest/general/ui_TestNpdApi.cfg</file>
         <file>smoketest/winscw_udeb/AppInstallSmokeTestModule.dll</file>
         <file>smoketest/general/AppInstallSmokeTestModule.cfg</file>
+        <file>smoketest/appinstall/general/sistest_winscw.sisx</file>
 		<file>smoketest/winscw_udeb/testsdkskins.dll</file>		
 		<file>smoketest/general/smoketest_uiresources.cfg</file>
 		<file>smoketest/general/ui_testsdkskinsu.cfg</file>
+        <file>smoketest/winscw_udeb/InputMethodSmokeTestModule.dll</file>
+        <file>smoketest/general/InputMethodSmokeTestModule.cfg</file>
+		<file>smoketest/winscw_udeb/IMApiTest.dll</file>		
+		<file>smoketest/general/imapitest.ini</file>
+
 	</files>
 </test>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/BWINS/DEMOMODULEU.DEF	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,6 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+	?Log@CTestLogger1@@SAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 3 NONAME ; void CTestLogger1::Log(class TRefByValue<class TDesC16 const >, ...)
+	?Log@CTestLogger@@SAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 4 NONAME ; void CTestLogger::Log(class TRefByValue<class TDesC16 const >, ...)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/EABI/DemomoduleU.def	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,16 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZN11CTestLogger3LogE11TRefByValueIK7TDesC16Ez @ 3 NONAME
+	_ZN12CTestLogger13LogE11TRefByValueIK7TDesC16Ez @ 4 NONAME
+	_ZTI11CTestRunner @ 5 NONAME ; #<TI>#
+	_ZTI14CTestScheduler @ 6 NONAME ; #<TI>#
+	_ZTI19CConnectionObserver @ 7 NONAME ; #<TI>#
+	_ZTI19CIMApiClientHandler @ 8 NONAME ; #<TI>#
+	_ZTV11CTestRunner @ 9 NONAME ; #<VT>#
+	_ZTV14CTestScheduler @ 10 NONAME ; #<VT>#
+	_ZTV19CConnectionObserver @ 11 NONAME ; #<VT>#
+	_ZTV19CIMApiClientHandler @ 12 NONAME ; #<VT>#
+	_ZTI16CImpsSettingFile @ 13 NONAME ; #<TI>#
+	_ZTV16CImpsSettingFile @ 14 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/group/Bld.inf	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  STIF TestFramework's IMApiTest
+*
+*
+*/
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    Build information for STIF Test Framework's IMApiTest.
+
+-------------------------------------------------------------------------------
+*/
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+../init/imapitest.ini c:/smoketest/imapitest.ini
+//../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework_im.ini
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+IMApiTest.mmp
+
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#ifndef __WINS__
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/group/IMApiTest.mmp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  STIF TestFramework's IMApiTest
+*
+*
+*/
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    MMP file for STIF Test Framework's IMApiTest.
+
+-------------------------------------------------------------------------------
+*/
+#if defined(__S60_)
+    //To get the OS_LAYER_SYSTEMINCLUDE-definition
+    #include <platform_paths.hrh>
+#endif
+
+TARGET      IMApiTest.dll
+TARGETTYPE  dll
+DEFFILE     Demomodule.def
+
+CAPABILITY	ALL -TCB
+VENDORID 	0x101FB657
+SECUREID        0x102073DB
+
+LIBRARY     commdb.lib 
+LIBRARY     euser.lib
+LIBRARY     stiftestinterface.lib
+LIBRARY       ECom.lib
+LIBRARY       bafl.lib
+LIBRARY       cntmodel.lib 
+LIBRARY       flogger.lib
+LIBRARY       efsrv.lib
+LIBRARY       estor.lib       // ReadStream
+
+
+SOURCEPATH      ../src
+SOURCE          IMApiTest.cpp
+SOURCE          IMApiTestCases.cpp
+SOURCE          IMApiMTHandlers.cpp
+SOURCE          TestRunner.cpp
+SOURCE          ParserUtils.cpp
+
+
+USERINCLUDE     ../inc 
+//USERINCLUDE     ../../inc
+
+#if defined(__S60_)
+    APP_LAYER_SYSTEMINCLUDE
+#else
+   	SYSTEMINCLUDE   /epoc32/include/ecom
+#endif
+
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/inc/IMApiMTHandlers.h	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handler class
+*
+*/
+
+
+#ifndef TESTHANDLERS_H
+#define TESTHANDLERS_H
+
+
+#include <e32base.h>
+#include "imconnection.h"
+#include "imclient.h"
+#include "imerrors.h"
+#include    <flogger.h>
+// FORWARD Declarations
+
+// CLASS DECLARATIONS
+
+//*************************************************************************************
+// CIMApiClientHandler
+//*************************************************************************************
+class CIMApiClientHandler : public MImObserver, public CBase
+    {
+    public:
+        static CIMApiClientHandler* NewL( TRequestStatus& aStatus );
+        virtual ~CIMApiClientHandler();
+
+        void HandleRegisterL(
+            const TInt aErrorCode );
+
+        void HandleMessageSentL(
+            const TInt aOpCode,
+            const TInt aErrorCode );
+
+        void HandleNewPToPMessageL(
+            const TInt aErrorCode,
+            const TContactItemId  aContactId,
+            const TDesC& aUserId,
+            const TDesC& aMessageType,
+            const TDesC8& aContent );
+
+        void HandleNewPToPMessageL(
+            const TInt aErrorCode,
+            const TContactItemId  aContactId,
+            const TDesC& aUserId,
+            const TDesC& aMessageType,
+            const TDesC16& aContent );
+
+        void HandleSendErrorL(
+            const TInt aOpCode,
+            const TInt aErrorCode,
+            MImClientDetailedError* aDetailedError );
+
+//    protected:
+        void TimedOut();
+
+    private:
+        CIMApiClientHandler( TRequestStatus& aStatus );
+        void ConstructL();
+
+    private:
+        TRequestStatus&      iStatus;
+
+    };
+
+
+class CConnectionObserver : public CBase,
+            public MImConnectionObserver
+    {
+    public:
+        static CConnectionObserver* NewL( TRequestStatus& aStatus );
+        virtual ~CConnectionObserver();
+
+        void HandleConnectL( const TInt aErrorCode );
+        void HandleDisconnectL();
+
+        void HandleLoginL( const TInt aErrorCode );
+        void HandleCancelLoginL( const TInt aErrorCode );
+        void HandleLogoutL( const TInt aErrorCode );
+
+    private:
+        CConnectionObserver( TRequestStatus& aStatus );
+        void ConstructL();
+
+    private:
+        TRequestStatus&     iStatus;
+    };
+
+class CTestLogger : public CBase
+    {
+    public:
+        //IMPORT_C static void CTestLogger::Log(TRefByValue<const TDesC> aFmt,...);
+        IMPORT_C static void Log( TRefByValue<const TDesC> aFmt, ... );
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/inc/IMApiTest.h	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,330 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class contains all test framework related parts of
+    this test module.
+*
+*
+*/
+
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This file contains the header file of IMApiTest of
+    STIF TestFramework.
+
+-------------------------------------------------------------------------------
+*/
+#ifndef IMApiTest_H
+#define IMApiTest_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include "IMApiMTHandlers.h"
+#include "imerrors.h"
+#include "imconnection.h"
+#include "imclient.h"
+#include "TestRunner.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// Logging path
+_LIT( KIMApiTestLogPath, "\\logs\\testframework\\IMApiTest\\" );
+// Log file
+_LIT( KIMApiTestLogFile, "IMApiTest.txt" );
+
+// Function pointer related internal definitions
+
+#define GETPTR &
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CIMApiTest;
+
+// DATA TYPES
+// None
+
+// A typedef for function that does the actual testing,
+// function is a type
+// TInt CIMApiTest::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt ( CIMApiTest::* TestFunction )( TTestResult& );
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText* iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC iCaseName;
+        TestFunction iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+        TCaseInfo( const TText* a ) : iCaseName( ( TText* ) a )
+            {
+            };
+
+    };
+
+
+// CLASS DECLARATION
+
+/**
+*  This a IMApiTest class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CIMApiTest ) : public CTestModuleBase
+    {
+public:  // Constructors and destructor
+
+
+    /**
+    * Two-phased constructor.
+    */
+    static CIMApiTest* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CIMApiTest();
+
+public: // New functions
+    // None
+
+public: // Functions from base classes
+
+    /**
+    * From CTestModuleBase InitL is used to initialize the
+    *       IMApiTest. It is called once for every instance of
+    *       TestModuleIMApiTest after its creation.
+    * @since ?Series60_version
+    * @param aIniFile Initialization file for the test module (optional)
+    * @param aFirstTime Flag is true when InitL is executed for first
+    *               created instance of IMApiTest.
+    * @return Symbian OS error code
+    */
+    TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+    /**
+    * From CTestModuleBase GetTestCasesL is used to inquiry test cases
+    *   from IMApiTest.
+    * @since ?Series60_version
+    * @param aTestCaseFile Test case file (optional)
+    * @param aTestCases  Array of TestCases returned to test framework
+    * @return Symbian OS error code
+    */
+    TInt GetTestCasesL( const TFileName& aTestCaseFile,
+                        RPointerArray<TTestCaseInfo>& aTestCases );
+
+    /**
+    * From CTestModuleBase RunTestCaseL is used to run an individual
+    *   test case.
+    * @since ?Series60_version
+    * @param aCaseNumber Test case number
+    * @param aTestCaseFile Test case file (optional)
+    * @param aResult Test case result returned to test framework (PASS/FAIL)
+    * @return Symbian OS error code (test case execution error, which is
+    *           not reported in aResult parameter as test case failure).
+    */
+    TInt RunTestCaseL( const TInt aCaseNumber,
+                       const TFileName& aTestCaseFile,
+                       TTestResult& aResult );
+
+    /**
+    * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+    * test case going to be executed using OOM conditions
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @param aFailureType OOM failure type (optional)
+    * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+    * @param aLastMemFailure The last heap memory allocation failure value (optional)
+    * @return TBool
+    */
+    virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */,
+                                 const TInt /* aCaseNumber */,
+                                 TOOMFailureType& aFailureType,
+                                 TInt& /* aFirstMemFailure */,
+                                 TInt& /* aLastMemFailure */ );
+
+    /**
+    * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
+    * test environment
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @return None
+    */
+    virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */,
+                                     const TInt /* aCaseNumber */ );
+    /**
+    * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+    * test environment
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @return None
+    */
+    virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */,
+                                   const TInt /* aCaseNumber */ );
+
+    /**
+    * From CTestModuleBase; OOMHandleWarningL
+    * @param aTestCaseFile Test case file (optional)
+    * @param aCaseNumber Test case number (optional)
+    * @param aFailNextValue FailNextValue for OOM test execution (optional)
+    * @return None
+    */
+    virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                    const TInt /* aCaseNumber */,
+                                    TInt& /* aFailNextValue */ );
+protected:  // New functions
+    // None
+
+protected:  // Functions from base classes
+    // None
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CIMApiTest();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    // Prohibit copy constructor if not deriving from CBase.
+    // ?classname( const ?classname& );
+    // Prohibit assigment operator if not deriving from CBase.
+    // ?classname& operator=( const ?classname& );
+
+    /**
+    * Function returning test case name and pointer to test case function.
+    * @since ?Series60_version
+    * @param aCaseNumber test case number
+    * @return TCaseInfo
+    */
+    const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+    /**
+    * Printing loop test case.
+    * @since ?Series60_version
+    * @param aResult Test case result (PASS/FAIL)
+    * @return Symbian OS error code (test case execution error
+    *   that is not returned as test case result in aResult)
+    */
+    TInt CreateImClientL( TTestResult& aResult );
+	TInt InvalidLoginL( TTestResult& aResult );
+    TInt LoginL( TTestResult& aResult );
+    TInt SendPToPValidUserIDL( TTestResult& aResult );
+    TInt SendPToPValidTwoUserIDL( TTestResult& aResult );
+    TInt SendPToPValidContactL( TTestResult& aResult );
+    TInt SendPToPValidTwoContactL( TTestResult& aResult );
+    TInt SendPToPContactContentTypeL( TTestResult& aResult );
+    TInt SendPToPUserIDContentTypeL( TTestResult& aResult );
+    TInt LogoutL( TTestResult& aResult );
+    TInt CancelLoginL( TTestResult& aResult );
+
+public:     // Data
+    // None
+
+protected:  // Data
+    // None
+
+private:    // Data
+    // Pointer to test (function) to be executed
+    TestFunction iMethod;
+
+    // Pointer to logger
+    CStifLogger * iLog;
+    CTestRunner*   iRunner;
+
+    CIMApiClientHandler*     iImObserver;
+    CConnectionObserver*    iConnObserver;
+    CImConnection*          iOpenApi;
+    MImClient*              iImClient;
+    CConsoleBase*           iConsole;
+    TBool                   iRepeat;
+
+    /*TInt      iAP;
+    TBuf<50>  iUser;
+    TBuf<50>  iPwd;
+    TBuf<50>  iRecipient;
+    TBuf<50>  iRecipient1;
+    TBuf<50>  iMySapAp;
+    TBuf<50>  iClientId;
+    */
+    // ?one_line_short_description_of_data
+    //?data_declaration;
+
+    // Reserved pointer for future extension
+    //TAny* iReserved;
+
+public:     // Friend classes
+    // None
+    friend class CTestRunner;
+protected:  // Friend classes
+    // None
+
+private:    // Friend classes
+    // None
+
+    };
+
+#endif      // IMApiTest_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/inc/ParserUtils.h	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The class handles IMPS Setting file reading.
+*
+*/
+
+
+#include <f32file.h>
+#include <s32file.h>
+
+// FORWARD DECLARATION
+
+//**********************************
+// CImpsSettingFile
+//**********************************
+// Read key-value pairs from ASCII file
+class CImpsSettingFile: public CBase
+    {
+    public:
+        /**
+        * Constructor.
+        */
+        static CImpsSettingFile* NewL(
+            RFs& aFs );
+
+        ~CImpsSettingFile();
+
+        /**
+        * Opens a file. It is closed in destructor!
+        */
+        void OpenL( TDesC& aResFile );
+
+        /**
+        * Get the key value. Leave with KErrNotFound if not found.
+        */
+        TPtrC8 KeyValueL( const TDesC8& aKey );
+
+    private:
+        CImpsSettingFile( RFs& aFs );
+
+        void ReadRowL( TPtrC8& aKey, TPtrC8& aValue );
+    private:
+        // Data
+        RFs& iFs;
+        RFileReadStream iReader;
+        TBuf8<128> iRowBuffer;
+        TFileName iFileName;
+        TBool     iOpen;
+
+    };
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/inc/TestRunner.h	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: The class handles the test case running.
+*
+*/
+
+
+#ifndef TESTRUNNER_H
+#define TESTRUNNER_H
+
+// INCLUDES
+#include <f32file.h>
+#include <e32test.h>
+#include "IMApiMTHandlers.h"
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include <badesca.h>
+
+#include <cntdb.h>
+#include <cntfield.h>
+#include <cntfldst.h>
+#include <cntitem.h>
+#include <commdb.h>
+
+
+
+// FORWARD DECLARATIONS
+class CTestRunner;
+
+// FORWARD DECLARATIONS
+class CErrorHandler;
+class CAccessHandler;
+class CTestIdleTimer;
+class CTestTimer;
+class CPureHandler;
+
+// ENUMS
+
+enum TWhichCase
+    {
+    InvalidLogin = 1,
+    Login,
+    SendMessageValidUserId,
+    SendMessageValidTwoUserId,
+    SendMessageValidContact,
+    SendMessageValidTwoContact,
+    SendPToPContactContentType,
+    SendPToPUserIDContentType,
+    Logout,
+    CancelLogin,
+    Finish,
+	CreateImClient
+    };
+
+
+// CONSTANTS
+const TInt KImpsMaxLen       = 100;
+const TInt KImpsMaxSapLen       = 100;
+const TInt KImpsMaxUserIdLen    =  50;
+const TInt KImpsMaxClientIdLen 	= 64;  // maximum Client ID, this is not sure!
+
+
+// CLASS DECLARATIONS
+
+
+class CTestRunner : public CActive
+    {
+    public:
+        /**
+        * Static factory method,
+        *
+        * Entry point into Symbian's 2 phase construction pattern.
+        */
+        static CTestRunner* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTestRunner();
+
+        /**
+        * Start the execution.
+        */
+        void StartRunL( TWhichCase aCase );
+
+        CContactIdArray* GetWVContactIdsLC();
+
+        /**
+        * Symbian's 2 phase construction pattern.
+        */
+        void ConstructL( );
+
+        TInt CreateInstanceL();
+        TInt RegisterConnObserverL();
+        TInt LoadIMInterfaceL();
+        TInt IMRegisterL();
+        TInt LoginL( const TDesC& aUserID );
+        TInt SendPToPValidUserIDL();
+        TInt SendPToPValidTwoUserIDL();
+        TInt SendPToPValidContactL();
+        TInt SendPToPValidTwoContactL();
+        TInt SendPToPContactContentTypeL();
+        TInt SendPToPUserIDContentTypeL();
+        TInt QueryIMConnectionStatusL();
+        TInt CancelLoginL();
+
+        void GetDefaultAccessPoint();
+
+        void ReadIniFileL();
+        TBuf<KImpsMaxSapLen> iSapValue;
+        TBuf<KImpsMaxUserIdLen> iUserIdValue;
+        TBuf<KImpsMaxLen> iPassword;
+        TBuf<KImpsMaxClientIdLen>  iClientId;  // 1.3 Client ID Implementation
+        TBuf<KImpsMaxLen> iUserId1;
+        TBuf<KImpsMaxLen> iUserId2;
+        TInt iIAP;
+
+    public: // Functions from base classes
+
+        /**
+        * Active object completion
+        */
+        void RunL();
+        /**
+        * Active object cancellation
+        */
+        void DoCancel();
+
+    private:
+
+        // By default, prohibit copy constructor
+        CTestRunner( const CTestRunner& );
+
+        // Prohibit assigment operator
+        CTestRunner& operator= ( const CTestRunner& );
+
+        /**
+        * C-style constructor.
+        */
+        CTestRunner();
+
+        // actual runner, that is leave trapped
+        void DoRunL();
+
+    private:    // Data
+
+        TWhichCase				iCase;
+        CIMApiClientHandler*     iImObserver; //earlier code
+        //MImObserver*     iImObserver;
+        CConnectionObserver*    iConnObserver;
+        CImConnection*          iOpenApi;
+        MImClient*              iImClient;
+        CStifLogger*			iLog;
+        CContactDatabase*       iDatabase;
+    };
+
+
+
+class CTestScheduler : public CActiveScheduler
+    {
+    public:
+        void Error ( TInt aError ) const;
+    };
+
+class CTestLogger1 : public CBase
+    {
+    public:
+        //IMPORT_C static void CTestLogger::Log(TRefByValue<const TDesC> aFmt,...);
+        IMPORT_C static void Log( TRefByValue<const TDesC> aFmt, ... );
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/init/TestFramework.ini	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,192 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone	# Possible values are:
+						# 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+					  	# 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+					  	# 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+					  	# 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+[New_Module]
+ModuleName= IMApiTest
+[End_Module]
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIFTestFramework logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES		# Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML			# Possible values: TXT or HTML
+#EmulatorOutput= FILE			# Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML			# Possible values: TXT or HTML
+#HardwareOutput= FILE			# Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE		# Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES			# Possible values: YES or NO
+#WithTimeStamp= YES			# Possible values: YES or NO
+#WithLineBreak= YES			# Possible values: YES or NO
+#WithEventRanking= YES			# Possible values: YES or NO
+
+#FileUnicode= YES			# Possible values: YES or NO
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/init/imapitest.ini	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,33 @@
+# IMPS Engine IM SDK API test module static settings
+# Copy this file to %epocroot%\testframework
+
+# SAP
+# Service Access Point for Presence services
+SAP=http://195.134.231.100/wv
+
+# Userid
+# UserId of the SIM registered at SAP
+Userid=test
+
+# Password
+# password for accessing SAP
+password=test
+
+# Clientid
+# no need to modify this
+clientid=apiclient@imps.org
+
+# IAP
+# If run on emulator, IAP=11
+# If run on HW, IAP is ID of Access Point using the SIM Operator's GPRS network, This can be found from "Access point" settings on Phone
+IAP=13
+
+# userid1
+# Any other userid
+userid1=bc2
+
+#userid2
+# Any other userid
+userid2=bc3
+
+# end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/src/IMApiMTHandlers.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handler class
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include    <apparc.h>
+#include    <e32std.h>
+#include    "IMApiMTHandlers.h"
+#include    "TestRunner.h"
+
+/******************************************************************************
+*
+* CIMApiClientHandler
+*
+******************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// Handler class
+CIMApiClientHandler* CIMApiClientHandler::NewL( TRequestStatus& aStatus )
+    {
+    CIMApiClientHandler* self = new( ELeave ) CIMApiClientHandler( aStatus );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+void CIMApiClientHandler::ConstructL()
+    {
+    }
+
+CIMApiClientHandler::CIMApiClientHandler( TRequestStatus& aStatus )
+        : iStatus( aStatus )
+    {
+    }
+
+CIMApiClientHandler::~CIMApiClientHandler()
+    {
+    }
+
+
+void CIMApiClientHandler::HandleMessageSentL( const TInt aOpCode,
+                                              const TInt aErrorCode )
+    {
+    TRequestStatus* s = &iStatus;
+    CTestLogger::Log( _L( "HandleMessageSentL Passed - aErrorCode=%d" ), aErrorCode );
+
+    if ( aErrorCode == 0 || aErrorCode == KImApiErrInvalidUserId || aErrorCode == KImApiErrNotLogged || aErrorCode == KImApiErrPartialSuccess  )
+        {
+        if ( aErrorCode == 0 )
+            {
+            User::RequestComplete( s, KErrNone ); // OK
+            }
+        else if ( aErrorCode == KImApiErrInvalidUserId )
+            {
+            User::RequestComplete( s, KErrNone ); // OK
+            }
+        else if ( aErrorCode == KImApiErrPartialSuccess )
+            {
+            User::RequestComplete( s, KErrNone ); // OK
+            }
+        else
+            {
+            User::RequestComplete( s, KErrNone );
+            }
+        }
+    else
+        {
+        User::RequestComplete( s, aErrorCode ); // FAILED
+        }
+    }
+
+void CIMApiClientHandler::HandleSendErrorL( const TInt aOpCode,
+                                            const TInt aErrorCode,
+                                            MImClientDetailedError* aDetailedError )
+
+    {
+    TRequestStatus* s = &iStatus;
+    TBuf<500> buffer;
+
+    CTestLogger::Log( _L( "HandleSendErrorL - aErrorCode=%d" ), aErrorCode );
+    if ( aErrorCode == 0 || aErrorCode == KImApiErrInvalidUserId || aErrorCode == KImApiErrNotLogged || aErrorCode == KImApiErrPartialSuccess  )
+        {
+        if ( aErrorCode == 0 )
+            {
+            User::RequestComplete( s, KErrNone ); // OK
+            }
+        else if ( aErrorCode == KImApiErrInvalidUserId )
+            {
+            User::RequestComplete( s, KErrNone ); // OK
+            }
+        else if ( aErrorCode == KImApiErrPartialSuccess )
+            {
+            for ( TInt i = 0; i < aDetailedError->Count(); i++ )
+                {
+                buffer.Copy( aDetailedError->UserId( i ) );
+                }
+            User::RequestComplete( s, KErrNone ); // OK
+            }
+        else
+            {
+            User::RequestComplete( s, KErrNone );
+            }
+        }
+    else
+        {
+        User::RequestComplete( s, KErrNone ); // PASSED sad but true
+        }
+    }
+
+
+void CIMApiClientHandler::HandleNewPToPMessageL( const TInt aErrorCode,
+                                                 const TContactItemId aContactId,
+                                                 const TDesC& aUserId,
+                                                 const TDesC& aMessageType,
+                                                 const TDesC16& aContent )
+    {
+    TRequestStatus* s = &iStatus;
+    CTestLogger::Log( _L( "HandleNewPToPMessageL Passed - aErrorCode=%d" ), aErrorCode );
+
+    if ( aErrorCode == 0 )
+        {
+        User::RequestComplete( s, KErrNone );
+        }
+    else
+        {
+        User::RequestComplete( s, aErrorCode );
+        }
+    }
+
+void CIMApiClientHandler::HandleNewPToPMessageL( const TInt aErrorCode,
+                                                 const TContactItemId aContactId,
+                                                 const TDesC& aUserId,
+                                                 const TDesC& aMessageType,
+                                                 const TDesC8& aContent )
+    {
+    TRequestStatus* s = &iStatus;
+    CTestLogger::Log( _L( "HandleNewPToPMessageL Passed - aErrorCode=%d" ), aErrorCode );
+    if ( aErrorCode == 0 )
+        {
+        User::RequestComplete( s, KErrNone );
+        }
+    else
+        {
+        User::RequestComplete( s, aErrorCode );
+        }
+    }
+
+
+void CIMApiClientHandler::TimedOut()
+    {
+    TRequestStatus* s = &iStatus;
+    User::RequestComplete( s, KErrTimedOut );
+    }
+
+
+
+//////////////////////////////////////////////////////////////////////////
+
+CConnectionObserver* CConnectionObserver::NewL( TRequestStatus& aStatus )
+    {
+    CConnectionObserver* self = new( ELeave ) CConnectionObserver( aStatus );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+void CConnectionObserver::ConstructL()
+    {
+    }
+
+CConnectionObserver::CConnectionObserver( TRequestStatus& aStatus )
+        : iStatus( aStatus )
+    {
+    }
+
+CConnectionObserver::~CConnectionObserver()
+    {
+    }
+
+
+void CConnectionObserver::HandleConnectL( const TInt aErrorCode )
+    {
+    TRequestStatus* s = &iStatus;
+    CTestLogger::Log( _L( "HandleConnectL Passed - aErrorCode=%d" ), aErrorCode );
+
+    if ( aErrorCode == 0 )
+        {
+        User::RequestComplete( s, KErrNone ); // OK
+        }
+    else if ( aErrorCode == KImApiErrInvalidUserId )
+        {
+        User::RequestComplete( s, KErrNone ); // OK
+        }
+    else if ( aErrorCode == -33 )
+        {
+        User::RequestComplete( s, aErrorCode ); // FAILED
+        }
+    else if ( aErrorCode == -4154 )
+        {
+        User::RequestComplete( s, aErrorCode );   // FAILED
+        }
+    else if ( aErrorCode == -16 )
+        {
+        User::RequestComplete( s, KErrNone );  // OK IN IMAPI POINT OF WIEV
+        }
+    else if ( aErrorCode == KImApiErrLoginInProgress )
+        {
+        User::RequestComplete( s, KErrNone );  // OK IN IMAPI POINT OF WIEV
+        }
+    else
+        {
+        User::RequestComplete( s, aErrorCode );// FAILED
+        }
+    }
+
+void CConnectionObserver::HandleDisconnectL()
+    {
+    TRequestStatus* s = &iStatus;
+    CTestLogger::Log( _L( " HandleDisconnectL " ) );
+    User::RequestComplete( s, KErrNone ); //OK
+    }
+
+void CConnectionObserver::HandleLoginL( const TInt aErrorCode )
+    {
+    CTestLogger::Log( _L( "HandleLoginL Passed - aErrorCode=%d" ), aErrorCode );
+
+    TRequestStatus* s = &iStatus;
+    if ( aErrorCode == 0 )
+        {
+        User::RequestComplete( s, KErrNone );
+        }
+    else
+        {
+        User::RequestComplete( s, aErrorCode );
+        }
+    }
+
+void CConnectionObserver::HandleCancelLoginL( const TInt aErrorCode )
+    {
+    CTestLogger::Log( _L( "HandleCancelLoginL Passed - aErrorCode=%d" ), aErrorCode );
+    TRequestStatus* s = &iStatus;
+    if ( aErrorCode == 0 )
+        {
+        User::RequestComplete( s, KErrNone );
+        }
+    else
+        {
+        User::RequestComplete( s, aErrorCode );
+        }
+    }
+
+void CConnectionObserver::HandleLogoutL( const TInt aErrorCode )
+    {
+    CTestLogger::Log( _L( "HandleLogoutL Passed-  aErrorCode=%d" ), aErrorCode );
+    CActiveScheduler::Stop();
+    }
+
+
+
+//**********************************
+// CImpsClientLogger
+//**********************************
+const TInt KLogBufferLength = 256;
+_LIT( KLogDir, "impsc" );
+_LIT( KLogFile, "IMAPIHandlersLog.txt" );
+
+EXPORT_C void CTestLogger::Log( TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+
+    // Print to log file
+    TBuf<KLogBufferLength> buf;
+    buf.FormatList( aFmt, list );
+
+    // Write to log file
+    RFileLogger::Write( KLogDir, KLogFile, EFileLoggingModeAppend, buf );
+    }
+
+void CTestScheduler::Error( TInt /*anError */ ) const
+    {
+    CTestLogger::Log( _L( "ClientTester RunL ERROR RECEIVED" ) );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/src/IMApiTest.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,547 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class contains all test framework related parts of
+    this test module.
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "IMApiTest.h"
+#include <e32math.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This file (IMApiTest.cpp) contains all test framework related parts of
+    this test module. Actual test cases are implemented in file
+    IMApiTestCases.cpp.
+
+    CIMApiTest is an example of test module implementation. This example
+    uses hard coded test cases (i.e it does not have any test case
+    configuration file).
+
+    Example uses function pointers to call test cases. This provides an easy
+    method to add new test cases.
+
+    See function Cases in file IMApiTestCases.cpp for instructions how to
+    add new test cases. It is not necessary to modify this file when adding
+    new test cases.
+
+    To take this module into use, add following lines to test framework
+    initialisation file:
+
+# Demo module
+[New_Module]
+ModuleName= IMApiTest
+[End_Module]
+
+-------------------------------------------------------------------------------
+*/
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: CIMApiTest
+
+    Description: C++ default constructor can NOT contain any code, that
+    might leave.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CIMApiTest::CIMApiTest()
+    {
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: ConstructL
+
+    Description: Symbian 2nd phase constructor that can leave.
+
+    Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+    with static buffer size parameter (aStaticBufferSize). Otherwise Logger
+    allocates memory from heap and therefore causes error situations with OOM
+    testing. For more information about STIF Logger construction, see STIF
+    Users Guide.
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CIMApiTest::ConstructL()
+    {
+    // Constructing static buffer size logger, needed with OOM testing because
+    // normally logger allocates memory from heap!
+    iLog = CStifLogger::NewL( KIMApiTestLogPath,
+                              KIMApiTestLogFile,
+                              CStifLogger::ETxt,
+                              CStifLogger::EFile,
+                              ETrue,
+                              ETrue,
+                              ETrue,
+                              EFalse,
+                              ETrue,
+                              EFalse,
+                              100 );
+
+    // Sample how to use logging
+    _LIT( KLogInfo, "IMApiTest logging starts!" );
+    iLog->Log( KLogInfo );
+    iRunner = CTestRunner::NewL();
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: NewL
+
+    Description: Two-phased constructor. Constructs new CIMApiTest
+    instance and returns pointer to it.
+
+    Parameters:    None
+
+    Return Values: CIMApiTest*: new object.
+
+    Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CIMApiTest* CIMApiTest::NewL()
+    {
+    CIMApiTest* self = new ( ELeave ) CIMApiTest;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: ~CIMApiTest
+
+    Description: Destructor.
+
+    Parameters:    None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+CIMApiTest::~CIMApiTest()
+    {
+    delete iLog;
+    if ( iRunner )
+        delete iRunner;
+    }
+
+/*
+-------------------------------------------------------------------------------
+    Class: CIMApiTest
+
+    Method: InitL
+
+    Description: Method for test case initialization
+
+    Parameters: None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+-------------------------------------------------------------------------------
+*/
+TInt CIMApiTest::InitL( TFileName& /*aIniFile*/,
+                        TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases
+    from the test module. Because this test module has hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used
+                RPointerArray<TTestCaseInfo>& aTestCases: out:
+                      Array of TestCases.
+
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CIMApiTest::GetTestCasesL( const TFileName& /*aConfig*/,
+                                RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array
+    for ( TInt i = 0; Case( i ).iMethod != NULL; i++ )
+        {
+        // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+
+        // PushL TTestCaseInfo to CleanupStack.
+        CleanupStack::PushL( newCase );
+
+        // Set number for the testcase.
+        // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+        // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case( i ).iCaseName );
+
+        // Append TTestCaseInfo to the testcase array. After appended
+        // successfully the TTestCaseInfo object is owned (and freed)
+        // by the TestServer.
+        User::LeaveIfError( aTestCases.Append ( newCase ) );
+
+        // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+        }
+
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases().
+
+    Parameters: const TInt aCaseNumber: in: Testcase number
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CIMApiTest::RunTestCaseL( const TInt aCaseNumber,
+                               const TFileName& /* aConfig */,
+                               TTestResult& aResult )
+    {
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests );
+    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );
+
+    _LIT( KLogInfo, "Starting testcase [%S]" );
+    iLog->Log( KLogInfo, &tmp.iCaseName );
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;
+        execStatus  = ( this->*iMethod )( aResult );
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: OOMTestQueryL
+
+    Description: Checks test case information for OOM execution.
+
+    Return Values: TBool
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TBool CIMApiTest::OOMTestQueryL( const TFileName& /* aTestCaseFile */,
+                                 const TInt aCaseNumber,
+                                 TOOMFailureType& /* aFailureType */,
+                                 TInt& aFirstMemFailure,
+                                 TInt& aLastMemFailure )
+    {
+    _LIT( KLogInfo, "CIMApiTest::OOMTestQueryL" );
+    iLog->Log( KLogInfo );
+
+    aFirstMemFailure = Case( aCaseNumber ).iFirstMemoryAllocation;
+    aLastMemFailure = Case( aCaseNumber ).iLastMemoryAllocation;
+
+    return Case( aCaseNumber ).iIsOOMTest;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: OOMTestInitializeL
+
+    Description: Used to perform the test environment setup for a particular
+    OOM test case. Test Modules may use the initialization file to read
+    parameters for Test Module initialization but they can also have their own
+    configure file or some other routine to initialize themselves.
+
+    NOTE: User may add implementation for OOM test environment initialization.
+    Usually no implementation is required.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CIMApiTest::OOMTestInitializeL( const TFileName& /* aTestCaseFile */,
+                                     const TInt /* aCaseNumber */ )
+    {
+    _LIT( KLogInfo, "CIMApiTest::OOMTestInitializeL" );
+    iLog->Log( KLogInfo );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: OOMHandleWarningL
+
+    Description: Used in OOM testing to provide a way to the derived TestModule
+    to handle warnings related to non-leaving or TRAPped allocations.
+
+    In some cases the allocation should be skipped, either due to problems in
+    the OS code or components used by the code being tested, or even inside the
+    tested components which are implemented this way on purpose (by design), so
+    it is important to give the tester a way to bypass allocation failures.
+
+    NOTE: User may add implementation for OOM test warning handling. Usually no
+    implementation is required.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CIMApiTest::OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                    const TInt /* aCaseNumber */,
+                                    TInt& /* aFailNextValue */ )
+    {
+    _LIT( KLogInfo, "CIMApiTest::OOMHandleWarningL" );
+    iLog->Log( KLogInfo );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: OOMTestFinalizeL
+
+    Description: Used to perform the test environment cleanup for a particular OOM
+    test case.
+
+    NOTE: User may add implementation for OOM test environment finalization.
+    Usually no implementation is required.
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+void CIMApiTest::OOMTestFinalizeL( const TFileName& /* aTestCaseFile */,
+                                   const TInt /* aCaseNumber */ )
+    {
+    _LIT( KLogInfo, "CIMApiTest::OOMTestFinalizeL" );
+    iLog->Log( KLogInfo );
+
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CIMApiTest::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/,
+                               TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+    /*
+        aParameterValid = KStifTestModuleParameterChanged;
+
+        CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+        // Stack size
+        param->iTestThreadStackSize= 16384; // 16K stack
+        // Heap sizes
+        param->iTestThreadMinHeap = 4096;   // 4K heap min
+        param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+        aTestModuleParam = param;
+    */
+    return KErrNone;
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/src/IMApiTestcases.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,297 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This module contains the implementation of CIMApiTest class
+    member functions that does the actual tests.
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "IMApiTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CIMApiTest class
+    member functions that does the actual tests.
+
+-------------------------------------------------------------------------------
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CIMApiTest
+
+    Method: Case
+
+    Description: Returns a test case by number.
+
+    This function contains an array of all available test cases
+    i.e pair of case name and test function. If case specified by parameter
+    aCaseNumber is found from array, then that item is returned.
+
+    The reason for this rather complicated function is to specify all the
+    test cases only in one place. It is not necessary to understand how
+    function pointers to class member functions works when adding new test
+    cases. See function body for instructions how to add new test case.
+
+    Parameters:    const TInt aCaseNumber :in:      Test case number
+
+    Return Values: const TCaseInfo Struct containing case name & function
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+const TCaseInfo CIMApiTest::Case (
+    const TInt aCaseNumber ) const
+    {
+
+    /*
+    * To add new test cases, implement new test case function and add new
+    * line to KCases array specify the name of the case and the function
+    * doing the test case
+    * In practice, do following
+    *
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to
+    *    OOMHard.cpp file and to OOMHard.h
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and
+    * TInt value for last heap memory allocation failure.
+    *
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation
+    * failure and TInt value for last heap memory allocation failure.
+    */
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g.
+        // CIMApiTest::PrintTest. Otherwise the compiler
+        // gives errors.
+
+		ENTRY( "Create IM Client", CIMApiTest::CreateImClientL ),
+//        ENTRY( "Invalid Login", CIMApiTest::InvalidLoginL ),
+//        ENTRY( "Login", CIMApiTest::LoginL ),
+//        ENTRY( "Send P To P ValidUserID", CIMApiTest::SendPToPValidUserIDL ),
+//        ENTRY( "Send P To P ValidTvoUserID", CIMApiTest::SendPToPValidTwoUserIDL ),
+//        ENTRY( "Send P To P ValidContact", CIMApiTest::SendPToPValidContactL ),
+//        ENTRY( "Send P To P ValidTwoContact", CIMApiTest::SendPToPValidTwoContactL ),
+//        ENTRY( "Send P To P ContactContentType", CIMApiTest::SendPToPContactContentTypeL ),
+//        ENTRY( "Send P To P UserIDContentType", CIMApiTest::SendPToPUserIDContentTypeL ),
+//        ENTRY( "Logout", CIMApiTest::LogoutL ),
+//        ENTRY( "Cancel Login", CIMApiTest::CancelLoginL ),
+        };
+
+    // Verify that case number is valid
+    if ( ( TUint ) aCaseNumber >= sizeof( KCases ) /
+         sizeof( TCaseInfoInternal ) )
+        {
+
+        // Invalid case, construct empty object
+        TCaseInfo null( ( const TText* ) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+
+        }
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+TInt CIMApiTest::CreateImClientL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( CreateImClient );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "CreateImClientL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+
+    }
+	
+TInt CIMApiTest::InvalidLoginL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( InvalidLogin );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "LoginL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+
+    }
+
+TInt CIMApiTest::LoginL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( Login );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "LoginL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt CIMApiTest::SendPToPValidUserIDL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( SendMessageValidUserId );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "SendPToPValidUserIDL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt CIMApiTest::SendPToPValidTwoUserIDL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( SendMessageValidTwoUserId );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "SendPToPValidTwoUserIDL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt CIMApiTest::SendPToPValidContactL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( SendMessageValidContact );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "SendPToPValidContactL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt CIMApiTest::SendPToPValidTwoContactL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( SendMessageValidTwoContact );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "SendPToPValidTwoContactL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+TInt CIMApiTest::SendPToPContactContentTypeL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( SendPToPContactContentType );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "SendPToPContactContentTypeL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+TInt CIMApiTest::SendPToPUserIDContentTypeL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( SendPToPUserIDContentType );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "SendPToPUserIDContentTypeL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+TInt CIMApiTest::LogoutL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( Logout );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "LogoutL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+
+TInt CIMApiTest::CancelLoginL( TTestResult& aResult )
+    {
+    iRunner->StartRunL( CancelLogin );
+    // Sets test case result and description(Maximum size is KStifMaxResultDes)
+    _LIT( KDescription, "CancelLoginL Passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    // Case was executed
+    return KErrNone;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/src/ParserUtils.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: The class handles IMPS Setting file reading.
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+#ifdef _DEBUG
+#include    <flogger.h>
+#endif
+#include "ParserUtils.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+
+//**********************************
+// CImpsSettingFile
+//**********************************
+
+CImpsSettingFile* CImpsSettingFile::NewL(
+    RFs& aFs )
+    {
+    CImpsSettingFile* self = new ( ELeave ) CImpsSettingFile( aFs );
+    return self;
+    }
+
+CImpsSettingFile::~CImpsSettingFile()
+    {
+    if ( iOpen )
+        {
+        iReader.Close();
+        }
+    iOpen = EFalse;
+    }
+
+CImpsSettingFile::CImpsSettingFile( RFs& aFs )
+        : iFs( aFs ),
+        iOpen( EFalse )
+    {
+
+    }
+
+void CImpsSettingFile::OpenL( TDesC& aResFile )
+    {
+    // open a file
+    iFileName = aResFile;
+
+    TInt myError = iReader.Open( iFs,
+                                 iFileName,
+                                 EFileShareReadersOnly );
+
+    User::LeaveIfError( myError );
+    iOpen = ETrue;
+
+    }
+
+TPtrC8 CImpsSettingFile::KeyValueL( const TDesC8& aKey )
+    {
+
+    TPtrC8 myKey;
+    TPtrC8 myValue;
+    TBool getIt( EFalse );
+    TInt err = 0;
+
+    // Reset the reader
+    OpenL( iFileName );
+
+    // Start to search
+    while ( !getIt )
+        {
+        TRAP ( err, ReadRowL( myKey, myValue ) );
+        if ( err != KErrNone )
+            {
+            User::Leave( KErrNotFound );
+            }
+        if ( !myKey.CompareF( aKey ) )
+            {
+            return myValue;
+            }
+        }
+    return TPtrC8();
+    }
+
+void CImpsSettingFile::ReadRowL( TPtrC8& aKey, TPtrC8& aValue )
+    {
+    // READ ONE ROW
+    TChar delim( 10 );
+    iReader.ReadL( iRowBuffer, delim );
+    TInt length = iRowBuffer.Length();
+    if ( length > 2 )
+        {
+        // DROP CR+LF FROM THE END OF LINE
+        iRowBuffer.Delete( length - 2, 2 );
+
+        TInt pos = 0;
+        pos = iRowBuffer.Find( _L8( "=" ) );
+        if ( pos > 0 )
+            {
+            aKey.Set( iRowBuffer.Left( pos ) );
+            // Cut off separator
+            aValue.Set( iRowBuffer.Mid( pos + 1 ) );
+            }
+        }
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/IM/src/TestRunner.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,701 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: The class handles the test case running.
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+#include    <flogger.h>
+#include 	"imerrors.h"
+#include    <CNTDEF.H>
+#include    "IMApiMTHandlers.h"
+#include    "TestRunner.h"
+#include 	"IMApiTest.h"
+#include 	"ParserUtils.h"
+
+_LIT( KImpsIMApiMTIniFile, "c:\\smoketest\\imapitest.ini" );
+_LIT8( KImpsSAP, "SAP" );
+_LIT8( KImpsUserID, "Userid" );
+_LIT8( KImpsPassword, "password" );
+_LIT8( KImpsClientid, "clientid" );
+_LIT8( KImpsIAP, "IAP" );
+_LIT8( KImpsUserid1, "userid1" );
+_LIT8( KImpsUserid2, "userid2" );
+
+void SetupSchedulerL()
+    {
+    // Create a scheduler
+    CTestScheduler* scheduler = new( ELeave )CTestScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+    CleanupStack::Pop(); // scheduler
+    }
+
+void CTestRunner::ReadIniFileL()
+    {
+    RFs myFs;
+    TInt err = 0;
+    TUint32 myTime = 0;
+    TLex lex;
+    err = myFs.Connect();
+    //CleanupClosePushL( myFs );
+    CImpsSettingFile* configFile = CImpsSettingFile::NewL( myFs );
+    CleanupStack::PushL( configFile );
+    TFileName fileN( KImpsIMApiMTIniFile );
+    // Open config file
+    TRAP( err, configFile->OpenL( fileN ) );
+    User::LeaveIfError( err );
+
+    TBuf<KImpsMaxSapLen> myPtr;
+    TRAP( err, myPtr.Copy( configFile->KeyValueL( KImpsSAP ) ) );
+    if ( !err )
+        {
+        iSapValue.Copy( myPtr );
+        }
+    TRAP( err, myPtr.Copy( configFile->KeyValueL( KImpsUserID ) ) );
+    if ( !err )
+        {
+        iUserIdValue.Copy( myPtr );
+        }
+    TRAP( err, myPtr.Copy( configFile->KeyValueL( KImpsPassword ) ) );
+    if ( !err )
+        {
+        iPassword.Copy( myPtr );
+        }
+    TRAP( err, myPtr.Copy( configFile->KeyValueL( KImpsClientid ) ) );
+    if ( !err )
+        {
+        iClientId.Copy( myPtr );
+        }
+    TRAP( err, myPtr.Copy( configFile->KeyValueL( KImpsIAP ) ) );
+    if ( !err )
+        {
+        lex.Assign( myPtr );
+        lex.Val( myTime, EDecimal );
+        iIAP = ( TInt ) myTime;
+        }
+    TRAP( err, myPtr.Copy( configFile->KeyValueL( KImpsUserid1 ) ) );
+    if ( !err )
+        {
+        iUserId1.Copy( myPtr );
+        }
+    TRAP( err, myPtr.Copy( configFile->KeyValueL( KImpsUserid2 ) ) );
+    if ( !err )
+        {
+        iUserId2.Copy( myPtr );
+        }
+    CleanupStack::PopAndDestroy( 1 );  // configFile
+    }
+
+
+
+CTestRunner* CTestRunner::NewL()
+    {
+    CTestRunner* self = new ( ELeave ) CTestRunner();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); //self
+    return self;
+    }
+
+void CTestRunner::ConstructL()
+    {
+    SetupSchedulerL();
+    iCase = Login;
+    iDatabase = CContactDatabase::OpenL();
+    iImObserver = CIMApiClientHandler::NewL( iStatus );
+    iConnObserver = CConnectionObserver::NewL( iStatus );
+    ReadIniFileL();
+
+    CActiveScheduler::Add( this );
+    }
+
+CTestRunner::~CTestRunner()
+    {
+
+    if ( iOpenApi != NULL )
+        {
+        iOpenApi->UnregisterObserver();
+        }
+    CTestLogger1::Log( _L( "Test Case Number #16" ) );
+    CTestLogger1::Log( _L( "CImConnection::UnregisterObserver" ) );
+    if ( iOpenApi != NULL )
+        {
+        delete iOpenApi;
+        iOpenApi = NULL;
+        }
+    if ( iImClient != NULL )
+        {
+        delete iImClient;
+        iImClient = NULL;
+        }
+    if ( iConnObserver != NULL )
+        {
+        delete iConnObserver;
+        iConnObserver = NULL;
+        }
+    if ( iImObserver != NULL )
+        {
+        delete iImObserver;
+        iImObserver = NULL;
+        }
+    if ( iDatabase != NULL )
+        {
+        delete iDatabase;
+        iDatabase = NULL;
+        }
+
+    }
+
+
+
+void CTestRunner::DoCancel()
+    {
+    // Complete the request with error
+    TRequestStatus* s = &iStatus;
+    User::RequestComplete( s, KErrCancel );
+    }
+
+
+CTestRunner::CTestRunner()
+        : CActive( 0 )
+    {
+    }
+
+
+void CTestRunner::StartRunL( TWhichCase aCase )
+    {
+    iCase = aCase;
+    SetActive();
+    TRequestStatus *s = &iStatus;
+    User::RequestComplete( s, KErrNone );
+    CActiveScheduler::Start();
+    }
+
+void CTestRunner::RunL()
+    {
+    TInt errxx = 0;
+    TRAP( errxx, DoRunL() );
+    if ( errxx < 0 )
+        {
+        CActiveScheduler::Stop();
+        }
+    }
+
+
+void CTestRunner::DoRunL()
+    {
+    if ( iCase >= Finish )
+        {
+        Cancel();
+        CActiveScheduler::Stop();
+        return;
+        }
+
+    if ( iStatus != KErrNone )
+        {
+        Cancel();
+        CActiveScheduler::Stop();
+        return;
+        }
+    switch ( iCase )
+        {
+        case CreateImClient:
+            {
+            CreateInstanceL();			//NewL - instantiate the object
+            RegisterConnObserverL();	//RegisterObserverL - register the observer methods
+            LoadIMInterfaceL();			//CreateImClientL - get the IM interface
+            }
+        break;
+        case InvalidLogin:
+            {
+            CreateInstanceL();
+            RegisterConnObserverL();
+            LoadIMInterfaceL();
+            IMRegisterL();
+            LoginL( _L( "InvalidUser" ) );
+            }
+        break;
+        case Login:
+            {
+            CreateInstanceL();
+            RegisterConnObserverL();
+            LoadIMInterfaceL();
+            IMRegisterL();
+            LoginL( iUserIdValue );
+            }
+        break;
+        case SendMessageValidUserId:
+            {
+            SendPToPValidUserIDL();
+            }
+        break;
+        case SendMessageValidTwoUserId:
+            {
+            SendPToPValidTwoUserIDL();
+            }
+        break;
+        case SendMessageValidContact:
+            {
+            SendPToPValidContactL();
+            }
+        break;
+        case SendMessageValidTwoContact:
+            {
+            SendPToPValidTwoContactL();
+            }
+        break;
+        case SendPToPContactContentType:
+            {
+            SendPToPContactContentTypeL();
+            }
+        break;
+        case SendPToPUserIDContentType:
+            {
+            SendPToPUserIDContentTypeL();
+            }
+        break;
+
+        case Logout:
+            {
+            QueryIMConnectionStatusL();
+            }
+        break;
+        case CancelLogin:
+            {
+            CancelLoginL();
+            }
+        break;
+        }
+
+    iCase = Finish;
+
+    return;
+    }
+
+
+CContactIdArray* CTestRunner::GetWVContactIdsLC( )
+    {
+    _LIT( KWVStart, "" );
+    // Specify in which fields search should be performed
+    CContactItemFieldDef* fieldToSearchIn = new ( ELeave ) CContactItemFieldDef();
+    CleanupStack::PushL( fieldToSearchIn );
+    fieldToSearchIn->AppendL( KUidContactFieldVCardMapWV );
+
+    // search in contact database
+    CContactIdArray *array = iDatabase->FindLC( KWVStart, fieldToSearchIn );
+    CleanupStack::Pop(); //>> array
+    CleanupStack::PopAndDestroy(); //>> fieldToSearchIn
+    CleanupStack::PushL( array );
+
+    return array;
+    }
+
+
+
+TInt CTestRunner::RegisterConnObserverL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #2" ) );
+    TRAPD( err, iOpenApi->RegisterObserverL( iConnObserver ) );
+    // Catch errors
+    if ( err == KImApiGeneralError ) // -30133
+        {
+        iStatus = err; // Failed
+        CTestLogger1::Log( _L( "CImConnection::RegisterObserverL - err=%d" ), err );
+        }
+    else
+        {
+        iStatus = KErrNone; //OK
+        CTestLogger1::Log( _L( "CImConnection::RegisterObserverL - err=%d" ), err );
+        }
+    }
+
+
+TInt CTestRunner::CreateInstanceL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #1" ) );
+    iOpenApi = CImConnection::NewL( iClientId );
+    CTestLogger1::Log( _L( "CImConnection::NewL" ) );
+    return KErrNone; //OK
+    }
+
+
+TInt CTestRunner::LoadIMInterfaceL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #3" ) );
+    TRAPD( err, iImClient = iOpenApi->CreateImClientL() );
+    // Catch errrors
+    if ( err == 0 )
+        {
+        iStatus = KErrNone; // OK
+        CTestLogger1::Log( _L( "CreateImClientL - err=%d" ), err );
+        }
+    else
+        {
+        iStatus = err; // Failed
+        CTestLogger1::Log( _L( "CreateImClientL - err=%d" ), err );
+        }
+    }
+
+
+TInt CTestRunner::IMRegisterL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #4" ) );
+    TRAPD( err, iImClient -> RegisterObserverL( iImObserver ) );
+    // Catch errors
+    if ( err == KImApiGeneralError ) //- 30133
+        {
+        iStatus = err; // Failes
+        CTestLogger1::Log( _L( "MImClient::RegisterObserverL - err=%d" ), err );
+        }
+    else
+        {
+        iStatus = KErrNone; //OK
+        CTestLogger1::Log( _L( "MImClient::RegisterObserverL - err=%d" ), err );
+        }
+    }
+
+TInt CTestRunner::LoginL( const TDesC& aUserID )
+    {
+    if ( aUserID.Compare( _L( "InvalidUser" ) ) )
+        CTestLogger1::Log( _L( "Test Case Number #6" ) );
+    else
+        {
+        CTestLogger1::Log( _L( "Invalid Login" ) );
+        CTestLogger1::Log( _L( "Test Case Number #5" ) );
+        }
+
+    if ( iSapValue.Size() == 0 || iPassword.Size() == 0 || aUserID.Size() == 0 )
+        {
+        iStatus = KErrNone;
+        CTestLogger1::Log( _L( "Invalid login parametres" ) );
+        Cancel();
+        CActiveScheduler::Stop();
+        return KErrNone;
+        }
+
+    TRAPD( err, iOpenApi->LoginL( iSapValue, aUserID, iPassword, iIAP ) );
+    // Catch errors
+    if ( err )
+        {
+        iStatus = err; // Failes
+        CTestLogger1::Log( _L( "LoginL - err=%d" ), err );
+        return err;
+        }
+    else
+        {
+        iStatus = KRequestPending;
+        CTestLogger1::Log( _L( "LoginL - err=%d" ), err );
+        SetActive();
+        return KErrNone;
+        }
+    }
+
+TInt CTestRunner::SendPToPValidUserIDL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #7" ) );
+    if ( iUserId1.Length() == 0 )
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidUserId) UserID1 is NULL " ) );
+        iStatus = KErrNone;
+        Cancel();
+        CActiveScheduler::Stop();
+        return KErrNone;
+        }
+    CDesCArray* userIds = new( ELeave ) CDesCArrayFlat( 1 ); // Create user list
+    CleanupStack::PushL( userIds );
+    userIds->AppendL( iUserId1 ); // Add one user
+
+    _LIT( KContentType, "text/plain" ); // Message type
+    _LIT( KMessage, "5. Hello In One Time Valid UserId" ); // Message
+    TInt OpId = 0;
+    // Send message
+    TRAPD ( err, OpId = iImClient->SendPToPMessageL( iUserId1, KMessage ) );
+    // Catch errors
+    if ( err == KImApiErrInvalidUserId && OpId == 0 ) // KImApiErrInvalidUserId
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidUserId) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = err;
+        return err;
+        }
+    else if ( err == KImApiGeneralError && OpId == 0 ) // General ImApi errror
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidUserId) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = err;
+        return err;
+        }
+    else
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidUserId) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = KRequestPending;
+        SetActive();
+        return KErrNone;
+        }
+    }
+
+
+TInt CTestRunner::SendPToPValidTwoUserIDL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #8" ) );
+    CDesCArray* userIds = new( ELeave ) CDesCArrayFlat( 2 ); // Create new user list
+    CleanupStack::PushL( userIds );
+    userIds->AppendL( iUserId1 ); // Add user 0 nok3
+    userIds->AppendL( iUserId2 ); // Add user 1 nok5
+
+    _LIT( KContentType, "text/plain" );
+    _LIT( KMessage, "6. Hello In Two Times Valid UserId" );
+    TInt OpId = 0;
+    // Send Message
+    TRAPD ( err, OpId = iImClient->SendPToPMessageL( *userIds, KMessage ) );
+    // Catch errors
+    if ( err == KImApiErrInvalidUserId && OpId == 0 ) // KImApiErrInvalidUserId
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidTwoUserIds) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = err;
+        return err;
+        }
+    else if ( err == KImApiGeneralError && OpId == 0 ) // General ImApi errror
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidTwoUserIds) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = err;
+        return err;
+        }
+    else
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidTwoUserIds) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = KRequestPending;
+        SetActive();
+        return KErrNone;
+        }
+    }
+
+
+TInt CTestRunner::SendPToPValidContactL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #9" ) );
+    CContactIdArray* contactIDArray = GetWVContactIdsLC();
+    if ( contactIDArray->Count() == 0 )
+        {
+        CTestLogger1::Log( _L( "Can not find WvContact ID" ) );
+        CleanupStack::PopAndDestroy();
+        iStatus = KErrNone;
+        Cancel();
+        CActiveScheduler::Stop();
+        return KErrNone;
+        }
+    TInt OpId = 0;
+    // Be sure that two contact is real WV contact
+    // Select first contact
+    TContactItemId& OmaContact = ( *contactIDArray )[0];
+
+    //Add first contact
+    CContactIdArray* myContactIds = CContactIdArray::NewL();
+    myContactIds->AddL( OmaContact );
+
+    // Check that we have only one contact
+    TInt nuberofcontacts = myContactIds->Count();
+    //CTestLogger1::Log( _L("nuberofcontacts =%d"), nuberofcontacts );
+    //Send message to myContacts
+    TRAPD( err, OpId = iImClient->SendPToPMessageL( OmaContact/*myContactIds*/, _L( "12. Hello One Valid Contact" ) ) );
+    // Just checking return value
+    if ( err == KImApiErrInvalidContactId && OpId == 0 ) // KImApiErrInvalidContactId and OperationId is 0
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidContact) - err=%d" ), err );
+        CleanupStack::PopAndDestroy();
+        iStatus = KErrNone;
+        Cancel();
+        CActiveScheduler::Stop();
+        return err;
+        }
+    else if ( err == KImApiGeneralError && OpId == 0 ) // General ImApi error
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidContact) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = err;
+        return err;
+        }
+    else
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidContact) - err=%d" ), err );
+        CleanupStack::PopAndDestroy();
+        iStatus = KRequestPending;
+        SetActive();
+        return KErrNone; //OpId;
+        }
+    }
+
+
+TInt CTestRunner::SendPToPValidTwoContactL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #10" ) );
+    CContactIdArray* contactIDArray = GetWVContactIdsLC();
+    TInt OpId = 0;
+    // Be sure that two contact is real WV contact
+    //Is there three contacts
+    TInt nuberofcontacts = contactIDArray->Count();
+    if ( contactIDArray->Count() == 0 )
+        {
+        CTestLogger1::Log( _L( "Can not find WvContact ID" ) );
+        CleanupStack::PopAndDestroy();
+        iStatus = KErrNone;
+        Cancel();
+        CActiveScheduler::Stop();
+        return KErrNone;
+        }
+    // Remove third contact
+    // Never commit the reset
+    if ( contactIDArray->Count() >= 3 )
+        {
+        contactIDArray->Remove( 2 );
+        }
+
+
+    // Check if Remove is OK
+    TRAPD( err1, OpId = iImClient->SendPToPMessageL( *contactIDArray, _L( "text/plain" ), _L8( "Hello All" ) ) );
+
+    //Send message
+    TRAPD( err, OpId = iImClient->SendPToPMessageL( *contactIDArray, _L( "13. Hello In Two Times Valid Contact" ) ) );
+
+    // Just checking return value
+    if ( err == KImApiErrInvalidContactId && OpId == 0 ) // KImApiErrInvalidContactId and OperationId is 0
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidTwoContact) - err=%d" ), err );
+        CleanupStack::PopAndDestroy();
+        iStatus = KErrNone;
+        Cancel();
+        CActiveScheduler::Stop();
+        return err;
+        }
+    else if ( err == KImApiGeneralError && OpId == 0 ) // General ImApi error
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidTwoContact) - err=%d" ), err );
+        CleanupStack::PopAndDestroy(); // userIds
+        iStatus = err;
+        return err;
+        }
+    else
+        {
+        CTestLogger1::Log( _L( "SendPToPMessageL(ValidTwoContact) - err=%d" ), err );
+        CleanupStack::PopAndDestroy();
+        iStatus = KRequestPending;
+        SetActive();
+        return KErrNone; // OpId;
+        }
+    }
+
+TInt CTestRunner::SendPToPContactContentTypeL()
+    {
+    //This SDK API is not supported. Test case is added to increase the code coverage
+    CTestLogger1::Log( _L( "Test Case Number #11" ) );
+    CTestLogger1::Log( _L( "SendPToPContactContentTypeL" ) );
+    TInt OpId = 0;
+    CContactIdArray* contactIDArray = GetWVContactIdsLC();
+    if ( contactIDArray->Count() == 0 )
+        {
+        CTestLogger1::Log( _L( "Can not find WvContact ID" ) );
+        CleanupStack::PopAndDestroy();
+        iStatus = KErrNone;
+        Cancel();
+        CActiveScheduler::Stop();
+        return KErrNone;
+        }
+    TRAPD( err, OpId = iImClient->SendPToPMessageL( *contactIDArray, _L( "text/plain" ), _L8( "Hello All" ) ) );
+    CleanupStack::PopAndDestroy(); // userIds
+    iStatus = err;
+    Cancel();
+    CActiveScheduler::Stop();
+    return err;
+    }
+
+TInt CTestRunner::SendPToPUserIDContentTypeL()
+    {
+    //This SDK API is not supported. Test case is added to increase the code coverage
+    CTestLogger1::Log( _L( "Test Case Number #12" ) );
+    CTestLogger1::Log( _L( "SendPToPUserIDContentTypeL" ) );
+    TInt OpId = 0;
+    CDesCArray* userIds = new( ELeave ) CDesCArrayFlat( 2 );
+    CleanupStack::PushL( userIds );
+
+    TRAPD( err, OpId = iImClient->SendPToPMessageL( *userIds, _L( "text/plain" ), _L8( "Hello All" ) ) );
+    CleanupStack::PopAndDestroy(); // userIds
+    iStatus = err;
+    Cancel();
+    CActiveScheduler::Stop();
+    return err;
+    }
+
+
+TInt CTestRunner::QueryIMConnectionStatusL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #13" ) );
+    TInt ret = iOpenApi->ImConnectionStatus();
+    // Check returnvalue
+    if ( ret == 0 ) // iLoggedIn
+        {
+        CTestLogger1::Log( _L( "LogoutL" ) );
+        iOpenApi->LogoutL();
+        iStatus = KErrNone;
+        return 0;
+        }
+    else // 1
+        {
+        iStatus = KErrNone;
+        Cancel();
+        CActiveScheduler::Stop();
+        return ret;
+        }
+    }
+
+
+TInt CTestRunner::CancelLoginL()
+    {
+    CTestLogger1::Log( _L( "Test Case Number #14" ) );
+    LoginL( iUserIdValue );
+    TRAPD ( err, iOpenApi->CancelLoginL() );
+    CTestLogger1::Log( _L( "CancelLoginL - err=%d" ), err );
+    iImClient->UnregisterObserver();
+    CTestLogger1::Log( _L( "Test Case Number #15" ) );
+    CTestLogger1::Log( _L( "CImClient::UnregisterObserver" ) );
+    }
+
+//**********************************
+// Logger
+//**********************************
+const TInt KLogBufferLength = 256;
+_LIT( KLogDir, "impsc" );
+_LIT( KLogFile, "IMAPITestCaseLog.txt" );
+
+EXPORT_C void CTestLogger1::Log( TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+
+    // Print to log file
+    TBuf<KLogBufferLength> buf;
+    buf.FormatList( aFmt, list );
+
+    // Write to log file
+    RFileLogger::Write( KLogDir, KLogFile, EFileLoggingModeAppend, buf );
+    }
+
--- a/common/tools/ats/smoketest/appinstall/conf/AppInstallSmokeTestModule.cfg	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/ats/smoketest/appinstall/conf/AppInstallSmokeTestModule.cfg	Mon Nov 16 14:47:25 2009 +0000
@@ -1,14 +1,14 @@
 [Test]
 title Install Application
 create AppInstallSmokeTestModule installer
-installer InstallApp c:\testing\data\sistest_winscw.sisx
+installer InstallApp c:\smoketest\appinstall\sistest_winscw.sisx
 delete installer
 [Endtest]
 
 [Test]
 title Uninstall Application
 create AppInstallSmokeTestModule uninstaller
-uninstaller UninstallApp 1A
+uninstaller UninstallApp E4F8641B
 delete uninstaller
 [Endtest]
 
Binary file common/tools/ats/smoketest/appinstall/data/sistest.sisx has changed
Binary file common/tools/ats/smoketest/appinstall/data/sistest_winscw.sisx has changed
--- a/common/tools/ats/smoketest/appinstall/group/Bld.inf	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/ats/smoketest/appinstall/group/Bld.inf	Mon Nov 16 14:47:25 2009 +0000
@@ -25,6 +25,7 @@
 // NOTE: If using ARS requirements all export operations should be done under this.
 // 'abld test export'
 ../conf/AppInstallSmokeTestModule.cfg	c:/smoketest/AppInstallSmokeTestModule.cfg
+../data/sistest_winscw.sisx				c:/smoketest/appinstall/sistest_winscw.sisx
 
 PRJ_EXPORTS
 // Specify the source file followed by its destination here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/Bmarm/InputMethodSmokeTestModuleU.DEF	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/Bwins/InputMethodSmokeTestModuleU.DEF	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/EABI/InputMethodSmokeTestModuleU.def	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/conf/InputMethodSmokeTestModule.cfg	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,20 @@
+[Test]
+title Create Predictive Text Engine
+create InputMethodSmokeTestModule ptiengine
+ptiengine CreatePtiEngine
+delete ptiengine
+[Endtest] 
+
+[Test]
+title Create Predictive Text Dictionary
+create InputMethodSmokeTestModule ptidict
+ptidict CreatePtiDictionary
+delete ptidict
+[Endtest]
+
+[Test]
+title Predict Word
+create InputMethodSmokeTestModule ptiengine
+ptiengine MultitapWord 26637776664443 android
+delete ptiengine
+[Endtest]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/group/Bld.inf	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description:
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+	
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+../conf/InputMethodSmokeTestModule.cfg	c:/smoketest/InputMethodSmokeTestModule.cfg
+
+PRJ_TESTMMPFILES
+
+	InputMethodSmokeTestModule.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/group/InputMethodSmokeTestModule.mmp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: MMP file for STIF Test Framework's TestScripter 
+* testclass test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          InputMethodSmokeTestModule.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         InputMethodSmokeTestModule.def
+
+USERINCLUDE     ../inc 
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          InputMethodSmokeTestModule.cpp
+SOURCE          InputMethodSmokeTestModuleBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY			bafl.lib
+LIBRARY         euser.lib
+LIBRARY			ecom.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY			ocrsrv.lib
+LIBRARY			ptiengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/inc/InputMethodSmokeTestModule.h	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: STIF testclass declaration
+*
+*/
+
+#ifndef INPUTMETHODSMOKETESTMODULE_H
+#define INPUTMETHODSMOKETESTMODULE_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( KInputMethodSmokeTestModuleLogPath, "\\logs\\testframework\\InputMethodSmokeTestModule\\" ); 
+// Log file
+_LIT( KInputMethodSmokeTestModuleLogFile, "InputMethodSmokeTestModule.txt" ); 
+_LIT( KInputMethodSmokeTestModuleLogFileWithTitle, "InputMethodSmokeTestModule_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CInputMethodSmokeTestModule;
+class CPtiEngine;
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CInputMethodSmokeTestModule test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CInputMethodSmokeTestModule) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CInputMethodSmokeTestModule* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CInputMethodSmokeTestModule();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CInputMethodSmokeTestModule( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * CreateOcrEngine test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt CreateOcrEngineL( CStifItemParser& aItem );
+        
+        /**
+        * CreatePtiEngine test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt CreatePtiEngineL( CStifItemParser& aItem );
+
+        /**
+        * CreatePtiEngine test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt CreatePtiDictionaryL( CStifItemParser& aItem );
+
+        /**
+        * CreatePtiEngine test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt MultitapWordL( CStifItemParser& aItem );
+        
+        void PtiEngSimulateInput(CPtiEngine* aEngine, const TDesC& aKeys);
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // INPUTMETHODSMOKETESTMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/inc/TestOcrObserver.h	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  test ocrsrv.h
+ *
+*/
+
+#ifndef TESTOCROBSERVER_H
+#define TESTOCROBSERVER_H
+
+#include <ocrsrv.h>
+
+/**
+ *  CTestNotesControl is used to add setting page control in its window
+ */
+class TTestOcrObserver : public MOCREngineObserver
+    {
+public:
+    // from MOCREngineObserver
+    void RecognizeBlockComplete( TInt /*aError*/, const TOCRTextRgnInfo* /*aBlocks*/, const TInt /*aBlockCount*/ ) {}
+    void RecognizeSpecialRegionComplete( TInt /*aError*/, const TOCRTextRgnInfo* /*aBlocks*/, const TInt /*aBlockCount*/ ) {}
+    void RecognizeComplete( TInt /*aError*/, const TOCRTextRgnInfo* /*aBlocks*/, const TInt /*aBlockCount*/ ) {}
+    void LayoutComplete( TInt /*aError*/, const TOCRBlockInfo* /*aBlocks*/, const TInt /*aBlockCount*/ ) {}
+    void RecognizeProcess( const TUint /*aPercent*/ ) {}
+    };
+
+#endif /*TESTOCROBSERVER_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/src/InputMethodSmokeTestModule.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: This file contains testclass implementation.
+*
+*/
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "InputMethodSmokeTestModule.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::CInputMethodSmokeTestModule
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CInputMethodSmokeTestModule::CInputMethodSmokeTestModule( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CInputMethodSmokeTestModule::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KInputMethodSmokeTestModuleLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KInputMethodSmokeTestModuleLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KInputMethodSmokeTestModuleLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CInputMethodSmokeTestModule* CInputMethodSmokeTestModule::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CInputMethodSmokeTestModule* self = new (ELeave) CInputMethodSmokeTestModule( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CInputMethodSmokeTestModule::~CInputMethodSmokeTestModule()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CInputMethodSmokeTestModule::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("InputMethodSmokeTestModule.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) CInputMethodSmokeTestModule::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/src/InputMethodSmokeTestModuleBlocks.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: This file contains testclass implementation.
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include <ocrsrv.h>
+#include <ptiengine.h>
+#include <ptiuserdictionary.h>
+#include <Ecom/Ecom.h>
+#include "InputMethodSmokeTestModule.h"
+#include "TestOcrObserver.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+const TInt KMaxSize = 32;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CInputMethodSmokeTestModule::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CInputMethodSmokeTestModule::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "CreateOcrEngine", CInputMethodSmokeTestModule::CreateOcrEngineL ),
+        ENTRY( "CreatePtiEngine", CInputMethodSmokeTestModule::CreatePtiEngineL ),
+        ENTRY( "CreatePtiDictionary", CInputMethodSmokeTestModule::CreatePtiDictionaryL ),
+        ENTRY( "MultitapWord", CInputMethodSmokeTestModule::MultitapWordL ),
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CInputMethodSmokeTestModule::CreateOcrEngineL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT( KInputMethodSmokeTestModule, "InputMethodSmokeTestModule" );
+    _LIT( KCreateOcrEngine, "In Create OCR Engine" );
+    
+    iLog->Log( KCreateOcrEngine );
+    
+    TOcrEngineEnv engineEnv;
+    engineEnv.iPriority = EPriorityNormal;
+    engineEnv.iMaxHeapSize = 1200+KMinHeapGrowBy+1;
+    
+    TTestOcrObserver observer;
+    
+    MOCREngineInterface* ocrEngine = NULL;
+    ocrEngine = OCREngineFactory::CreateOCREngineL(observer, engineEnv, OCREngineFactory::EEngineLayoutRecognize);
+    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CInputMethodSmokeTestModule::CreatePtiEngineL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT( KInputMethodSmokeTestModule, "InputMethodSmokeTestModule" );
+    _LIT( KCreatePtiEngine, "In Create PTI Engine" );
+    
+    iLog->Log( KCreatePtiEngine );
+    
+    CPtiEngine* ptiEngine = CPtiEngine::NewL();
+    CleanupStack::PushL(ptiEngine);
+    
+    ptiEngine->ActivateLanguageL(ELangEnglish, EPtiEngineMultitapping);
+    
+    CleanupStack::PopAndDestroy(ptiEngine);
+    REComSession::FinalClose();
+    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CInputMethodSmokeTestModule::CreatePtiDictionaryL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT( KInputMethodSmokeTestModule, "InputMethodSmokeTestModule" );
+    _LIT( KCreatePtiDictionary, "In Create PTI Dictionary" );
+    
+    iLog->Log( KCreatePtiDictionary );
+    
+    CPtiUserDictionary* ptiDictionary = CPtiUserDictionary::NewL(KMaxSize);
+
+    delete ptiDictionary;
+    ptiDictionary = NULL;
+    
+    REComSession::FinalClose();
+    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CInputMethodSmokeTestModule::MultitapWordL(CStifItemParser& aItem)
+	{
+    // Print to UI
+    _LIT( KInputMethodSmokeTestModule, "InputMethodSmokeTestModule" );
+    _LIT( KMultitapWord, "In Multitap Word" );
+    
+    iLog->Log( KMultitapWord );
+	
+	TPtrC inputSequence;
+	if ( aItem.GetNextString(inputSequence) == KErrNone )
+		{
+		CPtiEngine *ptiEngine = CPtiEngine::NewL();
+		CleanupStack::PushL(ptiEngine);
+
+		// setup multitap
+		ptiEngine->ActivateLanguageL(ELangEnglish, EPtiEngineMultitapping);
+		PtiEngSimulateInput(ptiEngine, inputSequence);
+		
+		TPtrC expectedWord;
+		if ( aItem.GetNextString(expectedWord) == KErrNone )
+			{
+			if ( ptiEngine->CurrentWord() == expectedWord )
+				{
+				iLog->Log(_L("Words matched"));
+				}
+			else
+				{
+				User::Leave(KErrArgument);
+				}
+			}
+
+		ptiEngine->CommitCurrentWord();
+
+		ptiEngine->CloseCurrentLanguageL();
+		CleanupStack::PopAndDestroy(ptiEngine);
+		REComSession::FinalClose();
+		}
+
+	return KErrNone;
+	}
+
+void CInputMethodSmokeTestModule::PtiEngSimulateInput(CPtiEngine* aEngine, const TDesC& aKeys)
+    {
+    for(int i=0; i<aKeys.Length(); ++i)
+        {
+        if (aKeys[i] == ' ')
+            {
+            continue;
+            }
+        else if (aKeys[i] == 'p')
+            {
+            continue;
+            }
+        else if (aKeys[i] == 'd')
+            {
+            aEngine->DeleteKeyPress();
+            }
+        else
+            {
+            aEngine->AppendKeyPress(aEngine->CharacterToKey(aKeys[i]));
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CInputMethodSmokeTestModule::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+TInt CInputMethodSmokeTestModule::?member_function(
+   CItemParser& aItem )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/inputmethods/src/TestOcrObserver.cpp	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,1 @@
+
--- a/common/tools/brag/brag.xsl	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/brag/brag.xsl	Mon Nov 16 14:47:25 2009 +0000
@@ -108,10 +108,17 @@
 		<xsl:for-each select="step[count(failures/failure/@package) != count(failures/failure)]">
 			<h4>Step: <xsl:value-of select="@name"/></h4>
 			<xsl:for-each select="failures[count(failure/@package) != count(failure)]">
-				<dl><dt><xsl:value-of select="@level"/></dt><dd>
+				<xsl:variable name="severity" select="@level"/>
+				<dl><dt><xsl:value-of select="@level"/> (<xsl:value-of select="count(/buildStatus/phase/step/failures[@level = $severity]/failure[count(@package) = 0])"/>)</dt><dd>
 				<ul>
 				<xsl:for-each select="failure[count(@package) = 0]">
-					<li><xsl:value-of select="."/></li>
+					<li><xsl:value-of select="effect"/></li>
+					<xsl:if test="@unreported_causes != '0'">
+						<br/>(Too much text to show everything; <xsl:value-of select="@unreported_causes"/> lines not shown.)
+					</xsl:if>
+					<xsl:for-each select="causes">
+						<pre><xsl:value-of select="."/></pre>
+					</xsl:for-each>
 				</xsl:for-each>
 				</ul>
 				</dd></dl>
@@ -138,7 +145,13 @@
 				<ul>
 				<xsl:for-each select="/buildStatus/phase/step/failures[@level = $severity]/failure[@package = $package]">
 					<xsl:sort select="@package"/>
-					<li><xsl:value-of select="@package"/>: <xsl:value-of select="."/></li>
+					<li><xsl:value-of select="effect"/></li>
+					<xsl:if test="@unreported_causes != '0'">
+						<br/>(Too much text to show everything; <xsl:value-of select="@unreported_causes"/> lines not shown.)
+					</xsl:if>
+					<xsl:for-each select="causes">
+						<pre><xsl:value-of select="."/></pre>
+					</xsl:for-each>
 				</xsl:for-each>
 				</ul>
 				</dd></dl>
--- a/common/tools/brag/logToBRAG.pl	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/brag/logToBRAG.pl	Mon Nov 16 14:47:25 2009 +0000
@@ -100,7 +100,7 @@
 		{
 			last if $rule->{severity} eq "ignore";
 			# We found a match
-			my $failure = bless{ Kids => [ bless { Text => $line }, "Characters" ] }, "failure";
+			my $failure = bless{ Kids => [ bless { Kids => [ bless { Text => $line }, "Characters" ]}, "effect"] }, "failure";
 			# Ensure we have a <failures> tag for this severity
 			if (!exists $severityShortcut->{$rule->{severity}})
 			{
--- a/common/tools/brag/raptorToBRAG.pl	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/brag/raptorToBRAG.pl	Mon Nov 16 14:47:25 2009 +0000
@@ -18,10 +18,12 @@
 
 use FindBin;
 use lib "$FindBin::Bin/../lib";
+use lib "$FindBin::Bin";
 
 use Getopt::Long;
 use Text::CSV;
 
+use ToBrag;
 
 my $raptorSummary;
 my $help = 0;
@@ -39,24 +41,9 @@
 }
 
 # Start to build structure to be output as XML (same format as XML::Parser would create for us)
-my $xmlNewline = bless { Text => "\n" }, "Characters";
-my $buildStatus =
-[
-	bless
-	{
-		Kids =>
-		[
-			$xmlNewline,
-			bless
-			{
-				name => "Build",
-				Kids => [ $xmlNewline ]
-			}, "phase",
-		]
-	}, "buildStatus"
-];
-# Get a shortcut reference to the bit we will use a lot
-my $buildPhase = $buildStatus->[0]->{Kids}->[-1];
+my $buildStatus = ToBrag::createBuildStatus();
+# Obtain a phase object
+my $buildPhase = ToBrag::ensurePhase($buildStatus, "Build");
 
 # READ SUMMARY.CSV FILE
 open(CSV, $raptorSummary);
@@ -98,116 +85,34 @@
 	$failure->{subcategory} ||= 'uncategorized';
 	$failure->{severity} ||= 'unknown';
 	
-	# Look through the steps to see if we already have one to match this config
-	my $step;
-	foreach (@{$buildPhase->{Kids}})
-	{
-		next unless ref $_ eq "step";
-		if ($_->{name} eq $failure->{config})
-		{
-			$step = $_;
-			last;
-		}
-	}
-	unless ($step)
-	{
-		# First item found in this step - create step entry
-		$step = bless { name => $failure->{config}, Kids => [ $xmlNewline ] }, "step";
-		push @{$buildPhase->{Kids}}, $step, $xmlNewline;
-		# Also create empty <failures> tags with severities in a sensible order
-		foreach my $severity (qw{critical major minor})
-		{
-			my $failureSet = bless { level => $severity, Kids => [ $xmlNewline ] }, "failures";
-			push @{$step->{Kids}}, $failureSet, $xmlNewline;
-		}
-	}
+	# Obtain a matching step
+	my $step = ToBrag::ensureStep($buildPhase, $failure->{config});
+	# Also create empty <failures> tags with severities in a sensible order
+	ToBrag::ensureFailureSet($step, "critical");
+	ToBrag::ensureFailureSet($step, "major");
+	ToBrag::ensureFailureSet($step, "minor");
 	
-	# Look through the sets of failures in this step to see if we hve one which matches this severity
-	my $failureSet;
-	foreach (@{$step->{Kids}})
-	{
-		next unless ref $_ eq "failures";
-		if ($_->{level} eq $failure->{severity})
-		{
-			$failureSet = $_;
-			last;
-		}
-	}
-	unless ($failureSet)
-	{
-		# First item found at this severity - create failures entry
-		$failureSet = bless { level => $failure->{severity}, Kids => [ $xmlNewline ] }, "failures";
-		push @{$step->{Kids}}, $failureSet, $xmlNewline;
-	}
+	# Obtain a set of failures which matches this severity
+	my $failureSet = ToBrag::ensureFailureSet($step, $failure->{severity});
 
 	# Now create the failure itself, and add it to this failure set
 	my $failureItem = bless {
-#		href => "",
-		Kids => [ bless { Text => $failure->{subcategory} }, "Characters" ]
+		Kids => [ bless { Kids => [ bless { Text => $failure->{subcategory} }, "Characters" ]}, "effect" ],
 	}, "failure";
 	if ($failure->{component})
 	{
 		$failure->{component} =~ s{^(/sf/.*?/.*?)/.*$}{$1};
 		$failureItem->{package} = $failure->{component};
 	}
-	push @{$failureSet->{Kids}}, $failureItem, $xmlNewline;
+	push @{$failureSet->{Kids}}, $failureItem, $ToBrag::xmlNewline;
 }
 close(CSV);
 
 # Print XML
 print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 print "<?xml-stylesheet type='text/xsl' href='brag.xsl'?>\n";
-printTree($buildStatus->[0]);
+ToBrag::printTree($buildStatus->[0]);
 print "\n";
 
 exit(0);
 
-sub printTree
-{
-	my $tree = shift or die;
-	die unless ref $tree;
-
-	my $tagName = ref $tree;
-	$tagName =~ s{^main::}{};
-	if ($tagName eq "Characters")
-	{
-		print $tree->{Text};
-		return;
-	}
-	
-	print "<$tagName";
-
-	foreach my $attr (
-		sort {
-			my $order = "name level start stop href";
-			my $ixA = index $order, $a;
-			my $ixB = index $order, $b;
-			die "$a $b" if $ixA + $ixB == -2;
-			$ixA - $ixB;
-		}
-		grep {
-			! ref $tree->{$_}
-		}
-		keys %$tree)
-	{
-		print " $attr=\"$tree->{$attr}\"";
-	}
-
-	my $children = $tree->{Kids} || [];
-	if (scalar @$children)
-	{
-		print ">";
-		foreach my $child (@$children)
-		{
-			printTree($child);
-		}
-		print "</$tagName";
-	}
-	else
-	{
-		print "/"
-	}
-
-	print ">";
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/brag/sbsToBrag.pl	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,153 @@
+#!perl -w
+#
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Generate the BRAG-compatible XML summary of the Raptor log from the CSV output of the raptor parser
+
+use strict;
+
+use FindBin;
+use lib "$FindBin::Bin";
+
+use XML::Parser;
+#use Getopt::Long;
+
+use ToBrag;
+
+my $raptorLogGlob = shift or die "First argument must be raptor XML log to read\n";
+shift and die "Only one argument please\n";
+
+@ARGV = glob $raptorLogGlob;
+
+# Start to build structure to be output as XML (same format as XML::Parser would create for us)
+my ($doc, $buildStatus) = ToBrag::createDocumentAndRoot("buildStatus");
+# Obtain a phase object
+my $buildPhase = ToBrag::ensureChild($buildStatus, "phase", "name", "Build");
+
+# Parse the Raptor logs
+# (Use XML::Parser in "Stream" mode so we don't have to hold all the data in memory at the same time)
+my $xml = XML::Parser->new(Style => "Stream", Pkg => "main");
+
+foreach my $log (@ARGV)
+{
+	$xml->parsefile($log);
+}
+
+print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+print "<?xml-stylesheet type='text/xsl' href='brag.xsl'?>\n";
+ToBrag::printTree($doc->[0]);
+print "\n";
+
+exit (0);
+
+my $context;
+sub StartTag
+{
+	my $expat = shift;
+	my $tagName = shift;
+	my %attrib = %_;
+
+	if ($tagName eq "recipe")
+	{
+		$context = {%attrib};
+	}
+	elsif ($tagName eq "status")
+	{
+		$context->{"exit"} = $attrib{"exit"};
+	}
+}
+sub EndTag
+{
+	my $expat = shift;
+	my $tagName = shift;
+
+	if ($tagName eq "recipe")
+	{
+		die unless $context;
+
+		if ($context->{"exit"} ne "ok")
+		{
+			# Create a more readable error message
+			my %errorIdToDetail = (
+				tem => {message => "Failed to execute '$context->{source}' invoked via $context->{bldinf}", severity => "major"},
+				msvctoolscompile => {message => "Failed to compile $context->{source}", severity => "minor"},
+				compile => {message => "Failed to compile $context->{source}", severity => "minor"},
+				compile2object => {message => "Failed to compile $context->{source}", severity => "minor"},
+				win32compile2object => {message => "Failed to compile $context->{source}", severity => "minor"},
+				tools2lib => {message => "Failed to build library $context->{target}", severity => "minor"},
+				ar => {message => "Failed to build library $context->{target}", severity => "minor"},
+				win32archive => {message => "Failed to build library $context->{target}", severity => "minor"},
+				"link" => {message => "Failed to create symbols for $context->{target}", severity => "minor"},
+				postlink => {message => "Failed to link $context->{target}", severity => "minor"},
+				win32stageonelink => {message => "Failed to link $context->{target} (stage 1)", severity => "minor"},
+				win32stagetwolink => {message => "Failed to link $context->{target}", severity => "minor"},
+				win32simplelink => {message => "Failed to link $context->{target}", severity => "minor"},
+				win32processexports => {message => "Failed to export $context->{source} to $context->{target}", severity => "minor"},
+				tracecompile => {message => "Trace compile failure for $context->{target}", severity => "unknown"},
+				extension_makefile => {message => "Failed within an extension makefile connected to $context->{bldinf}", severity => "major"},
+			);
+#			die $context->{name} unless exists $errorIdToDetail{$context->{name}};
+
+			my $message = $errorIdToDetail{$context->{name}}->{message} || "Unknown failure tag '$context->{name}' ($context->{source} -> $context->{target})";
+			$context->{severity} = $errorIdToDetail{$context->{name}}->{severity} || "unknown";
+
+			# Obtain a step object
+			my $step = ToBrag::ensureStep($buildPhase, $context->{config});
+			# Also create empty <failures> tags with severities in a sensible order
+			ToBrag::ensureFailureSet($step, "critical");
+			ToBrag::ensureFailureSet($step, "major");
+			ToBrag::ensureFailureSet($step, "minor");
+			# Obtain a failures object
+			my $failureSet = ToBrag::ensureFailureSet($step, $context->{severity});
+
+			# Now create the failure itself, and add it to this failure set
+			my $failureItem = bless {
+				Kids => [ bless { Kids => [ bless { Text => $message }, "Characters" ]}, "effect" ],
+			}, "failure";
+			if ($context->{component})
+			{
+				$context->{bldinf} =~ s{^\w:(/sf/.*?/.*?)/.*$}{$1};
+				$failureItem->{package} = $context->{bldinf};
+			}
+			my @causes = grep { $_ && ! m/^\+ / } split("\n", $context->{Chars});
+			@causes = map { "  $_" } @causes;
+			if (@causes)
+			{
+				my @reportedCauses = @causes[0 .. min($#causes, 49)];
+				my $causesItem = bless {
+					Kids => [ bless { Text => join "\n", @reportedCauses }, "Characters" ]
+				}, "causes";
+				push @{$failureItem->{Kids}}, $causesItem;
+				my $unreportedCauses = scalar @causes - scalar @reportedCauses;
+				$failureItem->{unreported_causes} = $unreportedCauses;
+			}
+			push @{$failureSet->{Kids}}, $failureItem, $ToBrag::xmlNewline;
+		}
+		
+		$context = undef;
+	}
+}
+sub Text
+{
+	s/^\n*//;
+	if ($context)
+	{
+		$context->{Chars} .= $_;
+	}
+}
+
+sub min
+{
+	return ($_[0] < $_[1]) ? $_[0] : $_[1] ;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/brag/toBrag.pm	Mon Nov 16 14:47:25 2009 +0000
@@ -0,0 +1,160 @@
+#!perl -w
+#
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Functionality common to BRAG file generation
+
+use strict;
+
+package ToBrag;
+
+# A useful constant
+our $xmlNewline = bless { Text => "\n" }, "Characters";
+
+sub createDocumentAndRoot
+{
+	my $rootTag = shift;
+
+	my $root = bless
+	{
+		Kids =>
+		[ $ToBrag::xmlNewline ]
+	}, $rootTag;
+
+	return [$root], $root;
+}
+
+sub createBuildStatus
+{
+	return [
+		bless
+		{
+			Kids =>
+			[ $ToBrag::xmlNewline ]
+		}, "buildStatus"
+	];
+}
+
+sub ensurePhase
+{
+	my $buildStatus = shift;
+	my $phaseName = shift;
+
+	my ($phase) = grep { ref $_ eq "phase" && $_->{name} eq $phaseName } @{$buildStatus->[-1]->{Kids}};
+	unless ($phase)
+	{
+		$phase = bless
+		{
+			name => $phaseName,
+			Kids => [ $ToBrag::xmlNewline ]
+		}, "phase";
+		push @{$buildStatus->[-1]->{Kids}}, $phase, $ToBrag::xmlNewline;
+	}
+	return $phase;
+}
+
+sub ensureStep
+{
+	my $phase = shift;
+	my $stepName = shift;
+
+	return ensureChild($phase, "step", "name", $stepName);
+}
+
+sub ensureFailureSet
+{
+	my $step = shift;
+	my $level = shift;
+
+	return ensureChild($step, "failures", "level", $level);
+}
+
+sub ensureChild
+{
+	my $parent = shift;
+	my $childName = shift;
+	my $childAttr = shift;
+	my $childAttrValue = shift;
+
+	my ($child) = grep { ref $_ eq $childName && $_->{$childAttr} eq $childAttrValue } @{$parent->{Kids}};
+	unless ($child)
+	{
+		$child = bless
+		{
+			$childAttr => $childAttrValue,
+			Kids => [ $ToBrag::xmlNewline ]
+		}, $childName;
+		push @{$parent->{Kids}}, $child, $ToBrag::xmlNewline;
+	}
+	return $child;
+}
+
+# Prints out the XML tree to STDOUT
+sub printTree
+{
+	my $tree = shift or die;
+	die unless ref $tree;
+
+	my $tagName = ref $tree;
+	$tagName =~ s{^main::}{};
+	if ($tagName eq "Characters")
+	{
+		if ($tree->{Text} =~ m{[<>&]})
+		{
+			print "<![CDATA[$tree->{Text}]]>";
+		}
+		else
+		{
+			print $tree->{Text};
+		}
+		return;
+	}
+	
+	print "<$tagName";
+
+	foreach my $attr (
+		sort {
+			my $order = "name level start stop href package effect";
+			my $ixA = index $order, $a;
+			my $ixB = index $order, $b;
+			die "$a $b" if $ixA + $ixB == -2;
+			$ixA - $ixB;
+		}
+		grep {
+			! ref $tree->{$_}
+		}
+		keys %$tree)
+	{
+		print " $attr=\"$tree->{$attr}\"";
+	}
+
+	my $children = $tree->{Kids} || [];
+	if (scalar @$children)
+	{
+		print ">";
+		foreach my $child (@$children)
+		{
+			printTree($child);
+		}
+		print "</$tagName";
+	}
+	else
+	{
+		print "/"
+	}
+
+	print ">";
+}
+
+1;
+
--- a/common/tools/brag/yarpToBRAG.pl	Fri Nov 13 15:53:47 2009 +0000
+++ b/common/tools/brag/yarpToBRAG.pl	Mon Nov 16 14:47:25 2009 +0000
@@ -18,10 +18,13 @@
 
 use FindBin;
 use lib "$FindBin::Bin/../lib";
+use lib "$FindBin::Bin";
 
 use Getopt::Long;
 use Text::CSV;
 
+use ToBrag;
+
 if (!@ARGV)
 {
 	warn "Generate an XML summary of the Raptor build from a Yarp CSV file\n";
@@ -30,20 +33,9 @@
 }
 
 # Start to build structure to be output as XML (same format as XML::Parser would create for us)
-my $xmlNewline = bless { Text => "\n" }, "Characters";
-my $buildPhase = bless { name => "Build", Kids => [ $xmlNewline ] }, "phase";
-my $buildStatus =
-[
-	bless
-	{
-		Kids =>
-		[
-			$xmlNewline,
-			$buildPhase,
-			$xmlNewline,
-		]
-	}, "buildStatus"
-];
+my $buildStatus = ToBrag::createBuildStatus();
+# Obtain a phase object
+my $buildPhase = ToBrag::ensurePhase($buildStatus, "Build");
 
 @ARGV = map { glob $_ } @ARGV;
 
@@ -114,113 +106,32 @@
 #		die $failure->{name} unless exists $errorIdToDetail{$failure->{name}};
 		my $message = $errorIdToDetail{$failure->{name}}->{message} || "Unknown failure tag '$failure->{name}' ($failure->{source} -> $failure->{target})";
 		$failure->{severity} = $errorIdToDetail{$failure->{name}}->{severity} || "unknown";
-
-		# Look through the steps to see if we already have one to match this platform
-		my $step;
-		foreach (@{$buildPhase->{Kids}})
-		{
-			next unless ref $_ eq "step";
-			if ($_->{name} eq $failure->{platform})
-			{
-				$step = $_;
-				last;
-			}
-		}
-		unless ($step)
-		{
-			# First item found for this platform - create step entry
-			$step = bless { name => $failure->{platform}, Kids => [ $xmlNewline ] }, "step";
-			push @{$buildPhase->{Kids}}, $step, $xmlNewline;
-			# Also create empty <failures> tags with severities in a sensible order
-			foreach my $severity (qw{critical major minor})
-			{
-				my $failureSet = bless { level => $severity, Kids => [ $xmlNewline ] }, "failures";
-				push @{$step->{Kids}}, $failureSet, $xmlNewline;
-			}
-		}
 		
-		# Look through the sets of failures in this step to see if we hve one which matches this severity
-		my $failureSet;
-		foreach (@{$step->{Kids}})
-		{
-			next unless ref $_ eq "failures";
-			if ($_->{level} eq $failure->{severity})
-			{
-				$failureSet = $_;
-				last;
-			}
-		}
-		unless ($failureSet)
-		{
-			# First item found at this severity - create failures entry
-			$failureSet = bless { level => $failure->{severity}, Kids => [ $xmlNewline ] }, "failures";
-			push @{$step->{Kids}}, $failureSet, $xmlNewline;
-		}
+		# Obtain a matching step
+		my $step = ToBrag::ensureStep($buildPhase, $failure->{platform});
+		# Also create empty <failures> tags with severities in a sensible order
+		ToBrag::ensureFailureSet($step, "critical");
+		ToBrag::ensureFailureSet($step, "major");
+		ToBrag::ensureFailureSet($step, "minor");
+		
+		# Obtain a set of failures which matches this severity
+		my $failureSet = ToBrag::ensureFailureSet($step, $failure->{severity});
 		
 		# Now create the failure itself, and add it to this failure set
 		my $failureItem = bless {
 #			href => "",
 			"package" => $failure->{package},
-			Kids => [ bless { Text => $message }, "Characters" ],
+			Kids => [ bless { Kids => [ bless { Text => $message }, "Characters" ]}, "effect"],
 		}, "failure";
-		push @{$failureSet->{Kids}}, $failureItem, $xmlNewline;
+		push @{$failureSet->{Kids}}, $failureItem, $ToBrag::xmlNewline;
 	}
 	close(CSV);
 }
 # Print XML
 print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 print "<?xml-stylesheet type='text/xsl' href='brag.xsl'?>\n";
-printTree($buildStatus->[0]);
+ToBrag::printTree($buildStatus->[0]);
 print "\n";
 
 exit(0);
 
-sub printTree
-{
-	my $tree = shift or die;
-	die unless ref $tree;
-
-	my $tagName = ref $tree;
-	$tagName =~ s{^main::}{};
-	if ($tagName eq "Characters")
-	{
-		print $tree->{Text};
-		return;
-	}
-	
-	print "<$tagName";
-
-	foreach my $attr (
-		sort {
-			my $order = "name level start stop href";
-			my $ixA = index $order, $a;
-			my $ixB = index $order, $b;
-			die "$a $b" if $ixA + $ixB == -2;
-			$ixA - $ixB;
-		}
-		grep {
-			! ref $tree->{$_}
-		}
-		keys %$tree)
-	{
-		print " $attr=\"$tree->{$attr}\"";
-	}
-
-	my $children = $tree->{Kids} || [];
-	if (scalar @$children)
-	{
-		print ">";
-		foreach my $child (@$children)
-		{
-			printTree($child);
-		}
-		print "</$tagName";
-	}
-	else
-	{
-		print "/"
-	}
-
-	print ">";
-}
-
--- a/sf-platform/platform_props.ant.xml	Fri Nov 13 15:53:47 2009 +0000
+++ b/sf-platform/platform_props.ant.xml	Mon Nov 16 14:47:25 2009 +0000
@@ -7,11 +7,11 @@
 
   <property name="sf.spec.bldmefirst.s60.variant" value="western" /> <!-- western|apac|japan -->
 
-  <property name="sf.spec.baseline.getenv_options" value="-I tools"/> <!-- Sync the tools... -->
+  <property name="sf.spec.baseline.getenv_options" value="-I tools -k"/> <!-- Sync the tools... -->
   <property name="sf.spec.baseline.clean"          value="false"/>
   <property name="sf.spec.baseline.select"         value="location" />
 
-  <property name="sf.spec.toolsbaseline.getenv_options" value="-i emu"/>
+  <property name="sf.spec.toolsbaseline.getenv_options" value="-i emu -k"/>
   <property name="sf.spec.toolsbaseline.select"         value="location" />
   <property name="sf.spec.toolsbaseline.location"       value="\\v800008\Builds01\PDT\PDT_b50" /> <!-- for TEF etc -->