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: package com.bostechcorp.cbesb.common.sa.service;
26:
27: import java.io.IOException;
28:
29: import junit.framework.TestCase;
30:
31: import com.bostechcorp.cbesb.common.sa.vo.ComponentVO;
32: import com.bostechcorp.cbesb.common.sa.vo.EndPointVO;
33:
34: public class TestParserComponent extends TestCase {
35: private ComponentVO cVo;
36: private EndPointVO evo;
37:
38: protected void setUp() throws Exception {
39: cVo = new ComponentVO();
40: cVo.setComponentID(987654321);
41: cVo.setComponentType("Parser");
42: cVo.setDescription("TEST");
43: cVo.setInterfaceName("ParserInterFace");
44: cVo.setName("TestParser");
45: cVo.setServiceName("ParserService");
46:
47: evo = new EndPointVO();
48: evo.setName("parser");
49: evo.setRole("consumer");
50:
51: }
52:
53: protected void tearDown() throws Exception {
54: super .tearDown();
55: }
56:
57: public void testParserComponent() throws IOException {
58: ParserComponent pComponent = new ParserComponent(cVo);
59: EndPoint ep = new EndPoint(evo);
60: ep.addSetting(PropertiesKey.PARSER_WSDL_MESSAGEDEFINITION,
61: "aaa");
62: ep.addSetting(PropertiesKey.PARSER_WSDL_PARSERTYPE, "X12");
63: pComponent.endPointList.add(ep);
64: // pComponent.addSetting(pKey.PARSER_WSDL_PARSERTYPE, "MDL");
65: // pComponent.addSetting(pKey.PARSER_WSDL_MESSAGEDEFINITION, "formats/variable1.mdl:Variable1");
66: try {
67: pComponent.generateWSDL("target/test-data/out", "sa");
68: } catch (Exception e) {
69: e.printStackTrace();
70: }
71: // String rsuleString=FileUtil.readStringFromFile("target/test-data/out/TestParser/Parser.wsdl");
72: // String beginString=FileUtil.readStringFromFile("target/test-data/result/Parser.txt");
73: // assertTrue(rsuleString.equals(beginString));
74: }
75:
76: }
|