contentstorage/tsrc/t_casrv/src/casrvtestutils.cpp
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <W32STD.H>
       
    19 #include <e32property.h>
       
    20 #include <cadef.h>
       
    21 #include <badesca.h>
       
    22 #include <apgtask.h>
       
    23 #include <AknTaskList.h>
       
    24 #include <apgcli.h>
       
    25 #include <APACMDLN.h>
       
    26 #include <EIKENV.h>
       
    27 
       
    28 
       
    29 #include "castorageproxy.h"
       
    30 #include "cainnerentry.h"
       
    31 #include "cainnerquery.h"
       
    32 #include "caarraycleanup.inl"
       
    33 
       
    34 #include "casrvtestutils.h"
       
    35 #include "testconsts.h"
       
    36 
       
    37 
       
    38 //-----------------------------------------------------------------------
       
    39 // CONSTRUCTION
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 CTestUtils* CTestUtils::NewL()
       
    43     {
       
    44     CTestUtils* self = CTestUtils::NewLC();
       
    45     CleanupStack::Pop();
       
    46 
       
    47     return self;
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 CTestUtils* CTestUtils::NewLC()
       
    55     {
       
    56     CTestUtils* self = new( ELeave ) CTestUtils();
       
    57     CleanupStack::PushL( self );
       
    58 
       
    59     self->ConstructL();
       
    60 
       
    61     return self;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // Destructor (virtual by CBase)
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CTestUtils::~CTestUtils()
       
    69     {
       
    70 	iFileManager->Delete(KTestDbDest);
       
    71     delete iFileManager;    iFileManager = NULL;
       
    72     iFs.Close();
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Default constructor
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 CTestUtils::CTestUtils()
       
    80     {
       
    81 
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // Second phase construct
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 void CTestUtils::ConstructL()
       
    89     {
       
    90     User::LeaveIfError( iFs.Connect() );
       
    91     iFileManager = CFileMan::NewL( iFs );
       
    92     }
       
    93 
       
    94 
       
    95 //-----------------------------------------------------------------------
       
    96 //
       
    97 //-----------------------------------------------------------------------
       
    98 TInt CTestUtils::Copy( const TDesC& aSource, const TDesC& aDest )
       
    99     {
       
   100     return iFileManager->Copy(aSource, aDest);
       
   101     }
       
   102 
       
   103 //-----------------------------------------------------------------------
       
   104 //
       
   105 //-----------------------------------------------------------------------
       
   106 TInt CTestUtils::CopyDb()
       
   107     {
       
   108     return Copy(KTestDbSource, KTestDbDest);
       
   109     }
       
   110