@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; }
@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; }
/** * Test serializeConfigurationMethod with Endpoint added for SynapseConfiguration and assert OMElement returned */ @Test public void testSerializeConfiguration6() { SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer(); SynapseConfiguration synapseConfiguration = new SynapseConfiguration(); AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); definition.setAddress("testUrl"); endpoint.setName("testEndpoint"); endpoint.setDefinition(definition); synapseConfiguration.addEndpoint(endpoint.getName(), endpoint); OMElement element = serializer.serializeConfiguration(synapseConfiguration); Assert.assertNotNull("OMElement is not returned", element); Assert.assertEquals("definitions", element.getLocalName()); Assert.assertTrue("Endpoint added is not serialized.", element.getChildren().next(). toString().contains("name=\"testEndpoint\"")); }