[jboss-svn-commits] JBL Code SVN: r19930 - labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 12 11:00:54 EDT 2008
Author: tfennelly
Date: 2008-05-12 11:00:54 -0400 (Mon, 12 May 2008)
New Revision: 19930
Added:
labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_SoapUIClientServiceMBeanUnitTest.java
Removed:
labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_RedpillSoapUIClientServiceMBeanUnitTest.java
Modified:
labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml
labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl
Log:
Some renaming
Deleted: labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_RedpillSoapUIClientServiceMBeanUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_RedpillSoapUIClientServiceMBeanUnitTest.java 2008-05-12 11:21:25 UTC (rev 19929)
+++ labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_RedpillSoapUIClientServiceMBeanUnitTest.java 2008-05-12 15:00:54 UTC (rev 19930)
@@ -1,157 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.services.soapui;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.math.BigDecimal;
-import java.util.*;
-
-import javax.xml.transform.stream.StreamResult;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.services.soapui.orderprocessing.Order;
-import org.jboss.soa.esb.services.soapui.orderprocessing.LineItem;
-import org.jboss.soa.esb.services.soapui.orderprocessing.ProcessOrderRequest;
-import org.jboss.soa.esb.http.HttpClientFactory;
-import org.jboss.soa.esb.dom.YADOMUtil;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * @author someone at redpill
- */
-public class JBESB_1713_RedpillSoapUIClientServiceMBeanUnitTest extends TestCase {
-
- private class PostTrainMessage1 {
- public String arg0 = "argument 0";
- public List<String> arg1;
- public boolean arg2 = true;
- public String arg3 = "argument 3";
- public long arg4 = 1;
- public long arg5 = 2;
- }
-
- private class PostTrainMessage2 {
- public String arg0 = "argument 0";
- public String[] arg1;
- public boolean arg2 = true;
- public String arg3 = "argument 3";
- public long arg4 = 1;
- public long arg5 = 2;
- }
-
- private void addTrains(List<String> trains) {
- trains.add(new String("1111"));
- trains.add(new String("2222"));
- trains.add(new String("3333"));
- trains.add(new String("4444"));
- }
-
- private static final String WSDL_LOCATAION = "src/test/java/org/jboss/soa/esb/services/soapui";
- private Properties properties;
-
- protected void setUp() throws Exception {
- properties = new Properties();
- }
-
- public void test_redpill() throws IOException, SAXException, ConfigurationException {
- File wsdlFile = new File(WSDL_LOCATAION + "/handdator.wsdl");
- SoapUIClientService mbean = new SoapUIClientService();
- Map params = new HashMap();
-
- params.put("dumpSOAP", null);
-
- PostTrainMessage1 postTrainMessage1 = new PostTrainMessage1();
- PostTrainMessage2 postTrainMessage2 = new PostTrainMessage2();
- List<String> trains1 = new ArrayList<String>();
- String[] trains2 = new String[4];
-
- properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
-
- addTrains(trains1);
- postTrainMessage1.arg1 = trains1;
- trains1.toArray(trains2);
- postTrainMessage2.arg1 = trains2;
-
- params.put("postTrainMessage", postTrainMessage1);
-
- String message = mbean.buildRequest(wsdlFile.toURI().toString(), "postTrainMessage", params, properties, null, null);
- assertTrue("Generated SOAP message not as expected. See expected_JBESB_1713.xml. Generated message: \n" + message, compareCharStreams(getClass().getResourceAsStream("expected_JBESB_1713.xml"), new ByteArrayInputStream(message.getBytes())));
-
- params.put("postTrainMessage", postTrainMessage2);
-
- message = mbean.buildRequest(wsdlFile.toURI().toString(), "postTrainMessage", params, properties, null, null);
-
- assertTrue("Generated SOAP message not as expected. See expected_JBESB_1713.xml. Generated message: \n" + message, compareCharStreams(getClass().getResourceAsStream("expected_JBESB_1713.xml"), new ByteArrayInputStream(message.getBytes())));
- }
-
- // Lifted from milyn commons
- public static boolean compareCharStreams(InputStream s1, InputStream s2) {
- try {
- final String xml1 = trimLines(s1).toString() ;
- final String xml2 = trimLines(s2).toString() ;
-
- final Document doc1 = YADOMUtil.parse(xml1) ;
- final Document doc2 = YADOMUtil.parse(xml2) ;
-
- final StringWriter writer1 = new StringWriter() ;
- final StringWriter writer2 = new StringWriter() ;
- YADOMUtil.serialize(doc1, new StreamResult(writer1)) ;
- YADOMUtil.serialize(doc2, new StreamResult(writer2)) ;
- return (writer1.toString().equals(writer2.toString())) ;
- } catch (IOException e) {
- // fail the comparison
- } catch (SAXException e) {
- // fail the comparison
- } catch (ConfigurationException e) {
- // fail the comparison
- }
-
- return false;
- }
- public static StringBuffer trimLines(InputStream charStream) throws IOException {
- StringBuffer stringBuf = new StringBuffer();
- BufferedReader reader = new BufferedReader(new InputStreamReader(charStream));
- String line;
-
- while((line = reader.readLine()) != null) {
- stringBuf.append(line.trim());
- }
-
- return stringBuf;
- }
-
- public static void main(final String[] args)
- {
- final InputStream expectedIS = SoapUIClientServiceMBeanUnitTest.class.getResourceAsStream("expected_02.xml") ;
- final InputStream outputIS = SoapUIClientServiceMBeanUnitTest.class.getResourceAsStream("output.xml") ;
-
- System.out.println("compare returns: " + compareCharStreams(expectedIS, outputIS));
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_SoapUIClientServiceMBeanUnitTest.java (from rev 19929, labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_RedpillSoapUIClientServiceMBeanUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_SoapUIClientServiceMBeanUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_SoapUIClientServiceMBeanUnitTest.java 2008-05-12 15:00:54 UTC (rev 19930)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.services.soapui;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.util.*;
+
+import javax.xml.transform.stream.StreamResult;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.http.HttpClientFactory;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+public class JBESB_1713_SoapUIClientServiceMBeanUnitTest extends TestCase {
+
+ private class PostBlahMessage1 {
+ public String arg0 = "argument 0";
+ public List<String> arg1;
+ public boolean arg2 = true;
+ public String arg3 = "argument 3";
+ public long arg4 = 1;
+ public long arg5 = 2;
+ }
+
+ private class PostBlahMessage2 {
+ public String arg0 = "argument 0";
+ public String[] arg1;
+ public boolean arg2 = true;
+ public String arg3 = "argument 3";
+ public long arg4 = 1;
+ public long arg5 = 2;
+ }
+
+ private void addBlahs(List<String> blahs) {
+ blahs.add(new String("1111"));
+ blahs.add(new String("2222"));
+ blahs.add(new String("3333"));
+ blahs.add(new String("4444"));
+ }
+
+ private static final String WSDL_LOCATAION = "src/test/java/org/jboss/soa/esb/services/soapui";
+ private Properties properties;
+
+ protected void setUp() throws Exception {
+ properties = new Properties();
+ }
+
+ public void test_JBESB_1713() throws IOException, SAXException, ConfigurationException {
+ File wsdlFile = new File(WSDL_LOCATAION + "/handdator.wsdl");
+ SoapUIClientService mbean = new SoapUIClientService();
+ Map params = new HashMap();
+
+ params.put("dumpSOAP", null);
+
+ PostBlahMessage1 postBlahMessage1 = new PostBlahMessage1();
+ PostBlahMessage2 postBlahMessage2 = new PostBlahMessage2();
+ List<String> blahs1 = new ArrayList<String>();
+ String[] blahs2 = new String[4];
+
+ properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
+
+ addBlahs(blahs1);
+ postBlahMessage1.arg1 = blahs1;
+ blahs1.toArray(blahs2);
+ postBlahMessage2.arg1 = blahs2;
+
+ params.put("postBlahMessage", postBlahMessage1);
+
+ String message = mbean.buildRequest(wsdlFile.toURI().toString(), "postBlahMessage", params, properties, null, null);
+ assertTrue("Generated SOAP message not as expected. See expected_JBESB_1713.xml. Generated message: \n" + message, compareCharStreams(getClass().getResourceAsStream("expected_JBESB_1713.xml"), new ByteArrayInputStream(message.getBytes())));
+
+ params.put("postBlahMessage", postBlahMessage2);
+
+ message = mbean.buildRequest(wsdlFile.toURI().toString(), "postBlahMessage", params, properties, null, null);
+
+ assertTrue("Generated SOAP message not as expected. See expected_JBESB_1713.xml. Generated message: \n" + message, compareCharStreams(getClass().getResourceAsStream("expected_JBESB_1713.xml"), new ByteArrayInputStream(message.getBytes())));
+ }
+
+ // Lifted from milyn commons
+ public static boolean compareCharStreams(InputStream s1, InputStream s2) {
+ try {
+ final String xml1 = trimLines(s1).toString() ;
+ final String xml2 = trimLines(s2).toString() ;
+
+ final Document doc1 = YADOMUtil.parse(xml1) ;
+ final Document doc2 = YADOMUtil.parse(xml2) ;
+
+ final StringWriter writer1 = new StringWriter() ;
+ final StringWriter writer2 = new StringWriter() ;
+ YADOMUtil.serialize(doc1, new StreamResult(writer1)) ;
+ YADOMUtil.serialize(doc2, new StreamResult(writer2)) ;
+ return (writer1.toString().equals(writer2.toString())) ;
+ } catch (IOException e) {
+ // fail the comparison
+ } catch (SAXException e) {
+ // fail the comparison
+ } catch (ConfigurationException e) {
+ // fail the comparison
+ }
+
+ return false;
+ }
+ public static StringBuffer trimLines(InputStream charStream) throws IOException {
+ StringBuffer stringBuf = new StringBuffer();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(charStream));
+ String line;
+
+ while((line = reader.readLine()) != null) {
+ stringBuf.append(line.trim());
+ }
+
+ return stringBuf;
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/JBESB_1713_SoapUIClientServiceMBeanUnitTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml
===================================================================
--- labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml 2008-05-12 11:21:25 UTC (rev 19929)
+++ labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_JBESB_1713.xml 2008-05-12 15:00:54 UTC (rev 19930)
@@ -1,20 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.itrl.ipl.sj.se/">
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:x="http://x.y.x/">
<soapenv:Header/>
<soapenv:Body>
- <ws:postTrainMessage>
+ <x:postBlahMessage>
<!--Optional:-->
<arg0>argument 0</arg0>
<!--Zero or more repetitions: - cloned-->
<arg1>1111</arg1>
- <arg1>2222</arg1>
-<arg1>3333</arg1>
-<arg1>4444</arg1>
-<arg2>true</arg2>
+ <arg1>2222</arg1><arg1>3333</arg1><arg1>4444</arg1><arg2>true</arg2>
<!--Optional:-->
<arg3>argument 3</arg3>
<arg4>1</arg4>
<arg5>2</arg5>
- </ws:postTrainMessage>
+ </x:postBlahMessage>
</soapenv:Body>
</soapenv:Envelope>
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl
===================================================================
--- labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl 2008-05-12 11:21:25 UTC (rev 19929)
+++ labs/jbossesb/trunk/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/handdator.wsdl 2008-05-12 15:00:54 UTC (rev 19930)
@@ -1,9 +1,9 @@
-<definitions name='DummyHanddatorWSBeanService' targetNamespace='http://ws.itrl.ipl.sj.se/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://ws.itrl.ipl.sj.se/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+<definitions name='DummyHanddatorWSBeanService' targetNamespace='http://x.y.x/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://x.y.x/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
- <xs:schema targetNamespace='http://ws.itrl.ipl.sj.se/' version='1.0' xmlns:tns='http://ws.itrl.ipl.sj.se/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
- <xs:element name='postTrainMessage' type='tns:postTrainMessage'/>
- <xs:element name='postTrainMessageResponse' type='tns:postTrainMessageResponse'/>
- <xs:complexType name='postTrainMessage'>
+ <xs:schema targetNamespace='http://x.y.x/' version='1.0' xmlns:tns='http://x.y.x/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='postBlahMessage' type='tns:postBlahMessage'/>
+ <xs:element name='postBlahMessageResponse' type='tns:postBlahMessageResponse'/>
+ <xs:complexType name='postBlahMessage'>
<xs:sequence>
<xs:element minOccurs='0' name='arg0' type='xs:string'/>
<xs:element maxOccurs='unbounded' minOccurs='0' name='arg1' type='xs:string'/>
@@ -13,26 +13,26 @@
<xs:element name='arg5' type='xs:long'/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name='postTrainMessageResponse'>
+ <xs:complexType name='postBlahMessageResponse'>
<xs:sequence/>
</xs:complexType>
</xs:schema>
</types>
- <message name='DummyHanddatorWSBean_postTrainMessageResponse'>
- <part element='tns:postTrainMessageResponse' name='postTrainMessageResponse'></part>
+ <message name='DummyHanddatorWSBean_postBlahMessageResponse'>
+ <part element='tns:postBlahMessageResponse' name='postBlahMessageResponse'></part>
</message>
- <message name='DummyHanddatorWSBean_postTrainMessage'>
- <part element='tns:postTrainMessage' name='postTrainMessage'></part>
+ <message name='DummyHanddatorWSBean_postBlahMessage'>
+ <part element='tns:postBlahMessage' name='postBlahMessage'></part>
</message>
<portType name='DummyHanddatorWSBean'>
- <operation name='postTrainMessage' parameterOrder='postTrainMessage'>
- <input message='tns:DummyHanddatorWSBean_postTrainMessage'></input>
- <output message='tns:DummyHanddatorWSBean_postTrainMessageResponse'></output>
+ <operation name='postBlahMessage' parameterOrder='postBlahMessage'>
+ <input message='tns:DummyHanddatorWSBean_postBlahMessage'></input>
+ <output message='tns:DummyHanddatorWSBean_postBlahMessageResponse'></output>
</operation>
</portType>
<binding name='DummyHanddatorWSBeanBinding' type='tns:DummyHanddatorWSBean'>
<soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
- <operation name='postTrainMessage'>
+ <operation name='postBlahMessage'>
<soap:operation soapAction=''/>
<input>
<soap:body use='literal'/>
More information about the jboss-svn-commits
mailing list