639 } |
644 } |
640 else |
645 else |
641 { |
646 { |
642 iResult = code; |
647 iResult = code; |
643 } |
648 } |
644 } |
649 } |
|
650 else if(iCase == EAddContactASyncTest || iCase == EAddGroupASyncTest) |
|
651 { |
|
652 if(aEventId == KLiwEventCompleted && code == KErrNone) |
|
653 { |
|
654 TInt pos = 0; |
|
655 const TLiwGenericParam* param; |
|
656 |
|
657 param = aEventParamList.FindFirst( pos, KReturnValue ); |
|
658 |
|
659 TLiwVariant cntId = param->Value(); |
|
660 |
|
661 TPtrC idVal = cntId.AsDes(); |
|
662 if(idVal.Compare(KNullDesC) != 0) |
|
663 { |
|
664 iResult = KErrNone; |
|
665 } |
|
666 else |
|
667 { |
|
668 iResult = KErrGeneral; |
|
669 } |
|
670 } |
|
671 else |
|
672 { |
|
673 iResult = code; |
|
674 } |
|
675 } |
|
676 else if(iCase == EGetListNewFieldsTest) |
|
677 { |
|
678 iResult = KErrNone; |
|
679 if(aEventId == KLiwEventCompleted && code == KErrNone) |
|
680 { |
|
681 TInt pos = 0; |
|
682 TBuf<255> firstName; |
|
683 TBuf<255> secName; |
|
684 TBuf<255> callerObjImg; |
|
685 TBuf<255> Note; |
|
686 TLiwVariant cntId; |
|
687 TLiwVariant mapfield; |
|
688 TLiwVariant firstname; |
|
689 TLiwVariant secname; |
|
690 TLiwVariant callerobjimg; |
|
691 TLiwVariant xspidarr; |
|
692 TLiwVariant note; |
|
693 TLiwVariant entry; |
|
694 const CLiwMap* map = NULL; |
|
695 const CLiwMap* mapField = NULL; |
|
696 const CLiwList* xspid = NULL; |
|
697 |
|
698 param = aEventParamList.FindFirst(pos, KReturnValue); |
|
699 TLiwVariant iterator = param->Value(); |
|
700 CLiwIterable* iter = iterator.AsIterable(); |
|
701 if(iter->NextL(entry)) |
|
702 { |
|
703 map = entry.AsMap(); |
|
704 TInt count1 = map->Count(); |
|
705 map->FindL(KContactId, cntId); |
|
706 TPtrC8 ptr = cntId.AsData(); |
|
707 if(map->FindL(KFirstName,mapfield)) |
|
708 mapField = mapfield.AsMap(); |
|
709 |
|
710 TInt count = mapField->Count(); |
|
711 firstname.Reset(); |
|
712 mapField->FindL(KFieldValue,firstname); |
|
713 firstName = firstname.AsDes(); |
|
714 if(firstName.CompareF(_L("Barbie")) != 0) |
|
715 { |
|
716 iResult = KErrGeneral; |
|
717 return; |
|
718 } |
|
719 |
|
720 if(map->FindL(KSecondName,mapfield)) |
|
721 mapField = mapfield.AsMap(); |
|
722 count = mapField->Count(); |
|
723 mapField->FindL(KFieldValue,secname); |
|
724 secName = secname.AsDes(); |
|
725 if(secName.CompareF(_L("Doll")) != 0) |
|
726 { |
|
727 iResult = KErrGeneral; |
|
728 return; |
|
729 } |
|
730 |
|
731 if(map->FindL(KCallerObjImg,mapfield)) |
|
732 mapField = mapfield.AsMap(); |
|
733 count = mapField->Count(); |
|
734 mapField->FindL(KFieldValue,callerobjimg); |
|
735 callerObjImg = callerobjimg.AsDes(); |
|
736 if(callerObjImg.CompareF(_L("C:\\data\\images\\pic.jpg")) != 0) |
|
737 { |
|
738 iResult = KErrGeneral; |
|
739 return; |
|
740 } |
|
741 if(map->FindL(KNote,mapfield)) |
|
742 mapField = mapfield.AsMap(); |
|
743 count = mapField->Count(); |
|
744 mapField->FindL(KFieldValue,note); |
|
745 Note = note.AsDes(); |
|
746 if(Note.CompareF(_L("Lead role in Barbie, the island princess")) != 0) |
|
747 { |
|
748 iResult = KErrGeneral; |
|
749 return; |
|
750 } |
|
751 |
|
752 if(map->FindL(KXSPID,mapfield)) |
|
753 mapField = mapfield.AsMap(); |
|
754 //count = mapField->Count(); |
|
755 mapField->FindL(KFieldValue,xspidarr); |
|
756 xspid = xspidarr.AsList(); |
|
757 for(TInt index =0;index<xspid->Count(); index++) |
|
758 { |
|
759 TLiwVariant xspidVal; |
|
760 if(xspid->AtL(index,xspidVal)) |
|
761 { |
|
762 TPtrC ptrVal = xspidVal.AsDes(); |
|
763 if(ptrVal.CompareF(_L("Yahoo:Barbie@yahoo.co.in")) != 0 && ptrVal.CompareF(_L("Google:Barbie@gmail.com")) != 0) |
|
764 { |
|
765 iResult = KErrGeneral; |
|
766 return; |
|
767 } |
|
768 } |
|
769 } |
|
770 |
|
771 } |
|
772 } |
|
773 else |
|
774 { |
|
775 iResult = code; |
|
776 } |
|
777 } |
645 } |
778 } |
646 |
779 |
647 void CTestProvider::LoadService() |
780 void CTestProvider::LoadService() |
648 { |
781 { |
649 TInt pos = 0; |
782 TInt pos = 0; |
2399 list->DecRef(); |
2532 list->DecRef(); |
2400 return iResult; |
2533 return iResult; |
2401 } |
2534 } |
2402 |
2535 |
2403 |
2536 |
2404 |
2537 |
2405 |
2538 |
2406 |
2539 TInt CTestProvider :: AddContactASyncTestL(CStifItemParser& /*aItem */) |
2407 |
2540 { |
2408 |
2541 |
2409 |
2542 iResult = KErrGeneral; |
2410 |
2543 iCase = EAddContactASyncTest; |
|
2544 LoadService(); |
|
2545 |
|
2546 CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
2547 |
|
2548 |
|
2549 TInt pos = 0; |
|
2550 |
|
2551 pMap->InsertL(KContactId, TLiwVariant( _L(""))); |
|
2552 CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); |
|
2553 fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); |
|
2554 |
|
2555 fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); |
|
2556 |
|
2557 pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); |
|
2558 |
|
2559 CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); |
|
2560 fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); |
|
2561 |
|
2562 fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); |
|
2563 |
|
2564 pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); |
|
2565 |
|
2566 CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); |
|
2567 |
|
2568 fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); |
|
2569 |
|
2570 fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Lead role in Barbie, the island princess"))); |
|
2571 |
|
2572 pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); |
|
2573 |
|
2574 CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); |
|
2575 anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); |
|
2576 anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
2577 pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); |
|
2578 |
|
2579 |
|
2580 CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); |
|
2581 dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); |
|
2582 dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
2583 pMap->InsertL(KDate, TLiwVariant(dateMap)); |
|
2584 |
|
2585 |
|
2586 CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); |
|
2587 fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); |
|
2588 |
|
2589 fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); |
|
2590 |
|
2591 pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); |
|
2592 |
|
2593 CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); |
|
2594 fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); |
|
2595 |
|
2596 fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); |
|
2597 |
|
2598 pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); |
|
2599 |
|
2600 CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); |
|
2601 CLiwList* list = CLiwDefaultList::NewL(); |
|
2602 list->AppendL(TLiwVariant(_L("Yahoo:barbie@yahoo.co.in"))); |
|
2603 list->AppendL(TLiwVariant(_L("Google:barbie@gmail.com"))); |
|
2604 fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); |
|
2605 |
|
2606 fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); |
|
2607 |
|
2608 pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); |
|
2609 |
|
2610 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
2611 const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; |
|
2612 |
|
2613 inList ->AppendL( paramContentType ); |
|
2614 inList ->AppendL( paramAddData ); |
|
2615 |
|
2616 iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this); |
|
2617 |
|
2618 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
2619 TLiwVariant err = param->Value(); |
|
2620 TInt code = err.AsTInt32(); |
|
2621 |
|
2622 if(code == SErrNone) |
|
2623 { |
|
2624 CActiveScheduler::Start(); |
|
2625 } |
|
2626 pMap->DecRef(); |
|
2627 fieldMap->DecRef(); |
|
2628 fieldMap->DecRef(); |
|
2629 |
|
2630 inList->Reset(); |
|
2631 outList->Reset(); |
|
2632 |
|
2633 return iResult; |
|
2634 } |
|
2635 |
|
2636 |
|
2637 TInt CTestProvider :: AddGroupASyncTestL(CStifItemParser& /*aItem*/) |
|
2638 { |
|
2639 LoadService(); |
|
2640 CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
2641 iCase = EAddGroupASyncTest; |
|
2642 TInt pos = 0; |
|
2643 |
|
2644 pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb"))); |
|
2645 pMap->InsertL(KGroupId, TLiwVariant(_L8(""))); |
|
2646 pMap->InsertL(KGroupLabel, TLiwVariant(_L("TestAddGroup"))); |
|
2647 |
|
2648 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group"))); |
|
2649 const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; |
|
2650 |
|
2651 inList ->AppendL( paramContentType ); |
|
2652 inList ->AppendL( paramAddData ); |
|
2653 iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this); |
|
2654 |
|
2655 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
2656 TLiwVariant err = param->Value(); |
|
2657 TInt code = err.AsTInt32(); |
|
2658 |
|
2659 inList->Reset(); |
|
2660 outList->Reset(); |
|
2661 |
|
2662 if(code == SErrNone) |
|
2663 { |
|
2664 CActiveScheduler::Start(); |
|
2665 } |
|
2666 pMap->DecRef(); |
|
2667 return iResult; |
|
2668 } |
|
2669 TInt CTestProvider :: AddOneContactNewFieldsL() |
|
2670 { |
|
2671 //LoadService(); |
|
2672 |
|
2673 CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); |
|
2674 |
|
2675 TInt pos = 0; |
|
2676 pMap->InsertL(KContactId, TLiwVariant( _L(""))); |
|
2677 CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); |
|
2678 fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); |
|
2679 |
|
2680 fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); |
|
2681 |
|
2682 pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); |
|
2683 |
|
2684 CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); |
|
2685 fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); |
|
2686 |
|
2687 fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); |
|
2688 |
|
2689 pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); |
|
2690 |
|
2691 CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); |
|
2692 |
|
2693 fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); |
|
2694 |
|
2695 fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Lead role in Barbie, the island princess"))); |
|
2696 |
|
2697 pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); |
|
2698 |
|
2699 CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); |
|
2700 anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); |
|
2701 anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
2702 pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); |
|
2703 |
|
2704 |
|
2705 CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); |
|
2706 dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); |
|
2707 dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); |
|
2708 pMap->InsertL(KDate, TLiwVariant(dateMap)); |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); |
|
2714 fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); |
|
2715 |
|
2716 fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); |
|
2717 |
|
2718 pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); |
|
2719 |
|
2720 CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); |
|
2721 fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); |
|
2722 |
|
2723 fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); |
|
2724 |
|
2725 pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); |
|
2726 |
|
2727 CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); |
|
2728 CLiwList* list = CLiwDefaultList::NewL(); |
|
2729 list->AppendL(TLiwVariant(_L("Yahoo:barbie@yahoo.co.in"))); |
|
2730 list->AppendL(TLiwVariant(_L("Google:barbie@gmail.com"))); |
|
2731 fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); |
|
2732 |
|
2733 fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); |
|
2734 |
|
2735 pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); |
|
2736 |
|
2737 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
2738 const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; |
|
2739 |
|
2740 inList ->AppendL( paramContentType ); |
|
2741 inList ->AppendL( paramAddData ); |
|
2742 |
|
2743 iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); |
|
2744 |
|
2745 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
2746 TLiwVariant err = param->Value(); |
|
2747 TInt code = err.AsTInt32(); |
|
2748 |
|
2749 |
|
2750 pMap->DecRef(); |
|
2751 fieldMap->DecRef(); |
|
2752 fieldMap->DecRef(); |
|
2753 |
|
2754 inList->Reset(); |
|
2755 outList->Reset(); |
|
2756 if(code == SErrNone) |
|
2757 { |
|
2758 return KErrNone; |
|
2759 } |
|
2760 return KErrGeneral; |
|
2761 } |
|
2762 |
|
2763 |
|
2764 TInt CTestProvider :: GetListNewFieldsTestL(CStifItemParser& /*aItem */) |
|
2765 { |
|
2766 LoadService(); |
|
2767 TInt addRes = AddOneContactNewFieldsL(); |
|
2768 if(addRes != KErrNone) |
|
2769 { |
|
2770 return KErrGeneral; |
|
2771 } |
|
2772 |
|
2773 _LIT8(KFilter, "Filter"); |
|
2774 _LIT8(KSearchVal, "SearchVal"); |
|
2775 iResult = KErrGeneral; |
|
2776 |
|
2777 TInt pos = 0; |
|
2778 iCase = EGetListNewFieldsTest; |
|
2779 |
|
2780 //const TLiwGenericParam paramGetListSortOrder; |
|
2781 |
|
2782 const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); |
|
2783 inList ->AppendL( paramContentType ); |
|
2784 |
|
2785 CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); |
|
2786 CleanupStack::PushL(map); |
|
2787 map->InsertL(KSearchVal,_L("Barbie")); |
|
2788 |
|
2789 const TLiwGenericParam paramData(KFilter, TLiwVariant(map)); |
|
2790 inList ->AppendL( paramData ); |
|
2791 |
|
2792 iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this); |
|
2793 |
|
2794 const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); |
|
2795 TLiwVariant err = param->Value(); |
|
2796 TInt code = err.AsTInt32(); |
|
2797 |
|
2798 if(code == SErrNone) |
|
2799 { |
|
2800 CActiveScheduler::Start(); |
|
2801 } |
|
2802 |
|
2803 CleanupStack::Pop(map); |
|
2804 map->DecRef(); |
|
2805 inList->Reset(); |
|
2806 outList->Reset(); |
|
2807 return iResult; |
|
2808 } |