[jboss-svn-commits] JBL Code SVN: r38235 - in labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src: main/java/org/jboss/soa/esb/actions/soap/proxy and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 25 11:03:59 EDT 2012


Author: tcunning
Date: 2012-10-25 11:03:59 -0400 (Thu, 25 Oct 2012)
New Revision: 38235

Modified:
   labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java
   labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSWebserviceContractPublisher.java
   labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java
   labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java
Log:
JBESB-3868 
Commit Tadayoshi's patch so that rewriteEndpointUrl is initialized in HttpGateway and
JBRGateway and Contract Web.


Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java	2012-10-24 19:10:48 UTC (rev 38234)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/AbstractWsdlContractPublisher.java	2012-10-25 15:03:59 UTC (rev 38235)
@@ -68,12 +68,12 @@
     private Smooks transformer;
 
     /**
-     * Set the {@link SOAPProcessor} action configuration.
-     * @param actionConfig action config.
+     * Initialize this publisher using the action properties.
+     * @param actionProperties The action properties.
      * @throws ConfigurationException Bad config.
      */
-    public void setActionConfig(Action actionConfig) throws ConfigurationException {
-        actionProperties = actionConfig.getProperties();
+    protected void initialize(Properties actionProperties) throws ConfigurationException {
+        this.actionProperties = actionProperties;
 
         final String rewriteEndpointUrlVal = actionProperties.getProperty(AbstractWsdlContractPublisher.REWRITE_ENDPOINT_URL);
         if (rewriteEndpointUrlVal != null) {
@@ -84,6 +84,15 @@
     }
 
     /**
+     * Set the {@link SOAPProcessor} action configuration.
+     * @param actionConfig action config.
+     * @throws ConfigurationException Bad config.
+     */
+    public void setActionConfig(Action actionConfig) throws ConfigurationException {
+        initialize(actionConfig.getProperties());
+    }
+
+    /**
      * Get the action properties.
      * @return The action properties.
      */
@@ -95,7 +104,11 @@
      * Set the action properties.
      */
     protected void setActionProperties(Properties actionProperties) {
-    	this.actionProperties = actionProperties;
+        try {
+            initialize(actionProperties);
+        } catch (ConfigurationException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     /**

Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSWebserviceContractPublisher.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSWebserviceContractPublisher.java	2012-10-24 19:10:48 UTC (rev 38234)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSWebserviceContractPublisher.java	2012-10-25 15:03:59 UTC (rev 38235)
@@ -93,11 +93,6 @@
     public ContractInfo provideContract(Service service, String endpointAddressOverride) throws IOException {
         ContractInfo contract;
         if (endpointAddressOverride != null) {
-            try {
-                initializeTransformer();
-            } catch (ConfigurationException ce) {
-                throw new IOException(ce.getMessage());
-            }
             contract = getContractInfo(new EPR(URI.create(endpointAddressOverride)));
         } else {
             contract = getContractInfo(service, getWsdlAddress());

Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java	2012-10-24 19:10:48 UTC (rev 38234)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxyWsdlContractPublisher.java	2012-10-25 15:03:59 UTC (rev 38235)
@@ -105,14 +105,6 @@
 		ContractInfo contract;
 		if (endpointAddressOverride != null)
 		{
-			try
-			{
-				initializeTransformer();
-			}
-			catch (ConfigurationException ce)
-			{
-				throw new IOException( ce.getMessage() );
-			}
 			contract = getContractInfo( new EPR(URI.create(endpointAddressOverride)) );
 		}
 		else

Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java	2012-10-24 19:10:48 UTC (rev 38234)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java	2012-10-25 15:03:59 UTC (rev 38235)
@@ -35,49 +35,95 @@
 public class JBossWSAdapterContractPublisherUnitTest extends TestCase {
 	private Logger log = Logger .getLogger( JBossWSAdapterContractPublisherUnitTest.class );
 	
-    public void test() throws Exception {
+    /** Test for JBR Gateway */
+    public void test_asContractPublisher() throws Exception {
         JBossWSWebserviceContractPublisher publisher = new JBossWSWebserviceContractPublisher();
         String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl")));
         String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-out-expected.wsdl")));
         EPR epr = new EPR(URI.create("socket://x.y.x:8989/"));
 
         publisher.setActionConfig(buildActionConfig(true));
-        publisher.initializeTransformer();
         String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "socket");
         log.debug(wsdlOut);
 
         assertTrue("XML Comparison", XMLHelper.compareXMLContent(wsdlOutExpected, wsdlOut));
     }
 
-    public void test_http_rewrite() throws Exception {
+    /** Test for HTTP Gateway */
+    // JBESB-3868
+    public void test_asContractProvider() throws Exception {
         JBossWSWebserviceContractPublisher publisher = new JBossWSWebserviceContractPublisher();
         String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl")));
+        String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-out-expected.wsdl")));
+        EPR epr = new EPR(URI.create("socket://x.y.x:8989/"));
+
+        publisher.setContractProperties(buildActionConfig(true).getProperties());
+        String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "socket");
+        log.debug(wsdlOut);
+
+        assertTrue("XML Comparison", XMLHelper.compareXMLContent(wsdlOutExpected, wsdlOut));
+    }
+
+    /** Test for JBR Gateway */
+    public void test_http_rewrite_asContractPublisher() throws Exception {
+        JBossWSWebserviceContractPublisher publisher = new JBossWSWebserviceContractPublisher();
+        String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl")));
         String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-out-expected-http-rewrite.wsdl")));
         EPR epr = new EPR(URI.create("http://x.y.x:8989/"));
 
         publisher.setActionConfig(buildActionConfig(true));
 
-        publisher.initializeTransformer();
         String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "http");
         log.debug(wsdlOut);
 
         assertTrue("XML Comparison", XMLHelper.compareXMLContent(wsdlOutExpected, wsdlOut));
     }
 
-    public void test_http_norewrite() throws Exception {
+    /** Test for HTTP Gateway */
+    // JBESB-3868
+    public void test_http_rewrite_asContractProvider() throws Exception {
         JBossWSWebserviceContractPublisher publisher = new JBossWSWebserviceContractPublisher();
         String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl")));
+        String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-out-expected-http-rewrite.wsdl")));
+        EPR epr = new EPR(URI.create("http://x.y.x:8989/"));
+
+        publisher.setContractProperties(buildActionConfig(true).getProperties());
+
+        String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "http");
+        log.debug(wsdlOut);
+
+        assertTrue("XML Comparison", XMLHelper.compareXMLContent(wsdlOutExpected, wsdlOut));
+    }
+
+    /** Test for JBR Gateway */
+    public void test_http_norewrite_asContractPublisher() throws Exception {
+        JBossWSWebserviceContractPublisher publisher = new JBossWSWebserviceContractPublisher();
+        String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl")));
         String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl"))); // expected same as input wsdl
         EPR epr = new EPR(URI.create("http://x.y.x:8989/"));
 
         publisher.setActionConfig(buildActionConfig(false));
         
-        publisher.initializeTransformer();
         String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "http");
         log.debug(wsdlOut);
         assertTrue("XML Comparison", XMLHelper.compareXMLContent(wsdlOutExpected, wsdlOut));
     }
 
+    /** Test for HTTP Gateway */
+    // JBESB-3868
+    public void test_http_norewrite_asContractProvider() throws Exception {
+        JBossWSWebserviceContractPublisher publisher = new JBossWSWebserviceContractPublisher();
+        String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl")));
+        String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("/test-in.wsdl"))); // expected same as input wsdl
+        EPR epr = new EPR(URI.create("http://x.y.x:8989/"));
+
+        publisher.setContractProperties(buildActionConfig(false).getProperties());
+
+        String wsdlOut = publisher.updateWsdl(wsdlIn, epr, "myServiceCat", "myServiceName", "http");
+        log.debug(wsdlOut);
+        assertTrue("XML Comparison", XMLHelper.compareXMLContent(wsdlOutExpected, wsdlOut));
+    }
+
     private Action buildActionConfig(boolean rewriteUrls) {
         final Properties properties = new Properties() ;
 



More information about the jboss-svn-commits mailing list