os/security/cryptoservices/certificateandkeymgmt/tcertstore/doctestharness.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tcertstore/doctestharness.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,187 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* \page pt Test Harness for the certificate store manager
    1.19 +* <H2>Testing</H2>
    1.20 +* <H3>Test goals</H3>
    1.21 +* <P>We want to the entire API for CCertStore and CCertStoreManager. Some other classes
    1.22 +* will tested indirectly by these tests i.e. the other classes in certstore.h and the file
    1.23 +* certstore implementation.</P>
    1.24 +* <P>Test cases</P>
    1.25 +* IMPORT_C const RArray<TCertManClientInfo>& Clients() const;
    1.26 +* IMPORT_C void GetCACerts(RPointerArray<CCACertStoreEntry>& aEntries,
    1.27 +* const TCACertStoreFilter& aFilter, TRequestStatus& aStatus);
    1.28 +* IMPORT_C void GetUserCerts(RPointerArray<CUserCertStoreEntry>& aEntries,
    1.29 +* const TUserCertStoreFilter& aFilter, TRequestStatus& aStatus);
    1.30 +* IMPORT_C TInt StoreCount() const;
    1.31 +* IMPORT_C CCertStore& Store(TInt aIndex) const;
    1.32 +* <TABLE BORDER1>
    1.33 +* <TR>
    1.34 +* <TD>1. Opening, initializing and deleting the certificate store manager</TD>
    1.35 +* <TD>This series of tests open, initialize and delete the certificate store manager.</TD>
    1.36 +* <TD>IMPORT_C static CCertStoreManager* NewL(RFs& aFs, TBool aOpenForWrite);<BR>
    1.37 +* IMPORT_C static CCertStoreManager* NewLC(RFs& aFs, TBool aOpenForWrite);<BR>
    1.38 +* IMPORT_C ~CCertStoreManager();<BR>
    1.39 +* IMPORT_C void Initialise(TRequestStatus& aStatus);<BR></TD>
    1.40 +* </TR>
    1.41 +* <TR>
    1.42 +* <TD>1.1. Opening, initializing and deleting, usual steps.</TD>
    1.43 +* </TR>
    1.44 +* <TR>
    1.45 +* <TD>1.1.1. Creating and initializing the certificate store manager</TD>
    1.46 +* </TR>
    1.47 +* <TR>
    1.48 +* <TD>1.1.2. Deleting the certificate store manager</TD>
    1.49 +* </TR>
    1.50 +* <TR>
    1.51 +* <TD>1.2. Opening, initializing and trying to open another certificate manager</TD>
    1.52 +* </TR>
    1.53 +* <TR>
    1.54 +* <TD>1.2.1. Creating and initializing the certificate store manager</TD>
    1.55 +* </TR>
    1.56 +* <TR>
    1.57 +* <TD>1.2.2. Creating and initializing another certificate store manager</TD>
    1.58 +* </TR>
    1.59 +* <TR>
    1.60 +* <TD>1.2.3. Deleting the certificate store manager</TD>
    1.61 +* </TR>
    1.62 +* <TR>
    1.63 +* <TD>1.2.4. Opening a certificate store manager</TD>
    1.64 +* </TR>
    1.65 +* <TR>
    1.66 +* <TD>1.2.5. Deleting certificate store manager</TD>
    1.67 +* </TR>
    1.68 +* <TR>
    1.69 +* <TD>2. Adding and removing clients</TD>
    1.70 +* <TD>IMPORT_C void AddClientL(const TCertManClientInfo& aClient);<BR>
    1.71 +* IMPORT_C void RemoveClientL(const TUid& aUid);</TD>
    1.72 +* </TD>
    1.73 +* </TR>
    1.74 +* <TR>
    1.75 +* <TD>2.1. Adding and retrieving a client</TD>
    1.76 +* </TR>
    1.77 +* <TR>
    1.78 +* <TD>2.1.1. Initializing the manager</TD>
    1.79 +* </TR>
    1.80 +* <TR>
    1.81 +* <TD>2.1.2. Adding a client</TD>
    1.82 +* </TR>
    1.83 +* <TR>
    1.84 +* <TD>2.1.3. Retrieving the clients</TD>
    1.85 +* </TR>
    1.86 +* <TR>
    1.87 +* <TD>2.1.4. Deleting the client</TD>
    1.88 +* </TR>
    1.89 +* <TR>
    1.90 +* <TD>2.1.5. Deleting the manager</TD>
    1.91 +* </TR>
    1.92 +* <TR>
    1.93 +* <TD>2.2. Adding and retrieving a client, closing the store between the adding and the
    1.94 +* retrieving</TD>
    1.95 +* </TR>
    1.96 +* <TR>
    1.97 +* <TD>2.2.1. Initializing the manager</TD>
    1.98 +* </TR>
    1.99 +* <TR>
   1.100 +* <TD>2.2.2. Adding a client</TD>
   1.101 +* </TR>
   1.102 +* <TR>
   1.103 +* <TD>2.2.3. Deleting the manager</TD>
   1.104 +* </TR>
   1.105 +* <TR>
   1.106 +* <TD>2.2.4. Initializing the manager</TD>
   1.107 +* </TR>
   1.108 +* <TR>
   1.109 +* <TD>2.2.5. Retrieving the clients</TD>
   1.110 +* </TR>
   1.111 +* <TR>
   1.112 +* <TD>2.2.6. Deleting the client</TD>
   1.113 +* </TR>
   1.114 +* <TR>
   1.115 +* <TD>2.2.7. Deleting the manager</TD>
   1.116 +* </TR>
   1.117 +* <TR>
   1.118 +* <TD>2.3. Adding and removing 2 clients</TD>
   1.119 +* </TR>
   1.120 +* <TR>
   1.121 +* <TD>2.3.1. Initializing the manager</TD>
   1.122 +* </TR>
   1.123 +* <TR>
   1.124 +* <TD>2.3.2. Adding a client (1001)</TD>
   1.125 +* </TR>
   1.126 +* <TR>
   1.127 +* <TD>2.3.3. Adding a client (1002)</TD>
   1.128 +* </TR>
   1.129 +* <TR>
   1.130 +* <TD>2.3.4. Retrieving the clients</TD>
   1.131 +* </TR>
   1.132 +* <TR>
   1.133 +* <TD>2.3.5. Deleting one of the client (1001)</TD>
   1.134 +* </TR>
   1.135 +* <TR>
   1.136 +* <TD>2.3.6. Retrieving the clients</TD>
   1.137 +* </TR>
   1.138 +* <TR>
   1.139 +* <TD>2.3.7. Deleting one of the client (1002)</TD>
   1.140 +* </TR>
   1.141 +* <TR>
   1.142 +* <TD>2.3.8. Retrieving the clients</TD>
   1.143 +* </TR>
   1.144 +* <TR>
   1.145 +* <TD>2.3.9. Deleting the manager</TD>
   1.146 +* </TR>
   1.147 +* <TR>
   1.148 +* <TD>2.4.1. Initializing the manager</TD>
   1.149 +* </TR>
   1.150 +* <TR>
   1.151 +* <TD>2.4.2. Deleting a client that doesn't exist</TD>
   1.152 +* </TR>
   1.153 +* <TR>
   1.154 +* <TD>2.4.3. Deleting the manager</TD>
   1.155 +* </TR>
   1.156 +* </TABLE>
   1.157 +* <H2>Testing with failures</H2>
   1.158 +* <H3>Introduction</H3>
   1.159 +* <P>The following test script is meant to test the correct behaviour when errors occur.</P>
   1.160 +* <H3>Test goals</H3>
   1.161 +* This is a list of specific error conditions we have to test for.
   1.162 +* <TABLE BORDER"1">
   1.163 +* <TR>
   1.164 +* <TD>Addition of a client</TD><TD>Addition to memory successfull but writing to the store
   1.165 +* fails</TD>
   1.166 +* </TR>
   1.167 +* </TABLE>
   1.168 +* <H3>Test cases</H3>
   1.169 +* <TABLE BORDER1>
   1.170 +* <TR>
   1.171 +* <TD>1</TD>
   1.172 +* </TR>
   1.173 +* </TABLE>
   1.174 +* 1) We initialize the store.
   1.175 +* 2) We get the clients and make sure there are none. This is to ensure that the test
   1.176 +* are meaningfull.
   1.177 +* 3) We add a client to the store but we make this operation fail after the memory cache
   1.178 +* is updated but before the stream is updated.
   1.179 +* 4) We get the clients and make sure that it is still empty.
   1.180 +* 5) We close the store manager.
   1.181 +* 6) We reopen it.
   1.182 +* 7) We get the clients and make sure that it is still empty.
   1.183 +* 8) We close the store.
   1.184 +*
   1.185 +*/
   1.186 +
   1.187 +
   1.188 +/**
   1.189 + @file
   1.190 +*/