networkcontrol/ipupsplugins/test/te_ipups/src/te_ipups_server.cpp
branchRCL_3
changeset 22 8d540f55e491
parent 21 abbed5a4b42a
child 23 425d8f4f7fa5
equal deleted inserted replaced
21:abbed5a4b42a 22:8d540f55e491
     1 // Copyright (c) 2008-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 
       
    22 #include "te_ipups_server.h"
       
    23 #include "te_ipups_ups_step.h"
       
    24 #include "te_ipups_notify_count.h"
       
    25 #include "te_ipups_delete_decision_db.h"
       
    26 #include <bacline.h>
       
    27 
       
    28 CTeIpUpsSuite* CTeIpUpsSuite::NewL(const TDesC& aName)
       
    29 /**
       
    30  * @return - Instance of the test server
       
    31  */
       
    32 	{
       
    33 	CTeIpUpsSuite * server = new (ELeave) CTeIpUpsSuite();
       
    34 	CleanupStack::PushL(server);
       
    35 	server->ConstructL(aName);
       
    36 	CleanupStack::Pop(server);
       
    37 	return server;
       
    38 	}
       
    39 
       
    40 
       
    41 LOCAL_C void MainL()
       
    42 /**
       
    43  * Main implementation
       
    44  */
       
    45 	{
       
    46 	CActiveScheduler* sched=NULL;
       
    47 	sched=new(ELeave) CActiveScheduler;
       
    48 	CActiveScheduler::Install(sched);
       
    49 	CTeIpUpsSuite* server = NULL;
       
    50 		
       
    51 	CCommandLineArguments* args = CCommandLineArguments::NewLC();
       
    52 	TPtrC exeName = args->Arg(0);
       
    53 	TParse fullName;
       
    54 	fullName.Set(exeName, NULL, NULL);
       
    55 	CleanupStack::PopAndDestroy(args);
       
    56 	
       
    57 	// Create the CTestServer derived server
       
    58 	TRAPD(err,server = CTeIpUpsSuite::NewL(fullName.Name()));
       
    59 	if(!err)
       
    60 		{
       
    61 		// Sync with the client and enter the active scheduler
       
    62 		RProcess::Rendezvous(KErrNone);
       
    63 		sched->Start();
       
    64 		}
       
    65 	delete server;
       
    66 	delete sched;
       
    67 	}
       
    68 
       
    69 
       
    70 
       
    71 GLDEF_C TInt E32Main()
       
    72 /**
       
    73  * @return - Standard Epoc error code on process exit
       
    74  * Process entry point. Called by client using RProcess API
       
    75  */
       
    76 	{
       
    77 	__UHEAP_MARK;
       
    78 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    79 	if(cleanup == NULL)
       
    80 		{
       
    81 		return KErrNoMemory;
       
    82 		}
       
    83 	TRAPD(err,MainL());
       
    84 	delete cleanup;
       
    85 	__UHEAP_MARKEND;
       
    86 	return err;
       
    87     }
       
    88 
       
    89 
       
    90 CTestStep* CTeIpUpsSuite::CreateTestStep(const TDesC& aStepName)
       
    91 /**
       
    92  * @return - A CTestStep derived instance
       
    93  */
       
    94 	{
       
    95 	CTestStep* testStep = NULL;
       
    96 	
       
    97 	if(aStepName == KIpUpsClientStep)
       
    98 		{
       
    99 		testStep = new CIpUpsStep();
       
   100 		}
       
   101 	else if(aStepName == KIpUpsNotifyCount)
       
   102 		{
       
   103 		testStep = new CIpUpsNotifyCount();
       
   104 		}
       
   105 	else if(aStepName == KIpUpsDeleteDecisionDB)
       
   106 		{
       
   107 		testStep = new CIpUpsDeleteDecisionDB();
       
   108 		}
       
   109 	
       
   110 	return testStep;
       
   111 	}