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/21 11:31:20 UTC
svn commit: r345889 -
/incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynapseEngineRuleTest.java
Author: saminda
Date: Mon Nov 21 02:31:14 2005
New Revision: 345889
URL: http://svn.apache.org/viewcvs?rev=345889&view=rev
Log:
Added new testcase to test "all" and "xpath"
Added:
incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynapseEngineRuleTest.java
Added: incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynapseEngineRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynapseEngineRuleTest.java?rev=345889&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynapseEngineRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/prototype2/test/org/apache/synapse/spi/engine/SynapseEngineRuleTest.java Mon Nov 21 02:31:14 2005
@@ -0,0 +1,85 @@
+package org.apache.synapse.spi.engine;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMDocument;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.synapse.axis2.SynapseMessageReceiver;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+
+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 SynapseEngineRuleTest 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());
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ SOAPEnvelope dumEnv = OMAbstractFactory.getSOAP11Factory()
+ .getDefaultEnvelope();
+ OMDocument doc = fac.createOMDocument();
+ doc.addChild(dumEnv);
+
+ OMElement ele = fac.createOMElement("text", "urn:text-body","t");
+ dumEnv.getBody().addChild(ele);
+
+ 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 testAllAndXpath() 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