Revision: 201017 RCL_3 PDK_3.0.i
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 17:53:34 +0300
branchRCL_3
changeset 15 51722b10598b
parent 14 4ccf8e394726
child 17 9ddb1d67ebaf
Revision: 201017 Kit: 201017
commsfwsupport/commselements/commsfw/src/cfutil.cpp
commsfwsupport/commselements/serverden/src/sd_workersession.cpp
datacommsserver/esockserver/ssock/ss_connstates.cpp
datacommsserver/esockserver/ssock/ss_nodemessages_legacy.cpp
datacommsserver/esockserver/ssock/ss_roles.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h
datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp
datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760645.ini
datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760645.script
--- a/commsfwsupport/commselements/commsfw/src/cfutil.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/commsfwsupport/commselements/commsfw/src/cfutil.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -438,6 +438,7 @@
 		{
 		do 
 			{
+			CleanupStack::PushL(dir);
 			const TInt cnt = dir->Count();
 			for(TInt i = 0; i < cnt; ++i)
 				{
@@ -445,7 +446,7 @@
 				fullEntry.Set(entry.iName, &ff.File(), NULL);      
 				AddL(TOwnEntry(fullEntry, entry));
 				}
-			delete dir;
+			CleanupStack::PopAndDestroy(dir);
 			}
 		while(ff.FindWild(dir) == KErrNone);
 		}	
@@ -469,46 +470,46 @@
 	TParse fullEntry;
 	CDir* dir;
 	RArray<TEntry> files;
+	CleanupClosePushL(files);
 	TBool found;
 	if(ff.FindWildByDir(aFileMask, aDir, dir) == KErrNone)
 		{
 		do 
 			{
+			CleanupStack::PushL(dir);
 			const TInt cnt = dir->Count();
 			for(TInt i = 0; i < cnt; ++i)
 				{
 				const TEntry& entry = (*dir)[i];
-		               if(files.Count()!=0)
-				      {
+				if(files.Count()!=0)
+					{
 					found = EFalse;
 					for( TInt Index=0;Index<files.Count();Index++)
-			    	           {
+						{
 						if(files[Index].iName.CompareF(entry.iName)==0)
-						     {
+							{
 							found = ETrue;
-					             }
-				             }
-	                            if(!found)
-	    	                         {
-				    	   files.Append(entry);
-					   fullEntry.Set(entry.iName, &ff.File(), NULL);      
-					   AddL(TOwnEntry(fullEntry, entry));
-				    	     }
-				       }
-		        	else
-			          {
-			           files.Append(entry);
+							}
+						}
+					if(!found)
+						{
+						files.Append(entry);
+						fullEntry.Set(entry.iName, &ff.File(), NULL);      
+						AddL(TOwnEntry(fullEntry, entry));
+						}
+					}
+				else
+					{
+					files.Append(entry);
 				    fullEntry.Set(entry.iName, &ff.File(), NULL);      
 				    AddL(TOwnEntry(fullEntry, entry));
-				    }		
-							
-		         }
-		     delete dir;
-			
-	           }
-	           while(ff.FindWild(dir) == KErrNone);
-        	}	
-	files.Close();	
+				    }
+				}
+				CleanupStack::PopAndDestroy(dir);
+			}
+		while(ff.FindWild(dir) == KErrNone);
+		}	
+	CleanupStack::PopAndDestroy(&files);
 	fs.Pop();
 	}
 
--- a/commsfwsupport/commselements/serverden/src/sd_workersession.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/commsfwsupport/commselements/serverden/src/sd_workersession.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -464,26 +464,29 @@
 	iProcess.Close();
 
 	const CCommonServer* s = static_cast<const CCommonServer*>(Server());
-	__ASSERT_DEBUG(s->iNumSessions>0, User::Panic(KDenFaultPanic, ECommonNegativeSessionCount));
-	s->iNumSessions--;
-	COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("CWorkerSession(%08x):\t~CWorkerSession() iNumSessions=%d (remaining)"), this, s->iNumSessions));
-
-	CCommonWorkerThread& selfWorker = WorkerThread();
-	if (selfWorker.ShuttingDown())
-		{
-		COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("Shutdown requested: %d sessions"), s->iNumSessions));
-		if (s->iNumSessions <= 0)
-			{
-			if(selfWorker.IsMainThread())
-				{
-				selfWorker.PitBoss().SessionShutdownComplete();
-				}
-			else
-				{
-				selfWorker.MaybeTriggerThreadShutdownCallback();
-				}
-			}
-		}
+	if (s)     // guard against leave during construction (e.g. a leave from CWorkerSession::ConstructL()).
+	    {
+        __ASSERT_DEBUG(s->iNumSessions>0, User::Panic(KDenFaultPanic, ECommonNegativeSessionCount));
+        s->iNumSessions--;
+        COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("CWorkerSession(%08x):\t~CWorkerSession() iNumSessions=%d (remaining)"), this, s->iNumSessions));
+    
+        CCommonWorkerThread& selfWorker = WorkerThread();
+        if (selfWorker.ShuttingDown())
+            {
+            COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("Shutdown requested: %d sessions"), s->iNumSessions));
+            if (s->iNumSessions <= 0)
+                {
+                if(selfWorker.IsMainThread())
+                    {
+                    selfWorker.PitBoss().SessionShutdownComplete();
+                    }
+                else
+                    {
+                    selfWorker.MaybeTriggerThreadShutdownCallback();
+                    }
+                }
+            }
+	    }
 	}
 
 EXPORT_C void CWorkerSession::ProcessSubSessions(TWorkerId aPeerId, TSubSessionProcessor aSubSessionProcessor, TAny* aArg)
--- a/datacommsserver/esockserver/ssock/ss_connstates.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -637,23 +637,22 @@
         {
         TStateChange& progress = progressMsg->iStateChange;
         
-        if (iContext.iSender != iContext.Node().Id())
-            {
-            //CConnection trusts that locally generated progresses are to be trusted,
-            //but some of the legacy progresses coming from the stack need some filtering.
-            //Here's the filtering.
+		// Check whether KDataTransferUnblocked is received and if yes, then traslate it to KConnectionUp (== KLinkLayerOpen)
+		// the log only sees the translated version, this goes into the queue, so it alright I suppose.
+		if (progress.iStage == KDataTransferUnblocked )
+			{
+			progress.iStage = KConnectionUp;    // KLinkLayerOpen
+			}
+		if (progress.iError == KErrForceDisconnected)
+			{
+			progress.iError = KErrDisconnected;
+			}
         
-            // Check whether KDataTransferUnblocked is received and if yes, then traslate it to KConnectionUp (== KLinkLayerOpen)
-            // the log only sees the translated version, this goes into the queue, so it alright I suppose.
-            if (progress.iStage == KDataTransferUnblocked )
-                {
-                progress.iStage = KConnectionUp;    // KLinkLayerOpen
-                }
-            if (progress.iError == KErrForceDisconnected)
-                {
-                progress.iError = KErrDisconnected;
-                }
-            
+		// CConnection trusts that locally generated progresses are to be trusted,
+		// but some of the legacy progresses coming from the stack need some filtering.
+		// Here's the filtering.
+		if (iContext.iSender != iContext.Node().Id())
+            {
             if (progress.iStage == KConnectionUninitialised)
                 {
                 //KConnectionUninitialised has been deprecated in the stack and it will be ignored
--- a/datacommsserver/esockserver/ssock/ss_nodemessages_legacy.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_nodemessages_legacy.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -103,18 +103,8 @@
 	ASSERT(aContext.Activity() != NULL);
 	RNodeInterface* rcpt = NULL;
 
-	/* At the connection level we want to go down active serviceprovider, as there are multiple
-	   and the first one is usually an scpr */
-	if (aContext.Activity()->ActivitySigId() == ECFActivityConnectionLegacyRMessage2Handler)
-		{
-		rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EActive),
+	rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EActive),
 			Messages::TClientType(0, Messages::TClientType::ELeaving));
-		}
-	else
-		{
-		rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider),
-			Messages::TClientType(0, Messages::TClientType::ELeaving));
-		}
 
     if(rcpt)
     	{
--- a/datacommsserver/esockserver/ssock/ss_roles.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_roles.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -1797,7 +1797,6 @@
 	else
 		{
     	err = KErrNoMemory;
-    	CleanupStack::Pop(startupInfo);
    		}
 
    	return err;
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h	Tue Apr 27 17:53:34 2010 +0300
@@ -25,6 +25,7 @@
 #define CONNECTIONS_TESTSTEPS_H
 
 #include <test/testexecutestepbase.h>
+#include <metadatabase.h>
 #include "Te_EsockStepBase.h"
 
 _LIT(KTe_ConnectionName,"ConnName");
@@ -41,6 +42,9 @@
 _LIT(KTe_CommDbBearerCSD,"KCommDbBearerCSD");
 _LIT(KTe_CommDbBearerWcdma,"KCommDbBearerWcdma");
 _LIT(KTe_CommDbBearerLAN,"KCommDbBearerLAN");
+_LIT(KTe_ParameterType, "ParameterType");
+_LIT(KTe_ParameterExpectedValue,"ParameterExpectedValue");
+
 
 //mobility api
 _LIT(KTe_MobilityAPIName,"MobilityExtName");
@@ -424,6 +428,22 @@
 _LIT(KCheckNegativeProgressNotificationStep,"CheckNegativeProgressNotificationStep");
 
 
+class CGetParameters_IntStep : public CTe_EsockStepBase
+    {
+public:
+    CGetParameters_IntStep(CCEsockTestBase*& aEsockTest);
+    TVerdict doSingleTestStep();
+    TInt ConfigureFromIni();
+private:
+    TPtrC iConnectionName;
+    TPtrC iFieldName;    
+    CommsDat::TMDBElementId iRecordTypeId;
+    TInt  iExpectedValue;
+    };
+
+_LIT(KGetParameters_IntStep,"GetParameters_IntStep");
+
+
 #endif // CONNECTIONS_TESTSTEPS_H
 
 
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h	Tue Apr 27 17:53:34 2010 +0300
@@ -517,6 +517,8 @@
     TInt CreateAvailabilityExtension(const TDesC& aAvailabilityExtensionName);
     TInt RegisterForProgressNotificationEvent(const TEventContainerParams& aParams);
     TInt ReceiveProgressNotificationEvent(TNifProgress*& aNifProgress, const TDesC& aEventName, TUint aTimeoutInMiliSec = 0);
+    TInt GetParameters(TPtrC aConnectionName, ESock::CCommsDataObjectBase& aDataObject);
+    TInt GetIntSetting(TPtrC aConnectionName, const TDesC& aSettingName, TUint32& aValue);
 
     //mobility extensions
     RCommsMobilityApiExt* FindMobilityExtension(const TDesC& aMobilityExtensionName);
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -22,6 +22,9 @@
 #include "SocketServer.TestSteps.h"
 #include "Sockets.TestSteps.h"
 #include <cdbcols.h>
+#include <commsdattypeinfov1_1.h>
+#include <comms-infras/es_commsdataobject.h>
+#include <comms-infras/connectionqueryset.h>
 
 
 #ifdef _DEBUG
@@ -1205,4 +1208,103 @@
 	}
 
 
+// GetParameters_Int
+//-------------------------------
 
+CGetParameters_IntStep::CGetParameters_IntStep(CCEsockTestBase*& aEsockTest)
+:   CTe_EsockStepBase(aEsockTest)
+    {
+    SetTestStepName(KGetParameters_IntStep);
+    }
+
+TInt CGetParameters_IntStep::ConfigureFromIni()
+    {
+    // Read in appropriate fields
+    if((GetStringFromConfig(iSection, KTe_ConnectionName, iConnectionName) != 1)
+        || (iConnectionName.Length() == 0))
+        {
+        INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+        return KErrNotFound;
+        }
+
+    if((GetStringFromConfig(iSection, KTe_ParameterType, iFieldName) != 1)
+        || (iFieldName.Length() == 0))
+        {
+        INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+        return KErrNotFound;
+        }
+    _LIT(KIapTableIdDes, "IAP\\Id" );
+    if (iFieldName.Compare(KIapTableIdDes) == 0)
+        {
+        iRecordTypeId = CommsDat::KCDTIdIAPRecord | CommsDat::KCDTIdRecordTag;
+        }
+    /*else
+     * Don't get too angry, but so far, this generic looking test step only does IAP
+     * There are nice arrays in CED that can be used to address any field. If you're
+     * desperate, please pull them in and modify this test step to be able to retrieve
+     * any field 
+     */
+
+    if(!GetIntFromConfig(iSection, KTe_ParameterExpectedValue, iExpectedValue))
+        {
+        INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+        return KErrNotFound;
+        }
+    
+    return KErrNone;
+    }
+
+
+TVerdict CGetParameters_IntStep::doSingleTestStep()
+    {
+    TInt ret = KErrNone;
+    ESock::XConnectionQuerySet* querySet = NULL;
+    TRAP(ret, querySet = ESock::XConnectionQuerySet::NewL() );
+   
+    if ( ret == KErrNone )
+        {
+        TRAP(ret, ESock::XUintQuery::NewL(iRecordTypeId, *querySet) );
+        }
+    ESock::CConnectionQuerySet* connectionQuerySet = NULL;
+    if ( ret == KErrNone )
+        {
+        TRAP(ret, connectionQuerySet = ESock::CConnectionQuerySet::NewL(querySet) );
+        }    
+    
+    if( (ret = iEsockTest->GetParameters(iConnectionName, *connectionQuerySet)) != KErrNone)
+        {
+        INFO_PRINTF2(_L("RConnection::GetParameters returned %d"), ret);
+        SetTestStepError(ret);
+        return EFail;
+        }
+
+    ESock::XConnectionQuerySet& outputQuerySet = connectionQuerySet->DataObject();
+    ESock::XUintQuery* iapTableIdQuery = static_cast<ESock::XUintQuery*>(outputQuerySet.FindQuery( iRecordTypeId ));
+    __ASSERT_DEBUG(iapTableIdQuery, User::Panic(KSpecAssert_ESockTestCnctnsT, 2));
+    if (iapTableIdQuery->Error() != KErrNone)
+        {
+        INFO_PRINTF2(_L("RConnection::GetParameters Int query returned (%d)"), iapTableIdQuery->Error());
+        SetTestStepError(KErrCorrupt);
+        return EFail;        
+        }
+    
+    if (iapTableIdQuery->Data() != iExpectedValue)
+        {
+        INFO_PRINTF3(_L("RConnection::GetParameters Int query returned (%d) something else than expected (%d)"), iapTableIdQuery->Data(), iExpectedValue);
+        SetTestStepError(KErrCorrupt);
+        return EFail;        
+        }
+    
+    /*Just out of justified paranoia, we're extracting the same field using RConnection::GetIntSetting*/
+    TUint32 aValue;
+    iEsockTest->GetIntSetting(iConnectionName, iFieldName, aValue);
+    if (aValue != iExpectedValue)
+        {
+        INFO_PRINTF3(_L("RConnection::GetIntSetting returned (%d) something else than expected (%d)"), aValue, iExpectedValue);
+        SetTestStepError(KErrCorrupt);
+        return EFail;        
+        }
+           
+    return EPass;
+    }
+
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -1232,6 +1232,23 @@
 	return KErrNone;
 	}
 
+TInt CCEsockTestBase::GetParameters(TPtrC aConnectionName, ESock::CCommsDataObjectBase& aDataObject)
+    {
+    RConnection* c = iConns.Find(aConnectionName);
+    if (c==NULL)
+        return KErrNotFound;
+    return c->GetParameters(aDataObject);
+    }
+
+TInt CCEsockTestBase::GetIntSetting(TPtrC aConnectionName, const TDesC& aSettingName, TUint32& aValue)
+    {
+    RConnection* c = iConns.Find(aConnectionName);
+    if (c==NULL)
+        return KErrNotFound;
+    return c->GetIntSetting(aSettingName, aValue);
+    }
+
+
 TInt CCEsockTestBase::StartConnection(TRConnectionParams& aParams)
 	{
     RConnection* c = iConns.Find(aParams.iConnectionName);
@@ -2235,6 +2252,8 @@
     return ec->iEventReceived.Int();
     }
 
+
+
 //
 //cleanup
 
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp	Tue Apr 27 17:53:34 2010 +0300
@@ -422,6 +422,7 @@
 	NEW_ESOCK_TESTSTEP(RegisterProgressNotificationStep)
 	NEW_ESOCK_TESTSTEP(CheckProgressNotificationStep)
 	NEW_ESOCK_TESTSTEP(CheckNegativeProgressNotificationStep)
+	NEW_ESOCK_TESTSTEP(GetParameters_IntStep)	
 	return testStep;
 	}
 
--- a/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760645.ini	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760645.ini	Tue Apr 27 17:53:34 2010 +0300
@@ -57,11 +57,13 @@
 [MigrateToPreferredCarrier]
 MobilityExtName=MobExt1
 
-[RejectNewCarrier]
+[AcceptNewCarrier]
 MobilityExtName=MobExt1
 
-[AcceptNewCarrier]
-MobilityExtName=MobExt1
+[CheckNewIAP]
+ConnName=Conn1
+ParameterType=IAP\Id
+ParameterExpectedValue=5
 
 [CloseMobilityExtension]
 MobilityExtName=MobExt1
--- a/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760645.script	Wed Apr 14 17:14:05 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760645.script	Tue Apr 27 17:53:34 2010 +0300
@@ -23,6 +23,7 @@
 PRINT Simulate current AP going down,
 PRINT Receive PreferredCarierAvailable but no KLinkLayerClosed,
 PRINT Migration to the new AP,
+PRINT RConnection::GetParameters(IAP) to check the reported IAP is expected
 PRINT New AP goes down, reception of KLinkLayerClosed ,
 PRINT RCommsMobilityApiExt::Close()
 
@@ -84,6 +85,10 @@
 //Check we did not receive the Klinklayerclosed event
 RUN_TEST_STEP 100 te_esockteststepsSuite CheckNegativeProgressNotificationStep z:\testdata\configs\BearerMobility\Mobility_760645.ini CheckNegativeProgressNotificationEvent1 
 
+//Check IAP
+RUN_TEST_STEP 150 te_esockteststepsSuite GetParameters_IntStep z:\testdata\configs\BearerMobility\Mobility_760645.ini CheckNewIAP
+
+
 //Simulate the new access point going down and receive 
 RUN_TEST_STEP 150 te_esockteststepsSuite SetAccessPointAvailabilityStep z:\testdata\configs\BearerMobility\Mobility_760645.ini ChangeAvailabilityDownAp5