/*  ===========================================================================
 *  Copyright © 2006-2007 Nokia Corporation.
 *  This material, including documentation and any related
 *  computer programs, is protected by copyright controlled by
 *  Nokia Corporation. All rights are reserved. Copying,
 *  including reproducing, storing, adapting or translating, any
 *  or all of this material requires the prior written consent of
 *  Nokia Corporation. This material also contains confidential
 *  information which may not be disclosed to others without the
 *  prior written consent of Nokia Corporation.
 * ============================================================================
 
 
NOTE:
1. NULL input means not passing any value for the placeholder
2. NULLVALUE means a NULL is passed as value to the placeholder
3. "NULL" as input to a parameter means a Null string or a string of value "NULL" is passed as input
4. All the fields in input is mandatory, if no value is to be passed for any field, a value NULL can be passed. And if NULL is to be passed as value, then 
	value "NULLVALUE" needs to be passed.
5. The key-value pair in Expected output can be in any order and all are optional.


//Testcase format:
//Description of the testcase
//Input: Input values
//Expected:(+ve/-ve case) Expected output or behaviour 
[Test]
title Sample
create tcontactsgetidsprovidertest foobar
//foobar GetIdsL <Type> <DBUri> <SearchVal> <SortOrder> <expected error code> 
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL NULL Ascending 0
delete foobar
[Endtest]

*/

############################################### Test cases starts ###############################################


[Test]
title AddContactAndGrps
create tcontactsgetidsprovidertest foobar
foobar AddContactAndGrp 0
delete foobar
[Endtest]



//Get the ids without passing any input
//Input: No input. Note here NULL value refers to nothing being passed
//Expected: errorcode 1003-MissingArgument error is expected as Type input is mandatory
[Test]
title GetIdsNoInput
create tcontactsgetidsprovidertest foobar
foobar GetIdsL NULL NULL NULL NULL 1003
delete foobar
[Endtest]

//GetIds with type as the only input and Contact as value for Type
//Input: Contact as value for Type and no other values are passed
//Expected: zero as error code is expected
[Test]
title GetIdsValidTypeAlone1
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact NULL NULL NULL 0
delete foobar
[Endtest]

//GetIds with valid input Group for type and type as the only input. This returns the list of ids of all groups
//Input: Group as value for Type and no other values are passed
//Expected: zero as error code is expected
[Test]
title GetIdsValidTypeAlone2
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Group NULL NULL NULL 0
delete foobar
[Endtest]

//Getids with value Database which is valid for getLIst as input for Type
//Input: Database as value for Type and no other values are passed
//Expected: non-zero error code is expected
[Test]
title GetIdsDatabaseAsType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Database NULL NULL NULL 1002 //1004
delete foobar
[Endtest]

//getids with a valid string value like Dummy as value for Type
//Input: Dummy as value for Type and no other values are passed
//Expected: 1002 errorcode- BadArgumentType error is expected
[Test]
title GetIdsDummyType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Dummy NULL NULL NULL 1002
delete foobar
[Endtest]

//getids with a value of type other than string like an integer value 12 as value for type
//Input: 12 as value for Type and no other values are passed
//Expected: 1002 errorcode- BadArgumentType error is expected
[Test]
title GetIdsIntegerType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL 12 NULL NULL NULL 1002
delete foobar
[Endtest]

//getids with a huge string with more than 255 characters as value for type
//Input: a huge string with more than 255 characters as value for Type and no other values are passed
//Expected: 1002 errorcode- BadArgumentType error is expected
[Test]
title GetIdsHugeStringAsType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz NULL NULL NULL 1002
delete foobar
[Endtest]

//getids with null asvalue for Type
//Input: NULLVALUE as value for Type and no other values are passed
//Expected: 1002 errorcode- MissingArgument error is expected
[Test]
title GetIdsNullType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL NULLVALUE NULL NULL NULL 1002
delete foobar
[Endtest]

//getids with a valid value cntdb://c:contacts.cdb as value for DBUri, with Type as Contact
//Expected: zero errorcode
[Test]
title GetIdsPhoneDBUri
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL NULL 0
delete foobar
[Endtest]

//getids with a valid value sim://global_adn as value for DBUri, with Type as Contact
//Expected: zero errorcode
[Test]
title GetIdsSimDBUri
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact sim:\/\/global_adn NULL NULL 0
delete foobar
[Endtest]

//getids with a valid value cntdb://c:contacts.cdb as value for DBUri, with Type as Group
//Expected: zero errorcode
[Test]
title GetIdsPhoneDBUriGrpType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Group cntdb:\/\/c:contacts.cdb NULL NULL 0
delete foobar
[Endtest]

//getids with a valid value sim://global_adn as value for DBUri, with Type as Group
//Expected: 1012-ServiceNotsupported as errorcode
[Test]
title GetIdsSimDBUriGrpType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Group sim:\/\/global_adn NULL NULL 1012
delete foobar
[Endtest]

//getids with a value cntda://c:contacts.cda as value for DBUri and Contact as value for Type
//Expected: 1014-BadArgumentType as errorcode
[Test]
title GetIdsInvalidDBUri
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntda:\/\/c:contacts.cda NULL NULL 1014
delete foobar
[Endtest]

//getids with an empty string as value for DBUri
//Expected: 1014-BadArgumentType as errorcode
[Test]
title GetIdsEmptyStringDBUri
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact "" NULL NULL 1014
delete foobar
[Endtest]

//getids with a null value for DBUri
//Expected: 0 as errorcode
[Test]
title GetIdsNullDBUri
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact NULLVALUE NULL NULL 0
delete foobar
[Endtest]

//getids with an integer value 12 for DBUri
//Expected: 1014-BadArgumentType as errorcode
[Test]
title GetIdsIntegerDBUri
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact 12 NULL NULL 1014
delete foobar
[Endtest]


//getids with a huge string with more than 255 characters as value for DBUri
//Expected: 1002-BadArgumentType as errorcode
[Test]
title GetIdsHugeStringDBUri
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz  NULL NULL 1014 
delete foobar
[Endtest]

//getids with a valid string value for searchval and Type as Contact and cntdb://c:contacts.cdb as DBUri
//Expected: zero errorcode
[Test]
title GetIdsValidSrchVal
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb Arnold NULL 0 
delete foobar
[Endtest]

//getids with a valid string value for searchval and Type as Group and cntdb://c:contacts.cdb as DBUri
//Expected: zero errorcode
[Test]
title GetIdsValidSrchValForGrpType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Group cntdb:\/\/c:contacts.cdb Group1 NULL 0
delete foobar
[Endtest]

//getids with a valid string value for searchval and Type as Contact and sim://global_adn as DBUri
//Expected: 1012 errorcode
[Test]
title GetIdsValidSrchValForSimDbCntType
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact sim:\/\/global_adn Bob NULL 1012
delete foobar
[Endtest]

//getids with a valid string value for SearchVal which does not result in any output. Give the search for the contact which does not exist
//Expected: 1012 errorcode
[Test]
title GetIdsValidNotExistSrchVal
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NotExists NULL 1012
delete foobar
[Endtest]

//getids with an integer value for searchval input
//Expected: 1012 errorcode
[Test]
title GetIdsIntegerSrchVal
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb 12 NULL 1012
delete foobar
[Endtest]

//getids with a null value for searchval input and other inputs having valid values
//Expected: 0 errorcode
[Test]
title GetIdsNullSrchVal
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULLVALUE NULL 0
delete foobar
[Endtest]

//getids with a long string with more than 255 characters as value for searchval input
//Expected: 1012 errorcode
[Test]
title GetIdsHugeStringSrchVal
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz NULL 1012
delete foobar
[Endtest]

//getids with an empty string as value for searchVal input
//Expected: 1012 errorcode
[Test]
title GetIdsEmptyStringSrchVal
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb "" NULL 1012
delete foobar
[Endtest]

//Get the ids of all contacts in the phone database in ascending order
//Input: Contact as Type, cntdb:\/\/c:contacts.cdb as DBUri and Ascending as sort order
//Expected: errorcode 0 is expected
[Test]
title GetIdsAllContactsInPhone
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL Ascending 0
delete foobar
[Endtest]

//get the ids of all contacts in phone database in descending order
//Input: Contact as Type, cntdb:\/\/c:contacts.cdb as DBUri and Descending as sort order
//Expected: errorcode 0 is expected
[Test]
title GetIdsDescOrderPhoneDB
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL Descending 0
delete foobar
[Endtest]

//get the ids of all contacts in sim database in ascending order
//Input: Contact as Type, sim:\/\/global_adn as DBUri and Ascending as sort order
//Expected: errorcode 0 is expected
[Test]
title GetIdsAscOrderSimDB
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact sim:\/\/global_adn NULL Ascending 0
delete foobar
[Endtest]


//get the ids of all contacts in sim database in descending order
//Input: Contact as Type, sim:\/\/global_adn as DBUri and Descending as sort order
//Expected: errorcode 0 is expected
[Test]
title GetIdsDescOrderSimDB
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact sim:\/\/global_adn NULL Descending 0
delete foobar
[Endtest]

//get the ids by passing a valid sort order and Type value as Group
//Input: Group as Type, nothing passed as DBUri and Descending as sort order
//Expected: errorcode 0 is expected
[Test]
title GetIdsDescOrderGrp
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Group NULL NULL Descending 0
delete foobar
[Endtest]

//get the ids by passing null as value for sort order
//Input: Contact as Type, nothing passed as DBUri and NULLVALUE as sort order
//Expected: errorcode 1002 is expected
[Test]
title GetIdsNullOrder
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact NULL NULL NULLVALUE 1002
delete foobar
[Endtest]

//get the ids of all contacts by passing an integer value 12 as value for sort order
//Input: Contact as Type, nothing passed as DBUri and 12 as sort order
//Expected: errorcode 1002 is expected
[Test]
title GetIdsIntegerOrder
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact NULL NULL 12 1002
delete foobar
[Endtest]

//get the ids of all contacts by passing a long string of more than 255 characters as value for sort order
//Input: Contact as Type, nothing passed as DBUri and string with more than 255 characters as sort order
//Expected: errorcode 1002 is expected
[Test]
title GetIdsHugeStringOrder
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact NULL NULL abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz 1002
delete foobar
[Endtest]

//get the ids by passing an empty string as value for sort order
//Input: Contact as Type, nothing passed as DBUri and empty string as sort order
//Expected: errorcode 1002 is expected
[Test]
title GetIdsEmptyStringOrder
create tcontactsgetidsprovidertest foobar
foobar GetIdsL Contact NULL NULL "" 1002
delete foobar
[Endtest]
################################################################    End     ############################################################
