datacommsserver/esockserver/test/te_mecunittest/src/mectest054step.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 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 //
       
    15 // mectest054step.cpp
       
    16 //
       
    17 
       
    18 /**
       
    19 @file
       
    20 */
       
    21 
       
    22 #include "mectest054step.h"
       
    23 #include "testextensions.h"
       
    24 #include "metaextensioncontainerspy.h"
       
    25 #include <comms-infras/ss_rmetaextensioncontainer.h>
       
    26 #include <comms-infras/ss_commsprov.h>
       
    27 
       
    28 using namespace ESock;
       
    29 
       
    30 CMecTest054Step::~CMecTest054Step()
       
    31     {
       
    32     }
       
    33 
       
    34 
       
    35 /**
       
    36 //! @SYMTestCaseID      MEC_UNIT_TEST_054
       
    37 //! @SYMTestCaseDesc 	Container Merging Test, Open container, append extensions, then append a container
       
    38 //! @SYMFssID 			COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest
       
    39 //! @SYMTestActions 	1) Open container cont1
       
    40 //						2) AppendExtension T1.1 to cont1
       
    41 //						3) AppendExtension T2.1 to cont1
       
    42 //						4) Open container mergeMec
       
    43 //						5) AppendExtension T2.2 to mergeMec
       
    44 //						5) AppendExtension T3.1 to mergeMec
       
    45 //						8) AppendContainerL cont1  to mergeMec
       
    46 //						9) mergeMec container count == 2
       
    47 //						11) Find Extension T1 == T1.1
       
    48 //						12) Find Extension T2 == T2.1
       
    49 //						13) Find Extension T3 == T3.1
       
    50 //						14) Close
       
    51 //! @SYMTestExpectedResults  KErrNone.
       
    52 */
       
    53 TVerdict CMecTest054Step::RunTestStepL()
       
    54     {
       
    55     TVerdict result = EFail;
       
    56     
       
    57     RMetaExtensionContainer container1;
       
    58     container1.Open();
       
    59     CleanupClosePushL(container1);
       
    60     CreateAndAppendExtensionL(container1, TTestExtension1::ETypeId, KExtVersion1);
       
    61     CreateAndAppendExtensionL(container1, TTestExtension2::ETypeId, KExtVersion1);
       
    62 
       
    63     
       
    64     RMetaExtensionContainer mergeMec;
       
    65     mergeMec.Open();
       
    66     CleanupClosePushL(mergeMec);
       
    67     
       
    68     CreateAndAppendExtensionL(mergeMec, TTestExtension2::ETypeId, KExtVersion2);
       
    69     CreateAndAppendExtensionL(mergeMec, TTestExtension3::ETypeId, KExtVersion1);
       
    70     
       
    71     mergeMec.AppendContainerL(container1);
       
    72     
       
    73     ESock::CMetaExtensionContainerArray* mergeMecImpl = TMetaExtensionContainerSpy::AppendableContainerArray(mergeMec);
       
    74     if (mergeMecImpl && TMetaExtensionContainerSpy::ContainerCount(*mergeMecImpl) == 2)
       
    75     	{
       
    76 		const TTestExtension1* ext1 = static_cast<const TTestExtension1*>(mergeMec.FindExtension(TTestExtension1::TypeId()));
       
    77 		const TTestExtension2* ext2 = static_cast<const TTestExtension2*>(mergeMec.FindExtension(TTestExtension2::TypeId()));
       
    78 		const TTestExtension3* ext3 = static_cast<const TTestExtension3*>(mergeMec.FindExtension(TTestExtension3::TypeId()));
       
    79 		if (ext1 && ext1->GetTypeId() == TTestExtension1::TypeId() && ext1->iVersion == KExtVersion1
       
    80 			&& ext2 && ext2->GetTypeId() == TTestExtension2::TypeId() && ext2->iVersion == KExtVersion1
       
    81 			&& ext3 && ext3->GetTypeId() == TTestExtension3::TypeId() && ext3->iVersion == KExtVersion1)
       
    82 			{
       
    83 			result = EPass;
       
    84 			}
       
    85     	}
       
    86 	
       
    87     CleanupStack::PopAndDestroy(&mergeMec);
       
    88     CleanupStack::PopAndDestroy(&container1);
       
    89     return result;
       
    90     }
       
    91