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 TestFileComponent extends TestCase {
35:
36: private EndPointVO evo;
37: private EndPointVO evo2;
38: private ComponentVO cVo;
39:
40: protected void setUp() throws Exception {
41:
42: cVo = new ComponentVO();
43: cVo.setComponentID(987654321);
44: cVo.setComponentType("FILE");
45: cVo.setDescription("TEST FILE");
46: cVo.setInterfaceName("FILE InterFace");
47: cVo.setName("TestFILE");
48: cVo.setServiceName("FILEService");
49:
50: evo = new EndPointVO();
51: evo.setName("name");
52: evo.setRole("consumer");
53:
54: evo2 = new EndPointVO();
55: evo2.setName("name2");
56: evo2.setRole("provider");
57:
58: }
59:
60: protected void tearDown() throws Exception {
61: super .tearDown();
62: }
63:
64: public void test() throws IOException {
65: EndPoint ep = new EndPoint(evo);
66: ep.addSetting(PropertiesKey.FILE_WSDL_READ_CHARSET, "a");
67: ep.addSetting(PropertiesKey.FILE_WSDL_READ_SOURCEDIR, "ddd");
68: ep.addSetting(PropertiesKey.FILE_WSDL_READ_COMPLETION_ACTION,
69: "true");
70: ep.addSetting(PropertiesKey.FILE_WSDL_READ_DEFAULTMEP, "inOut");
71: ep.addSetting(PropertiesKey.FILE_WSDL_READ_FILEPATTERN, "*");
72: ep.addSetting(PropertiesKey.FILE_WSDL_READ_HOLD_ENABLED,
73: "enable");
74:
75: EndPoint ep2 = new EndPoint(evo2);
76: ep2.addSetting(PropertiesKey.FILE_WSDL_WRITE_CHARSET, "b");
77: ep2.addSetting(
78: PropertiesKey.FILE_WSDL_WRITE_DESTINATIONDIRECTORY,
79: "CCC");
80: ep2.addSetting(PropertiesKey.FILE_WSDL_WRITE_DEFAULTMEP,
81: "inOut");
82:
83: FileComponent fComponent = new FileComponent(cVo);
84: fComponent.endPointList.add(ep);
85: fComponent.endPointList.add(ep2);
86:
87: try {
88: fComponent.generateWSDL("target/test-data/out", "sa");
89: } catch (Exception e) {
90: e.printStackTrace();
91: }
92: // String rsuleString=FileUtil.readStringFromFile("target/test-data/out/TestFile/consumer/File.wsdl");
93: // String beginString=FileUtil.readStringFromFile("target/test-data/result/FileR.txt");
94: // String rsuleString2=FileUtil.readStringFromFile("target/test-data/out/TestFile/provider/File.wsdl");
95: // String beginString2=FileUtil.readStringFromFile("target/test-data/result/FileX.txt");
96: // assertTrue(rsuleString.equals(beginString));
97: // assertTrue(rsuleString2.equals(beginString2));
98: }
99: }
|