os/security/authorisation/userpromptservice/test/tups/src/tupsintegserver.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
/*
sl@0
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#include "tupsintegserver.h"
sl@0
    20
#include "tupsclientstep.h"
sl@0
    21
#include <bacline.h>
sl@0
    22
#include "tupspropertystep.h"
sl@0
    23
#include "tups_utils.h"
sl@0
    24
#include "tups_minortests.h"
sl@0
    25
#include "tupsdbmanagementstep.h"
sl@0
    26
#include "tupscoordinatorstep.h"
sl@0
    27
sl@0
    28
sl@0
    29
CTUpsSuite* CTUpsSuite::NewL(const TDesC& aName)
sl@0
    30
/**
sl@0
    31
 * @return - Instance of the test server
sl@0
    32
 */
sl@0
    33
	{
sl@0
    34
	CTUpsSuite * server = new (ELeave) CTUpsSuite();
sl@0
    35
	CleanupStack::PushL(server);
sl@0
    36
	server->ConstructL(aName);
sl@0
    37
	CleanupStack::Pop(server);
sl@0
    38
	return server;
sl@0
    39
	}
sl@0
    40
sl@0
    41
sl@0
    42
LOCAL_C void MainL()
sl@0
    43
/**
sl@0
    44
 * Main implementation
sl@0
    45
 */
sl@0
    46
	{
sl@0
    47
sl@0
    48
	CActiveScheduler* sched=NULL;
sl@0
    49
	sched=new(ELeave) CActiveScheduler;
sl@0
    50
	CActiveScheduler::Install(sched);
sl@0
    51
	CTUpsSuite* server = NULL;
sl@0
    52
	
sl@0
    53
	// gets name of executable, this will allow correct cloning with SETCAP
sl@0
    54
	CCommandLineArguments* args = CCommandLineArguments::NewLC();
sl@0
    55
	TPtrC exeName = args->Arg(0);
sl@0
    56
	TParse fullName;
sl@0
    57
	fullName.Set(exeName, NULL, NULL);   
sl@0
    58
	CleanupStack::PopAndDestroy(args);
sl@0
    59
	
sl@0
    60
	// Create the CTestServer derived server
sl@0
    61
	TRAPD(err,server = CTUpsSuite::NewL(fullName.Name()));
sl@0
    62
	if(!err)
sl@0
    63
		{
sl@0
    64
		// Sync with the client and enter the active scheduler
sl@0
    65
		RProcess::Rendezvous(KErrNone);
sl@0
    66
		sched->Start();
sl@0
    67
		}
sl@0
    68
	delete server;
sl@0
    69
	delete sched;
sl@0
    70
	}
sl@0
    71
sl@0
    72
sl@0
    73
sl@0
    74
GLDEF_C TInt E32Main()
sl@0
    75
/**
sl@0
    76
 * @return - Standard Epoc error code on process exit
sl@0
    77
 * Process entry point. Called by client using RProcess API
sl@0
    78
 */
sl@0
    79
	{
sl@0
    80
	__UHEAP_MARK;
sl@0
    81
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
    82
	if(cleanup == NULL)
sl@0
    83
		{
sl@0
    84
		return KErrNoMemory;
sl@0
    85
		}
sl@0
    86
	TRAPD(err,MainL());
sl@0
    87
	delete cleanup;
sl@0
    88
	__UHEAP_MARKEND;
sl@0
    89
	return err;
sl@0
    90
    }
sl@0
    91
sl@0
    92
sl@0
    93
CTestStep* CTUpsSuite::CreateTestStep(const TDesC& aStepName)
sl@0
    94
/**
sl@0
    95
 * @return - A CTestStep derived instance
sl@0
    96
 */
sl@0
    97
	{
sl@0
    98
	CTestStep* testStep = NULL;
sl@0
    99
	if(aStepName == KUPSClientStep)
sl@0
   100
		testStep = new CUpsClientStep();
sl@0
   101
	else if (aStepName == KPropertyStep)
sl@0
   102
		testStep = new CPropertyStep();
sl@0
   103
	else if (aStepName == KCloseUps)
sl@0
   104
		testStep = new CCloseUpsStep();
sl@0
   105
	else if (aStepName == KProtServAuthorisationStep)
sl@0
   106
		testStep = new CNonProtServAuthorisation();
sl@0
   107
	else if (aStepName == KUPSDbManagementStep)
sl@0
   108
		testStep = new CUPSDbManagementStep();
sl@0
   109
	else if (aStepName == KUPSCoordinatorStep)
sl@0
   110
		testStep = new CUPSCoordinatorStep();
sl@0
   111
	else if (aStepName == KDyingClientStep)
sl@0
   112
		testStep = new CDyingClient();
sl@0
   113
	else if (aStepName == KCancelPromptStep)
sl@0
   114
		testStep = new CCancelUpsPrompt();
sl@0
   115
	else if (aStepName == KSimpleRequestStep)
sl@0
   116
		testStep = new CSimpleUpsRequest();
sl@0
   117
	else if (aStepName == KMultithreadStep)
sl@0
   118
		testStep = new CMultiTread();
sl@0
   119
	
sl@0
   120
	return testStep;
sl@0
   121
	}