loggingservices/eventlogger/test/src/t_logenvcreate.cpp
changeset 19 d6ef85bc5971
parent 17 55f2396f6d25
child 22 a7ba600cb39d
child 23 38383aab3fb8
child 28 7a522c0700d3
equal deleted inserted replaced
17:55f2396f6d25 19:d6ef85bc5971
     1 // Copyright (c) 2006-2010 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 // EventLogger - copying EventLogger test files from Z: to C:
       
    15 // Please, ensure that t_logenvcreate test is executed before the other EventLogger component tests
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <e32test.h>
       
    20 #include <bautils.h>
       
    21 #include "t_logutil.h"
       
    22 
       
    23 RTest TheTest(_L("t_logenvcreate - copying EventLogger test files to C:"));
       
    24 
       
    25 _LIT(KContactsServerName, "!CNTSRV");
       
    26 
       
    27 _LIT(KContactsServerPrivateDirC, "c:\\private\\10003a73\\");
       
    28 
       
    29 _LIT(KZFileName1, "z:\\private\\101f401d\\CntModel.ini");
       
    30 _LIT(KZFileName2, "z:\\private\\101f401d\\SQLite__Contacts.cdb");
       
    31 
       
    32 _LIT(KCFileName1, "c:\\private\\10003a73\\CntModel.ini");
       
    33 _LIT(KCFileName2, "c:\\private\\10003a73\\SQLite__Contacts.cdb");
       
    34 
       
    35 void DoRun()
       
    36 	{
       
    37     RFs fs;
       
    38 	TInt err = fs.Connect();
       
    39 	TEST2(err, KErrNone);
       
    40 
       
    41 	TheTest.Start(_L(" @SYMTestCaseID: PDS-LOGENG-CT-4048 Copy EventLogger test files from Z: to C: "));
       
    42 
       
    43 	err = BaflUtils::CopyFile(fs, KZFileName1, KCFileName1);
       
    44 	TEST2(err, KErrNone);
       
    45 	err = fs.SetAtt(KCFileName1, 0, KEntryAttReadOnly);
       
    46 	TEST2(err, KErrNone);
       
    47 
       
    48 	err = BaflUtils::CopyFile(fs, KZFileName2, KCFileName2);
       
    49 	TEST2(err, KErrNone);
       
    50 	err = fs.SetAtt(KCFileName2, 0, KEntryAttReadOnly);
       
    51 	TEST2(err, KErrNone);
       
    52 	fs.Close();
       
    53 	}
       
    54 
       
    55 void CreateContactsServerPrivateDir()
       
    56     {
       
    57     RFs fs;
       
    58 	TInt err = fs.Connect();
       
    59 	TEST2(err, KErrNone);
       
    60 
       
    61 	TRAP(err, BaflUtils::EnsurePathExistsL(fs, KContactsServerPrivateDirC));
       
    62 	TEST2(err, KErrNone);
       
    63 
       
    64 	fs.Close();
       
    65 	}
       
    66 
       
    67 TInt E32Main()
       
    68     {
       
    69 	TheTest.Title();
       
    70 
       
    71 	CTrapCleanup* tc = CTrapCleanup::New();
       
    72 
       
    73 	__UHEAP_MARK;
       
    74 
       
    75 	KillProcess(KContactsServerName);
       
    76 	
       
    77 	CreateContactsServerPrivateDir();
       
    78 
       
    79 	DoRun();
       
    80 
       
    81 	__UHEAP_MARKEND;
       
    82 
       
    83 	TheTest.End();
       
    84 	TheTest.Close();
       
    85 
       
    86 	delete tc;
       
    87 
       
    88 	User::Heap().Check();
       
    89 	return KErrNone;
       
    90     }