protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { OMElement classElement = epConfig.getFirstChildWithName(CLASS_QNAME); if (classElement == null) { return null; } String nameAttr = classElement.getAttributeValue(NAME_QNAME); if (nameAttr == null) { return null; } Endpoint endpoint = null; try { Class clazz = Class.forName(nameAttr); endpoint = (Endpoint) clazz.newInstance(); for (Iterator iter = classElement.getChildrenWithName(PARAMETER_QNAME); iter.hasNext(); ) { OMElement paramEle = (OMElement) iter.next(); setParameter(endpoint, paramEle); } } catch (Exception e) { handleException("Cannot create class endpoint", e); } return endpoint; }
public void testClassEndpointScenarioTwo() throws Exception { String inputXML = "<endpoint name=\"testEndpoint\" xmlns=" + "\"http://ws.apache.org/ns/synapse\">" + "<class name=\"org.apache.synapse.config.xml.endpoints.CustomClassEndpoint\"/>" + "</endpoint>"; OMElement inputElement = createOMElement(inputXML); ClassEndpoint endpoint = (ClassEndpoint) ClassEndpointFactory.getEndpointFromElement( inputElement,false,null); OMElement serializedOut = ClassEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue(compare(serializedOut,inputElement)); }
(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "class")); if (classElement != null) { return ClassEndpointFactory.getInstance();
public void testClassEndpointScenarioOne() throws Exception { String inputXML = "<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" + "<class name=\"org.apache.synapse.config.xml.endpoints.CustomClassEndpoint\"/>" + "</endpoint>"; OMElement inputElement = createOMElement(inputXML); ClassEndpoint endpoint = (ClassEndpoint) ClassEndpointFactory.getEndpointFromElement(inputElement, true, null); OMElement serializedOut = ClassEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue(compare(serializedOut, inputElement)); }
(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "class")); if (classElement != null) { return ClassEndpointFactory.getInstance();
iter.hasNext(); ) { OMElement paramEle = (OMElement) iter.next(); setParameter(endpoint, paramEle,clazzEndpoint); handleException("Cannot create class endpoint", e);
public void testClassEndpointScenarioThree() throws Exception { String inputXML = "<endpoint name=\"testEndpoint\" xmlns=" + "\"http://ws.apache.org/ns/synapse\">" + "<class name=\"org.apache.synapse.config.xml.endpoints.CustomClassEndpoint\">" + "<parameter xmlns=" + "\"\" name=\"foo\">XYZ</parameter>" + "</class>" + "</endpoint>"; OMElement inputElement = createOMElement(inputXML); ClassEndpoint endpoint = (ClassEndpoint) ClassEndpointFactory.getEndpointFromElement( inputElement,false,null); OMElement serializedOut = ClassEndpointSerializer.getElementFromEndpoint(endpoint); assertTrue(compare(serializedOut,inputElement)); }