messagingfw/msgtest/tools/utils/src/msgdump.cpp
changeset 22 bde600d88860
parent 0 8e480a14352b
equal deleted inserted replaced
21:08008ce8a6df 22:bde600d88860
       
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "emailtestutils.h"
       
    17 #include <miutlog.h>
       
    18 #include <miutmsg.h>
       
    19 #include <txtrich.h>
       
    20 
       
    21 
       
    22 // local variables etc //
       
    23 
       
    24 _LIT(KImcmTest, "U_IMUT - Utility for dumping the message tree");
       
    25 RTest test(KImcmTest);
       
    26 
       
    27 LOCAL_D CTrapCleanup* theCleanup;
       
    28 //LOCAL_D CActiveScheduler* scheduler;
       
    29 LOCAL_D CImLog* log;
       
    30 LOCAL_D CEmailTestUtils* testUtils;
       
    31 
       
    32 //
       
    33 
       
    34 LOCAL_C void Init()
       
    35 	{
       
    36 	testUtils = CEmailTestUtils::NewLC(test);
       
    37 	testUtils->CreateAllTestDirectories();
       
    38 	testUtils->FileSession().SetSessionPath(_L("C:\\"));
       
    39 	testUtils->GoClientSideL();
       
    40 
       
    41 	log = CImLog::NewL(_L("c:\\logs\\email\\u_imut.log"), EAppend);
       
    42 	CleanupStack::PushL(log);
       
    43 	log->AppendComment(_L8("*** U_IMUT Utility ***"));
       
    44 	TBuf8<80> buf;
       
    45 #if defined(__WINS__)
       
    46 	buf.Append(_L8("WINS "));
       
    47 #else
       
    48 	buf.Append(_L8("MARM "));
       
    49 #endif
       
    50 #if defined(_UNICODE)
       
    51 	buf.Append(_L8("U"));
       
    52 #endif
       
    53 #if defined(_DEBUG)
       
    54 	buf.Append(_L8("DEB"));
       
    55 #else
       
    56 	buf.Append(_L8("REL"));
       
    57 #endif
       
    58 	log->AppendComment(buf);
       
    59 	}
       
    60 	
       
    61 LOCAL_C void Closedown()
       
    62 	{
       
    63 	log->AppendComment(_L8("**********    U_IMUT Complete    **********"));
       
    64 	log->AppendComment(_L8(""));
       
    65 
       
    66 	CleanupStack::PopAndDestroy(2);  //testUtils, log
       
    67 	}
       
    68 
       
    69 //
       
    70 
       
    71 LOCAL_C void doMainL()
       
    72 	{
       
    73 	CActiveScheduler* scheduler;
       
    74 	scheduler = new (ELeave) CActiveScheduler;
       
    75 	CleanupStack::PushL(scheduler);
       
    76 	CActiveScheduler::Install(scheduler);
       
    77 
       
    78 	Init();
       
    79 
       
    80 	testUtils->FileSession().SetSessionPath(_L("c:\\"));
       
    81 
       
    82 	testUtils->FindChildrenL(0x01000, ETrue);
       
    83 
       
    84 	Closedown();
       
    85 
       
    86 	CleanupStack::PopAndDestroy(); // scheduler
       
    87 	}
       
    88 
       
    89 GLDEF_C TInt E32Main()
       
    90 	{	
       
    91 	__UHEAP_MARK;
       
    92 	test.Start(_L("T_IMCM03 Test CImStoreMessagePart/CImRemoveMessagePart classes"));
       
    93 	theCleanup=CTrapCleanup::New();
       
    94 	TRAPD(ret,doMainL());		
       
    95 	test(ret==KErrNone);
       
    96 	delete theCleanup;	
       
    97 	test.End();
       
    98 	test.Close();
       
    99 	__UHEAP_MARKEND;
       
   100 	User::Heap().Check();
       
   101 	return(KErrNone);
       
   102 	}