/*
* ChainBuilder ESB
* Visual Enterprise Integration
*
* Copyright (C) 2006 Bostech Corporation
*
* 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
*
*
*
*/
/*
* $Header: /home/projects/mule/scm/mule/mule/src/test/java/org/mule/test/config/MessagesTestCase.java,v 1.4 2005/06/23 08:01:27 gnt Exp $
* $Revision: 1.4 $
* $Date: 2005/06/23 08:01:27 $
* ------------------------------------------------------------------------------------------------------
*
* Copyright (c) SymphonySoft Limited. All rights reserved.
* http://www.symphonysoft.com
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package com.bostechcorp.cbesb.common.trn.test;
import java.io.File;
import java.io.IOException;
import junit.framework.TestCase;
import com.bostechcorp.cbesb.common.trn.compiler.TransformerCompiler;
import com.bostechcorp.cbesb.common.util.FileUtil;
import com.bostechcorp.cbesb.common.util.JavaUtils;
public class TransformerCompilerTest extends TestCase
{
String resultStr = "";
public TransformerCompilerTest() {
super();
try {
resultStr = FileUtil.readStringFromFile("target/test-data/result/Xlate1.java");
} catch (IOException e) {
e.printStackTrace();
}
}
public void testTransformerCompiler() throws Exception
{
try {
String javaFileName = "target/test-data/out/Xlate1.java";
String controlFileName = "target/test-data/config/copy.trn";
TransformerCompiler t = new TransformerCompiler(new File (controlFileName), new File(javaFileName));
t.generateJavaCode();
String outStr = FileUtil.readStringFromFile(javaFileName);
assertTrue(outStr.equals(resultStr));
boolean ret = JavaUtils.JDKcompile ("target/test-data/out/Xlate1.java", "", "target/test-data/out");
System.out.println("return:" + ret);
assertTrue(ret);
} catch (Exception e) {
System.err.println("TranslateCompiler exception: "+ e);
e.printStackTrace();
fail("unexpected expection: " + e.getMessage());
}
}
}
|