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 2006/02/15 08:11:37 UTC

svn commit: r377953 [6/9] - in /incubator/synapse/trunk/scratch/synase-multimodules: ./ bin/ etc/ modules/ modules/core/ modules/core/conf/ modules/core/src/ modules/core/src/org/ modules/core/src/org/apache/ modules/core/src/org/apache/synapse/ module...

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,61 @@
+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.Processor;
+import org.apache.synapse.processors.mediatortypes.ClassMediatorProcessor;
+import org.apache.synapse.xml.ClassMediatorProcessorConfigurator;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.util.Axis2EnvSetup;
+/*
+* 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 ClassMediatorProcessorWithRuleTest extends TestCase {
+    private MessageContext msgCtx;
+    private SynapseEnvironment env;
+    private OMElement config;
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<stage name=\"loger\">\n" +
+                    "    <classmediator name=\"mediation\" class=\"org.apache.synapse.mediators.LoggerTestSample\"/>\n" +
+                    "</stage>\n" +
+                    "</synapse>";
+
+    public void setUp() throws Exception {
+        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
+        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
+        env = new Axis2SynapseEnvironment(config,
+                Thread.currentThread().getContextClassLoader());
+    }
+
+    public void testClassMediatorProcessor() throws Exception {
+
+        SynapseMessage smc = new Axis2SynapseMessage(msgCtx);
+        env.injectMessage(smc);
+        assertNotNull(env.lookupProcessor("mediation"));
+    }
+    public void testClassMediatorConfigurator() throws Exception {
+        ClassMediatorProcessorConfigurator conf = new ClassMediatorProcessorConfigurator();
+        Processor pro = conf.createProcessor(env, config.getFirstElement().getFirstElement());
+        assertTrue(pro instanceof ClassMediatorProcessor);
+        assertEquals("mediation",pro.getName());
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/DefineProcessorwithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.processors.ListProcessor;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.addressing.EndpointReference;
+
+import java.util.List;
+
+
+public class DefineProcessorwithRuleTest extends TestCase {
+    private SynapseEnvironment env;
+    private OMElement config;
+    private MessageContext mc;
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<refdefine ref=\"test_define\"/>\n" +
+                    "<refdefine ref=\"test_define_addressing\"/>\n" +
+                    "<define name=\"test_define\">\n" +
+                    "    <log/>" +
+                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
+                    "</define>\n" +
+
+                    "<define name=\"test_define_addressing\">\n" +
+                    "    <engage-addressing-in/>" +
+                    "</define>\n" +
+            "</synapse>";
+    public void setUp() throws Exception{
+        mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
+        mc.setTo(new EndpointReference("http://xmethods.org"));
+        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
+        env = new Axis2SynapseEnvironment(config,
+                Thread.currentThread().getContextClassLoader());
+    }
+
+    public void testRegexProcessor() throws Exception {
+        SynapseMessage smc = new Axis2SynapseMessage(mc);
+        env.injectMessage(smc);
+        assertEquals("test_define", env.lookupProcessor("test_define").getName());
+        assertEquals("test_define_addressing", env.lookupProcessor("test_define_addressing").getName());
+        List embededProcessors = ((ListProcessor)env.lookupProcessor("test_define")).getList();
+        assertEquals(2,embededProcessors.size());
+        ListProcessor masterProcessor = (ListProcessor)env.getMasterProcessor();
+        List masterProcessorList = masterProcessor.getList();
+        assertEquals(4,masterProcessorList.size());
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/FaultProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,59 @@
+/*
+* 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.
+*
+*/
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.synapse.util.Axis2EnvSetup;
+
+
+public class FaultProcessorWithRuleTest extends TestCase {
+    /**
+     * this is an incomple test
+     * what we should expect an error code
+     * but what we receive is 200ok.
+     */
+    private SimpleHTTPServer synapseServer;
+    private EndpointReference targetEpr = new EndpointReference(
+            "http://127.0.0.1:5043/axis2/services/anonymous");
+
+    public void setUp() throws Exception {
+        synapseServer =
+                new SimpleHTTPServer("target/synapse-repository-fault", 5043);
+        synapseServer.start();
+    }
+
+    protected void tearDown() throws Exception {
+        synapseServer.stop();
+    }
+
+    public void testFaultPrcessor() throws Exception {
+        ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-fault"), null);
+        Options co = new Options();
+        co.setTo(targetEpr);
+        serviceClient.setOptions(co);
+        serviceClient.fireAndForget(Axis2EnvSetup.payload());
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/HTTPToTCPMessageMediationTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,64 @@
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.transport.tcp.TCPServer;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.om.OMElement;
+import org.apache.synapse.util.Axis2EnvSetup;
+/*
+* 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 HTTPToTCPMessageMediationTest extends TestCase {
+    private SimpleHTTPServer synapseServer;
+    private TCPServer axis2TcpServer;
+    private EndpointReference targetEpr = new EndpointReference(
+            "http://127.0.0.1:5043/axis2/services/anonymous");
+
+    public void setUp() throws Exception {
+        synapseServer =
+                new SimpleHTTPServer("target/synapse-repository-httptcp",
+                        5043);
+        /**
+         * axis2TcpServer is the one who holds the actual service
+         */
+        axis2TcpServer =
+                new TCPServer(8090, "target/synapse-repository-sendonAxis2Tcp");
+        synapseServer.start();
+        axis2TcpServer.start();
+    }
+
+    protected void tearDown() throws Exception {
+        synapseServer.stop();
+        axis2TcpServer.stop();
+    }
+
+    public void testSendProcessor() throws Exception {
+        ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-httptcp"), null);
+        Options options = new Options();
+        options.setTo(targetEpr);
+        serviceClient.setOptions(options);
+        OMElement response = serviceClient.sendReceive(Axis2EnvSetup.payload());
+        assertEquals("Synapse Testing String_Response", response.getText());
+
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/InProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,57 @@
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+import org.apache.axis2.context.MessageContext;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.Constants;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+/*
+* 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 InProcessorWithRuleTest extends TestCase {
+    private MessageContext msgCtx;
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<in>" +
+                    "    <ref ref=\"add\"/>\n" +
+                    "</in>\n" +
+                    "<never>\n"+
+                        "<stage name=\"add\">\n"+
+                            "<engage-addressing-in/>\n" +
+                        "</stage>\n"+
+                    "</never>\n" +
+            "</synapse>\n";
+
+    public void setUp() throws Exception {
+        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
+    }
+
+    public void testAddressingProcessor() throws Exception {
+        SynapseEnvironment env = new Axis2SynapseEnvironment(
+                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
+                Thread.currentThread().getContextClassLoader());
+        SynapseMessage smc = new Axis2SynapseMessage(msgCtx);
+        env.injectMessage(smc);
+        assertTrue(((Boolean) smc.getProperty(
+                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
+        assertEquals("add",env.lookupProcessor("add").getName());
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/RegexProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,64 @@
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+import org.apache.axis2.addressing.EndpointReference;
+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.Processor;
+import org.apache.synapse.processors.rules.RegexProcessor;
+import org.apache.synapse.xml.RegexProcessorConfigurator;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.util.Axis2EnvSetup;
+/*
+* 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 RegexProcessorWithRuleTest extends TestCase {
+    private SynapseEnvironment env;
+    private OMElement config;
+    private MessageContext mc;
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<stage name=\"regex\">\n" +
+                    "    <regex message-address=\"to\" pattern=\"http://xmethods..\\*\"/>\n" +
+                    "</stage>\n" +
+            "</synapse>";
+    public void setUp() throws Exception{
+        mc = Axis2EnvSetup.axis2Deployment("target/synapse-repository");
+        mc.setTo(new EndpointReference("http://xmethods.org"));
+        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
+        env = new Axis2SynapseEnvironment(config,
+                Thread.currentThread().getContextClassLoader());
+    }
+
+    public void testRegexProcessor() throws Exception {
+        SynapseMessage smc = new Axis2SynapseMessage(mc);
+        env.injectMessage(smc);
+        assertEquals("regex", env.lookupProcessor("regex").getName());
+
+    }
+
+    public void testRegexProcessorConfigurator() throws Exception {
+        RegexProcessorConfigurator conf = new RegexProcessorConfigurator();
+        Processor pro = conf.createProcessor(env,config.getFirstElement().getFirstElement());
+        assertTrue(pro instanceof RegexProcessor);
+        assertEquals("to",((RegexProcessor)pro).getHeaderType());
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendBackProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,54 @@
+/*
+* 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.
+*
+*/
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.synapse.util.Axis2EnvSetup;
+
+
+public class SendBackProcessorWithRuleTest extends TestCase {
+    private SimpleHTTPServer synapseServer;
+    private EndpointReference targetEpr = new EndpointReference(
+            "http://127.0.0.1:5043/axis2/services/anonymous");
+
+    public void setUp() throws Exception {
+        synapseServer = new SimpleHTTPServer("target/synapse-repository-send",
+                5043);
+        synapseServer.start();
+    }
+
+    protected void tearDown() throws Exception {
+        synapseServer.stop();
+    }
+
+    public void testSendPrcessor() throws Exception {
+        ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-send"), null);
+        Options co = new Options();
+        co.setTo(targetEpr);
+        serviceClient.setOptions(co);
+        serviceClient.fireAndForget(Axis2EnvSetup.payload());
+
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendNowProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.om.OMElement;
+import org.apache.synapse.util.Axis2EnvSetup;
+
+/*
+ */
+public class SendNowProcessorWithRuleTest extends TestCase {
+     private SimpleHTTPServer synapseServer;
+    private SimpleHTTPServer axis2Server;
+    private EndpointReference targetEpr = new EndpointReference(
+            "http://127.0.0.1:5043/axis2/services/anonymous");
+
+    public void setUp() throws Exception {
+        synapseServer = new SimpleHTTPServer("target/synapse-repository-sendnow",
+                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 testSendNowProcessor() throws Exception {
+        ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-sendnow"), null);
+        Options options = new Options();
+        options.setTo(targetEpr);
+        serviceClient.setOptions(options);
+        OMElement response = serviceClient
+                .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
+        assertEquals("Synapse Testing String_Response_With_Addressing",
+                response.getText());
+
+    }
+
+    public void testSendNowPingProcessor() throws Exception {
+        ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-sendnow"), null);
+        Options options = new Options();
+        options.setTo(targetEpr);
+        serviceClient.setOptions(options);
+        serviceClient.fireAndForget(Axis2EnvSetup.payloadNamedPing());
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithAddressingEngageWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -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.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.om.OMElement;
+import org.apache.synapse.util.Axis2EnvSetup;
+
+
+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");
+
+    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 {
+        ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-sendon"), null);
+        Options options = new Options();
+        options.setTo(targetEpr);
+        serviceClient.setOptions(options);
+        OMElement response = serviceClient
+                .sendReceive(Axis2EnvSetup.payloadNamedAdddressing());
+        assertEquals("Synapse Testing String_Response_With_Addressing",
+                response.getText());
+
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,80 @@
+/*
+* 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.
+*
+*/
+package org.apache.synapse.spi.injection;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.om.OMElement;
+import org.apache.synapse.util.Axis2EnvSetup;
+
+
+public class SendOnProcessorWithRuleTest extends TestCase {
+
+    private SimpleHTTPServer synapseServer;
+    private SimpleHTTPServer axis2Server;
+    private EndpointReference targetEpr = new EndpointReference(
+            "http://127.0.0.1:5043/axis2/services/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 {
+        ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-sendon"), null);
+        Options options = new Options();
+        options.setTo(targetEpr);
+        serviceClient.setOptions(options);
+        OMElement response = serviceClient.sendReceive(Axis2EnvSetup.payload());
+        assertEquals("Synapse Testing String_Response", response.getText());
+
+    }
+
+    public void testSendProcessorMultipleTimes() throws Exception {
+        for (int i = 0; i < 10; i++) {
+            ServiceClient serviceClient = new ServiceClient(
+                Axis2EnvSetup.createConfigurationContextFromFileSystem(
+                        "target/synapse-repository-sendon"), null);
+            Options options = new Options();
+            options.setTo(targetEpr);
+            serviceClient.setOptions(options);
+            OMElement response =
+                    serviceClient.sendReceive(Axis2EnvSetup.payload());
+            assertEquals("Synapse Testing String_Response", response.getText());
+        }
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithAddressingEnageWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -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.Axis2EnvSetup;
+/*
+* 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 = Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2");
+        OMElement config = Axis2EnvSetup.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"));
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/ServiceMediatorProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,63 @@
+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.Processor;
+import org.apache.synapse.processors.mediatortypes.axis2.ServiceMediatorProcessor;
+import org.apache.synapse.xml.ServiceMediatorProcessorConfigurator;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.util.Axis2EnvSetup;
+/*
+* 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 ServiceMediatorProcessorWithRuleTest extends TestCase {
+    private MessageContext msgCtx;
+    private SynapseEnvironment env;
+    private OMElement config;
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<stage name=\"test-service-mediator\">\n" +
+                    "    <servicemediator name=\"service-mediator\" service=\"test-mediator\"/>\n" +
+                    "</stage>\n" +
+                    "</synapse>";
+
+    public void setUp() throws Exception {
+        msgCtx = Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2");
+        config =Axis2EnvSetup.getSynapseConfigElement(synapsexml);
+        env = new Axis2SynapseEnvironment(config,
+                Thread.currentThread().getContextClassLoader());
+    }
+
+    public void testAxis2MediatorProcessor() throws Exception {
+
+        SynapseMessage smc = new Axis2SynapseMessage(msgCtx);
+        env.injectMessage(smc);
+        assertNotNull(env.lookupProcessor("service-mediator"));
+    }
+
+    public void testAxis2MediagtorConfigurator() throws Exception {
+        ServiceMediatorProcessorConfigurator conf = new ServiceMediatorProcessorConfigurator();
+
+        Processor pro = conf.createProcessor(env,config.getFirstElement().getFirstElement());
+        assertTrue(pro instanceof ServiceMediatorProcessor);
+        assertNotNull(pro.getName());
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/injection/XpathProcessorWithRuleTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,63 @@
+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.Processor;
+import org.apache.synapse.processors.rules.XPathProcessor;
+import org.apache.synapse.xml.XPathProcessorConfigurator;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.util.Axis2EnvSetup;
+/*
+* 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 XpathProcessorWithRuleTest extends TestCase {
+    private MessageContext mc;
+    private OMElement config;
+    private SynapseEnvironment env;
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<stage name=\"xpath\">\n" +
+                    "    <xpath expr=\"//ns:text\" xmlns:ns=\"urn:text-body\"/>\n" +
+                    "</stage>\n" +
+                    "</synapse>";
+
+    public void setUp() throws Exception {
+        mc = Axis2EnvSetup
+                .axis2Deployment("target/synapse-repository");
+        config = Axis2EnvSetup.getSynapseConfigElement(synapsexml);
+        env = new Axis2SynapseEnvironment(config,
+                Thread.currentThread().getContextClassLoader());
+    }
+
+    public void testXpathProcessor() throws Exception {
+        SynapseMessage smc = new Axis2SynapseMessage(mc);
+        env.injectMessage(smc);
+        assertEquals("xpath", env.lookupProcessor("xpath").getName());
+    }
+    public void testXpathProcessorConfigurator() throws Exception {
+        XPathProcessorConfigurator conf = new XPathProcessorConfigurator();
+        Processor pro = conf.createProcessor(env,config.getFirstElement().getFirstElement());
+        assertTrue(pro instanceof XPathProcessor);
+        assertEquals("//ns:text",((XPathProcessor)pro).getXPathExpr());
+    }
+}
+
+

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/AddressingProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,41 @@
+package org.apache.synapse.spi.processors;
+
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.Constants;
+import org.apache.synapse.Processor;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.processors.builtin.axis2.AddressingInProcessor;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+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 AddressingProcessorTest extends TestCase {
+
+    public void testAddressingProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        Processor addressingProcessor = new AddressingInProcessor();
+        SynapseEnvironment env = new Axis2SynapseEnvironment(null,null);
+        boolean result = addressingProcessor.process(env,sm);
+        assertTrue(((Boolean) sm.getProperty(
+                Constants.MEDIATOR_RESPONSE_PROPERTY)).booleanValue());
+        assertTrue(result);
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/BulitinProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,37 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.Processor;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.processors.builtin.LogProcessor;
+/*
+* 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 BulitinProcessorTest extends TestCase {
+    public void testLogProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        Processor log = new LogProcessor();
+        boolean result = log.process(null,sm);
+        assertTrue(result);
+    }
+    public void testSendProcessorTest() throws Exception {
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,34 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.processors.mediatortypes.ClassMediatorProcessor;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+/*
+* 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 ClassMediatorProcessorTest extends TestCase {
+    public void testClassMediatorProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        ClassMediatorProcessor pro = new ClassMediatorProcessor();
+        pro.setClazz(Class.forName("org.apache.synapse.mediators.LoggerTestSample"));
+        boolean result = pro.process(null,sm);
+        assertTrue(result);
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/FaultProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+
+import org.apache.axis2.AxisFault;
+import org.apache.synapse.util.Axis2EnvSetup;
+
+import javax.xml.namespace.QName;
+
+public class FaultProcessorTest extends TestCase {
+
+	private SimpleHTTPServer synapseServer;
+
+	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-fault",
+				5043);
+		synapseServer.start();
+	}
+
+	protected void tearDown() throws Exception {
+		synapseServer.stop();
+	}
+
+	public void testFaultProcessor() {
+		try {
+			ServiceClient sc = new ServiceClient();
+
+			Options options = new Options();
+			options.setTo(targetEpr);
+			sc.setOptions(options);
+
+			sc.sendReceive(operation, Axis2EnvSetup.payload());
+			fail(null);
+		} catch (AxisFault e) {
+		}
+	}
+
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/InProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,35 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.processors.InProcessor;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+/*
+* 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 InProcessorTest extends TestCase {
+
+    public void testInProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        InProcessor pro = new InProcessor();
+        boolean retrun = pro.process(null,sm);
+        assertTrue(retrun);
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/NeverProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,26 @@
+package org.apache.synapse.spi.processors;
+
+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 NeverProcessorTest extends TestCase {
+    public void testNeverProcessor() throws Exception{
+        //todo: this should be filled 
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/RegexProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,36 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.processors.rules.RegexProcessor;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.axis2.addressing.EndpointReference;
+/*
+* 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 RegexProcessorTest extends TestCase {
+    public void testRegexProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        sm.setTo(new EndpointReference("http://xmethods.org"));
+        RegexProcessor pro = new RegexProcessor();
+        pro.setPattern("http://xmethods..\\*");
+        boolean result = pro.process(null,sm);
+        assertTrue(result);
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/ServiceMediatorProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,34 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.processors.mediatortypes.axis2.ServiceMediatorProcessor;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+/*
+* 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 ServiceMediatorProcessorTest extends TestCase {
+    public void testServiceMediatorProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository-sendonAxis2"));
+        ServiceMediatorProcessor pro = new ServiceMediatorProcessor();
+        pro.setServiceName("test-mediator");
+        boolean result = pro.process(null,sm);
+        assertTrue(result);
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/StageProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,48 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.processors.StageProcessor;
+import org.apache.synapse.processors.rules.RegexProcessor;
+import org.apache.synapse.processors.rules.XPathProcessor;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+
+import java.util.List;
+import java.util.LinkedList;
+/*
+* 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 StageProcessorTest extends TestCase {
+    public void testStageProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        StageProcessor pro = new StageProcessor();
+        boolean result = pro.process(null, sm);
+        assertTrue(result);
+
+        List list = new LinkedList();
+        list.add(new RegexProcessor());
+        list.add(new XPathProcessor());
+        pro.setList(list);
+
+        boolean ret = pro.process(null,sm);
+
+        assertTrue(ret);
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XSLTProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,80 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.xml.ProcessorConfiguratorFinder;
+import org.apache.synapse.processors.builtin.xslt.XSLTProcessor;
+import org.apache.synapse.processors.builtin.xslt.XSLTProcessorConfigurator;
+import org.apache.synapse.util.Axis2EnvSetup;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.axis2.Axis2SynapseEnvironment;
+
+import java.io.ByteArrayInputStream;
+/*
+* 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 XSLTProcessorTest extends TestCase {
+    private String xsl = "<xsl:stylesheet version='1.0'\n" +
+            "                xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>\n" +
+            "    <xsl:template match=\"/\">\n" +
+            "        <transformedText>\n" +
+            "            <xsl:value-of select=\"//text\"/>\n" +
+            "            <xsl:text>Test Being Transformed</xsl:text>" +
+            "        </transformedText>\n" +
+            "    </xsl:template>\n" +
+            "</xsl:stylesheet>";
+
+    private String synapsexml =
+            "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
+                    "<xslt name=\"stlt_test_name\" xsl=\"./transformation/simple_transformation.xsl\" type=\"body\"/>" +
+                    "</synapse>";
+
+
+    public void testXSLTProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        XSLTProcessor pro = new XSLTProcessor();
+        pro.setXSLInputStream(new ByteArrayInputStream(xsl.getBytes()));
+        pro.setIsBody(true);
+        boolean result = pro.process(null, sm);
+        assertTrue(result);
+    }
+
+    public void testXSLTProcessorConfigurator() throws Exception {
+        XSLTProcessorConfigurator xsltProcessorConfigurator =
+                new XSLTProcessorConfigurator();
+        Class clazz = ProcessorConfiguratorFinder
+                .find(xsltProcessorConfigurator.getTagQName());
+        assertNotNull(clazz);
+        Object processorObject = clazz.newInstance();
+        if (!(processorObject instanceof XSLTProcessorConfigurator)) {
+            throw new Exception(
+                    "XSLTProcessorConfigurator initialization falied");
+        }
+        SynapseEnvironment env = new Axis2SynapseEnvironment(
+                Axis2EnvSetup.getSynapseConfigElement(synapsexml),
+                Thread.currentThread().getContextClassLoader());
+        assertNotNull(env.getMasterProcessor());
+
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        // throws exceptions if anything goes wrong
+        env.injectMessage(sm);
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/spi/processors/XpathProcessorTest.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,36 @@
+package org.apache.synapse.spi.processors;
+
+import junit.framework.TestCase;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.axis2.Axis2SynapseMessage;
+import org.apache.synapse.processors.rules.XPathProcessor;
+import org.apache.synapse.util.Axis2EnvSetup;
+/*
+* 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 XpathProcessorTest extends TestCase {
+    public void testXpathProcessor() throws Exception {
+        SynapseMessage sm = new Axis2SynapseMessage(
+                Axis2EnvSetup.axis2Deployment("target/synapse-repository"));
+        XPathProcessor pro = new XPathProcessor();
+        pro.setXPathExpr("//ns:text");
+        pro.addXPathNamespace("ns", "urn:text-body");
+        boolean result = pro.process(null, sm);
+        assertTrue(result);
+
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/org/apache/synapse/util/Axis2EnvSetup.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,131 @@
+package org.apache.synapse.util;
+
+import org.apache.axis2.AxisFault;
+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.om.*;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.synapse.axis2.SynapseMessageReceiver;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.ByteArrayInputStream;
+/*
+* 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 Axis2EnvSetup {
+    public static MessageContext axis2Deployment(String testingRepository)
+            throws AxisFault {
+        ConfigurationContextFactory conFac = new ConfigurationContextFactory();
+        ConfigurationContext configCtx = conFac
+                .createConfigurationContextFromFileSystem(testingRepository);
+        MessageContext msgCtx = new MessageContext();
+        msgCtx.setConfigurationContext(configCtx);
+        msgCtx.setEnvelope(testEnvSetup());
+        msgCtx.setServerSide(true);
+
+        AxisConfiguration axisConfiguration = msgCtx.getConfigurationContext()
+                .getAxisConfiguration();
+        AxisService service = new AxisService("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");
+        return msgCtx;
+    }
+
+    private static SOAPEnvelope testEnvSetup() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory()
+                .getDefaultEnvelope();
+        OMDocument doc = fac.createOMDocument();
+        doc.addChild(env);
+        OMElement ele = fac.createOMElement("text", "urn:text-body", "ns");
+        env.getBody().addChild(ele);
+        return env;
+    }
+
+    public static OMElement getSynapseConfigElement(String synapseXml)
+            throws XMLStreamException {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(
+                        new ByteArrayInputStream(synapseXml.getBytes()));
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        StAXOMBuilder staxBuilder = new StAXOMBuilder(fac, parser);
+        OMElement config = staxBuilder.getDocumentElement();
+        return config;
+
+    }
+
+    public static OMElement payload() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace(
+                "urn:text-body", "ns");
+        OMElement method = fac.createOMElement("service", omNs);
+        OMElement value = fac.createOMElement("text", omNs);
+        value.addChild(
+                fac.createText(value, "Synapse Testing String"));
+        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;
+    }
+
+    public static OMElement payloadNamedPing() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace(
+                "urn:text-body", "ns");
+        OMElement method = fac.createOMElement("service", omNs);
+        OMElement value = fac.createOMElement("text_ping", omNs);
+        value.addChild(
+                fac.createText(value, "Synapse Testing String for Ping"));
+        method.addChild(value);
+        return method;
+    }
+
+    public static ConfigurationContext createConfigurationContextFromFileSystem(String repository) throws AxisFault {
+        ConfigurationContextFactory fac = new ConfigurationContextFactory();
+        ConfigurationContext configContext =
+                fac.createConfigurationContextFromFileSystem(repository);
+        return configContext;
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-environmentaware.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-environmentaware.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-environmentaware.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-environmentaware.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,7 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+    <stage name="test-environmentaware">
+        <engage-addressing-in/>
+        <servicemediator name="environmentaware-mediator"
+                         service="environmentaware-mediator"/>
+    </stage>
+</synapse>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-fault-return.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-fault-return.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-fault-return.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-fault-return.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,10 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+    <stage name="xpath">
+        <xpath expr="//ns:text" xmlns:ns="urn:text-body">
+            <fault/>
+        </xpath>
+    </stage>
+    <stage name="fault_return">
+        <send/>
+    </stage>
+</synapse>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-httptcp.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-httptcp.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-httptcp.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-httptcp.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,13 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+    <stage name="xpath">
+        <xpath expr="//ns:response_text" xmlns:ns="urn:text-body">
+            <send/>
+        </xpath>
+        <xpath expr="//ns:text" xmlns:ns="urn:text-body">
+            <engage-addressing-in/>
+            <header type="to" value="tcp://localhost:8090/axis2/services/npe"/>
+            <header type="action" value="urn:synapse/sendon"/>
+            <send/>
+        </xpath>
+    </stage>
+</synapse>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-send.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-send.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-send.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-send.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,8 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+    <stage name="xpath">
+        <xpath expr="//ns:text" xmlns:ns="urn:text-body">
+            <classmediator name="sendBackHelper" class="org.apache.synapse.mediators.SendBack"/>
+            <send/>
+        </xpath>
+    </stage>
+</synapse>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendnow.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendnow.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendnow.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendnow.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,22 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+  <engage-addressing-in/>
+
+    <refdefine ref="ping"/>
+    <refdefine ref="addressing"/>
+
+      <define name="addressing">
+        <xpath expr="//ns:text_addressing" xmlns:ns="urn:text-body">
+            <header type="to" value="http://localhost:8090/axis2/services/npe"/>
+            <header type="action" value="urn:synapse/sendon-addressing-engage"/>
+            <sendnow/>
+        </xpath>
+      </define>
+
+    <define name="ping">
+        <xpath expr="//ns:text_ping" xmlns:ns="urn:text-body">
+            <header type="to" value="http://localhost:8090/axis2/services/npe"/>
+            <header type="action" value="urn:synapse/ping"/>
+            <sendnow/>
+        </xpath>
+      </define>
+  </synapse>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendon.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendon.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendon.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/test/rules/synapse-sendon.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,21 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+    <stage name="xpath">
+        <xpath expr="//ns:text" xmlns:ns="urn:text-body">
+            <classmediator name="simpleRouting" class="org.apache.synapse.mediators.SampleRouter"/>
+            <send/>
+        </xpath>
+        <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>
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/extensions/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/extensions/maven.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/extensions/maven.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/extensions/maven.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project default="jar"
+         xmlns:j="jelly:core"
+         xmlns:u="jelly:util"
+         xmlns:deploy="deploy"
+         xmlns:ant="jelly:ant"
+         xmlns:maven="jelly:maven"
+         xmlns:define="jelly:define">
+
+    <j:set var="dist.name" value="${pom.artifactId}-${pom.currentVersion}"/>
+    <!--<j:set var="dist.dir" value="target/dist"/>-->
+    <j:set var="extensions.dir" value="target/extensions"/>
+
+    <postGoal name="test:test">
+        <j:if test="${context.getVariable('maven.test.skip') != 'true'}">
+            <attainGoal name="extensions"/>
+        </j:if>
+    </postGoal>
+
+
+    <goal name="extensions">
+        <mkdir dir="${extensions.dir}/spring"/>
+        <mkdir dir="${extensions.dir}/spring/META-INF"/>
+        <ant:copy todir="${extensions.dir}/spring">
+            <ant:fileset dir="target/classes">
+                <ant:include name="**/spring/**"/>
+            </ant:fileset>
+        </ant:copy>
+        <ant:copy todir="${extensions.dir}/spring/META-INF">
+            <ant:fileset dir="src/META-INF">
+                <ant:include name="**"/>
+            </ant:fileset>
+        </ant:copy>
+
+        <jar jarfile="${extensions.dir}/spring_mediator.jar"
+             basedir="${extensions.dir}/spring">
+            <include name="**"/>
+        </jar>
+        <ant:delete dir="${extensions.dir}/spring"/>
+    </goal>
+</project>



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