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 TestJMSComponent extends TestCase {
35: private ComponentVO cVo;
36: private EndPointVO evo;
37: private EndPointVO evo2;
38:
39: protected void setUp() throws Exception {
40: cVo = new ComponentVO();
41: cVo.setComponentID(987654321);
42: cVo.setComponentType("JMS");
43: cVo.setDescription("TEST");
44: cVo.setInterfaceName("JMSInterFace");
45: cVo.setName("TestJMS");
46: cVo.setServiceName("JMSService");
47:
48: evo = new EndPointVO();
49: evo.setName("name");
50: evo.setRole("consumer");
51:
52: evo2 = new EndPointVO();
53: evo2.setName("name2");
54: evo2.setRole("provider");
55:
56: }
57:
58: protected void tearDown() throws Exception {
59: super .tearDown();
60: }
61:
62: public void testJMSComponent() throws IOException {
63: JMSComponent jComponent = new JMSComponent(cVo);
64: EndPoint ep = new EndPoint(evo);
65: EndPoint ep2 = new EndPoint(evo2);
66:
67: ep.addSetting(PropertiesKey.JMS_WSDL_CONSUMER_CHARSET, "aaa");
68: ep.addSetting(PropertiesKey.JMS_WSDL_CONSUMER_DEFAULTMEP,
69: "inOut");
70: ep.addSetting(PropertiesKey.JMS_WSDL_CONSUMER_WRITESYLE, "*");
71:
72: ep2.addSetting(PropertiesKey.JMS_WSDL_PROVIDER_DEFAULTMEP,
73: "inOnly");
74: ep2.addSetting(PropertiesKey.JMS_WSDL_PROVIDER_CHARSET, "**");
75:
76: jComponent.endPointList.add(ep);
77: jComponent.endPointList.add(ep2);
78: ;
79: // jComponent.addSetting(pKey.JMS_WSDL_CONSUMERSERVICE_PORT_ROLE,"consumer");
80: // jComponent.addSetting(pKey.JMS_WSDL_CONSUMERSERVICE_PORT_CONFIG_DEFAULTMEP,"InOut");
81: // jComponent.addSetting(pKey.JMS_WSDL_CONSUMERSERVICE_PORT_CONFIG_READSTYLE,"raw");
82: // jComponent.addSetting(pKey.JMS_WSDL_CONSUMERSERVICE_PORT_CONFIG_TARGETDESTINATIONNAME,"jms/ConnectionFactory");
83: //
84: // jComponent.addSetting(pKey.JMS_WSDL_PROVIDERSERVICE_PORT_ROLE,"provider");
85: // jComponent.addSetting(pKey.JMS_WSDL_PROVIDERSERVICE_PORT_CONFIG_DEFAULTMEP,"InOnly");
86: // jComponent.addSetting(pKey.JMS_WSDL_PROVIDERSERVICE_PORT_CONFIG_READSTYLE,"raw");
87: try {
88: jComponent.generateWSDL("target/test-data/out", "sa");
89: } catch (Exception e) {
90: e.printStackTrace();
91: }
92: // String rsuleString=FileUtil.readStringFromFile("target/test-data/out/TestJMS/JMS.wsdl");
93: // String beginString=FileUtil.readStringFromFile("target/test-data/result/JMS.txt");
94: // assertTrue(rsuleString.equals(beginString));
95: }
96: }
|