/*!
  @header FTObjectToIdMapperTEST
  @abstract Module of FT
 
  @availability OS X, GNUstep
  @copyright 2004, 2005 Free Software Foundation, Inc.
  
  Author: Oliver Langer

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  22.02.05 ola     initial version
  -------------------------------------------------------------------------
  </pre>
*/
#include "Encore/Encore.h"
#include "FTObjectToIdMapperTEST.h"


@implementation FTObjectToIdMapperTEST
- testObjectToIdMapper {
  id <FTObjectToIdMapper> defaultObjectToIdMapper;
  NSString *key1, *key2;
  id ftID1,ftID2,ftID3;
  
  NSLog( @"FTObjectToIdMapperTEST::testObjectToIdMapper: BEGIN...." );
  
  EC_AUTORELEASEPOOL_BEGIN
  
  NSLog( @"Logged in!" );
  defaultObjectToIdMapper = [session defaultObjectToIdMapper];
  
  key1 = [[[NSString alloc] initWithString: @"SampleObject-1"] autorelease];
  ftID1 = [defaultObjectToIdMapper mapObject: key1 ];
  NSLog( @"Got ftID1 for key1" );
  
  ftID2 = [defaultObjectToIdMapper mapObject: key1 ];
  NSLog( @"Got ftID2 for key1" );  
  
  key2 = [[[NSString alloc] initWithString: @"SampleObject-2" ] autorelease];
  ftID3 = [defaultObjectToIdMapper mapObject: key2 ];
  NSLog( @"Got ftID3 for key2. Now comparing....." );  
  
  ECAssertTrue( nil != ftID1 && nil != ftID2 && nil != ftID3,
    @"Did not get an ID for each case!" );
	
  ECAssertTrue( [ftID1 isEqual: ftID2], @"ftID1 does NOT equal ftID2" );
  ECAssertTrue( !([ftID1 isEqual: ftID3]), @"ftID1 equals ftID3" );

  
  EC_AUTORELEASEPOOL_END
  NSLog( @"FTObjectToIdMapperTEST::testObjectToIdMapper: FINISHED" );
  return self;
}
@end
