websrv_pub/web_service_connection_api/tsrc/WsStarMessageHandlerTester/src/WsStarMessageHandlerTesterBlocks.cpp
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:        ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 // [INCLUDE FILES] - do not remove
       
    27 #include <e32svr.h>
       
    28 #include <StifParser.h>
       
    29 #include <StifTestInterface.h>
       
    30 #include "WsStarMessageHandlerTester.h"
       
    31 #include <SenXmlUtils.h>
       
    32 
       
    33 // EXTERNAL DATA STRUCTURES
       
    34 //extern  ?external_data;
       
    35 
       
    36 // EXTERNAL FUNCTION PROTOTYPES  
       
    37 //extern ?external_function( ?arg_type,?arg_type );
       
    38 
       
    39 // CONSTANTS
       
    40 //const ?type ?constant_var = ?constant;
       
    41 
       
    42 // MACROS
       
    43 //#define ?macro ?macro_def
       
    44 #define LOCAL_ASSERT(expression)	{if(!(expression)){return KErrArgument;}}
       
    45 
       
    46 // LOCAL CONSTANTS AND MACROS
       
    47 //const ?type ?constant_var = ?constant;
       
    48 //#define ?macro_name ?macro_def
       
    49 
       
    50 // MODULE DATA STRUCTURES
       
    51 //enum ?declaration
       
    52 //typedef ?declaration
       
    53 
       
    54 // LOCAL FUNCTION PROTOTYPES
       
    55 //?type ?function_name( ?arg_type, ?arg_type );
       
    56 
       
    57 // FORWARD DECLARATIONS
       
    58 //class ?FORWARD_CLASSNAME;
       
    59 
       
    60 // ============================= LOCAL FUNCTIONS ===============================
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // ?function_name ?description.
       
    64 // ?description
       
    65 // Returns: ?value_1: ?description
       
    66 //          ?value_n: ?description_line1
       
    67 //                    ?description_line2
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 /*
       
    71 ?type ?function_name(
       
    72     ?arg_type arg,  // ?description
       
    73     ?arg_type arg)  // ?description
       
    74     {
       
    75 
       
    76     ?code  // ?comment
       
    77 
       
    78     // ?comment
       
    79     ?code
       
    80     }
       
    81 */
       
    82 
       
    83 // ============================ MEMBER FUNCTIONS ===============================
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CWsStarMessageHandlerTester::Delete
       
    87 // Delete here all resources allocated and opened from test methods. 
       
    88 // Called from destructor. 
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 void CWsStarMessageHandlerTester::Delete() 
       
    92     {
       
    93 
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CWsStarMessageHandlerTester::RunMethodL
       
    98 // Run specified method. Contains also table of test mothods and their names.
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 TInt CWsStarMessageHandlerTester::RunMethodL( 
       
   102     CStifItemParser& aItem ) 
       
   103     {
       
   104 
       
   105     static TStifFunctionInfo const KFunctions[] =
       
   106         {  
       
   107         // Copy this line for every implemented function.
       
   108         // First string is the function name used in TestScripter script file.
       
   109         // Second is the actual implementation member function. 
       
   110 		ENTRY("NewL-test_CWSStarAddressingHandler_NewL", MT_CWSStarAddressingHandler_NewLL),
       
   111 		ENTRY("InvokeL-test1_CWSStarAddressingHandler_InvokeL", MT_CWSStarAddressingHandler_InvokeL1L),
       
   112 		ENTRY("InvokeL-test2_CWSStarAddressingHandler_InvokeL", MT_CWSStarAddressingHandler_InvokeL2L),
       
   113 		ENTRY("InvokeL-test3_CWSStarAddressingHandler_InvokeL", MT_CWSStarAddressingHandler_InvokeL3L),
       
   114 		ENTRY("InvokeL-test4_CWSStarAddressingHandler_InvokeL", MT_CWSStarAddressingHandler_InvokeL4L),
       
   115 		ENTRY("InvokeL-test5_CWSStarAddressingHandler_InvokeL", MT_CWSStarAddressingHandler_InvokeL5L),
       
   116 		ENTRY("InvokeL-test6_CWSStarAddressingHandler_InvokeL", MT_CWSStarAddressingHandler_InvokeL6L),
       
   117 		ENTRY("Direction-test_CWSStarAddressingHandler_Direction", MT_CWSStarAddressingHandler_DirectionL),
       
   118 		ENTRY("Phase-test_CWSStarAddressingHandler_Phase", MT_CWSStarAddressingHandler_PhaseL),
       
   119 		ENTRY("InitL-test_CWSStarAddressingHandler_InitL", MT_CWSStarAddressingHandler_InitLL),
       
   120 		ENTRY("NewL-test_CWSStarEnveloperHandler_NewL", MT_CWSStarEnveloperHandler_NewLL),
       
   121 		ENTRY("InvokeL-test1_CWSStarEnveloperHandler_InvokeL", MT_CWSStarEnveloperHandler_InvokeL1L),
       
   122 		ENTRY("InvokeL-test2_CWSStarEnveloperHandler_InvokeL", MT_CWSStarEnveloperHandler_InvokeL2L),
       
   123 		ENTRY("Direction-test_CWSStarEnveloperHandler_Direction", MT_CWSStarEnveloperHandler_DirectionL),
       
   124 		ENTRY("Phase-test_CWSStarEnveloperHandler_Phase", MT_CWSStarEnveloperHandler_PhaseL),
       
   125 		ENTRY("InitL-test_CWSStarEnveloperHandler_InitL", MT_CWSStarEnveloperHandler_InitLL),
       
   126 		ENTRY("NewL-test_CWSStarCredentialCollectorHandler_NewL", MT_CWSStarCredentialCollectorHandler_NewLL),
       
   127 		ENTRY("InvokeL-test1_CWSStarCredentialCollectorHandler_InvokeL", MT_CWSStarCredentialCollectorHandler_InvokeL1L),
       
   128 		ENTRY("InvokeL-test2_CWSStarCredentialCollectorHandler_InvokeL", MT_CWSStarCredentialCollectorHandler_InvokeL2L),
       
   129 		ENTRY("InvokeL-test3_CWSStarCredentialCollectorHandler_InvokeL", MT_CWSStarCredentialCollectorHandler_InvokeL3L),
       
   130 		ENTRY("Direction-test_CWSStarCredentialCollectorHandler_Direction", MT_CWSStarCredentialCollectorHandler_DirectionL),
       
   131 		ENTRY("Phase-test_CWSStarCredentialCollectorHandler_Phase", MT_CWSStarCredentialCollectorHandler_PhaseL),
       
   132 		ENTRY("InitL-test_CWSStarCredentialCollectorHandler_InitL", MT_CWSStarCredentialCollectorHandler_InitLL),
       
   133 		ENTRY("NewL-test_CWSStarPassportHandler_NewL", MT_CWSStarPassportHandler_NewLL),
       
   134 		ENTRY("InvokeL-test1_CWSStarPassportHandler_InvokeL", MT_CWSStarPassportHandler_InvokeL1L),
       
   135 		ENTRY("InvokeL-test2_CWSStarPassportHandler_InvokeL", MT_CWSStarPassportHandler_InvokeL2L),
       
   136 		ENTRY("Direction-test_CWSStarPassportHandler_Direction", MT_CWSStarPassportHandler_DirectionL),
       
   137 		ENTRY("Phase-test_CWSStarPassportHandler_Phase", MT_CWSStarPassportHandler_PhaseL),
       
   138 		ENTRY("InitL-test_CWSStarPassportHandler_InitL", MT_CWSStarPassportHandler_InitLL),
       
   139 		ENTRY("NewL-test_CWSStarSecurityHandler_NewL", MT_CWSStarSecurityHandler_NewLL),
       
   140 		ENTRY("InvokeL-test1_CWSStarSecurityHandler_InvokeL", MT_CWSStarSecurityHandler_InvokeL1L),
       
   141 		ENTRY("InvokeL-test2_CWSStarSecurityHandler_InvokeL", MT_CWSStarSecurityHandler_InvokeL2L),
       
   142 		ENTRY("Direction-test_CWSStarSecurityHandler_Direction", MT_CWSStarSecurityHandler_DirectionL),
       
   143 		ENTRY("Phase-test_CWSStarSecurityHandler_Phase", MT_CWSStarSecurityHandler_PhaseL),
       
   144 		ENTRY("InitL-test_CWSStarSecurityHandler_InitL", MT_CWSStarSecurityHandler_InitLL),
       
   145 
       
   146         };
       
   147 
       
   148     const TInt count = sizeof( KFunctions ) / 
       
   149                         sizeof( TStifFunctionInfo );
       
   150 
       
   151     return RunInternalL( KFunctions, count, aItem );
       
   152 
       
   153     }
       
   154 
       
   155 void CWsStarMessageHandlerTester::SetupL()
       
   156     {
       
   157         if (iLogger!=NULL)
       
   158         {
       
   159             delete iLogger;
       
   160             iLogger = NULL;
       
   161         }
       
   162         iLogger = new (ELeave)RFileLogger();
       
   163         iLogger->Connect();
       
   164         iLogger->CreateLog(_L("CWsStarMessageHandlerTester"),_L("CWsStarMessageHandlerTester.log"),
       
   165                                                 EFileLoggingModeOverwrite);
       
   166         if ( iParser!= NULL )
       
   167         {
       
   168             delete iParser;
       
   169     	    iParser = NULL;
       
   170         }
       
   171         iParser = CSenXmlReader::NewL();
       
   172         User::LeaveIfNull(iParser);
       
   173 
       
   174         if ( iMessageContextOut!= NULL )
       
   175         {
       
   176             delete iMessageContextOut;
       
   177     	    iMessageContextOut = NULL;
       
   178         }
       
   179         iMessageContextOut = CWSStarMessageContext::NewL(SenContext::EOutgoing, iParser);
       
   180         User::LeaveIfNull(iMessageContextOut);
       
   181 
       
   182         if ( iMessageContextIn!= NULL )
       
   183         {
       
   184             delete iMessageContextIn;
       
   185     	    iMessageContextIn = NULL;
       
   186         }
       
   187         iMessageContextIn = CWSStarMessageContext::NewL(SenContext::EIncoming, iParser);
       
   188         User::LeaveIfNull(iMessageContextIn);
       
   189     }
       
   190 
       
   191 void CWsStarMessageHandlerTester::SetupAddressingL()
       
   192     {
       
   193         SetupL();
       
   194         if ( iHandler!= NULL )
       
   195         {
       
   196             delete iHandler;
       
   197     	    iHandler = NULL;
       
   198         }
       
   199         if ( iHandlerCtx!= NULL )
       
   200         {
       
   201             delete iHandlerCtx;
       
   202     	    iHandlerCtx = NULL;
       
   203         }
       
   204         iHandlerCtx = CWSStarHandlerContext::NewL();
       
   205         iHandlerCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   206         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*iHandlerCtx);
       
   207         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   208         iHandler = CWSStarAddressingHandler::NewL(param);
       
   209     }
       
   210 
       
   211 
       
   212 void CWsStarMessageHandlerTester::SetupEnveloperL()
       
   213     {
       
   214         SetupL();
       
   215         if ( iHandler!= NULL )
       
   216         {
       
   217             delete iHandler;
       
   218     	    iHandler = NULL;
       
   219         }
       
   220         if ( iHandlerCtx!= NULL )
       
   221         {
       
   222             delete iHandlerCtx;
       
   223     	    iHandlerCtx = NULL;
       
   224         }
       
   225         iHandlerCtx = CWSStarHandlerContext::NewL();
       
   226         iHandlerCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   227         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*iHandlerCtx);
       
   228         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   229         iHandler = CWSStarEnveloperHandler::NewL(param);
       
   230     }
       
   231 
       
   232 
       
   233 void CWsStarMessageHandlerTester::SetupCredentialCollectorL()
       
   234     {
       
   235         SetupL();
       
   236         if ( iHandler!= NULL )
       
   237         {
       
   238             delete iHandler;
       
   239     	    iHandler = NULL;
       
   240         }
       
   241         if ( iHandlerCtx!= NULL )
       
   242         {
       
   243             delete iHandlerCtx;
       
   244     	    iHandlerCtx = NULL;
       
   245         }
       
   246         iHandlerCtx = CWSStarHandlerContext::NewL();
       
   247         iHandlerCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   248         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*iHandlerCtx);
       
   249         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   250         iHandler = CWSStarCredentialCollectorHandler::NewL(param);
       
   251     }
       
   252 
       
   253 void CWsStarMessageHandlerTester::SetupPassportL()
       
   254     {
       
   255         SetupL();
       
   256         if ( iHandler!= NULL )
       
   257         {
       
   258             delete iHandler;
       
   259     	    iHandler = NULL;
       
   260         }
       
   261         if ( iHandlerCtx!= NULL )
       
   262         {
       
   263             delete iHandlerCtx;
       
   264     	    iHandlerCtx = NULL;
       
   265         }
       
   266         iHandlerCtx = CWSStarHandlerContext::NewL();
       
   267         iHandlerCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   268         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*iHandlerCtx);
       
   269         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   270         iHandler = CWSStarPassportHandler::NewL(param);
       
   271     }
       
   272 
       
   273 void CWsStarMessageHandlerTester::SetupSecurityL()
       
   274     {
       
   275         SetupL();
       
   276         if ( iHandler!= NULL )
       
   277         {
       
   278             delete iHandler;
       
   279     	    iHandler = NULL;
       
   280         }
       
   281         if ( iHandlerCtx!= NULL )
       
   282         {
       
   283             delete iHandlerCtx;
       
   284     	    iHandlerCtx = NULL;
       
   285         }
       
   286         iHandlerCtx = CWSStarHandlerContext::NewL();
       
   287         iHandlerCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   288         iHandler = CWSStarSecurityHandler::NewL(iHandlerCtx);
       
   289     }
       
   290 
       
   291 void CWsStarMessageHandlerTester::Teardown(  )
       
   292     {
       
   293         if (iHandler!= NULL)
       
   294         {
       
   295             delete iHandler;
       
   296             iHandler = NULL;
       
   297         }
       
   298         if (iHandlerCtx!=NULL)
       
   299         {
       
   300             delete iHandlerCtx;
       
   301             iHandlerCtx = NULL;
       
   302         }
       
   303         if ( iParser!= NULL )
       
   304         {
       
   305             delete iParser;
       
   306         	iParser = NULL;
       
   307         }
       
   308         if ( iMessageContextOut!= NULL )
       
   309         {
       
   310             delete iMessageContextOut;
       
   311         	iMessageContextOut = NULL;
       
   312         }
       
   313         if ( iMessageContextIn!= NULL )
       
   314         {
       
   315             delete iMessageContextIn;
       
   316     	    iMessageContextIn = NULL;
       
   317         }
       
   318         if (iLogger!=NULL)
       
   319         {
       
   320             iLogger->CloseLog();
       
   321             iLogger->Close();
       
   322             delete iLogger;
       
   323             iLogger = NULL;    
       
   324         }
       
   325     }
       
   326 
       
   327 
       
   328 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_NewLL(  )
       
   329     {
       
   330         CWSStarAddressingHandler* handler = NULL; 
       
   331         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   332         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   333         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   334         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   335         __ASSERT_ALWAYS_NO_LEAVE(handler = CWSStarAddressingHandler::NewL(param));
       
   336         TL(handler != (CWSStarAddressingHandler*)NULL);
       
   337         __ASSERT_ALWAYS_NO_LEAVE(delete handler);
       
   338         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   339         pCtx = NULL;
       
   340         handler = NULL;
       
   341         return KErrNone;
       
   342     }
       
   343 
       
   344 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_InvokeL1L()
       
   345     {
       
   346         SetupAddressingL();
       
   347         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP12);
       
   348         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   349         iMessageContextOut->Update(WSStarContextKeys::KTo,_L8("endpoint"));
       
   350         iMessageContextOut->Update(WSStarContextKeys::KAction,_L8("action"));
       
   351         iMessageContextOut->Update(WSStarContextKeys::KRelatesTo,_L8("relatesTo"));
       
   352         iMessageContextOut->Update(WSStarContextKeys::KFrom,_L8("from"));
       
   353         iMessageContextOut->Update(WSStarContextKeys::KReplyTo,_L8("replyTo"));
       
   354         iMessageContextOut->Update(WSStarContextKeys::KFaultTo,_L8("faultTo"));
       
   355         TL(iHandler->InvokeL(*iMessageContextOut)== KErrNone);
       
   356 
       
   357         message->SetReader(*iParser);
       
   358         message->BuildFrom(KFaultMessage12);
       
   359         iMessageContextIn->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   360         TL(iHandler->InvokeL(*iMessageContextIn) == KErrNone);
       
   361         LOCAL_ASSERT(iMessageContextIn->GetDesC8L(WSStarContextKeys::KTo)->Compare(_L8("endpoint"))==0);
       
   362         LOCAL_ASSERT(iMessageContextIn->GetDesC8L(WSStarContextKeys::KAction)->Compare(_L8("action"))==0);
       
   363         LOCAL_ASSERT(iMessageContextIn->GetDesC8L(WSStarContextKeys::KRelatesTo)->Compare(_L8("relatesTo"))==0);
       
   364         LOCAL_ASSERT(iMessageContextIn->GetDesC8L(WSStarContextKeys::KFrom)->Compare(_L8("from"))==0);
       
   365         LOCAL_ASSERT(iMessageContextIn->GetDesC8L(WSStarContextKeys::KReplyTo)->Compare(_L8("replyTo"))==0);
       
   366         LOCAL_ASSERT(iMessageContextIn->GetDesC8L(WSStarContextKeys::KFaultTo)->Compare(_L8("faultTo"))==0);
       
   367         LOCAL_ASSERT(*iMessageContextIn->GetIntL(WSStarSession::KErrorLayer) == WSStarSession::EAddressing);
       
   368         LOCAL_ASSERT(*iMessageContextIn->GetIntL(WSStarContextKeys::KRetryAfter) == 500);
       
   369         
       
   370         iMessageContextOut->Reset();
       
   371         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   372         Teardown();
       
   373         return KErrNone;
       
   374     }
       
   375 
       
   376 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_InvokeL2L()
       
   377     {
       
   378     	SetupAddressingL();
       
   379         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP12);
       
   380         TL(iHandler->InvokeL(*iMessageContextOut)== KErrNotFound);
       
   381         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   382         TL(iHandler->InvokeL(*iMessageContextOut)== KErrNotFound);
       
   383         iMessageContextOut->Update(WSStarContextKeys::KTo,_L8("endpoint"));
       
   384         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNotFound);
       
   385         iMessageContextOut->Update(WSStarContextKeys::KAction,_L8("action"));
       
   386         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   387         TL(*iMessageContextOut->GetDesC8L(WSStarContextKeys::KReplyTo) == WSStarAddressing::KReplyToAnonymous200508);
       
   388         CSenElement& body = message->BodyL();
       
   389         CSenElement& applies = body.AddElementL(WSPolicy::KPolicyNamespace200409,
       
   390                                                         WSPolicy::KAppliesToTag,
       
   391                                                         WSPolicy::KAppliesToQTag);
       
   392         SenXmlUtils::AddAttributeL(applies, WSStarContextKeys::KAddressAttrMark, _L8("appliesTo"));
       
   393         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   394         iMessageContextOut->Reset();
       
   395         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   396         Teardown();
       
   397         return KErrNone;
       
   398         }
       
   399 
       
   400 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_InvokeL3L()
       
   401     {
       
   402     	SetupAddressingL();
       
   403         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP11);
       
   404         message->SetReader(*iParser);
       
   405         message->BuildFrom(KFaultMessage11);
       
   406         iMessageContextIn->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   407         TL(iHandler->InvokeL(*iMessageContextIn) == KErrNone);
       
   408         LOCAL_ASSERT(*iMessageContextIn->GetIntL(WSStarSession::KErrorLayer) == WSStarSession::EAddressing);
       
   409         iMessageContextIn->Reset();
       
   410         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   411         Teardown();
       
   412         return KErrNone;
       
   413     }
       
   414 
       
   415 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_InvokeL4L()
       
   416     {
       
   417     	SetupAddressingL();
       
   418         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP11);
       
   419         message->SetReader(*iParser);
       
   420         message->BuildFrom(KFaultMessage11_1);
       
   421         iMessageContextIn->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   422         TL(iHandler->InvokeL(*iMessageContextIn) == KErrNone);
       
   423         LOCAL_ASSERT(*iMessageContextIn->GetIntL(WSStarSession::KErrorLayer) == WSStarSession::EAddressing);
       
   424         iMessageContextIn->Reset();
       
   425         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   426         Teardown();
       
   427         return KErrNone;
       
   428     }
       
   429 
       
   430 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_InvokeL5L()
       
   431     {
       
   432     	SetupAddressingL();
       
   433         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP11);
       
   434         message->SetReader(*iParser);
       
   435         message->BuildFrom(KFaultMessage11_2);
       
   436         iMessageContextIn->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   437         TL(iHandler->InvokeL(*iMessageContextIn) == KErrNone);
       
   438         LOCAL_ASSERT(*iMessageContextIn->GetIntL(WSStarSession::KErrorLayer) == WSStarSession::EAddressing);
       
   439         iMessageContextIn->Reset();
       
   440         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   441         Teardown();
       
   442         return KErrNone;
       
   443     }
       
   444 
       
   445 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_InvokeL6L()
       
   446     {
       
   447     	SetupAddressingL();
       
   448         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP11);
       
   449         message->SetReader(*iParser);
       
   450         message->BuildFrom(KFaultMessage11_3);
       
   451         iMessageContextIn->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   452         TL(iHandler->InvokeL(*iMessageContextIn) == KErrNone);
       
   453         LOCAL_ASSERT(*iMessageContextIn->GetIntL(WSStarSession::KErrorLayer) == WSStarSession::EAddressing);
       
   454         iMessageContextIn->Reset();
       
   455         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   456         Teardown();
       
   457         return KErrNone;
       
   458     }
       
   459 
       
   460 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_DirectionL(  )
       
   461     {
       
   462     	SetupAddressingL();
       
   463         LOCAL_ASSERT(iHandler->Direction() == SenHandler::EBoth);
       
   464         Teardown();
       
   465         return KErrNone;
       
   466     }
       
   467 
       
   468 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_PhaseL(  )
       
   469     {
       
   470     	SetupAddressingL();
       
   471         LOCAL_ASSERT(iHandler->Phase() == SenHandler::EMessage);
       
   472         Teardown();
       
   473         return KErrNone;
       
   474     }
       
   475 
       
   476 TInt CWsStarMessageHandlerTester::MT_CWSStarAddressingHandler_InitLL(  )
       
   477     {
       
   478         SetupAddressingL();  
       
   479         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   480         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   481         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   482         __ASSERT_ALWAYS_NO_LEAVE(iHandler->InitL(hCtx));
       
   483         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   484         pCtx = NULL;
       
   485         Teardown();
       
   486         return KErrNone;
       
   487     }
       
   488 
       
   489 //enveloper
       
   490 
       
   491 
       
   492 TInt CWsStarMessageHandlerTester::MT_CWSStarEnveloperHandler_NewLL(  )
       
   493     {
       
   494     	SetupEnveloperL();
       
   495         CWSStarEnveloperHandler* handler = NULL; 
       
   496         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   497         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   498         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   499         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   500         __ASSERT_ALWAYS_NO_LEAVE(handler = CWSStarEnveloperHandler::NewL(param));
       
   501         TL(handler != (CWSStarEnveloperHandler*)NULL);
       
   502         __ASSERT_ALWAYS_NO_LEAVE(delete handler);
       
   503         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   504         pCtx = NULL;
       
   505         handler = NULL;
       
   506         Teardown();
       
   507         return KErrNone;
       
   508     }
       
   509 
       
   510 TInt CWsStarMessageHandlerTester::MT_CWSStarEnveloperHandler_InvokeL1L()
       
   511     {
       
   512     	SetupEnveloperL();
       
   513         iMessageContextOut->Update(WSStarContextKeys::KSoapVersion,ESOAP11);
       
   514         iHandlerCtx->Update(HandlerContextKey::KVersion,KSecurityXmlNs);
       
   515         CSenBaseElement* element = CSenBaseElement::NewL(_L8("elementBody")); 
       
   516         iMessageContextOut->Update(WSStarContextKeys::KBodyElement,element);
       
   517         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   518 
       
   519         CSenSoapMessage* message = iMessageContextOut->GetCurrentSoapMessage();
       
   520         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   521         iMessageContextOut->Reset();
       
   522         Teardown();
       
   523         return KErrNone;
       
   524     }
       
   525 
       
   526 TInt CWsStarMessageHandlerTester::MT_CWSStarEnveloperHandler_InvokeL2L()
       
   527     {
       
   528     	SetupEnveloperL();
       
   529         iHandlerCtx->Update(HandlerContextKey::KVersion,KSecuritySchemeXmlNs);
       
   530         iMessageContextOut->Update(WSStarContextKeys::KBody,_L8("body content"));
       
   531         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   532 
       
   533         CSenSoapMessage* message = iMessageContextOut->GetCurrentSoapMessage();
       
   534 
       
   535         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   536         iMessageContextOut->Reset();
       
   537         Teardown();
       
   538         return KErrNone;
       
   539     }
       
   540 
       
   541 TInt CWsStarMessageHandlerTester::MT_CWSStarEnveloperHandler_DirectionL(  )
       
   542     {
       
   543     	SetupEnveloperL();
       
   544         LOCAL_ASSERT(iHandler->Direction() == SenHandler::EOutgoing);
       
   545         Teardown();
       
   546         return KErrNone;
       
   547     }
       
   548 
       
   549 TInt CWsStarMessageHandlerTester::MT_CWSStarEnveloperHandler_PhaseL(  )
       
   550     {
       
   551     	SetupEnveloperL();
       
   552         LOCAL_ASSERT(iHandler->Phase() == SenHandler::EMessage);
       
   553         Teardown();
       
   554         return KErrNone;
       
   555     }
       
   556 
       
   557 TInt CWsStarMessageHandlerTester::MT_CWSStarEnveloperHandler_InitLL(  )
       
   558     {
       
   559     	SetupEnveloperL();
       
   560         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   561         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   562         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   563         __ASSERT_ALWAYS_NO_LEAVE(iHandler->InitL(hCtx));
       
   564         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   565         pCtx = NULL;
       
   566         Teardown();
       
   567         return KErrNone;        
       
   568     }
       
   569 
       
   570 //credential collector
       
   571 
       
   572 
       
   573 TInt CWsStarMessageHandlerTester::MT_CWSStarCredentialCollectorHandler_NewLL(  )
       
   574     {
       
   575     	SetupCredentialCollectorL();
       
   576         CWSStarCredentialCollectorHandler* handler = NULL; 
       
   577         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   578         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   579         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   580         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   581         __ASSERT_ALWAYS_NO_LEAVE(handler = CWSStarCredentialCollectorHandler::NewL(param));
       
   582         TL(handler != (CWSStarCredentialCollectorHandler*)NULL);
       
   583         __ASSERT_ALWAYS_NO_LEAVE(delete handler);
       
   584         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   585         pCtx = NULL;
       
   586         handler = NULL;
       
   587         Teardown();
       
   588         return KErrNone;
       
   589     }
       
   590 
       
   591 TInt CWsStarMessageHandlerTester::MT_CWSStarCredentialCollectorHandler_InvokeL1L()
       
   592     {
       
   593     	SetupCredentialCollectorL();
       
   594         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP12);
       
   595         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   596         iMessageContextOut->Update(WSStarContextKeys::KSecurityToken,_L8("security token"));
       
   597         iMessageContextOut->Update(WSStarContextKeys::KTimestampCreated,_L8("2007-02-22T15:30:00Z"));
       
   598         iMessageContextOut->Update(WSStarContextKeys::KTimestampExpires,_L8("timestamp expired"));
       
   599         iMessageContextOut->Update(WSStarContextKeys::KPhoneTimeWhenMTResolved,_L8("2007-02-22T15:31:00Z"));
       
   600         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   601         iMessageContextOut->Reset();
       
   602         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   603         Teardown();
       
   604         return KErrNone;
       
   605     }
       
   606 
       
   607 TInt CWsStarMessageHandlerTester::MT_CWSStarCredentialCollectorHandler_InvokeL2L()
       
   608     {
       
   609     	SetupCredentialCollectorL();
       
   610         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP12);
       
   611         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   612         iMessageContextOut->Update(WSStarContextKeys::KSecurityToken,_L8("security token"));
       
   613         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   614 
       
   615         iMessageContextOut->Reset();
       
   616         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   617         Teardown();
       
   618         return KErrNone;
       
   619     }
       
   620 
       
   621 TInt CWsStarMessageHandlerTester::MT_CWSStarCredentialCollectorHandler_InvokeL3L()
       
   622     {
       
   623     	SetupCredentialCollectorL();
       
   624         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP12);
       
   625         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNotFound);
       
   626         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   627         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   628 
       
   629         iMessageContextOut->Reset();
       
   630         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   631         Teardown();
       
   632         return KErrNone;
       
   633     }
       
   634 
       
   635 TInt CWsStarMessageHandlerTester::MT_CWSStarCredentialCollectorHandler_DirectionL(  )
       
   636     {
       
   637     	SetupCredentialCollectorL();
       
   638         LOCAL_ASSERT(iHandler->Direction() == SenHandler::EOutgoing);
       
   639         Teardown();
       
   640         return KErrNone;
       
   641     }
       
   642 
       
   643 TInt CWsStarMessageHandlerTester::MT_CWSStarCredentialCollectorHandler_PhaseL(  )
       
   644     {
       
   645     	SetupCredentialCollectorL();
       
   646         LOCAL_ASSERT(iHandler->Phase() == SenHandler::EMessage);
       
   647         Teardown();
       
   648         return KErrNone;    
       
   649     }
       
   650 
       
   651 TInt CWsStarMessageHandlerTester::MT_CWSStarCredentialCollectorHandler_InitLL(  )
       
   652     {
       
   653     	SetupCredentialCollectorL();
       
   654         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   655         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   656         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   657         __ASSERT_ALWAYS_NO_LEAVE(iHandler->InitL(hCtx));
       
   658         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   659         pCtx = NULL;
       
   660         Teardown();
       
   661         return KErrNone;
       
   662     }
       
   663 
       
   664 //passport
       
   665 
       
   666 
       
   667 TInt CWsStarMessageHandlerTester::MT_CWSStarPassportHandler_NewLL(  )
       
   668     {
       
   669     	SetupPassportL();
       
   670         CWSStarPassportHandler* handler = NULL; 
       
   671         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   672         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   673         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   674         TAny* param = reinterpret_cast<TAny*>(&hCtx);
       
   675         __ASSERT_ALWAYS_NO_LEAVE(handler = CWSStarPassportHandler::NewL(param));
       
   676         TL(handler != (CWSStarPassportHandler*)NULL);
       
   677         __ASSERT_ALWAYS_NO_LEAVE(delete handler);
       
   678         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   679         pCtx = NULL;
       
   680         handler = NULL;
       
   681         Teardown();
       
   682         return KErrNone;
       
   683     }
       
   684 
       
   685 TInt CWsStarMessageHandlerTester::MT_CWSStarPassportHandler_InvokeL1L()
       
   686     {
       
   687     	SetupPassportL();
       
   688         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP11);
       
   689         CSenElement& body = message->BodyL();
       
   690         body.AddElementL(WSStarContextKeys::KMultiReqTagMark);
       
   691         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   692         iMessageContextOut->Update(WSStarContextKeys::KPassportEnabled,ETrue);
       
   693         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   694 
       
   695         __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   696         iMessageContextOut->Reset();
       
   697         Teardown();
       
   698         return KErrNone;
       
   699     }
       
   700 
       
   701 TInt CWsStarMessageHandlerTester::MT_CWSStarPassportHandler_InvokeL2L()
       
   702     {
       
   703     	SetupPassportL();
       
   704         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNotFound);
       
   705         iMessageContextOut->Reset();
       
   706         Teardown();
       
   707         return KErrNone;
       
   708     }
       
   709 
       
   710 TInt CWsStarMessageHandlerTester::MT_CWSStarPassportHandler_DirectionL(  )
       
   711     {
       
   712     	SetupPassportL();
       
   713         LOCAL_ASSERT(iHandler->Direction() == SenHandler::EOutgoing);
       
   714         Teardown();
       
   715         return KErrNone;
       
   716     }
       
   717 
       
   718 TInt CWsStarMessageHandlerTester::MT_CWSStarPassportHandler_PhaseL(  )
       
   719     {
       
   720     	SetupPassportL();
       
   721         LOCAL_ASSERT(iHandler->Phase() == SenHandler::EMessage);
       
   722         Teardown();
       
   723         return KErrNone;
       
   724     }
       
   725 
       
   726 TInt CWsStarMessageHandlerTester::MT_CWSStarPassportHandler_InitLL(  )
       
   727     {
       
   728     	SetupPassportL();
       
   729         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   730         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   731         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   732         __ASSERT_ALWAYS_NO_LEAVE(iHandler->InitL(hCtx));
       
   733         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   734         pCtx = NULL;
       
   735         Teardown();
       
   736         return KErrNone;    
       
   737     }
       
   738 
       
   739 //security
       
   740 
       
   741 
       
   742 TInt CWsStarMessageHandlerTester::MT_CWSStarSecurityHandler_NewLL(  )
       
   743     {
       
   744     	SetupSecurityL();
       
   745         CWSStarSecurityHandler* handler = NULL; 
       
   746         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   747         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   748         __ASSERT_ALWAYS_NO_LEAVE(handler = CWSStarSecurityHandler::NewL(pCtx));
       
   749         TL(handler != (CWSStarSecurityHandler*)NULL);
       
   750         __ASSERT_ALWAYS_NO_LEAVE(delete handler);
       
   751         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   752         pCtx = NULL;
       
   753         handler = NULL;
       
   754         Teardown();
       
   755         return KErrNone;
       
   756     }
       
   757 
       
   758 TInt CWsStarMessageHandlerTester::MT_CWSStarSecurityHandler_InvokeL1L()
       
   759     {
       
   760     	SetupSecurityL();
       
   761         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP12);
       
   762         CSenElement& header = message->HeaderL();
       
   763         CSenElement& security = header.AddElementL(_L8("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"),
       
   764                                                    _L8("Security"),
       
   765                                                    _L8("wsse"));  
       
   766         security.AddElementL(_L8("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"),
       
   767                              _L8("Timestamp"),
       
   768                              _L8("wsu"));
       
   769         CSenElement& body = message->BodyL();
       
   770         iMessageContextOut->Update(WSStarContextKeys::KPOPBase64,_L8("WmPjJkStecgGm0SlT7ORuQ=="));
       
   771         iMessageContextOut->Update(WSStarContextKeys::KBinaryType,WSStarContextValues::KPOPTypeSimmetric);
       
   772         iMessageContextOut->Update(WSStarContextKeys::KSTR,
       
   773                                    _L8("<wsse:SecurityTokenReference xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\"><wsse:KeyIdentifier ValueType=\"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID\">uuid-8222b7a2-3874-4884-bdb5-9c2ddd4b86b5-16</wsse:KeyIdentifier></wsse:SecurityTokenReference>"));
       
   774         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   775         iMessageContextOut->SetOwnedEnvelope();
       
   776         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   777 
       
   778 //        __ASSERT_ALWAYS_NO_LEAVE(delete message);
       
   779         iMessageContextOut->Reset();
       
   780         Teardown();
       
   781         return KErrNone;
       
   782     }
       
   783 
       
   784 TInt CWsStarMessageHandlerTester::MT_CWSStarSecurityHandler_InvokeL2L()
       
   785     {
       
   786     	SetupSecurityL();
       
   787         CSenSoapMessage* message = CSenSoapMessage::NewL(ESOAP12);
       
   788         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   789         iMessageContextOut->Update(WSStarContextKeys::KPOPBase64,_L8("abcd!%@"));
       
   790         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   791         iMessageContextOut->Update(WSStarContextKeys::KPOPBase64,_L8("WmPjJkStecgGm0SlT7ORuQ=="));
       
   792         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   793         iMessageContextOut->SetOwnedEnvelope();
       
   794         iMessageContextOut->Add(SenContext::KSenCurrentSoapMessageCtxKey,message);
       
   795         iMessageContextOut->Update(WSStarContextKeys::KBinaryType,_L8("adcedf"));
       
   796         *((RPointerArray<HBufC8>*)iMessageContextOut->GetAnyL(WSStarContextKeys::KSignedPartsArray)) = 	
       
   797                 iSignedParts;	//codescannerwarnings
       
   798         TL(iHandler->InvokeL(*iMessageContextOut) == KErrNone);
       
   799         CSenElement& body = message->BodyL();
       
   800         body.AddNamespaceL(_L8("wsu"),_L8("abscderf"));
       
   801         SenXmlUtils::AddAttributeL(body, _L8("wsu:qqq"), _L8("qqq"));
       
   802         //EUNIT_ASSERT_SPECIFIC_LEAVE(iHandler->InvokeL(*iMessageContextOut), KErrCorrupt);
       
   803         TRAPD(leave, iHandler->InvokeL(*iMessageContextOut));
       
   804         if(leave != KErrCorrupt)
       
   805         	User::Leave(KErrGeneral);
       
   806         
       
   807         iMessageContextOut->Reset();
       
   808         Teardown();
       
   809         return KErrNone;
       
   810     }
       
   811 
       
   812 TInt CWsStarMessageHandlerTester::MT_CWSStarSecurityHandler_DirectionL(  )
       
   813     {
       
   814     	SetupSecurityL();
       
   815         LOCAL_ASSERT(iHandler->Direction() == SenHandler::EBoth);
       
   816         Teardown();
       
   817         return KErrNone;
       
   818     }
       
   819 
       
   820 TInt CWsStarMessageHandlerTester::MT_CWSStarSecurityHandler_PhaseL(  )
       
   821     {
       
   822     	SetupSecurityL();
       
   823         LOCAL_ASSERT(iHandler->Phase() == SenHandler::EMessage);
       
   824         Teardown();
       
   825         return KErrNone;
       
   826     }
       
   827 
       
   828 TInt CWsStarMessageHandlerTester::MT_CWSStarSecurityHandler_InitLL(  )
       
   829     {
       
   830     	SetupSecurityL();
       
   831         CWSStarHandlerContext* pCtx = CWSStarHandlerContext::NewL();
       
   832         pCtx->Add(HandlerContextKey::KLogger(), iLogger);
       
   833         MSenHandlerContext& hCtx = (MSenHandlerContext&)(*pCtx);
       
   834         __ASSERT_ALWAYS_NO_LEAVE(iHandler->InitL(hCtx));
       
   835         __ASSERT_ALWAYS_NO_LEAVE(delete pCtx);
       
   836         pCtx = NULL;
       
   837         Teardown();
       
   838         return KErrNone;    
       
   839     }
       
   840 
       
   841 
       
   842 // -----------------------------------------------------------------------------
       
   843 // CWsStarMessageHandlerTester::?member_function
       
   844 // ?implementation_description
       
   845 // (other items were commented in a header).
       
   846 // -----------------------------------------------------------------------------
       
   847 //
       
   848 /*
       
   849 TInt CWsStarMessageHandlerTester::?member_function(
       
   850    CItemParser& aItem )
       
   851    {
       
   852 
       
   853    ?code
       
   854 
       
   855    }
       
   856 */
       
   857 
       
   858 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   859 // None
       
   860 
       
   861 //  [End of File] - Do not remove