os/security/authorisation/userpromptservice/test/tups/src/tupsintegserver.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2007-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 the License "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 
    19 #include "tupsintegserver.h"
    20 #include "tupsclientstep.h"
    21 #include <bacline.h>
    22 #include "tupspropertystep.h"
    23 #include "tups_utils.h"
    24 #include "tups_minortests.h"
    25 #include "tupsdbmanagementstep.h"
    26 #include "tupscoordinatorstep.h"
    27 
    28 
    29 CTUpsSuite* CTUpsSuite::NewL(const TDesC& aName)
    30 /**
    31  * @return - Instance of the test server
    32  */
    33 	{
    34 	CTUpsSuite * server = new (ELeave) CTUpsSuite();
    35 	CleanupStack::PushL(server);
    36 	server->ConstructL(aName);
    37 	CleanupStack::Pop(server);
    38 	return server;
    39 	}
    40 
    41 
    42 LOCAL_C void MainL()
    43 /**
    44  * Main implementation
    45  */
    46 	{
    47 
    48 	CActiveScheduler* sched=NULL;
    49 	sched=new(ELeave) CActiveScheduler;
    50 	CActiveScheduler::Install(sched);
    51 	CTUpsSuite* server = NULL;
    52 	
    53 	// gets name of executable, this will allow correct cloning with SETCAP
    54 	CCommandLineArguments* args = CCommandLineArguments::NewLC();
    55 	TPtrC exeName = args->Arg(0);
    56 	TParse fullName;
    57 	fullName.Set(exeName, NULL, NULL);   
    58 	CleanupStack::PopAndDestroy(args);
    59 	
    60 	// Create the CTestServer derived server
    61 	TRAPD(err,server = CTUpsSuite::NewL(fullName.Name()));
    62 	if(!err)
    63 		{
    64 		// Sync with the client and enter the active scheduler
    65 		RProcess::Rendezvous(KErrNone);
    66 		sched->Start();
    67 		}
    68 	delete server;
    69 	delete sched;
    70 	}
    71 
    72 
    73 
    74 GLDEF_C TInt E32Main()
    75 /**
    76  * @return - Standard Epoc error code on process exit
    77  * Process entry point. Called by client using RProcess API
    78  */
    79 	{
    80 	__UHEAP_MARK;
    81 	CTrapCleanup* cleanup = CTrapCleanup::New();
    82 	if(cleanup == NULL)
    83 		{
    84 		return KErrNoMemory;
    85 		}
    86 	TRAPD(err,MainL());
    87 	delete cleanup;
    88 	__UHEAP_MARKEND;
    89 	return err;
    90     }
    91 
    92 
    93 CTestStep* CTUpsSuite::CreateTestStep(const TDesC& aStepName)
    94 /**
    95  * @return - A CTestStep derived instance
    96  */
    97 	{
    98 	CTestStep* testStep = NULL;
    99 	if(aStepName == KUPSClientStep)
   100 		testStep = new CUpsClientStep();
   101 	else if (aStepName == KPropertyStep)
   102 		testStep = new CPropertyStep();
   103 	else if (aStepName == KCloseUps)
   104 		testStep = new CCloseUpsStep();
   105 	else if (aStepName == KProtServAuthorisationStep)
   106 		testStep = new CNonProtServAuthorisation();
   107 	else if (aStepName == KUPSDbManagementStep)
   108 		testStep = new CUPSDbManagementStep();
   109 	else if (aStepName == KUPSCoordinatorStep)
   110 		testStep = new CUPSCoordinatorStep();
   111 	else if (aStepName == KDyingClientStep)
   112 		testStep = new CDyingClient();
   113 	else if (aStepName == KCancelPromptStep)
   114 		testStep = new CCancelUpsPrompt();
   115 	else if (aStepName == KSimpleRequestStep)
   116 		testStep = new CSimpleUpsRequest();
   117 	else if (aStepName == KMultithreadStep)
   118 		testStep = new CMultiTread();
   119 	
   120 	return testStep;
   121 	}