package com.eactive.eai.transformer;

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

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


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

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

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

    public void setUp() throws Exception {
        engine = TransformEngine.getInstance();

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

    public void tearDown() throws Exception {
        //
    }
    
    public void testEbcdicToUJson() throws Exception {
    	System.out.println("Ebcdic TO Json ==============================================================");
    	//logger.debug("Transform08900001Test | testTransform()");
    	
    	String data ="";
    	data = "100000007000000000000001957520400000000000000279600000000000010000001072800000000000000000000000000000100000007000000000000000000000000000000000000028000000000000000224784120000000000000000000000000000003211100056980000000398897920000010728000000000000000000000000000 0000000000000000000000";
    	byte[] d = IConv.asciiToEBCDIC(data);
    	System.out.println(new String(d));
    	Message source = MessageFactory.getFactory().getMessage("KFK_KFK128B040_RES1");
    	source.setData(d);
    	
    	System.out.println("source="+source);

    	Transformer transformer = engine.getTransformer();
    	Message target = transformer.transform("TRANSFORM_BFE_KFK128B040BFE_RES", new Message[] { source });
    	
    	System.out.println(target.toString());
    	System.out.println(target.getData());
    	
    }
    
    

    
    
}
