os/security/authorisation/userpromptservice/test/tups/src/tups_utils.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/authorisation/userpromptservice/test/tups/src/tups_utils.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,97 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include "tups_utils.h" 
    1.23 + 
    1.24 +CCloseUpsStep::CCloseUpsStep()
    1.25 +/**
    1.26 + * Constructor
    1.27 + * The use of this test step is to shutdown the ups server form a test script using tupsinteg_x
    1.28 + * test step, this action will cause the closure of the decisions database used by UPS server, an
    1.29 + * in consecuence allows the deletion of the DB file.   
    1.30 + *
    1.31 + * Note: This test step will be only effective if there is not any server connected to ups server.    
    1.32 + * This test step does not delete the decision DB.
    1.33 + */
    1.34 +	{
    1.35 +	SetTestStepName(KCloseUps);
    1.36 +	}
    1.37 +
    1.38 +CCloseUpsStep::~CCloseUpsStep()
    1.39 +/**
    1.40 + * Destructor
    1.41 + */
    1.42 +	{
    1.43 + 	__UHEAP_MARKEND;
    1.44 +	}
    1.45 +
    1.46 +TVerdict CCloseUpsStep::doTestStepPreambleL()
    1.47 +/**
    1.48 + * @return - TVerdict code
    1.49 + */
    1.50 +	{
    1.51 + 	__UHEAP_MARK;
    1.52 + 	SetTestStepResult(EPass);
    1.53 +	return TestStepResult();
    1.54 +	}
    1.55 +
    1.56 +TVerdict CCloseUpsStep::doTestStepL()
    1.57 +/**
    1.58 + * @return - TVerdict code
    1.59 + */
    1.60 +	{
    1.61 +	UserPromptService::RUpsSession sTestSession;
    1.62 +	
    1.63 +	TInt err = KErrNone;
    1.64 +	
    1.65 +	// Connects to UPS server.
    1.66 +	err = sTestSession.Connect();
    1.67 +	 
    1.68 +	if(err == KErrNone)
    1.69 +		{
    1.70 +		// Requests UPS server shut down
    1.71 +     	err = sTestSession.ShutdownServer();
    1.72 +     	
    1.73 +     	sTestSession.Close();
    1.74 +  
    1.75 +    	if(err == KErrNone)
    1.76 +			{
    1.77 +			INFO_PRINTF1(_L("UtilsCloseUps: UPS Server successfully shut down"));
    1.78 +			}
    1.79 +		else
    1.80 +			{
    1.81 +			ERR_PRINTF2(_L("UtilsCloseUps: Failure to shut down UPS Server: %d"),err);
    1.82 +			User::Leave(err);	
    1.83 +			}	
    1.84 +		}
    1.85 +	else
    1.86 +		{
    1.87 +		ERR_PRINTF2(_L("UtilsCloseUps: Failure to Connect to UPS Server: %d"),err);
    1.88 +		User::Leave(err);
    1.89 +		}
    1.90 +	
    1.91 +	return TestStepResult();
    1.92 +	}
    1.93 +	
    1.94 +TVerdict CCloseUpsStep::doTestStepPostambleL()
    1.95 +/**
    1.96 + * @return - TVerdict code
    1.97 + */
    1.98 +	{
    1.99 +	return TestStepResult();
   1.100 +	}