You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by sa...@apache.org on 2005/11/18 08:03:44 UTC

svn commit: r345465 - in /incubator/synapse/trunk/scratch/prototype2: ./ repo/ repo/modules/ repo/services/ src/org/apache/synapse/api/ src/org/apache/synapse/axis2/ test/ test/org/ test/org/apache/ test/org/apache/synapse/ test/org/apache/synapse/spi/...

Author: saminda
Date: Thu Nov 17 23:03:21 2005
New Revision: 345465

URL: http://svn.apache.org/viewcvs?rev=345465&view=rev
Log:
1. Little modification is done to Axis2SynapseEnvironmentFinder to make sure that synapse.xml is build before 
processing.
2. Temporary "repo" has been set up for Synpase build in services such as "classmediator". 
3. A test case have been added to test AllRuleEngine using above repository. More test cases will be added soon.
4. SOAPMessageContext has changed a little to cope with the latest Axis2 changes. {Changes that have been done in 
Addressing}

Added:
    incubator/synapse/trunk/scratch/prototype2/repo/
    incubator/synapse/trunk/scratch/prototype2/repo/axis2.xml
    incubator/synapse/trunk/scratch/prototype2/repo/modules/
    incubator/synapse/trunk/scratch/prototype2/repo/modules/addressing.mar   (with props)
    incubator/synapse/trunk/scratch/prototype2/repo/services/
    incubator/synapse/trunk/scratch/prototype2/repo/services/classmediator.aar   (with props)
    incubator/synapse/trunk/scratch/prototype2/repo/synapse.xml
    incubator/synapse/trunk/scratch/prototype2/test/
    incubator/synapse/trunk/scratch/prototype2/test/org/
    incubator/synapse/trunk/scratch/prototype2/test/org/apache/
    incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/
    incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/
    incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/
    incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynpaseEngineAllRuleTest.java
Modified:
    incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/api/SOAPMessageContext.java
    incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SOAPMessageContext.java
    incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
    incubator/synapse/trunk/scratch/prototype2/synapse.xml

Added: incubator/synapse/trunk/scratch/prototype2/repo/axis2.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/repo/axis2.xml?rev=345465&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/repo/axis2.xml (added)
+++ incubator/synapse/trunk/scratch/prototype2/repo/axis2.xml Thu Nov 17 23:03:21 2005
@@ -0,0 +1,140 @@
+<axisconfig name="AxisJava2.0">
+	<!-- ================================================= -->
+	<!-- Parameters -->
+	<!-- ================================================= -->
+	<parameter name="hotdeployment" locked="false">true</parameter>
+	<parameter name="hotupdate" locked="false">false</parameter>
+	<parameter name="enableMTOM" locked="false">true</parameter>
+	<!-- Uncomment this to enable REST support -->
+	<!--    <parameter name="enableREST" locked="false">true</parameter>-->
+
+
+	<parameter name="userName" locked="false">admin</parameter>
+	<parameter name="password" locked="false">axis2</parameter>
+
+	<parameter name="seralizeLocation" locked="false">.</parameter>
+
+	<parameter name="SynapseConfiguration" locked="false">synapse.xml</parameter>  
+
+	<!--if you want to extract the service archive file and work with that please uncomment this-->
+	<!--else , it wont extract archive file or does not take into consideration if someone drop-->
+	<!--exploded directory into /service directory-->
+	<!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+	<!--    The way of adding listener to the system-->
+	<!--    <listener class="org.apache.axis2.ObserverIMPL">-->
+	<!--        <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+	<!--    </listener>-->
+
+	<!--Registering Axis Storage Class if you comment this default one will -->
+	<!--does the job (org.apache.axis2.storage.impl.AxisMemoryStorage) , if you-->
+	<!--want to register new one write a class by extanding AbastractStorage-->
+	<!--and put that name here-->
+	<axisStorage
+		class="org.apache.axis2.storage.impl.AxisMemoryStorage">
+		<parameter name="StoreLocation" locked="false">N:S</parameter>
+	</axisStorage>
+
+
+
+	<!-- ================================================= -->
+	<!-- Message Receivers -->
+	<!-- ================================================= -->
+	<!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+	<messageReceiver mep="INOUT"
+		class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
+
+	<!-- ================================================= -->
+	<!-- Transport Ins -->
+	<!-- ================================================= -->
+	<transportReceiver name="http"
+		class="org.apache.axis2.transport.http.SimpleHTTPServer">
+		<parameter name="port" locked="false">6060</parameter>
+	</transportReceiver>
+
+	<!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+		<transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+		<parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
+		<parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
+		<parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
+		<parameter name="transport.mail.pop3.port" locked="false">110</parameter>
+		<parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
+		</transportReceiver> -->
+
+	<transportReceiver name="tcp"
+		class="org.apache.axis2.transport.tcp.TCPServer">
+		<parameter name="port" locked="false">6060</parameter>
+	</transportReceiver>
+
+	<!-- ================================================= -->
+	<!-- Transport Outs -->
+	<!-- ================================================= -->
+
+	<transportSender name="tcp"
+		class="org.apache.axis2.transport.tcp.TCPTransportSender" />
+	<transportSender name="local"
+		class="org.apache.axis2.transport.local.LocalTransportSender" />
+	<transportSender name="http"
+		class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+		<parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
+	</transportSender>
+	<transportSender name="https"
+		class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+		<parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+	</transportSender>
+
+	<!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+		<transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
+		<parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+		<parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+		<parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+		<parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+		</transportSender>
+	-->
+
+	<!-- ================================================= -->
+	<!-- Global Modules  -->
+	<!-- ================================================= -->
+	<!-- Comment this to disable Addressing -->
+	<!--  <module ref="addressing" /> -->
+	<module ref="addressing" /> 
+
+
+	<!--Configuring module , providing paramters for modules whether they refer or not-->
+	<!--<moduleConfig name="addressing">-->
+	<!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+	<!--</moduleConfig>-->
+
+	<dispatchOrder>
+		<dispatcher name="SyanpseDispatcher"
+			class="org.apache.synapse.axis2.SynapseDispatcher" />
+	</dispatchOrder>
+
+	<!-- ================================================= -->
+	<!-- Phases  -->
+	<!-- ================================================= -->
+	<phaseOrder type="inflow">
+		<!--  System pre defined phases       -->
+		<phase name="TransportIn" />
+		<phase name="PreDispatch" />
+		<phase name="Dispatch" />
+		<phase name="PostDispatch" />
+		<!--  System pre defined phases       -->
+		<!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+		<phase name="userphase1" />
+	</phaseOrder>
+	<phaseOrder type="outflow">
+		<!--      user can add his own phases to this area  -->
+		<phase name="userphase1" />
+	</phaseOrder>
+	<phaseOrder type="INfaultflow">
+		<!--      user can add his own phases to this area  -->
+		<phase name="userphase1" />
+	</phaseOrder>
+	<phaseOrder type="Outfaultflow">
+		<!--      user can add his own phases to this area  -->
+		<phase name="userphase1" />
+	</phaseOrder>
+</axisconfig>
+

Added: incubator/synapse/trunk/scratch/prototype2/repo/modules/addressing.mar
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/repo/modules/addressing.mar?rev=345465&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/prototype2/repo/modules/addressing.mar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/prototype2/repo/services/classmediator.aar
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/repo/services/classmediator.aar?rev=345465&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/prototype2/repo/services/classmediator.aar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/prototype2/repo/synapse.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/repo/synapse.xml?rev=345465&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/repo/synapse.xml (added)
+++ incubator/synapse/trunk/scratch/prototype2/repo/synapse.xml Thu Nov 17 23:03:21 2005
@@ -0,0 +1,27 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse"
+		
+		xmlns:sq="urn:xmethods-delayed-quotes">
+      
+    
+    <stage name="logall" rule-type="all">
+        <rule>
+            <mediator type="builtin" name="log" />
+        </rule>
+    </stage>
+    <!--<stage name="service-specific" rule-type="xpath">-->
+		<!--<rule xpath="//sq:getQuote" xmlns:sq="urn:xmethods-delayed-quotes">-->
+			<!--<mediator type="spring" name="redirect" bean="redirect">-->
+				<!--<beans>-->
+					<!--<bean id="redirect" class="sampleMediators.SpringRedirect">-->
+						<!--<property name="uri" value="http://FREO:8080/axis/services/E4XStock"/>-->
+					<!--</bean>-->
+				<!--</beans>-->
+			<!--</mediator>-->
+		<!--</rule>-->
+	<!--</stage>-->
+	<!--<stage name="sender" rule-type="all">-->
+		<!--<rule>-->
+			<!--<mediator type="builtin" name="sender"/>-->
+		<!--</rule>-->
+	<!--</stage>-->
+</synapse>
\ No newline at end of file

Modified: incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/api/SOAPMessageContext.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/api/SOAPMessageContext.java?rev=345465&r1=345464&r2=345465&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/api/SOAPMessageContext.java (original)
+++ incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/api/SOAPMessageContext.java Thu Nov 17 23:03:21 2005
@@ -18,7 +18,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.soap.SOAPEnvelope;
 
 

Modified: incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SOAPMessageContext.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SOAPMessageContext.java?rev=345465&r1=345464&r2=345465&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SOAPMessageContext.java (original)
+++ incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SOAPMessageContext.java Thu Nov 17 23:03:21 2005
@@ -5,7 +5,7 @@
 import java.util.Map;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.synapse.Constants;

Modified: incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java?rev=345465&r1=345464&r2=345465&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java (original)
+++ incubator/synapse/trunk/scratch/prototype2/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java Thu Nov 17 23:03:21 2005
@@ -34,19 +34,21 @@
 			}
 			String synapseConfig = (String) param.getValue();
 			InputStream is = mc.getAxisService().getClassLoader().getResourceAsStream(synapseConfig);
-			
+
 			StAXOMBuilder builder;
 			try {
 				builder =  new StAXOMBuilder(is);
 
 			} catch (XMLStreamException e1) {
 				throw new SynapseException("Trouble parsing Synapse Configuration ",e1);
-				
-			}		
+
+			}
 			OMElement config = builder.getDocumentElement();
-			Axis2SynapseEnvironment se = new Axis2SynapseEnvironment(config, mc.getAxisService().getClassLoader());
-			
-		
+            // todo: ---- following needed to be added. 
+            config.build();
+            Axis2SynapseEnvironment se = new Axis2SynapseEnvironment(config, mc.getAxisService().getClassLoader());
+
+
 			synapseEnvParam = new ParameterImpl(SYNAPSE_ENVIRONMENT, null);
 			synapseEnvParam.setValue(se);
 			try {
@@ -56,7 +58,7 @@
 			}
 		}
 		return (SynapseEnvironment) synapseEnvParam.getValue();
-		
+
 	}
 
 }

Modified: incubator/synapse/trunk/scratch/prototype2/synapse.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/synapse.xml?rev=345465&r1=345464&r2=345465&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/synapse.xml (original)
+++ incubator/synapse/trunk/scratch/prototype2/synapse.xml Thu Nov 17 23:03:21 2005
@@ -8,21 +8,20 @@
             <mediator type="builtin" name="log" />
         </rule>
     </stage>
-    <stage name="service-specific" rule-type="xpath">
-		<rule xpath="//sq:getQuote" xmlns:sq="urn:xmethods-delayed-quotes">
-			<mediator type="spring" name="redirect" bean="redirect">
-				<beans>
-					<bean id="redirect" class="sampleMediators.SpringRedirect">
-						<!--property name="uri" value="http://64.124.140.30:9090/soap"/-->
-						<property name="uri" value="http://FREO:8080/axis/services/E4XStock"/>
-					</bean>
-				</beans>
-			</mediator>
-		</rule>
-	</stage>
-	<stage name="sender" rule-type="all">
-		<rule>
-			<mediator type="builtin" name="sender"/>
-		</rule>
-	</stage>
+    <!--<stage name="service-specific" rule-type="xpath">-->
+		<!--<rule xpath="//sq:getQuote" xmlns:sq="urn:xmethods-delayed-quotes">-->
+			<!--<mediator type="spring" name="redirect" bean="redirect">-->
+				<!--<beans>-->
+					<!--<bean id="redirect" class="sampleMediators.SpringRedirect">-->
+						<!--<property name="uri" value="http://FREO:8080/axis/services/E4XStock"/>-->
+					<!--</bean>-->
+				<!--</beans>-->
+			<!--</mediator>-->
+		<!--</rule>-->
+	<!--</stage>-->
+	<!--<stage name="sender" rule-type="all">-->
+		<!--<rule>-->
+			<!--<mediator type="builtin" name="sender"/>-->
+		<!--</rule>-->
+	<!--</stage>-->
 </synapse>

Added: incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynpaseEngineAllRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynpaseEngineAllRuleTest.java?rev=345465&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynpaseEngineAllRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynpaseEngineAllRuleTest.java Thu Nov 17 23:03:21 2005
@@ -0,0 +1,77 @@
+package org.apache.synapse.spi.engine;
+
+import junit.framework.TestCase;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+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;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.synapse.Constants;
+import org.apache.synapse.axis2.SynapseMessageReceiver;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+/*
+* 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 SynpaseEngineAllRuleTest extends TestCase {
+    private MessageContext msgCtx;
+    private ConfigurationContext configCtx;
+
+    public  void setUp() throws Exception {
+        ConfigurationContextFactory conFac = new ConfigurationContextFactory();
+        File path = new File("./repo");
+        configCtx = conFac
+                .buildClientConfigurationContext(path.getAbsolutePath());
+
+        SOAPEnvelope dumEnv = OMAbstractFactory.getSOAP11Factory()
+                .getDefaultEnvelope();
+
+        msgCtx = new MessageContext(configCtx);
+        msgCtx.setEnvelope(dumEnv);
+        msgCtx.setServerSide(true);
+
+        //------------------
+        AxisConfiguration axisConfiguration = msgCtx.getSystemContext()
+                .getAxisConfiguration();
+        AxisService service = new AxisService(
+                new QName("se"));
+        msgCtx.setAxisService(service);
+        service.setClassLoader(axisConfiguration.getServiceClassLoader());
+        AxisOperation axisOp = new InOutAxisOperation(
+                new QName("op"));
+        msgCtx.setAxisOperation(axisOp);
+        axisOp.setMessageReceiver(new SynapseMessageReceiver());
+        service.addOperation(axisOp);
+        axisConfiguration.addService(service);
+
+        msgCtx.setTo(
+                new EndpointReference("/axis2/services/" + "se" + "/" + "op"));
+        msgCtx.setSoapAction("op");
+
+    }
+    public void testSynapseEngineAll() throws Exception {
+        AxisEngine engine = new AxisEngine(configCtx);
+        engine.receive(msgCtx);
+    }
+}



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