datacommsserver/esockserver/test/te_mecunittest/src/mectest053step.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 // mectest053step.cpp
       
    16 //
       
    17 
       
    18 /**
       
    19 @file
       
    20 */
       
    21 
       
    22 #include "mectest053step.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 CMecTest053Step::~CMecTest053Step()
       
    31     {
       
    32     }
       
    33 
       
    34 
       
    35 /**
       
    36 //! @SYMTestCaseID      MEC_UNIT_TEST_053
       
    37 //! @SYMTestCaseDesc 	Container Merging Test, Open container, append container, then override extension, then append another 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 cont2
       
    43 //						5) AppendExtension T3.1 to cont2
       
    44 //						6) AppendExtension T2.2 to cont2
       
    45 //						7) Open container mergeMec
       
    46 //						8) AppendContainerL cont1 to mergeMec
       
    47 //						10) mergeMec container count == 1
       
    48 //						11) AppendExtension T3.2 to mergeMec
       
    49 //						12) mergeMec container count == 2
       
    50 //						13) AppendContainerL cont2 to mergeMec
       
    51 //						14) mergeMec container count == 3
       
    52 //						15) Find Extension T1 == T1.1
       
    53 //						16) Find Extension T2 == T2.2
       
    54 //						17) Find Extension T3 == T3.1
       
    55 //						18) Close
       
    56 //! @SYMTestExpectedResults  KErrNone.
       
    57 */
       
    58 TVerdict CMecTest053Step::RunTestStepL()
       
    59     {
       
    60     TVerdict result = EFail;
       
    61     
       
    62     RMetaExtensionContainer container1;
       
    63     container1.Open();
       
    64     CleanupClosePushL(container1);
       
    65     CreateAndAppendExtensionL(container1, TTestExtension1::ETypeId, KExtVersion1);
       
    66     CreateAndAppendExtensionL(container1, TTestExtension2::ETypeId, KExtVersion1);
       
    67 
       
    68     RMetaExtensionContainer container2;
       
    69     container2.Open();
       
    70     CleanupClosePushL(container2);
       
    71     CreateAndAppendExtensionL(container2, TTestExtension3::ETypeId, KExtVersion1);
       
    72     CreateAndAppendExtensionL(container2, TTestExtension2::ETypeId, KExtVersion2);
       
    73     
       
    74     RMetaExtensionContainer mergeMec;
       
    75     mergeMec.Open();
       
    76     CleanupClosePushL(mergeMec);
       
    77     
       
    78     mergeMec.AppendContainerL(container1);
       
    79 
       
    80     ESock::CMetaExtensionContainerArray* mergeMecImpl = TMetaExtensionContainerSpy::AppendableContainerArray(mergeMec);
       
    81     if (mergeMecImpl && TMetaExtensionContainerSpy::ContainerCount(*mergeMecImpl) == 1)
       
    82     	{
       
    83     	CreateAndAppendExtensionL(mergeMec, TTestExtension3::ETypeId, KExtVersion2);
       
    84     	if (TMetaExtensionContainerSpy::ContainerCount(*mergeMecImpl) == 2)
       
    85     		{
       
    86         	mergeMec.AppendContainerL(container2);
       
    87         	if (TMetaExtensionContainerSpy::ContainerCount(*mergeMecImpl) == 3)
       
    88         		{
       
    89     			const TTestExtension1* ext1 = static_cast<const TTestExtension1*>(mergeMec.FindExtension(TTestExtension1::TypeId()));
       
    90     			const TTestExtension2* ext2 = static_cast<const TTestExtension2*>(mergeMec.FindExtension(TTestExtension2::TypeId()));
       
    91     			const TTestExtension3* ext3 = static_cast<const TTestExtension3*>(mergeMec.FindExtension(TTestExtension3::TypeId()));
       
    92     			if (ext1 && ext1->GetTypeId() == TTestExtension1::TypeId() && ext1->iVersion == KExtVersion1
       
    93     				&& ext2 && ext2->GetTypeId() == TTestExtension2::TypeId() && ext2->iVersion == KExtVersion2
       
    94     				&& ext3 && ext3->GetTypeId() == TTestExtension3::TypeId() && ext3->iVersion == KExtVersion1)
       
    95     				{
       
    96     				result = EPass;
       
    97     				}
       
    98         		}
       
    99     		}
       
   100     	}
       
   101     
       
   102     
       
   103 	
       
   104     CleanupStack::PopAndDestroy(&mergeMec);
       
   105     CleanupStack::PopAndDestroy(&container2);
       
   106     CleanupStack::PopAndDestroy(&container1);
       
   107     return result;
       
   108     }
       
   109