authenticationservices/authenticationserver/test/tauthcliserv/tauthcliserv.cpp
changeset 102 deec7e509f66
parent 94 0e6c5a9328b5
child 108 ca9a0fc2f082
equal deleted inserted replaced
94:0e6c5a9328b5 102:deec7e509f66
     1 /*
       
     2 * Copyright (c) 2005-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 * tauthdbserver.cpp
       
    16 * server implementation
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file 
       
    23 */
       
    24 
       
    25 #include "tauthcliservstep.h"
       
    26 
       
    27 _LIT(KServerName,"tauthcliserv");
       
    28 
       
    29 /**
       
    30  * Called inside the MainL() function to create and start the CTestServer 
       
    31  * derived server.
       
    32  * @return Instance of the test server
       
    33  */
       
    34 CTAuthDbServer* CTAuthDbServer::NewL()
       
    35 	{
       
    36 	CTAuthDbServer * server = new (ELeave) CTAuthDbServer();
       
    37 	CleanupStack::PushL(server);
       
    38 	
       
    39 	// Either use a StartL or ConstructL, the latter will permit Server Logging.
       
    40 
       
    41 	server->ConstructL(KServerName);
       
    42 	CleanupStack::Pop(server);
       
    43 	return server;
       
    44 	}
       
    45 
       
    46 LOCAL_C void MainL()
       
    47 	{
       
    48 	// Leave the hooks in for platform security
       
    49 #if (defined __DATA_CAGING__)
       
    50 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    51 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    52 #endif
       
    53 	CActiveScheduler* sched=NULL;
       
    54 	sched=new(ELeave) CActiveScheduler;
       
    55 	CleanupStack::PushL(sched);
       
    56 	CActiveScheduler::Install(sched);
       
    57 	CTAuthDbServer* server = NULL;
       
    58 	// Create the CTestServer derived server
       
    59 	TRAPD(err,server = CTAuthDbServer::NewL());
       
    60 	if(!err)
       
    61 		{
       
    62 		RProcess::Rendezvous(KErrNone);
       
    63 		sched->Start();
       
    64 		}
       
    65 	CleanupStack::Pop(sched);
       
    66 	delete server;
       
    67 	delete sched;
       
    68 	}
       
    69 
       
    70 GLDEF_C TInt E32Main()
       
    71 	{
       
    72 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    73 	if(cleanup == NULL)
       
    74 		{
       
    75 		return KErrNoMemory;
       
    76 		}
       
    77 	TRAP_IGNORE(MainL());	
       
    78 	delete cleanup;
       
    79 	return KErrNone;
       
    80     }
       
    81 
       
    82 CTestStep* CTAuthDbServer::CreateTestStep(const TDesC& aStepName)
       
    83 	{
       
    84 	CTestStep* testStep = NULL;
       
    85 
       
    86 	if(aStepName == KTStepClient)
       
    87 		{
       
    88 		testStep = new CTStepClient();
       
    89 		}
       
    90 	else if(aStepName == KTStepMgrClient)
       
    91 		{
       
    92 		testStep = new CTStepMgrClient();
       
    93 		}
       
    94 	else if(aStepName == KTStepFirstStart)
       
    95 		{
       
    96 		testStep = new CTStepFirstStart();
       
    97 		}
       
    98 
       
    99 	// authentication expression tests
       
   100 	else if (aStepName == KTStepAuthExprBuild)
       
   101 		{
       
   102 		testStep = new CTStepAuthExprBuild();
       
   103 		}
       
   104 	else if (aStepName == KTStepBadExtAuthExpr)
       
   105 		{
       
   106 		testStep = new CTStepBadExtAuthExpr();
       
   107 		}
       
   108 	else if (aStepName == KTStepAuthExprHighVer)
       
   109 		{
       
   110 		testStep = new CTStepAuthExprHighVer();
       
   111 		}
       
   112 	else if (aStepName == KTStepAuthExprEval)
       
   113 		{
       
   114 		testStep = new CTStepAuthExprEval();
       
   115 		}
       
   116 #ifdef _DEBUG
       
   117 	else if (aStepName == KTStepAuthExprTypePnc)
       
   118 		{
       
   119 		testStep = new CTStepAuthExprTypePnc();
       
   120 		}
       
   121 	else if (aStepName == KTStepAuthExprTypePncBadLeft)
       
   122 		{
       
   123 		testStep = new CTStepAuthExprTypePncBadLeft();
       
   124 		}
       
   125 	else if (aStepName == KTStepAuthExprTypePncBadRight)
       
   126 		{
       
   127 		testStep = new CTStepAuthExprTypePncBadRight();
       
   128 		}
       
   129 #endif
       
   130 
       
   131 	return testStep;
       
   132 	}