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/05 09:08:51 UTC
svn commit: r366116 - in /incubator/synapse/trunk/java:
src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
test/org/apache/synapse/environment/EnvironmentAwareTest.java
test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java
Author: saminda
Date: Thu Jan 5 00:08:41 2006
New Revision: 366116
URL: http://svn.apache.org/viewcvs?rev=366116&view=rev
Log:
Fix JIRA-6, change of logic in Axis2FlexibleMEPClient
Fix EnvironmentAwareTest case
Updated SendOnProcessorWithRuleTest
Modified:
incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
incubator/synapse/trunk/java/test/org/apache/synapse/environment/EnvironmentAwareTest.java
incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java
Modified: incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java?rev=366116&r1=366115&r2=366116&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java Thu Jan 5 00:08:41 2006
@@ -69,19 +69,24 @@
ConfigurationContext cc = smc.getConfigurationContext();
AxisConfiguration ac = cc.getAxisConfiguration();
PhasesInfo phasesInfo = ac.getPhasesInfo();
- // Lets default be OUT_IN
- OutInAxisOperation outInOperation = new OutInAxisOperation(new QName(
- "__OPERATION_OUT_IN__"));
- AxisService axisAnonymousService = new AxisService("ANONYMOUS_SERVICE");
// setting operation default chains
- phasesInfo.setOperationPhases(outInOperation);
- axisAnonymousService.addOperation(outInOperation);
- ac.addService(axisAnonymousService);
- ServiceGroupContext sgc =
- new ServiceGroupContext(cc, axisAnonymousService.getParent());
- ServiceContext sc = sgc.getServiceContext(axisAnonymousService);
- //
+ if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
+ // Lets default be OUT_IN
+ OutInAxisOperation outInOperation =
+ new OutInAxisOperation(new QName(
+ "__OPERATION_OUT_IN__"));
+ AxisService axisAnonymousService =
+ new AxisService("__ANONYMOUS_SERVICE__");
+ axisAnonymousService.addOperation(outInOperation);
+ ac.addService(axisAnonymousService);
+ phasesInfo.setOperationPhases(outInOperation);
+ }
+ ServiceGroupContext sgc = new ServiceGroupContext(cc,
+ ac.getService("__ANONYMOUS_SERVICE__").getParent());
+ ServiceContext sc =
+ sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
+
MessageContext mc = new MessageContext(sc.getConfigurationContext());
///////////////////////////////////////////////////////////////////////
// filtering properties
@@ -110,8 +115,9 @@
///////////////////////////////////////////////////////////////////////
- AxisOperation axisAnonymousOperation = axisAnonymousService
- .getOperation(new QName("__OPERATION_OUT_IN__"));
+ AxisOperation axisAnonymousOperation =
+ ac.getService("__ANONYMOUS_SERVICE__")
+ .getOperation(new QName("__OPERATION_OUT_IN__"));
//Options class from Axis2 holds client side settings
Options options = new Options();
Modified: incubator/synapse/trunk/java/test/org/apache/synapse/environment/EnvironmentAwareTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/environment/EnvironmentAwareTest.java?rev=366116&r1=366115&r2=366116&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/environment/EnvironmentAwareTest.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/environment/EnvironmentAwareTest.java Thu Jan 5 00:08:41 2006
@@ -4,6 +4,7 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.MessageSender;
+import org.apache.axis2.client.ServiceClient;
import org.apache.synapse.util.Axis2EvnSetup;
import junit.framework.TestCase;
@@ -29,7 +30,6 @@
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-environmentaware",
@@ -44,12 +44,11 @@
public void testSendProcessor() throws Exception {
// this test case throws exceptions if fail
// exceptions are propergated from Synapes Server
- MessageSender sender = new MessageSender();
+ ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(targetEpr);
- sender.setClientOptions(options);
- sender.send(operation.getLocalPart(),
- Axis2EvnSetup.payloadNamedAdddressing());
+ serviceClient.setOptions(options);
+ serviceClient.fireAndForget(Axis2EvnSetup.payloadNamedAdddressing());
}
Modified: incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java?rev=366116&r1=366115&r2=366116&view=diff
==============================================================================
--- incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java (original)
+++ incubator/synapse/trunk/java/test/org/apache/synapse/spi/injection/SendOnProcessorWithRuleTest.java Thu Jan 5 00:08:41 2006
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
-*/package org.apache.synapse.spi.injection;
+*/
+package org.apache.synapse.spi.injection;
import junit.framework.TestCase;
@@ -38,8 +39,9 @@
/**
* axis2Server is the one who holds the actual service
*/
- axis2Server = new SimpleHTTPServer("target/synapse-repository-sendonAxis2",
- 8090);
+ axis2Server =
+ new SimpleHTTPServer("target/synapse-repository-sendonAxis2",
+ 8090);
synapseServer.start();
axis2Server.start();
}
@@ -55,8 +57,20 @@
options.setTo(targetEpr);
serviceClient.setOptions(options);
OMElement response = serviceClient.sendReceive(Axis2EvnSetup.payload());
- assertEquals("Synapse Testing String_Response",response.getText());
+ assertEquals("Synapse Testing String_Response", response.getText());
+ }
+
+ public void testSendProcessorMultipleTimes() throws Exception {
+ ServiceClient serviceClient = new ServiceClient();
+ for (int i = 0; i < 5; i++) {
+ Options options = new Options();
+ options.setTo(targetEpr);
+ serviceClient.setOptions(options);
+ OMElement response =
+ serviceClient.sendReceive(Axis2EvnSetup.payload());
+ assertEquals("Synapse Testing String_Response", response.getText());
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org