void T_CSPSettings::T_CSPSettings_AddEntryLL(  )
    {
    CSPEntry* entry = CSPEntry::NewLC();
    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );

    EUNIT_ASSERT( KErrNone == iCSPSettings->AddEntryL( *entry ) );
    
    CleanupStack::PopAndDestroy( entry );
    }
void T_CSPSettingsEngine::T_CSPSettingsEngine_AddEntryLL(  )
    {
    CSPEntry* entry = CSPEntry::NewLC();
    TServiceId id = entry->GetServiceId();

    EUNIT_ASSERT_SPECIFIC_LEAVE( iCSPSettingsEngine->AddEntryL( *entry ), KErrArgument ) ;
    
    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
    iCSPSettingsEngine->AddEntryL( *entry );
    EUNIT_ASSERT( id != entry->GetServiceId() );

    CleanupStack::PopAndDestroy( entry );    
    }
void T_CSPSettings::T_CSPSettings_DeleteEntryLL(  )
    {
    CSPEntry* entry = CSPEntry::NewLC();
    User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) );
    TInt id = entry->GetServiceId();
    
    EUNIT_ASSERT( KErrNotFound == iCSPSettings->DeleteEntryL( id ) );
    
    iCSPSettings->AddEntryL( *entry );
    id = entry->GetServiceId();
    EUNIT_ASSERT( KErrNone == iCSPSettings->DeleteEntryL( id ) );
    CleanupStack::PopAndDestroy( entry );
    }
// ---------------------------------------------------------------------------
// Find service provider settings entry by service ID
// ---------------------------------------------------------------------------
//
 TInt CSPSettingsEngine::FindEntryL( TServiceId aServiceId, CSPEntry& aEntry )
    {
    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - IN", aServiceId );
    
    RIpAppPropArray array;
    TCleanupItem cleanup( CSPSettingsEngine::CleanupPointerArray, &array );
    CleanupStack::PushL( cleanup );

    TInt err = iCenRepUtils->FindEntryL( aServiceId, array );
    
    if( err == KErrNone )
        {
        TInt count = array.Count();

        for( TInt i = 0; i < count; i++ )
            {
            CCenRepDatabaseProperty* property = array[i];
            
            if( property->GetName() == EServiceName )
                {
                User::LeaveIfError( aEntry.SetServiceName( property->GetDesValue() ) );
                }
            else
                {
                CSPProperty* spProperty = CSPProperty::NewLC();
                User::LeaveIfError( spProperty->SetName( (TServicePropertyName)( property->GetName() )));
                User::LeaveIfError( spProperty->SetValue( property->GetDesValue() ));
                
                User::LeaveIfError( aEntry.AddPropertyL( *spProperty ));
                CleanupStack::PopAndDestroy( spProperty );
                }
            }
        }
    CleanupStack::PopAndDestroy( &array );
    
    aEntry.SetServiceId( aServiceId );
    
    XSPSLOGSTRING2( "CSPSettingsEngine::FindEntryL( %d ) - OUT", aServiceId );
    
    return err;
    }