datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp
branchRCL_3
changeset 15 51722b10598b
parent 13 0b0e9fce0b58
child 17 9ddb1d67ebaf
equal deleted inserted replaced
14:4ccf8e394726 15:51722b10598b
    20 #include "SubConnections.TestSteps.h"
    20 #include "SubConnections.TestSteps.h"
    21 #include "Connections.TestSteps.h"
    21 #include "Connections.TestSteps.h"
    22 #include "SocketServer.TestSteps.h"
    22 #include "SocketServer.TestSteps.h"
    23 #include "Sockets.TestSteps.h"
    23 #include "Sockets.TestSteps.h"
    24 #include <cdbcols.h>
    24 #include <cdbcols.h>
       
    25 #include <commsdattypeinfov1_1.h>
       
    26 #include <comms-infras/es_commsdataobject.h>
       
    27 #include <comms-infras/connectionqueryset.h>
    25 
    28 
    26 
    29 
    27 #ifdef _DEBUG
    30 #ifdef _DEBUG
    28 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    31 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    29 // (if it could happen through user error then you should give it an explicit, documented, category + code)
    32 // (if it could happen through user error then you should give it an explicit, documented, category + code)
  1203 
  1206 
  1204 	return EPass;
  1207 	return EPass;
  1205 	}
  1208 	}
  1206 
  1209 
  1207 
  1210 
  1208 
  1211 // GetParameters_Int
       
  1212 //-------------------------------
       
  1213 
       
  1214 CGetParameters_IntStep::CGetParameters_IntStep(CCEsockTestBase*& aEsockTest)
       
  1215 :   CTe_EsockStepBase(aEsockTest)
       
  1216     {
       
  1217     SetTestStepName(KGetParameters_IntStep);
       
  1218     }
       
  1219 
       
  1220 TInt CGetParameters_IntStep::ConfigureFromIni()
       
  1221     {
       
  1222     // Read in appropriate fields
       
  1223     if((GetStringFromConfig(iSection, KTe_ConnectionName, iConnectionName) != 1)
       
  1224         || (iConnectionName.Length() == 0))
       
  1225         {
       
  1226         INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
       
  1227         return KErrNotFound;
       
  1228         }
       
  1229 
       
  1230     if((GetStringFromConfig(iSection, KTe_ParameterType, iFieldName) != 1)
       
  1231         || (iFieldName.Length() == 0))
       
  1232         {
       
  1233         INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
       
  1234         return KErrNotFound;
       
  1235         }
       
  1236     _LIT(KIapTableIdDes, "IAP\\Id" );
       
  1237     if (iFieldName.Compare(KIapTableIdDes) == 0)
       
  1238         {
       
  1239         iRecordTypeId = CommsDat::KCDTIdIAPRecord | CommsDat::KCDTIdRecordTag;
       
  1240         }
       
  1241     /*else
       
  1242      * Don't get too angry, but so far, this generic looking test step only does IAP
       
  1243      * There are nice arrays in CED that can be used to address any field. If you're
       
  1244      * desperate, please pull them in and modify this test step to be able to retrieve
       
  1245      * any field 
       
  1246      */
       
  1247 
       
  1248     if(!GetIntFromConfig(iSection, KTe_ParameterExpectedValue, iExpectedValue))
       
  1249         {
       
  1250         INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
       
  1251         return KErrNotFound;
       
  1252         }
       
  1253     
       
  1254     return KErrNone;
       
  1255     }
       
  1256 
       
  1257 
       
  1258 TVerdict CGetParameters_IntStep::doSingleTestStep()
       
  1259     {
       
  1260     TInt ret = KErrNone;
       
  1261     ESock::XConnectionQuerySet* querySet = NULL;
       
  1262     TRAP(ret, querySet = ESock::XConnectionQuerySet::NewL() );
       
  1263    
       
  1264     if ( ret == KErrNone )
       
  1265         {
       
  1266         TRAP(ret, ESock::XUintQuery::NewL(iRecordTypeId, *querySet) );
       
  1267         }
       
  1268     ESock::CConnectionQuerySet* connectionQuerySet = NULL;
       
  1269     if ( ret == KErrNone )
       
  1270         {
       
  1271         TRAP(ret, connectionQuerySet = ESock::CConnectionQuerySet::NewL(querySet) );
       
  1272         }    
       
  1273     
       
  1274     if( (ret = iEsockTest->GetParameters(iConnectionName, *connectionQuerySet)) != KErrNone)
       
  1275         {
       
  1276         INFO_PRINTF2(_L("RConnection::GetParameters returned %d"), ret);
       
  1277         SetTestStepError(ret);
       
  1278         return EFail;
       
  1279         }
       
  1280 
       
  1281     ESock::XConnectionQuerySet& outputQuerySet = connectionQuerySet->DataObject();
       
  1282     ESock::XUintQuery* iapTableIdQuery = static_cast<ESock::XUintQuery*>(outputQuerySet.FindQuery( iRecordTypeId ));
       
  1283     __ASSERT_DEBUG(iapTableIdQuery, User::Panic(KSpecAssert_ESockTestCnctnsT, 2));
       
  1284     if (iapTableIdQuery->Error() != KErrNone)
       
  1285         {
       
  1286         INFO_PRINTF2(_L("RConnection::GetParameters Int query returned (%d)"), iapTableIdQuery->Error());
       
  1287         SetTestStepError(KErrCorrupt);
       
  1288         return EFail;        
       
  1289         }
       
  1290     
       
  1291     if (iapTableIdQuery->Data() != iExpectedValue)
       
  1292         {
       
  1293         INFO_PRINTF3(_L("RConnection::GetParameters Int query returned (%d) something else than expected (%d)"), iapTableIdQuery->Data(), iExpectedValue);
       
  1294         SetTestStepError(KErrCorrupt);
       
  1295         return EFail;        
       
  1296         }
       
  1297     
       
  1298     /*Just out of justified paranoia, we're extracting the same field using RConnection::GetIntSetting*/
       
  1299     TUint32 aValue;
       
  1300     iEsockTest->GetIntSetting(iConnectionName, iFieldName, aValue);
       
  1301     if (aValue != iExpectedValue)
       
  1302         {
       
  1303         INFO_PRINTF3(_L("RConnection::GetIntSetting returned (%d) something else than expected (%d)"), aValue, iExpectedValue);
       
  1304         SetTestStepError(KErrCorrupt);
       
  1305         return EFail;        
       
  1306         }
       
  1307            
       
  1308     return EPass;
       
  1309     }
       
  1310