datacommsserver/esockserver/test/TS_MultiHoming/TS_RConnectionStop.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2002-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 // This contains TS_MultiHoming RConnection Stop primitive.
       
    15 // RConnection starts opens and starts a connection, and 
       
    16 // stores this connection in C
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23  
       
    24 #include "TS_RConnectionStop.h"
       
    25 
       
    26 /* 
       
    27  * Test 1.1
       
    28  * Open a default / named connection
       
    29  */
       
    30 CTS_RConnectionStop::CTS_RConnectionStop()
       
    31 	{
       
    32 	iTestStepName = KRConnectionStop;
       
    33 	}
       
    34 
       
    35 CTS_RConnectionStop::~CTS_RConnectionStop()
       
    36 	{	
       
    37 	}
       
    38 
       
    39 enum TVerdict CTS_RConnectionStop::doTestStepPreambleL(void)
       
    40 /**
       
    41  * Implements OOM testing in each test
       
    42  */
       
    43 	{
       
    44 	if (!(GetBoolFromConfig(KConnectionInfo,KOomTest,iIsOOMTest)))
       
    45 		iIsOOMTest=EFalse;
       
    46 	return EPass;
       
    47 	}
       
    48 
       
    49 
       
    50 enum TVerdict CTS_RConnectionStop::doTestStepL()
       
    51 /**
       
    52  * Reads the configuration file to find out which
       
    53  * connection(s) need to be stopped.
       
    54  * Any clients using this connection will be disconnected
       
    55  * as a result.
       
    56  */
       
    57 	{
       
    58 
       
    59 	TPtrC connPtr(KNameDefault);
       
    60 	TInt err = KErrNone;
       
    61 	TInt numOfConns = 0;	//< fall back to zero
       
    62 	TBool defaultOnly = EFalse;
       
    63 
       
    64 	err = GetIntFromConfig(KConnectionInfo, KNumOfConns, numOfConns);
       
    65 	
       
    66 	// Is the default a vailid case
       
    67 	if (!err)		// We have no config available, so 1 default connection
       
    68 		{	
       
    69 		LogExtra((TText8*)__FILE__, __LINE__, ESevrInfo, KDoingDefault);
       
    70 		defaultOnly = ETrue;
       
    71 		}
       
    72 	
       
    73 		
       
    74 	// Get Config Values
       
    75 	TBuf<10> keyName;
       
    76 		
       
    77 	for (TInt i=0; i < numOfConns; i++)	
       
    78 		{
       
    79 		keyName = KConnName;		//< Descriptor len is ok up to 99 connections...
       
    80 		if (!defaultOnly)
       
    81 			{
       
    82 			keyName.AppendNum(i);
       
    83 			err = GetStringFromConfig(KConnectionInfo, keyName, connPtr);
       
    84 			if (!err)
       
    85 				{
       
    86 				LogExtra((TText8*)__FILE__, __LINE__, ESevrErr, KEConfigFile);;	// We must have the naming section, for >1 connection 
       
    87 				return EFail;
       
    88 				}
       
    89 			}	
       
    90 		err = iOwnerSuite->StopConnection(connPtr);
       
    91 		TESTE(err==KErrNone,err);
       
    92 		}	// for (<numOfConns>)
       
    93 		User::After(5000*1000);
       
    94 	return iTestStepResult;
       
    95 	}
       
    96 
       
    97