os/security/authorisation/userpromptservice/test/tups/src/tups_utils.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.
     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 "tups_utils.h" 
    20  
    21 CCloseUpsStep::CCloseUpsStep()
    22 /**
    23  * Constructor
    24  * The use of this test step is to shutdown the ups server form a test script using tupsinteg_x
    25  * test step, this action will cause the closure of the decisions database used by UPS server, an
    26  * in consecuence allows the deletion of the DB file.   
    27  *
    28  * Note: This test step will be only effective if there is not any server connected to ups server.    
    29  * This test step does not delete the decision DB.
    30  */
    31 	{
    32 	SetTestStepName(KCloseUps);
    33 	}
    34 
    35 CCloseUpsStep::~CCloseUpsStep()
    36 /**
    37  * Destructor
    38  */
    39 	{
    40  	__UHEAP_MARKEND;
    41 	}
    42 
    43 TVerdict CCloseUpsStep::doTestStepPreambleL()
    44 /**
    45  * @return - TVerdict code
    46  */
    47 	{
    48  	__UHEAP_MARK;
    49  	SetTestStepResult(EPass);
    50 	return TestStepResult();
    51 	}
    52 
    53 TVerdict CCloseUpsStep::doTestStepL()
    54 /**
    55  * @return - TVerdict code
    56  */
    57 	{
    58 	UserPromptService::RUpsSession sTestSession;
    59 	
    60 	TInt err = KErrNone;
    61 	
    62 	// Connects to UPS server.
    63 	err = sTestSession.Connect();
    64 	 
    65 	if(err == KErrNone)
    66 		{
    67 		// Requests UPS server shut down
    68      	err = sTestSession.ShutdownServer();
    69      	
    70      	sTestSession.Close();
    71   
    72     	if(err == KErrNone)
    73 			{
    74 			INFO_PRINTF1(_L("UtilsCloseUps: UPS Server successfully shut down"));
    75 			}
    76 		else
    77 			{
    78 			ERR_PRINTF2(_L("UtilsCloseUps: Failure to shut down UPS Server: %d"),err);
    79 			User::Leave(err);	
    80 			}	
    81 		}
    82 	else
    83 		{
    84 		ERR_PRINTF2(_L("UtilsCloseUps: Failure to Connect to UPS Server: %d"),err);
    85 		User::Leave(err);
    86 		}
    87 	
    88 	return TestStepResult();
    89 	}
    90 	
    91 TVerdict CCloseUpsStep::doTestStepPostambleL()
    92 /**
    93  * @return - TVerdict code
    94  */
    95 	{
    96 	return TestStepResult();
    97 	}