package com.eactive.eai.transformer;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

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

class TransformMessageLoadTest extends TransformExcelLoadConfiguration {

	protected static Logger logger = Logger.getLogger("transformer");

	@BeforeAll
	public static void props() {
		if (System.getProperty("transformer.rule.dir") == null) {
			System.setProperty("transformer.rule.dir", "src/test/resources/com/eactive/eai/transformer");
		}
	}

	@Test
	void testLoadLayout() throws Exception {
		long t = System.currentTimeMillis();

		System.out.println(
				"\n\n<<================================ TransformMessageLoadTest : testLoadLayout ================================>> \n");
		try {
			Message source = MessageFactory.getFactory().getMessage("BASICTEST101_REQ");
			System.out.println("\nSOURCE  : \n" + source);

			// @formatter:off
			String flatData = "00000000BASICTST110134567890ABCDEF";
	        // @formatter:on

			// when
			source.setData(flatData);
			System.out.println("\nSOURCE  : \n" + source);
			System.out.println("$$ Transform  Time (ms):" + (System.currentTimeMillis() - t));
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

}
