diff --git a/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/HTTPEndpointSerializerTest.java b/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/HTTPEndpointSerializerTest.java index 5747924368..08fbc0c266 100644 --- a/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/HTTPEndpointSerializerTest.java +++ b/modules/core/src/test/java/org/apache/synapse/config/xml/endpoints/HTTPEndpointSerializerTest.java @@ -33,4 +33,78 @@ public void test() throws Exception { OMElement serializedResponse = HTTPEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue("Endpoint not serialized!", compare(serializedResponse, inputElement)); } + + public void testCreateEndpointDefinitionWithErrorHandling() throws Exception { + + String inputXml = "" + + "" + + "" + + "1000" + + "discard" + + "" + + "" + + "403" + + "1" + + "" + + "" + + ""; + OMElement inputElement = AXIOMUtil.stringToOM(inputXml); + HTTPEndpoint endpoint = (HTTPEndpoint) HTTPEndpointFactory.getEndpointFromElement(inputElement, true, null); + OMElement serializedResponse = HTTPEndpointSerializer.getElementFromEndpoint(endpoint); + assertTrue("Endpoint definition with error handling not serialized!", compare(serializedResponse, inputElement)); + } + + public void testCreateEndpointDefinitionWithCompleteErrorHandling() throws Exception { + + String inputXml = "" + + "" + + "" + + "200" + + "discard" + + "" + + "" + + "403" + + "10" + + "10" + + "2" + + "" + + "" + + "304"+ + "10" + + "5" + + "" + + "" + + ""; + OMElement inputElement = AXIOMUtil.stringToOM(inputXml); + HTTPEndpoint endpoint = (HTTPEndpoint) HTTPEndpointFactory.getEndpointFromElement(inputElement, true, null); + OMElement serializedResponse = HTTPEndpointSerializer.getElementFromEndpoint(endpoint); + assertTrue("Endpoint definition with complete error handling not serialized!", compare(serializedResponse, inputElement)); + } + + public void testCreateEndpointDefinitionWithDynamicErrorHandling() throws Exception { + + String inputXml = "" + + "" + + "" + + "{get-property('timeoutDuration')}" + + "{get-property('timeoutAction')}" + + "" + + "" + + "{get-property('suspendErrorCodes')}" + + "{get-property('suspendInitialDuration')}" + + "{get-property('suspendMaximumDuration')}" + + "{get-property('suspendProgressionFactor')}" + + "" + + "" + + "{get-property('retryErrorCodes')}"+ + "{get-property('retryCount')}" + + "{get-property('retryDelay')}" + + "" + + "" + + ""; + OMElement inputElement = AXIOMUtil.stringToOM(inputXml); + HTTPEndpoint endpoint = (HTTPEndpoint) HTTPEndpointFactory.getEndpointFromElement(inputElement, true, null); + OMElement serializedResponse = HTTPEndpointSerializer.getElementFromEndpoint(endpoint); + assertTrue("Endpoint definition with dynamic error handling not serialized!", compare(serializedResponse, inputElement)); + } } \ No newline at end of file