Hi All, I am trying to check the functionality of the Fail Over Endpoint. I want to verify that the failover logic is happening to specific error codes. I used proxy given below for that,
According to [1]<http://wso2.org/library/articles/wso2-enterprise-service-bus-endpoint-error-handling>, error code 101504,101508 for timeouts. So I used following test case to produce the scenario, My logic was this, 1. Send a request to proxy to check it is functioning. 2. Shutdown http://localhost:9001 server. 3. Then send Send a request to proxy again. So the first endpoint should be failed. But it cant be suspend. Because it is only suspending for timeouts. 4. Response should come from second server. 5. Then Start the http://localhost:9001 server. 6. Then send Send a request to proxy again. Response should come from server1. Because it is not suspended.( I am trying this with in the suspend time period of 9001-server endpoint, so if is suspended, response should come from server2) But when I tried this, in the 3rd step of the logic (Red Highlighted line of the code) it fails. The endpoint is suspending for connection refused created by shutting down the server. According to spec it cant be. Is this a bug or am I doing something wrong here? Please look at this ASAP we need this to wind up Test Automation Hackathon tomorrow. Thanks AndunSLG [1] - http://wso2.org/library/articles/wso2-enterprise-service-bus-endpoint-error-handling Proxy Service : <proxy name="failoverEndPoint_Specific_Errors" transports="http,https"> <target> <inSequence> <send> <endpoint> <failover> <endpoint name="9001 Server"> <address uri=" http://localhost:9001/services/LBService1"> <timeout> <duration>2000</duration> </timeout> <markForSuspension> <errorCodes>101504,101508</errorCodes> <retriesBeforeSuspension>0</retriesBeforeSuspension> <retryDelay>0</retryDelay> </markForSuspension> <suspendOnFailure> <initialDuration>60000</initialDuration> <progressionFactor>2</progressionFactor> </suspendOnFailure> </address> </endpoint> <endpoint name="9002 Server"> <address uri=" http://localhost:9002/services/LBService1"> <timeout> <duration>2000</duration> </timeout> <markForSuspension> <errorCodes>101509</errorCodes> <retriesBeforeSuspension>0</retriesBeforeSuspension> <retryDelay>0</retryDelay> </markForSuspension> <suspendOnFailure> <initialDuration>60000</initialDuration> <progressionFactor>2</progressionFactor> </suspendOnFailure> </address> </endpoint> </failover> </endpoint> </send> </inSequence> <outSequence> <send/> </outSequence> </target> </proxy> Test Case : @Test(groups = "wso2.esb", description = "Test sending request to Fail Over Endpoint which Suspend Endpoints to Specific Errors") public void testSendingFailOverEndpoint_With_Specific_Errors() throws IOException, InterruptedException { //Check the fail over endpoint is functioning well String response = lbClient.sendLoadBalanceRequest(getProxyServiceURL("failoverEndPoint_Specific_Errors"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_1")); //Stop one server to generate a failure in one endpoint //But the suspend cant be triggered here. because suspend the endpoint happen only for Timeouts 101504,101508 axis2Server1.stop(); response = lbClient.sendLoadBalanceRequest(getProxyServiceURL("failoverEndPoint_Specific_Errors"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_2")); axis2Server1.start(); int counter=0; while(!AxisServiceClientUtils.isServiceAvailable(" http://localhost:9001/services/LBService1")) { if(counter>100){ break; } counter++; } if(counter>100){ throw new AssertionError("Axis2 Server didn't started with in expected time period.") ; } else{ //Checaxiaxis2Server1.start()s2Server1.stop()k that the endpoint one is not suspended. //If reply comes that means not suspended. //Because suspend duration of the endpoint is 20 seconds. So reply cant come in this time. response = lbClient.sendLoadBalanceRequest(getProxyServiceURL("failoverEndPoint_Specific_Errors"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_1")); //Invoke a web service method which will invoke a time out and cause the endpoint to suspend. response = lbClient.sendSleepRequest(getProxyServiceURL("failoverEndPoint_Specific_Errors"),"4000"); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_2")); //Invoke a web service method which will invoke a time out and cause the endpoint to suspend. response = lbClient.sendLoadBalanceRequest(getProxyServiceURL("failoverEndPoint_Specific_Errors"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_2")); } }
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
