os/ossrv/genericservices/taskscheduler/Test/Testexecute/tef_schsvr_bursuite/src/tef_schsvr_bursuiteserver.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
*/
sl@0
    19
sl@0
    20
#include "tef_schsvr_bursuiteserver.h"
sl@0
    21
#include "comparestep.h"
sl@0
    22
#include "initialisestep.h"
sl@0
    23
#include "apistep.h"
sl@0
    24
#include "multistep.h"
sl@0
    25
#include "burstep.h"
sl@0
    26
#include "mergestep.h"
sl@0
    27
sl@0
    28
_LIT(KServerName,"tef_schsvr_bursuite");
sl@0
    29
CTefSchsvrBURSuite* CTefSchsvrBURSuite::NewL()
sl@0
    30
/**
sl@0
    31
 * @return - Instance of the test server
sl@0
    32
 * Called inside the MainL() function to create and start the
sl@0
    33
 * CTestServer derived server.
sl@0
    34
 */
sl@0
    35
	{
sl@0
    36
	CTefSchsvrBURSuite* server = new (ELeave) CTefSchsvrBURSuite();
sl@0
    37
	CleanupStack::PushL(server);
sl@0
    38
	// CServer base class call which can be either StartL or ConstructL,
sl@0
    39
	// the later will permit Server Logging.
sl@0
    40
sl@0
    41
	server->StartL(KServerName);
sl@0
    42
	CleanupStack::Pop(server);
sl@0
    43
	return server;
sl@0
    44
	}
sl@0
    45
sl@0
    46
LOCAL_C void MainL()
sl@0
    47
/**
sl@0
    48
 * Uses the Rendezvous() call to sync with the client
sl@0
    49
 */
sl@0
    50
	{
sl@0
    51
	CActiveScheduler* sched=NULL;
sl@0
    52
	sched=new(ELeave) CActiveScheduler;
sl@0
    53
	CActiveScheduler::Install(sched);
sl@0
    54
	CTefSchsvrBURSuite* server = NULL;
sl@0
    55
	// Create the CTestServer derived server
sl@0
    56
	TRAPD(err,server = CTefSchsvrBURSuite::NewL());
sl@0
    57
	if(!err)
sl@0
    58
		{
sl@0
    59
		// Sync with the client and enter the active scheduler
sl@0
    60
		RProcess::Rendezvous(KErrNone);
sl@0
    61
		sched->Start();
sl@0
    62
		}
sl@0
    63
	delete server;
sl@0
    64
	delete sched;
sl@0
    65
	}
sl@0
    66
sl@0
    67
GLDEF_C TInt E32Main()
sl@0
    68
/**
sl@0
    69
 * @return - Standard Epoc error code on process exit
sl@0
    70
 * Process entry point. Called by client using RProcess API
sl@0
    71
 */
sl@0
    72
	{
sl@0
    73
	__UHEAP_MARK;
sl@0
    74
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
    75
	if(cleanup == NULL)
sl@0
    76
		{
sl@0
    77
		return KErrNoMemory;
sl@0
    78
		}
sl@0
    79
	TRAPD(err,MainL());
sl@0
    80
		
sl@0
    81
	delete cleanup;
sl@0
    82
	__UHEAP_MARKEND;
sl@0
    83
	
sl@0
    84
	return err;
sl@0
    85
	}
sl@0
    86
sl@0
    87
sl@0
    88
CTestStep* CTefSchsvrBURSuite::CreateTestStep(const TDesC& aStepName)
sl@0
    89
/**
sl@0
    90
 * @return - A CTestStep derived instance
sl@0
    91
 * Implementation of CTestServer pure virtual
sl@0
    92
 */
sl@0
    93
	{
sl@0
    94
	CTestStep* testStep = NULL;
sl@0
    95
	// They are created "just in time" when the worker thread is created
sl@0
    96
	// More test steps can be added below 
sl@0
    97
              if(aStepName == KCompareStep)
sl@0
    98
                            testStep = new CCompareStep();
sl@0
    99
              else if(aStepName == KInitialiseStep)
sl@0
   100
                            testStep = new CInitialiseStep();
sl@0
   101
              else if(aStepName == KAPIStep)
sl@0
   102
                            testStep = new CAPIStep();
sl@0
   103
              else if(aStepName == KMultiStep)
sl@0
   104
                            testStep = new CMultiStep();
sl@0
   105
              else if(aStepName == KBURStep)
sl@0
   106
                            testStep = new CBURStep();
sl@0
   107
              else if(aStepName == KMergeStep)
sl@0
   108
                            testStep = new CMergeStep();              
sl@0
   109
              
sl@0
   110
	return testStep;
sl@0
   111
	}