[jboss-svn-commits] JBL Code SVN: r20918 - in labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src: test/java/org/jboss/soa/esb/services/soapui and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jul 5 08:03:25 EDT 2008
Author: kevin.conner at jboss.com
Date: 2008-07-05 08:03:24 -0400 (Sat, 05 Jul 2008)
New Revision: 20918
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java
labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml
Log:
Updated soapui-client to trunk version, smooks version changed: JBESB-1854
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2008-07-05 10:19:46 UTC (rev 20917)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2008-07-05 12:03:24 UTC (rev 20918)
@@ -19,38 +19,38 @@
*/
package org.jboss.soa.esb.services.soapui;
-import com.eviware.soapui.impl.wsdl.WsdlInterface;
-import com.eviware.soapui.impl.wsdl.WsdlProject;
-import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader;
-import com.eviware.soapui.model.iface.Operation;
-import org.apache.commons.httpclient.HttpClient;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.*;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamResult;
+
import org.apache.log4j.Logger;
+import org.apache.commons.httpclient.HttpClient;
import org.jboss.internal.soa.esb.soap.OGNLUtils;
-import org.jboss.internal.soa.esb.util.ESBProperties;
import org.jboss.internal.soa.esb.util.LRUCache;
-import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.internal.soa.esb.util.ESBProperties;
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.http.HttpClientFactory;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.system.ServiceMBeanSupport;
+import org.milyn.xml.XmlUtil;
import org.milyn.Smooks;
-import org.milyn.container.standalone.StandaloneExecutionContext;
-import org.milyn.javabean.BeanAccessor;
import org.milyn.resource.URIResourceLocator;
-import org.milyn.xml.XmlUtil;
import org.w3c.dom.*;
-import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import org.xml.sax.InputSource;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.*;
+import com.eviware.soapui.impl.wsdl.WsdlInterface;
+import com.eviware.soapui.impl.wsdl.WsdlProject;
+import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader;
+import com.eviware.soapui.model.iface.Operation;
/**
* Soap UI Soap Client Service MBean.
@@ -143,8 +143,8 @@
return operationInst;
}
}
-
- // Try clearing WSDL cache, WSDL may have updated
+
+ // Try clearing WSDL cache, WSDL may have updated
wsdls.remove(wsdl);
wsdlInterfaces = getWsdlInterfaces(wsdl, httpClientProps);
@@ -155,7 +155,7 @@
return operationInst;
}
}
-
+
throw new UnsupportedOperationException("Operation '" + operation + "' not supported by WSDL '" + wsdl + "'.");
}
@@ -174,26 +174,27 @@
// it as easy as possible for the developer to dump the SOAP during dev. They
// just need to set "dumpSOAP" in the param Map....
boolean dumpSOAP = params.containsKey("dumpSOAP");
-
if(dumpSOAP) {
- dumpSOAP("SOAP Template:", docRoot);
+ dumpSOAP("SOAP Template (Unexpanded):", docRoot);
}
+
expandMessage(docRoot, params);
+
if(dumpSOAP) {
dumpSOAP("SOAP Template (Expanded):", docRoot);
}
injectParameters(docRoot, params, soapNs);
- if(dumpSOAP) {
- dumpSOAP("SOAP Template (Populated):", docRoot);
+ if(smooksResource != null) {
+ applySmooksTransform(smooksResource, messageDoc);
}
- if(smooksResource != null) {
- return applySmooksTransform(smooksResource, messageDoc, params);
- } else {
- return XmlUtil.serialize(messageDoc.getChildNodes());
+ if(dumpSOAP) {
+ dumpSOAP("SOAP Message (Populated Template):", docRoot);
}
+
+ return XmlUtil.serialize(messageDoc.getChildNodes());
}
private void dumpSOAP(String message, Element docRoot) {
@@ -207,29 +208,19 @@
System.out.println("------------------------------------------------------------------------------------------------------------------------------------------");
}
- private String applySmooksTransform(String smooksResource, Document messageDoc, Map requestParams) throws IOException, SAXException {
- Smooks smooks = smooksCache.get(smooksResource);
+ private void applySmooksTransform(String smooksResource, Document messageDoc) throws IOException, SAXException {
+ if(smooksResource != null) {
+ Smooks smooks = smooksCache.get(smooksResource);
- if(smooks == null) {
- synchronized (Smooks.class) {
- smooks = smooksCache.get(smooksResource);
- if(smooks == null) {
- smooks = new Smooks();
- smooks.addConfigurations("smooks-resource", new ByteArrayInputStream(smooksResource.getBytes("UTF-8")));
- smooks.addConfigurations("cdu-creators", new URIResourceLocator().getResource("/META-INF/smooks-creators.xml"));
- smooksCache.put(smooksResource, smooks);
- }
+ if(smooks == null) {
+ smooks = new Smooks();
+ smooks.addConfigurations("smooks-resource", new ByteArrayInputStream(smooksResource.getBytes("UTF-8")));
+ smooks.addConfigurations("cdu-creators", new URIResourceLocator().getResource("/META-INF/smooks-creators.xml"));
+ smooksCache.put(smooksResource, smooks);
}
- }
- StringWriter resultWriter = new StringWriter();
- StandaloneExecutionContext executionContext = smooks.createExecutionContext();
- Map beanMap = BeanAccessor.getBeans(executionContext);
-
- beanMap.putAll(requestParams);
- smooks.filter(new DOMSource(messageDoc), new StreamResult(resultWriter), executionContext);
-
- return resultWriter.toString();
+ smooks.filter(new DOMSource(messageDoc), new DOMResult(), smooks.createExecutionContext());
+ }
}
/**
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java 2008-07-05 10:19:46 UTC (rev 20917)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java 2008-07-05 12:03:24 UTC (rev 20918)
@@ -120,6 +120,8 @@
Map params = new HashMap();
ArrayList<LineItem> lineItems = new ArrayList<LineItem>();
+ params.put("dumpSOAP", null);
+
properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
Order order = new Order();
@@ -305,7 +307,6 @@
properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
params.put("salesOrderNotification", new OrderNotification());
- params.put("someDynamicValue", 123);
String message = mbean.buildRequest(wsdlFile.toURI().toString(), "SendSalesOrderNotification", params, properties, StreamUtils.readStreamString(getClass().getResourceAsStream("sendNotificationTransform.xml"), "UTF-8"), null);
assertTrue("Generated SOAP message not as expected. See expected_04.xml. Generated message: \n" + message, compareCharStreams(getClass().getResourceAsStream("expected_04.xml"), new ByteArrayInputStream(message.getBytes())));
assertEquals("http://localhost:18080/active-bpel/services/RetailerCallback", mbean.getEndpoint(wsdlFile.toURI().toString(), properties));
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml 2008-07-05 10:19:46 UTC (rev 20917)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml 2008-07-05 12:03:24 UTC (rev 20918)
@@ -1,8 +1,5 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:abi="http://org.jboss.esb/quickstarts/bpel/ABI_OrderManager">
- <soapenv:Header>
- <something addedto="header" />
- <somethingelse>123</somethingelse>
-</soapenv:Header>
+ <soapenv:Header><something addedto="header"/></soapenv:Header>
<soapenv:Body>
<abi:salesOrderNotification>
<abi:orderNumber>12345</abi:orderNumber>
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml 2008-07-05 10:19:46 UTC (rev 20917)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_FP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml 2008-07-05 12:03:24 UTC (rev 20918)
@@ -2,10 +2,12 @@
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
<resource-config selector="header">
- <resource type="ftl"><!--
- <something addedto="header" />
- <somethingelse>${someDynamicValue}</somethingelse>-->
+ <resource type="xsl">
+ <!--
+ <something addedto="header" />
+ -->
</resource>
+ <param name="is-xslt-templatelet">true</param>
<param name="action">addto</param>
</resource-config>
More information about the jboss-svn-commits
mailing list