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/01/16 14:36:01 UTC

svn commit: r369470 - in /incubator/synapse/trunk/java: ./ src/sampleMediators/ test/org/apache/axis2/ test/org/apache/synapse/mediators/ test/org/apache/synapse/spi/injection/ test/org/apache/synapse/spi/processors/ test/rules/

Author: saminda
Date: Mon Jan 16 05:35:39 2006
New Revision: 369470

URL: http://svn.apache.org/viewcvs?rev=369470&view=rev
Log:
Cleaning up test/ and samples/ directories. Updated test cases 

Added:
    incubator/synapse/trunk/java/test/org/apache/synapse/mediators/LoggerTestSample.java
    incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java
    incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleMediator2.java
    incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleRouter.java
    incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SendBack.java
Removed:
    incubator/synapse/trunk/java/src/sampleMediators/SampleFalseReturnMediator1.java
    incubator/synapse/trunk/java/src/sampleMediators/SampleMediator2.java
    incubator/synapse/trunk/java/src/sampleMediators/SampleRouter.java
    incubator/synapse/trunk/java/src/sampleMediators/SendBack.java
Modified:
    incubator/synapse/trunk/java/maven.xml
    incubator/synapse/trunk/java/test/org/apache/axis2/MultipleAddressingModuleEngagementTest.java
    incubator/synapse/trunk/java/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java
    incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java
    incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java
    incubator/synapse/trunk/java/test/rules/synapse-send.xml
    incubator/synapse/trunk/java/test/rules/synapse-sendon.xml

Modified: incubator/synapse/trunk/java/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/maven.xml?rev=369470&r1=369469&r2=369470&view=diff
==============================================================================
--- incubator/synapse/trunk/java/maven.xml (original)
+++ incubator/synapse/trunk/java/maven.xml Mon Jan 16 05:35:39 2006
@@ -42,6 +42,7 @@
     <postGoal name="test:compile">
         <ant:mkdir dir="${basedir}/target/lib"/>
         <deploy:copy-deps todir="${basedir}/target/lib"/>
+        <j:set var="class_test.dir" value="target/test-classes"/>
 
         <echo message="----------------Creating First Dispatching aar----------------"/>
         <mkdir dir="target/services/synapse/META-INF"/>
@@ -249,7 +250,9 @@
         <ant:delete file="target/synapse.aar"/>
         <ant:delete dir="target/sample-deprecation"/>
         <ant:delete file="target/DeprecationMediator.aar"/>
-
+        
+        <ant:path id="classes_test.dir" location="${class_test.dir}"/>
+        <maven:addPath id="maven.dependency.classpath" refid="classes_test.dir"/>
 
     </postGoal>
 

Modified: incubator/synapse/trunk/java/test/org/apache/axis2/MultipleAddressingModuleEngagementTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/axis2/MultipleAddressingModuleEngagementTest.java?rev=369470&r1=369469&r2=369470&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/axis2/MultipleAddressingModuleEngagementTest.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/axis2/MultipleAddressingModuleEngagementTest.java Mon Jan 16 05:35:39 2006
@@ -34,11 +34,11 @@
             "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
                     "<stage name=\"loger1\">\n" +
                     "    <engage-addressing-in/>" +
-                    "    <classmediator name=\"mediation\" class=\"sampleMediators.Logger\"/>\n" +
+                    "    <classmediator name=\"mediation\" class=\"org.apache.synapse.mediators.LoggerTestSample\"/>\n" +
                     "</stage>\n" +
                     "<stage name=\"loger2\">\n" +
                     "    <engage-addressing-in/>" +
-                    "    <classmediator name=\"mediation\" class=\"sampleMediators.Logger\"/>\n" +
+                    "    <classmediator name=\"mediation\" class=\"org.apache.synapse.mediators.LoggerTestSample\"/>\n" +
                     "</stage>\n" +
                     "</synapse>";
 

Added: incubator/synapse/trunk/java/test/org/apache/synapse/mediators/LoggerTestSample.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/mediators/LoggerTestSample.java?rev=369470&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/mediators/LoggerTestSample.java (added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/mediators/LoggerTestSample.java Mon Jan 16 05:35:39 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.mediators;
+
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.api.Mediator;
+
+/**
+ *
+ *
+ * <p>A sample Mediator that logs the message
+ * 
+ */
+public class LoggerTestSample implements Mediator {
+
+	public boolean mediate(SynapseMessage mc) {
+		System.out.println("LoggerTestSample.mediate:");
+		if (mc.getTo() != null && mc.getTo().getAddress() != null)
+			System.out.println("LoggerTestSample.mediate to:" + mc.getTo().getAddress());
+		else
+			System.out.println("Empty To");
+		if (mc.getReplyTo() != null && mc.getReplyTo().getAddress() != null)
+			System.out.println("LoggerTestSample.mediate ReplyTo:"
+					+ mc.getReplyTo().getAddress());
+		else
+			System.out.println("Empty ReplyTo");
+		SOAPEnvelope env = mc.getEnvelope();
+		System.out.println(env.toString());
+		System.out.println();
+		return true;
+	}
+
+}
\ No newline at end of file

Modified: incubator/synapse/trunk/java/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java?rev=369470&r1=369469&r2=369470&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/mediators/MediatorFalseReturnTest.java Mon Jan 16 05:35:39 2006
@@ -35,11 +35,11 @@
     private String synapsexml =
             "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
                     "<stage name=\"mediator_false\">\n" +
-                    "    <classmediator name=\"mediator_false\" class=\"sampleMediators.SampleFalseReturnMediator1\"/>\n" +
+                    "    <classmediator name=\"mediator_false\" class=\"org.apache.synapse.mediators.SampleFalseReturnMediator1\"/>\n" +
                     "    <log/>" +
                     "</stage>\n" +
                     "<stage name=\"do_loggin\">\n" +
-                    "    <classmediator name=\"mediator_false\" class=\"sampleMediators.SampleMediator2\"/>\n" +
+                    "    <classmediator name=\"mediator_false\" class=\"org.apache.synapse.mediators.SampleMediator2\"/>\n" +
                     "</stage>\n" +
                     "</synapse>";
 

Added: incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java?rev=369470&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java (added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleFalseReturnMediator1.java Mon Jan 16 05:35:39 2006
@@ -0,0 +1,28 @@
+package org.apache.synapse.mediators;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseMessage;
+/*
+* 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 SampleFalseReturnMediator1 implements Mediator {
+    public boolean mediate(SynapseMessage smc) {
+        System.out
+                .println("you are in the sample \"false\" returning mediator ");
+        return false;
+    }
+}

Added: incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleMediator2.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleMediator2.java?rev=369470&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleMediator2.java (added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleMediator2.java Mon Jan 16 05:35:39 2006
@@ -0,0 +1,27 @@
+package org.apache.synapse.mediators;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseMessage;
+/*
+* 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 SampleMediator2 implements Mediator {
+    public boolean mediate(SynapseMessage smc) {
+        smc.setProperty("test_string",new String("Done"));
+        return false;
+    }
+}

Added: incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleRouter.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleRouter.java?rev=369470&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleRouter.java (added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SampleRouter.java Mon Jan 16 05:35:39 2006
@@ -0,0 +1,30 @@
+package org.apache.synapse.mediators;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.api.Mediator;
+/*
+* 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 SampleRouter implements Mediator {
+    public boolean mediate(SynapseMessage smc) {
+        smc.setWSAAction("urn:synapse/sendon");
+        smc.setTo(new EndpointReference(
+                "http://localhost:8090/axis2/services/npe"));
+        return true;
+    }
+}

Added: incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SendBack.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SendBack.java?rev=369470&view=auto
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SendBack.java (added)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/mediators/SendBack.java Mon Jan 16 05:35:39 2006
@@ -0,0 +1,34 @@
+package org.apache.synapse.mediators;
+
+import org.apache.synapse.api.Mediator;
+import org.apache.synapse.SynapseMessage;
+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 SendBack implements Mediator {
+    public boolean mediate(SynapseMessage smc) {
+        /**
+         * Since addressing is not engaged before running this test case 
+         * To give the right behavior for this test-case
+         * setTo is set for anonymous url.
+         */
+        smc.setTo(new EndpointReference("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"));
+        smc.setResponse(true);
+        return true;
+    }
+}

Modified: incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java?rev=369470&r1=369469&r2=369470&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/ClassMediatorProcessorWithRuleTest.java Mon Jan 16 05:35:39 2006
@@ -35,7 +35,7 @@
     private String synapsexml =
             "<synapse xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
                     "<stage name=\"loger\">\n" +
-                    "    <classmediator name=\"mediation\" class=\"sampleMediators.Logger\"/>\n" +
+                    "    <classmediator name=\"mediation\" class=\"org.apache.synapse.mediators.LoggerTestSample\"/>\n" +
                     "</stage>\n" +
                     "</synapse>";
 

Modified: incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java?rev=369470&r1=369469&r2=369470&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/spi/processors/ClassMediatorProcessorTest.java Mon Jan 16 05:35:39 2006
@@ -27,7 +27,7 @@
         SynapseMessage sm = new Axis2SynapseMessage(
                 Axis2EvnSetup.axis2Deployment("target/synapse-repository"));
         ClassMediatorProcessor pro = new ClassMediatorProcessor();
-        pro.setClazz(Class.forName("sampleMediators.Logger"));
+        pro.setClazz(Class.forName("org.apache.synapse.mediators.LoggerTestSample"));
         boolean result = pro.process(null,sm);
         assertTrue(result);
     }

Modified: incubator/synapse/trunk/java/test/rules/synapse-send.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/rules/synapse-send.xml?rev=369470&r1=369469&r2=369470&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/rules/synapse-send.xml (original)
+++ incubator/synapse/trunk/java/test/rules/synapse-send.xml Mon Jan 16 05:35:39 2006
@@ -1,7 +1,7 @@
 <synapse xmlns="http://ws.apache.org/ns/synapse">
     <stage name="xpath">
         <xpath expr="//ns:text" xmlns:ns="urn:text-body">
-            <classmediator name="sendBackHelper" class="sampleMediators.SendBack"/>
+            <classmediator name="sendBackHelper" class="org.apache.synapse.mediators.SendBack"/>
             <send/>
         </xpath>
     </stage>

Modified: incubator/synapse/trunk/java/test/rules/synapse-sendon.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/rules/synapse-sendon.xml?rev=369470&r1=369469&r2=369470&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/rules/synapse-sendon.xml (original)
+++ incubator/synapse/trunk/java/test/rules/synapse-sendon.xml Mon Jan 16 05:35:39 2006
@@ -1,7 +1,7 @@
 <synapse xmlns="http://ws.apache.org/ns/synapse">
     <stage name="xpath">
         <xpath expr="//ns:text" xmlns:ns="urn:text-body">
-            <classmediator name="simpleRouting" class="sampleMediators.SampleRouter"/>
+            <classmediator name="simpleRouting" class="org.apache.synapse.mediators.SampleRouter"/>
             <send/>
         </xpath>
         <xpath expr="//ns:response_text" xmlns:ns="urn:text-body">



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