package com.eactive.eai.transformer;

import com.eactive.eai.common.util.Logger;
import com.eactive.eai.transformer.engine.TransformEngine;
import com.eactive.eai.transformer.message.Message;
import com.eactive.eai.transformer.message.MessageFactory;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;


public class Layout2Test extends TestCase {
	protected static Logger logger = Logger.getLogger("transformer");

	TransformEngine engine = null;
    
    
    public Layout2Test(String name) {
        super(name);
    }

    public static Test suite() {
        /*
        * the dynamic way
        */
        return new TestSuite(Layout2Test.class);
    }

    public void setUp() throws Exception {
        // 변환 초기화
        engine = TransformEngine.getInstance();

        if (!engine.isStarted()) {
            engine.start();
        } 
    }

    public void tearDown() throws Exception {
        //
    }
	public void testFindItemTest() throws Exception {
		System.out.println("JSON int Test ==============================================================");
      //----------------------------------------------------------------------
      // source message 생성
      //----------------------------------------------------------------------
//		String data ="{\"EAI_EITTCBK00000001_REQ2\":{\"tracekey1\":\"00000\",\"grid1Count\":1,\"trancode1\":\"0200\",\"trancode2\":\"800\",\"grid1\":[{\"data2\":\"data2\",\"data1\":\"data1\"}],\"tracekey2\":\"{{index}}\",\"bizkey1\":\"bizkey1\",\"add1\":\"add1\",\"bizkey2\":\"bizkey2\"}}              ";
		String data ="{\"EAI_EITTCBK00000001_REQ2\":{\"tracekey1\":\"00000\",\"grid1Count\":1,\"trancode1\":\"0200\",\"trancode2\":\"800\",\"grid1\":[{\"data2\":{\"abc\":\"data2\"},\"data1\":\"data1\"}],\"tracekey2\":\"{{index}}\",\"bizkey1\":\"bizkey1\",\"add1\":\"add1\",\"bizkey2\":\"bizkey2\"}}              ";
		
      Message source = MessageFactory.getFactory().getMessage("EAI_EITTCBK0000000X_REQ2");
      System.out.println("data=\n" +data);
      source.setData(data);
      System.out.println(source);
      System.out.println(source.getData());

		

	} 
    
}
