/*
 * SampleEntitInfo.java
 *
 * Created on 2007/04/13, 19:49
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package test.org.itscool.commons.dao.recordmap;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import junit.framework.TestCase;
import org.itscool.commons.dao.EntityInfo;
import org.itscool.commons.dao.EntityInfoMapping;
import org.itscool.commons.dao.RecordMap;
import org.itscool.weber.user.User;

/**
 *
 * @author KANO
 */
public class EntityInfoMappingTest extends TestCase{
    
    public void testCreate1() {
        EntityInfoMapping daoMapping = EntityInfoMapping.getInstance();
        HashMap classess = new HashMap();
        EntityInfo entity = new EntityInfo();
        
        classess.put(User.class.getName(), entity);
        
        daoMapping.setDaoInfoMappings(classess);
        
        RecordMap recordMap = daoMapping.getGRecordMap(User.class);
        System.out.println(recordMap.toString());
        
        HashMap fkRecordMaps = daoMapping.getFkRecordMaps(User.class);
        Set keySet = fkRecordMaps.keySet();
        Iterator it = keySet.iterator();
        while(it.hasNext()){
            Object key = it.next();
            System.out.println("fk key="+key);
            RecordMap fkRecordMap = (RecordMap)fkRecordMaps.get(key);
            System.out.println(fkRecordMap.toString());
        }
        
    }
    
    /** Creates a new instance of SampleEntitInfo */
    public void testCreate2() {
        EntityInfoMapping daoMapping = EntityInfoMapping.getInstance();
        HashMap classess = new HashMap();
        EntityInfo entity = new EntityInfo();
        
        classess.put(SampleEntity.class.getName(), entity);
        
        daoMapping.setDaoInfoMappings(classess);
        
        RecordMap recordMap = daoMapping.getGRecordMap(SampleEntity.class);
        System.out.println(recordMap.toString());
    }
}
