01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
20: * USA
21: *
22: *
23: *
24: */
25: /*
26: * $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 $
27: * $Revision: 1.4 $
28: * $Date: 2005/06/23 08:01:27 $
29: * ------------------------------------------------------------------------------------------------------
30: *
31: * Copyright (c) SymphonySoft Limited. All rights reserved.
32: * http://www.symphonysoft.com
33: *
34: * The software in this package is published under the terms of the BSD
35: * style license a copy of which has been included with this distribution in
36: * the LICENSE.txt file.
37: */
38: package com.bostechcorp.cbesb.common.trn.test;
39:
40: import java.io.File;
41: import java.io.IOException;
42:
43: import junit.framework.TestCase;
44:
45: import com.bostechcorp.cbesb.common.trn.compiler.TransformerCompiler;
46: import com.bostechcorp.cbesb.common.util.FileUtil;
47: import com.bostechcorp.cbesb.common.util.JavaUtils;
48:
49: public class TransformerCompilerTest extends TestCase {
50: String resultStr = "";
51:
52: public TransformerCompilerTest() {
53: super ();
54:
55: try {
56: resultStr = FileUtil
57: .readStringFromFile("target/test-data/result/Xlate1.java");
58: } catch (IOException e) {
59:
60: e.printStackTrace();
61: }
62:
63: }
64:
65: public void testTransformerCompiler() throws Exception {
66: try {
67:
68: String javaFileName = "target/test-data/out/Xlate1.java";
69: String controlFileName = "target/test-data/config/copy.trn";
70:
71: TransformerCompiler t = new TransformerCompiler(new File(
72: controlFileName), new File(javaFileName));
73: t.generateJavaCode();
74: String outStr = FileUtil.readStringFromFile(javaFileName);
75:
76: assertTrue(outStr.equals(resultStr));
77: boolean ret = JavaUtils.JDKcompile(
78: "target/test-data/out/Xlate1.java", "",
79: "target/test-data/out");
80: System.out.println("return:" + ret);
81: assertTrue(ret);
82:
83: } catch (Exception e) {
84: System.err.println("TranslateCompiler exception: " + e);
85: e.printStackTrace();
86: fail("unexpected expection: " + e.getMessage());
87: }
88: }
89:
90: }
|