os/persistentdata/loggingservices/eventlogger/test/tef/teflogengbur/src/backuprestoreserver.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Tests for log engine backup and restore
    15 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
    16 // in the process of the client. The client initialises the server by calling the
    17 // one and only ordinal.
    18 // 
    19 //
    20 
    21 /**
    22  @file
    23  @internalComponent
    24 */
    25 
    26 #include "backuprestoreserver.h"
    27 #include "backuprestorestep.h"
    28 
    29 _LIT(KServerName,"teflogengbur");
    30 CLogEngTestExecuteServer* CLogEngTestExecuteServer::NewL()
    31 /**
    32  @return - Instance of the test server
    33  Same code for Secure and non-secure variants
    34  Called inside the MainL() function to create and start the
    35  CTestServer derived server.
    36  */
    37 	{
    38 	CLogEngTestExecuteServer *server = new (ELeave) CLogEngTestExecuteServer();
    39 	CleanupStack::PushL(server);
    40 	// CServer base class call which can be either StartL or ConstructL,
    41 	// the later will permit Server Logging.
    42 
    43 	server->StartL(KServerName);
    44 	CleanupStack::Pop(server);
    45 	return server;
    46 	}
    47 
    48 LOCAL_C void MainL()
    49 	{
    50 	CActiveScheduler* sched=NULL;
    51 	sched=new(ELeave) CActiveScheduler;
    52 	CActiveScheduler::Install(sched);
    53 	CLogEngTestExecuteServer *server = NULL;
    54 	// Create the CTestServer derived server
    55 	TRAPD(err,server = CLogEngTestExecuteServer::NewL());
    56 	if(err == KErrNone)
    57 		{
    58 		// Sync with the client and enter the active scheduler
    59 		RProcess::Rendezvous(KErrNone);
    60 		sched->Start();
    61 		}
    62 	delete server;
    63 	delete sched;
    64 	}
    65 
    66 GLDEF_C TInt E32Main()
    67 /**
    68  @return - Standard Epoc error code on process exit
    69  Process entry point. Called by client using RProcess API
    70  */
    71 	{
    72 	__UHEAP_MARK;
    73 	CTrapCleanup* cleanup = CTrapCleanup::New();
    74 	if(cleanup == NULL)
    75 		{
    76 		return KErrNoMemory;
    77 		}
    78 	TRAPD(err,MainL());
    79 		
    80 	delete cleanup;
    81 	__UHEAP_MARKEND;
    82 	
    83 	return err;
    84 	}
    85 
    86 
    87 CTestStep* CLogEngTestExecuteServer::CreateTestStep(const TDesC& aStepName)
    88 /**
    89  @return - A CTestStep derived instance
    90  Implementation of CTestServer pure virtual
    91  */
    92 	{
    93 	CTestStep* testStep = NULL;
    94 	// They are created "just in time" when the worker thread is created
    95 	// More test steps can be added below 
    96 	if(aStepName == KBackupRestoreInitializeStep)
    97 		testStep = new CBackupRestoreInitializeStep();
    98 	if(aStepName == KStopLogServerStep)
    99 		testStep = new CStopLogServerStep();
   100 	if(aStepName == KBackupRestoreVerifyStep)
   101 		testStep = new CBackupRestoreVerifyStep();
   102 
   103 	return testStep;
   104 	}
   105