sl@0: /*
sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of the License "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #include "tups_utils.h" 
sl@0:  
sl@0: CCloseUpsStep::CCloseUpsStep()
sl@0: /**
sl@0:  * Constructor
sl@0:  * The use of this test step is to shutdown the ups server form a test script using tupsinteg_x
sl@0:  * test step, this action will cause the closure of the decisions database used by UPS server, an
sl@0:  * in consecuence allows the deletion of the DB file.   
sl@0:  *
sl@0:  * Note: This test step will be only effective if there is not any server connected to ups server.    
sl@0:  * This test step does not delete the decision DB.
sl@0:  */
sl@0: 	{
sl@0: 	SetTestStepName(KCloseUps);
sl@0: 	}
sl@0: 
sl@0: CCloseUpsStep::~CCloseUpsStep()
sl@0: /**
sl@0:  * Destructor
sl@0:  */
sl@0: 	{
sl@0:  	__UHEAP_MARKEND;
sl@0: 	}
sl@0: 
sl@0: TVerdict CCloseUpsStep::doTestStepPreambleL()
sl@0: /**
sl@0:  * @return - TVerdict code
sl@0:  */
sl@0: 	{
sl@0:  	__UHEAP_MARK;
sl@0:  	SetTestStepResult(EPass);
sl@0: 	return TestStepResult();
sl@0: 	}
sl@0: 
sl@0: TVerdict CCloseUpsStep::doTestStepL()
sl@0: /**
sl@0:  * @return - TVerdict code
sl@0:  */
sl@0: 	{
sl@0: 	UserPromptService::RUpsSession sTestSession;
sl@0: 	
sl@0: 	TInt err = KErrNone;
sl@0: 	
sl@0: 	// Connects to UPS server.
sl@0: 	err = sTestSession.Connect();
sl@0: 	 
sl@0: 	if(err == KErrNone)
sl@0: 		{
sl@0: 		// Requests UPS server shut down
sl@0:      	err = sTestSession.ShutdownServer();
sl@0:      	
sl@0:      	sTestSession.Close();
sl@0:   
sl@0:     	if(err == KErrNone)
sl@0: 			{
sl@0: 			INFO_PRINTF1(_L("UtilsCloseUps: UPS Server successfully shut down"));
sl@0: 			}
sl@0: 		else
sl@0: 			{
sl@0: 			ERR_PRINTF2(_L("UtilsCloseUps: Failure to shut down UPS Server: %d"),err);
sl@0: 			User::Leave(err);	
sl@0: 			}	
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		ERR_PRINTF2(_L("UtilsCloseUps: Failure to Connect to UPS Server: %d"),err);
sl@0: 		User::Leave(err);
sl@0: 		}
sl@0: 	
sl@0: 	return TestStepResult();
sl@0: 	}
sl@0: 	
sl@0: TVerdict CCloseUpsStep::doTestStepPostambleL()
sl@0: /**
sl@0:  * @return - TVerdict code
sl@0:  */
sl@0: 	{
sl@0: 	return TestStepResult();
sl@0: 	}