/** * Create a Endpoint for a given URL * * @param endpointUrl URL * @param se synapse environment * @return AddressEndpoint address endpoint */ private Endpoint getEndpointFromURL(String endpointUrl, SynapseEnvironment se) { AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition def = new EndpointDefinition(); def.setAddress(endpointUrl.trim()); endpoint.setDefinition(def); endpoint.init(se); return endpoint; }
/** * Create a Endpoint for a given URL * * @param endpointUrl URL * @param se synapse environment * @return AddressEndpoint address endpoint */ private Endpoint getEndpointFromURL(String endpointUrl, SynapseEnvironment se) { AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition def = new EndpointDefinition(); def.setAddress(endpointUrl.trim()); endpoint.setDefinition(def); endpoint.init(se); return endpoint; }
definition.setReplicationDisabled(true); definition.setAddress(url); endpoint.setDefinition(definition); endpoint.init(env);
definition.setReplicationDisabled(true); definition.setAddress(url); endpoint.setDefinition(definition); endpoint.init(env);
@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; }
endpoint.setDefinition(definition); endpoint.init(synCtx.getEnvironment()); endpoint.send(synCtx);
endpoint.setDefinition(definition); endpoint.init(synCtx.getEnvironment()); endpoint.send(synCtx);
endpoint.setDefinition(definition); endpoint.init(newCtx.getEnvironment());
endpoint.setDefinition(definition); endpoint.init(newCtx.getEnvironment());
private List<Endpoint> createEndpoints() { List<Endpoint> endpoints = new ArrayList<Endpoint>(); for (int i = 0; i < hosts.length; i++) { AddressEndpoint addressEndpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); definition.setAddress("http://" + hosts[i] + "/"); addressEndpoint.setDefinition(definition); MediatorProperty property = new MediatorProperty(); property.setName(WeightedRRLCAlgorithm.LB_WEIGHTED_RRLC_WEIGHT); property.setValue(weights[i]); addressEndpoint.addProperty(property); endpoints.add(addressEndpoint); } return endpoints; } }
/** * * @param to get an endpoint to send the information * @param member The member to which an EP has to be created * @param synCtx synapse context * @return the created endpoint */ private Endpoint getEndpoint(EndpointReference to, Member member, MessageContext synCtx) { AddressEndpoint endpoint = new AddressEndpoint(); endpoint.setEnableMBeanStats(false); endpoint.setName("DLB:" + member.getHostName() + ":" + member.getPort() + ":" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setSuspendMaximumDuration(10000); definition.setReplicationDisabled(true); definition.setAddress(to.getAddress()); endpoint.setDefinition(definition); endpoint.init((SynapseEnvironment) ((Axis2MessageContext) synCtx).getAxis2MessageContext(). getConfigurationContext().getAxisConfiguration(). getParameterValue(SynapseConstants.SYNAPSE_ENV)); return endpoint; }
/** * * @param to get an endpoint to send the information * @param member The member to which an EP has to be created * @param synCtx synapse context * @return the created endpoint */ private Endpoint getEndpoint(EndpointReference to, Member member, MessageContext synCtx) { AddressEndpoint endpoint = new AddressEndpoint(); endpoint.setEnableMBeanStats(false); endpoint.setName("DLB:" + member.getHostName() + ":" + member.getPort() + ":" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setSuspendMaximumDuration(10000); definition.setReplicationDisabled(true); definition.setAddress(to.getAddress()); endpoint.setDefinition(definition); endpoint.init((SynapseEnvironment) ((Axis2MessageContext) synCtx).getAxis2MessageContext(). getConfigurationContext().getAxisConfiguration(). getParameterValue(SynapseConstants.SYNAPSE_ENV)); return endpoint; }
/** * 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\"")); }
/** * Tests building a proxy service with an unreachable endpoint specified as the published wsdl url with the * 'enablePublishWSDLSafeMode' set to true. * * @throws Exception if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithUnreachableWsdlEndpointWithPublishWSDLSafeModeDisabled() throws Exception { SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("faultyPublishWsdlEndpointProxyWithPublishWSDLSafeModeDisabled"); proxyService.setPublishWSDLEndpoint("wsdlEndPoint"); AddressEndpoint wsdlEndpoint = new AddressEndpoint(); EndpointDefinition endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress((new URI("http://invalid-host/SimpleStockService.wsdl")).toString()); wsdlEndpoint.setDefinition(endpointDefinition); proxyService.addParameter("enablePublishWSDLSafeMode", false); synCfg.addEndpoint("wsdlEndPoint", wsdlEndpoint); try { proxyService.buildAxisService(synCfg, axisCfg); Assert.fail("Axis service built with an unreachable wsdl endpoint should throw fault"); } catch (SynapseException e) { Assert.assertTrue("Unexpected exception thrown: " + e, e.getMessage().contains("Error reading from wsdl URI")); } }
/** * Tests building a proxy service with an unreachable endpoint specified as the published wsdl url with the * 'enablePublishWSDLSafeMode' set to false. * * @throws Exception if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithUnreachableWsdlEndpointWithPublishWSDLSafeModeEnabled() throws Exception { MessageContext synCtx = new TestMessageContext(); SynapseConfiguration synCfg = new SynapseConfiguration(); synCtx.setConfiguration(synCfg); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("faultyPublishWsdlEndpointProxyWithPublishWSDLSafeModeEnabled"); proxyService.setPublishWSDLEndpoint("wsdlEndPoint"); AddressEndpoint wsdlEndpoint = new AddressEndpoint(); EndpointDefinition endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress((new URI("http://invalid-host/SimpleStockService.wsdl")).toString()); wsdlEndpoint.setDefinition(endpointDefinition); proxyService.addParameter("enablePublishWSDLSafeMode", true); synCfg.addEndpoint("wsdlEndPoint", wsdlEndpoint); Assert.assertNull("Axis service built with an unreachable wsdl endpoint be null", proxyService.buildAxisService(synCfg, axisCfg)); }
/** * Tests building a proxy service with a faulty wsdl endpoint specified as the wsdl endpoint. * * @throws Exception if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithFaultyPublishWsdlEndpoint() throws Exception { SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("faultyPublishWsdlEndpointProxy"); proxyService.setPublishWSDLEndpoint("wsdlEndPoint"); try { proxyService.buildAxisService(synCfg, axisCfg); Assert.fail("Axis service built with null wsdl endpoint should throw fault"); } catch (SynapseException e) { Assert.assertEquals("Unexpected exception thrown: " + e, "Unable to resolve WSDL url. wsdlEndPoint is null", e.getMessage()); } AddressEndpoint wsdlEndpoint = new AddressEndpoint(); EndpointDefinition endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress(getClass().getResource("SimpleStockService.wsdl").toURI().toString()); wsdlEndpoint.setDefinition(endpointDefinition); synCfg.addEndpoint("wsdlEndPoint", wsdlEndpoint); try { proxyService.buildAxisService(synCfg, axisCfg); Assert.fail("Axis service built with faulty wsdl endpoint should be null"); } catch (SynapseException e) { Assert.assertEquals("Unexpected exception thrown: " + e, "Error building service from WSDL", e.getMessage()); } }
endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress(serviceURL); ((AddressEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true; } else if (endpoint == null) {
endpointDefinition.addSuspendErrorCode(-1); endpointDefinition.addTimeoutErrorCode(-1); ((AddressEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true; } else if (endpoint == null && endpointKey == null) {