@Override protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { AddressEndpoint addressEndpoint = new AddressEndpoint(); OMAttribute name = epConfig.getAttribute( new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); if (name != null) { addressEndpoint.setName(name.getAttributeValue()); } OMElement addressElement = epConfig.getFirstChildWithName( new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address")); if (addressElement != null) { EndpointDefinition definition = createEndpointDefinition(addressElement); addressEndpoint.setDefinition(definition); processAuditStatus(definition, addressEndpoint.getName(), addressElement); } processProperties(addressEndpoint, epConfig); return addressEndpoint; }
DefinitionFactory fac = getEndpointDefinitionFactory(); EndpointDefinition endpointDefinition; if (fac == null) { endpointDefinition.setAddress(addressURI.trim()); } else { handleException("Invalid endpoint definition. " + "\"uri\" attribute of the address endpoint cannot be empty."); extractSpecificEndpointProperties(endpointDefinition, elem); return endpointDefinition;
/** * Creates an EndpointDefinition instance using the XML fragment specification. Configuration * for EndpointDefinition always resides inside a configuration of an AddressEndpoint. This * factory extracts the details related to the EPR provided for address endpoint. * * @param elem XML configuration element * @return EndpointDefinition object containing the endpoint details. */ @Override public EndpointDefinition createEndpointDefinition(OMElement elem) { OMAttribute address = elem.getAttribute(new QName("uri")); DefinitionFactory fac = getEndpointDefinitionFactory(); EndpointDefinition endpointDefinition; if (fac == null) { fac = new EndpointDefinitionFactory(); endpointDefinition = fac.createDefinition(elem); } else{ endpointDefinition = fac.createDefinition(elem); } if (address != null) { endpointDefinition.setAddress(address.getAttributeValue().trim()); } extractSpecificEndpointProperties(endpointDefinition, elem); return endpointDefinition; } }
public void testAddressEndpointScenarioOne() throws Exception { String inputXML = "<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" + "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" />" + "</endpoint>" ; OMElement inputElement = createOMElement(inputXML); AddressEndpoint endpoint = (AddressEndpoint) AddressEndpointFactory.getEndpointFromElement( inputElement,true,null); OMElement serializedOut = AddressEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue(compare(serializedOut,inputElement)); }
new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address")); if (addressElement != null) { return AddressEndpointFactory.getInstance();
public void testAddressEndpointScenarioTwo() throws Exception { String inputXML = "<endpoint name=\"testEndpoint\" onError=\"foo\" xmlns=" + "\"http://ws.apache.org/ns/synapse\">" + "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" >" + "</address>"+ "</endpoint>" ; OMElement inputElement = createOMElement(inputXML); AddressEndpoint endpoint = (AddressEndpoint) AddressEndpointFactory.getEndpointFromElement( inputElement,false,null); OMElement serializedOut = AddressEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue(compare(serializedOut,inputElement)); }
new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address")); if (addressElement != null) { return AddressEndpointFactory.getInstance();
@Override protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { AddressEndpoint addressEndpoint = new AddressEndpoint(); OMAttribute name = epConfig.getAttribute( new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); if (name != null) { addressEndpoint.setName(name.getAttributeValue()); } OMElement addressElement = epConfig.getFirstChildWithName( new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address")); if (addressElement != null) { EndpointDefinition definition = createEndpointDefinition(addressElement); addressEndpoint.setDefinition(definition); processAuditStatus(definition, addressEndpoint.getName(), addressElement); } processProperties(addressEndpoint, epConfig); return addressEndpoint; }
public void testAddressEndpointScenarioFour() throws Exception { String inputXML = "<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" + "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" >" + "</address>"+ "</endpoint>" ; OMElement inputElement = createOMElement(inputXML); AddressEndpoint endpoint = (AddressEndpoint) AddressEndpointFactory.getEndpointFromElement( inputElement, true, null); //assertNotNull(endpoint.getName()); // make sure we generate names for anonymous endpoints OMElement serializedOut = AddressEndpointSerializer.getElementFromEndpoint(endpoint); // the generated name should not show up in the serialization assertTrue(compare(serializedOut,inputElement)); }
public void testAddressEndpointScenarioThree() throws Exception { String inputXML = "<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" + "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" >" + "<markForSuspension>" + "<errorCodes>101507,101508</errorCodes>" + "<retriesBeforeSuspension>3</retriesBeforeSuspension>" + "<retryDelay>1000</retryDelay>" + "</markForSuspension>" + "<suspendOnFailure>" + "<errorCodes>101505,101506</errorCodes>" + "<initialDuration>5000</initialDuration>" + "<progressionFactor>2.0</progressionFactor>" + "<maximumDuration>60000</maximumDuration>" + "</suspendOnFailure>" + "<retryConfig>" + "<disabledErrorCodes>101501,101502</disabledErrorCodes>" + "</retryConfig>" + "</address>" + "</endpoint>" ; OMElement inputElement = createOMElement(inputXML); AddressEndpoint endpoint = (AddressEndpoint) AddressEndpointFactory.getEndpointFromElement( inputElement,true,null); OMElement serializedOut = AddressEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue(compare(serializedOut,inputElement)); }
public void testAddressEndpointScenarioDe() throws Exception { String inputXML = "<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" + "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" >" + "<markForSuspension>" + "<errorCodes>101507,101508</errorCodes>" + "<retriesBeforeSuspension>3</retriesBeforeSuspension>" + "<retryDelay>1000</retryDelay>" + "</markForSuspension>" + "<suspendOnFailure>" + "<errorCodes>101505,101506</errorCodes>" + "<initialDuration>5000</initialDuration>" + "<progressionFactor>2.0</progressionFactor>" + "<maximumDuration>60000</maximumDuration>" + "</suspendOnFailure>" + "<retryConfig>" + "<enabledErrorCodes>101501,101502</enabledErrorCodes>" + "</retryConfig>" + "</address>" + "</endpoint>" ; OMElement inputElement = createOMElement(inputXML); AddressEndpoint endpoint = (AddressEndpoint) AddressEndpointFactory.getEndpointFromElement( inputElement,true,null); OMElement serializedOut = AddressEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue(compare(serializedOut,inputElement)); }