synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r358922 - in /incubator/synapse/trunk/java: ./ src/org/apache/synapse/ src/org/apache/synapse/axis2/ src/org/apache/synapse/processors/builtin/axis2/ test/org/apache/axis2/META-INF/ test/org/apache/axis2/test/ test/org/apache/synapse/spi/in...
Date Sat, 24 Dec 2005 10:37:10 GMT
Author: saminda
Date: Sat Dec 24 02:36:50 2005
New Revision: 358922

URL: http://svn.apache.org/viewcvs?rev=358922&view=rev
Log:
1.AddressingInProcesses's logic has been  updated to switch on/off of addressing module engagement.
2.Added test cases to test out the logic. All the possible scenarios have been tested 
3.Now we have good logic base behind sendOn() and sendBack(). :) 

Added:
    incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java
    incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java
Modified:
    incubator/synapse/trunk/java/maven.xml
    incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java
    incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java
    incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java
    incubator/synapse/trunk/java/test/org/apache/axis2/META-INF/services.xml
    incubator/synapse/trunk/java/test/org/apache/axis2/test/Echo.java
    incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java
    incubator/synapse/trunk/java/test/rules/synapse-sendon.xml

Modified: incubator/synapse/trunk/java/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/maven.xml?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/maven.xml (original)
+++ incubator/synapse/trunk/java/maven.xml Sat Dec 24 02:36:50 2005
@@ -51,13 +51,13 @@
             <include name="**"/>
         </jar>
         <echo message="----------------Creating Empty Mediator aar----------------"/>
-        <mkdir dir="target/services/emptymediator/META-INF"/>
-        <copy file="synapse-test-resources/axis2/services/emptymediator/META-INF/services.xml"
-              tofile="target/services/emptymediator/META-INF/services.xml"/>
-        <jar jarfile="target/emptymediator.aar"
-             basedir="target/services/emptymediator">
-            <include name="**"/>
-        </jar>
+        <!--<mkdir dir="target/services/emptymediator/META-INF"/>-->
+        <!--<copy file="synapse-test-resources/axis2/services/emptymediator/META-INF/services.xml"-->
+              <!--tofile="target/services/emptymediator/META-INF/services.xml"/>-->
+        <!--<jar jarfile="target/emptymediator.aar"-->
+             <!--basedir="target/services/emptymediator">-->
+            <!--<include name="**"/>-->
+        <!--</jar>-->
         <j:if test="${context.getVariable('maven.test.skip') != 'true'}">
 
             <echo message="----------------Creating NPE aar----------------"/>
@@ -89,8 +89,8 @@
                   tofile="target/synapse-repository-sendon/services/synapse.aar"/>
             <copy file="target/npe.aar"
                   tofile="target/synapse-repository-sendon/services/npe.aar"/>
-            <copy file="target/emptymediator.aar"
-                  tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>
+            <!--<copy file="target/emptymediator.aar"-->
+                  <!--tofile="target/synapse-repository-sendon/services/emptymediator.aar"/>-->
             <mkdir dir="target/synapse-repository-sendon/modules"/>
             <copy file="synapse-test-resources/axis2/modules/addressing.mar"
                   tofile="target/synapse-repository-sendon/modules/addressing.mar"/>
@@ -123,8 +123,8 @@
         <mkdir dir="target/synapse-repository"/>
         <copy file="target/synapse.aar"
               tofile="target/synapse-repository/services/synapse.aar"/>
-        <copy file="target/emptymediator.aar"
-              tofile="target/synapse-repository/services/emptymediator.aar"/>
+        <!--<copy file="target/emptymediator.aar"-->
+              <!--tofile="target/synapse-repository/services/emptymediator.aar"/>-->
         <mkdir dir="target/synapse-repository/modules"/>
         <copy file="synapse-test-resources/axis2/modules/addressing.mar"
               tofile="target/synapse-repository/modules/addressing.mar"/>
@@ -137,8 +137,8 @@
         <mkdir dir="target/synapse-repository-fault"/>
         <copy file="target/synapse.aar"
               tofile="target/synapse-repository-fault/services/synapse.aar"/>
-        <copy file="target/emptymediator.aar"
-              tofile="target/synapse-repository-fault/services/emptymediator.aar"/>
+        <!--<copy file="target/emptymediator.aar"-->
+              <!--tofile="target/synapse-repository-fault/services/emptymediator.aar"/>-->
         <mkdir dir="target/synapse-repository-fault/modules"/>
         <copy file="synapse-test-resources/axis2/modules/addressing.mar"
               tofile="target/synapse-repository-fault/modules/addressing.mar"/>
@@ -151,8 +151,8 @@
         <mkdir dir="target/synapse-repository-send"/>
         <copy file="target/synapse.aar"
               tofile="target/synapse-repository-send/services/synapse.aar"/>
-        <copy file="target/emptymediator.aar"
-              tofile="target/synapse-repository-send/services/emptymediator.aar"/>
+        <!--<copy file="target/emptymediator.aar"-->
+              <!--tofile="target/synapse-repository-send/services/emptymediator.aar"/>-->
         <mkdir dir="target/synapse-repository-send/modules"/>
         <copy file="synapse-test-resources/axis2/modules/addressing.mar"
               tofile="target/synapse-repository-send/modules/addressing.mar"/>
@@ -189,7 +189,7 @@
 
         <ant:delete dir="target/modules"/>
         <ant:delete dir="target/services"/>
-        <ant:delete file="target/emptymediator.aar"/>
+        <!--<ant:delete file="target/emptymediator.aar"/>-->
         <ant:delete file="target/synapse.aar"/>
         <ant:delete dir="target/sample-deprecation"/>
         <ant:delete file="target/DeprecationMediator.aar"/>

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java Sat Dec 24 02:36:50
2005
@@ -49,4 +49,5 @@
     // for security supporting
 
     String SECURITY_QOS = "synapse_security";
+    String ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT = "addressing_processed_configurationContext";
 }

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2Sender.java Sat Dec 24
02:36:50 2005
@@ -22,6 +22,7 @@
 import org.apache.axis2.soap.SOAPFactory;
 
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.TransportInDescription;
 
 import org.apache.axis2.engine.AxisEngine;
@@ -58,6 +59,17 @@
              */
             smc.setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
                     true));
+            ///////////////////////////////////////////////////////////////////
+            // special treat for Module Engagement
+            ConfigurationContext configContext = (ConfigurationContext) smc
+                    .getProperty(
+                            Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT);
+            if (configContext != null) {
+                outMsgContext.setProperty(
+                        Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT,
+                        configContext);
+            }
+            //////////////////////////////////////////////////////////////////
 
             outMsgContext.setServerSide(true);
 
@@ -71,7 +83,7 @@
                 SOAPFactory soapFactory;
                 if (envelope.getNamespace().getName()
                         .equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                     soapFactory = OMAbstractFactory.getSOAP12Factory();
+                    soapFactory = OMAbstractFactory.getSOAP12Factory();
                     newEnvelope = soapFactory.getDefaultEnvelope();
                 } else {
                     soapFactory = OMAbstractFactory.getSOAP11Factory();
@@ -87,10 +99,11 @@
                 //todo: as a temporartory hack this was taken into account
                 Iterator iterator = envelope.getAllDeclaredNamespaces();
                 while (iterator.hasNext()) {
-                    OMNamespace namespace = (OMNamespace)iterator.next();
+                    OMNamespace namespace = (OMNamespace) iterator.next();
                     newEnvelope.declareNamespace(namespace);
                 }
-                newEnvelope.getBody().addChild(envelope.getBody().getFirstElement());
+                newEnvelope.getBody()
+                        .addChild(envelope.getBody().getFirstElement());
                 outMsgContext.setEnvelope(newEnvelope);
             }
 
@@ -114,9 +127,10 @@
                 new AxisEngine(messageContext.getConfigurationContext());
         try {
             if (messageContext.getEnvelope().getHeader() == null) {
-             messageContext.getEnvelope().getBody().insertSiblingBefore(
-                    OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope()
-                            .getHeader());
+                messageContext.getEnvelope().getBody().insertSiblingBefore(
+                        OMAbstractFactory.getSOAP11Factory()
+                                .getDefaultEnvelope()
+                                .getHeader());
 
             }
             System.out.println(messageContext.getEnvelope());
@@ -124,7 +138,14 @@
             messageContext
                     .setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
                             true));
-
+            // check for addressing is alredy engaged for this message.
+            // if engage we should use the address enable Configuraion context.
+            ConfigurationContext configContext = (ConfigurationContext) smc
+                    .getProperty(
+                            Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT);
+            if (configContext != null) {
+                messageContext.setConfigurationContext(configContext);
+            }
 
             ae.send(messageContext);
         } catch (AxisFault e) {

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java
(original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/processors/builtin/axis2/AddressingInProcessor.java
Sat Dec 24 02:36:50 2005
@@ -19,13 +19,10 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.*;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOutAxisOperation;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 
@@ -39,6 +36,7 @@
 
 
 import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.axis2.EmptyMessageReceiver;
 
 import org.apache.synapse.processors.AbstractProcessor;
 
@@ -57,45 +55,98 @@
         try {
             MessageContext mc = ((Axis2SynapseMessage) smc)
                     .getMessageContext();
+            ///////////////////////////////////////////////////////////////////
+            // Default Configurations. We are not going to alter these configurtions
             ConfigurationContext cc = mc.getConfigurationContext();
             AxisConfiguration ac = cc.getAxisConfiguration();
-            AxisEngine ae = new AxisEngine(cc);
-            AxisService as = ac.getService(Constants.EMPTYMEDIATOR);
-            if (as == null)
-                throw new SynapseException("cannot locate service "
-                        + Constants.EMPTYMEDIATOR);
+            //////////////////////////////////////////////////////////////////
+//            AxisService as = ac.getService(Constants.EMPTYMEDIATOR);
+//            if (as == null)
+//                throw new SynapseException("cannot locate service "
+//                        + Constants.EMPTYMEDIATOR);
+
+            ///////////////////////////////////////////////////////////////////
+            //////////////////////////////////////////////////////////////////
+            // making addressing on/off behavior possible
+            // default addressing is on. Allow MessageContext to pass through the chain
+            // and fill the addressingHeaderInformation. Once the chain is excuted old ConfigurationContext
+            // set to the MessageContext.
+            // inorder to make this possible, we create a new ConfigurationContext
+            // from scratch. Then add the service, operation and MessageReceiver
+            // programatically. After the invocation, old ConfigurationContext and
+            // AxisConfiguration is set to the MessageContext
+
+            ConfigurationContextFactory configCtxFac =
+                    new ConfigurationContextFactory();
+            ConfigurationContext configCtx =
+                    configCtxFac.buildConfigurationContext(null);
+            AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
+
+            AxisService service = new AxisService(Constants.EMPTYMEDIATOR);
+            service.setClassLoader(ac.getServiceClassLoader());
+            AxisOperation axisOp =
+                    new InOutAxisOperation(Constants.MEDIATE_OPERATION_NAME);
+            axisOp.setMessageReceiver(new EmptyMessageReceiver());
+            service.addOperation(axisOp);
+            axisConfig.addService(service);
+
+            mc.setConfigurationContext(configCtx);
+
+            //setging the addressing enable ConfigurationContext to SynapeMessage
+
+            smc.setProperty(Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT,
+                    configCtx);
+            //////////////////////////////////////////////////////////////////
+            //////////////////////////////////////////////////////////////////
+            //AxisEngine ae = new AxisEngine(cc);
+            AxisEngine ae = new AxisEngine(configCtx);
 
             // see if addressing already engage
-            boolean addressingModuleEngage = false;
-            for (Iterator iterator = ac.getEngagedModules().iterator();
-                 iterator.hasNext();) {
-                QName qname = (QName) iterator.next();
-                if (qname.getLocalPart()
-                        .equals(org.apache.axis2.Constants.MODULE_ADDRESSING)) {
-                    addressingModuleEngage = true;
-                    break;
-                }
-            }
-            if (!addressingModuleEngage) {
-                ac.engageModule(new QName(
-                        org.apache.axis2.Constants.MODULE_ADDRESSING));
-            }
-            AxisOperation ao = as
-                    .getOperation(Constants.MEDIATE_OPERATION_NAME);
+//            boolean addressingModuleEngage = false;
+//            for (Iterator iterator = ac.getEngagedModules().iterator();
+//                 iterator.hasNext();) {
+//                QName qname = (QName) iterator.next();
+//                if (qname.getLocalPart()
+//                        .equals(org.apache.axis2.Constants.MODULE_ADDRESSING)) {
+//                    addressingModuleEngage = true;
+//                    break;
+//                }
+//            }
+//            if (!addressingModuleEngage) {
+//                ac.engageModule(new QName(
+//                        org.apache.axis2.Constants.MODULE_ADDRESSING));
+//            }
+//            AxisOperation ao = as
+//                    .getOperation(Constants.MEDIATE_OPERATION_NAME);
+//            OperationContext oc = OperationContextFactory
+//                    .createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
             OperationContext oc = OperationContextFactory
-                    .createOperationContext(ao.getAxisSpecifMEPConstant(), ao);
-            ao.registerOperationContext(mc, oc);
-
-            ServiceContext sc = Utils.fillContextInformation(ao, as, cc);
+                    .createOperationContext(axisOp.getAxisSpecifMEPConstant(),
+                            axisOp);
+            //ao.registerOperationContext(mc, oc);
+            axisOp.registerOperationContext(mc, oc);
+
+            //ServiceContext sc = Utils.fillContextInformation(ao, as, cc);
+            ServiceContext sc =
+                    Utils.fillContextInformation(axisOp, service, configCtx);
             oc.setParent(sc);
 
             mc.setOperationContext(oc);
             mc.setServiceContext(sc);
 
-            mc.setAxisOperation(ao);
-            mc.setAxisService(as);
+//            mc.setAxisOperation(ao);
+//            mc.setAxisService(as);
+            mc.setAxisOperation(axisOp);
+            mc.setAxisService(service);
 
             ae.receive(mc);
+            //////////////////////////////////////////////////////////////////////
+            // Now the MessageContext is filled with SOAP properties. We don't need to send
+            // this message anymore time through AddressingInHandler. But we need to send
it through
+            // AddressingOutHandler
+            // Thus, setting the Default ConfigurationContext
+            mc.setConfigurationContext(cc);
+            /////////////////////////////////////////////////////////////////////
 
         } catch (AxisFault e) {
             throw new SynapseException(e);

Modified: incubator/synapse/trunk/java/test/org/apache/axis2/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/axis2/META-INF/services.xml?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/axis2/META-INF/services.xml (original)
+++ incubator/synapse/trunk/java/test/org/apache/axis2/META-INF/services.xml Sat Dec 24 02:36:50
2005
@@ -12,4 +12,7 @@
     <operation name="fault" locked="false">
         <parameter name="wsamapping">urn:synapse/sendon-fault</parameter>
     </operation>
+    <operation name="echo_addressing" locked="false">
+        <parameter name="wsamapping">urn:synapse/sendon-addressing-engage</parameter>
+    </operation>
 </service>

Modified: incubator/synapse/trunk/java/test/org/apache/axis2/test/Echo.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/axis2/test/Echo.java?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/axis2/test/Echo.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/axis2/test/Echo.java Sat Dec 24 02:36:50
2005
@@ -39,4 +39,17 @@
     public OMElement fault(OMElement element) throws AxisFault {
         throw new AxisFault("Native End Point Throws an Exception");
     }
+    public OMElement echo_addressing(OMElement element) {
+        System.out.println(
+                "This is the actual service which has been redirected with addressing");
+        element.build();
+        element.detach();
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace(
+                "urn:text-body", "ns");
+        OMElement responseText = fac.createOMElement("response_text_addressing", omNs);
+        responseText.addChild(
+                fac.createText(responseText, "Synapse Testing String_Response_With_Addressing"));
+        return responseText;
+    }
 }

Added: incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java?rev=358922&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java
(added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java
Sat Dec 24 02:36:50 2005
@@ -0,0 +1,67 @@
+package org.apache.synapse.spi.injection;
+
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Call;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.om.OMElement;
+import org.apache.synapse.util.Axis2EvnSetup;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+public class SendOnProcessorWithAddressingEngageWithRuleTest extends TestCase {
+    private SimpleHTTPServer synapseServer;
+    private SimpleHTTPServer axis2Server;
+    private EndpointReference targetEpr = new EndpointReference(
+            "http://127.0.0.1:5043/axis2/services/anonymous");
+    private QName operation = new QName("anonymous");
+
+    public void setUp() throws Exception {
+        synapseServer = new SimpleHTTPServer("target/synapse-repository-sendon",
+                5043);
+        /**
+         * axis2Server is the one who holds the actual service
+         */
+        axis2Server =
+                new SimpleHTTPServer("target/synapse-repository-sendonAxis2",
+                        8090);
+        synapseServer.start();
+        axis2Server.start();
+    }
+
+    protected void tearDown() throws Exception {
+        synapseServer.stop();
+        axis2Server.stop();
+    }
+
+    public void testSendProcessor() throws Exception {
+        Call call = new Call();
+        Options options = new Options();
+        options.setTo(targetEpr);
+        call.setClientOptions(options);
+        OMElement response = call.invokeBlocking(operation.getLocalPart(),
+                Axis2EvnSetup.payloadNamedAdddressing());
+        assertEquals("Synapse Testing String_Response_With_Addressing",
+                response.getText());
+
+    }
+
+}

Added: incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java?rev=358922&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java
(added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java
Sat Dec 24 02:36:50 2005
@@ -0,0 +1,52 @@
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.om.OMElement;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.util.Axis2EvnSetup;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+public class ServiceMediatorProcessorWithAddressingEnageWithRuleTest extends TestCase {
+    private MessageContext msgCtx;
+    private SynapseEnvironment env;
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<stage name=\"test-service-mediator\">\n" +
+                    "    <engage-addressing-in/>\n"+
+                    "    <servicemediator name=\"service-mediator\" service=\"test-mediator\"/>\n"
+
+                    "</stage>\n" +
+                    "</synapse>";
+
+    public void setUp() throws Exception {
+        msgCtx = Axis2EvnSetup.axis2Deployment("target/synapse-repository-sendonAxis2");
+        OMElement config = Axis2EvnSetup.getSynapseConfigElement(synapsexml);
+        env = new Axis2SynapseEnvironment(config,
+                Thread.currentThread().getContextClassLoader());
+    }
+
+    public void testServiceMediatorWithAddressingEngage() throws Exception {
+
+        SynapseMessage smc = new Axis2SynapseMessage(msgCtx);
+        env.injectMessage(smc);
+        assertNotNull(env.lookupProcessor("service-mediator"));
+    }
+}

Modified: incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/util/Axis2EvnSetup.java Sat Dec 24
02:36:50 2005
@@ -97,4 +97,15 @@
         method.addChild(value);
         return method;
     }
+     public static OMElement payloadNamedAdddressing() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace(
+                "urn:text-body", "ns");
+        OMElement method = fac.createOMElement("service", omNs);
+        OMElement value = fac.createOMElement("text_addressing", omNs);
+        value.addChild(
+                fac.createText(value, "Synapse Testing String Through Addressing"));
+        method.addChild(value);
+        return method;
+    }
 }

Modified: incubator/synapse/trunk/java/test/rules/synapse-sendon.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/rules/synapse-sendon.xml?rev=358922&r1=358921&r2=358922&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/rules/synapse-sendon.xml (original)
+++ incubator/synapse/trunk/java/test/rules/synapse-sendon.xml Sat Dec 24 02:36:50 2005
@@ -7,5 +7,15 @@
         <xpath expr="//ns:response_text" xmlns:ns="urn:text-body">
             <send/>
         </xpath>
+        <xpath expr="//ns:text_addressing" xmlns:ns="urn:text-body">
+            <engage-addressing-in/>
+            <header type="to" value="http://localhost:8090/axis2/services/npe"/>
+            <header type="action" value="urn:synapse/sendon-addressing-engage"/>
+            <send/>
+        </xpath>
+        <xpath expr="//ns:response_text_addressing" xmlns:ns="urn:text-body">
+            <send/>
+        </xpath>
+
     </stage>
 </synapse>



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message