/** * 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; }
endpoint.setEnableMBeanStats(false); endpoint.setName("DYNAMIC_RECIPIENT_LIST_EP_" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setReplicationDisabled(true); definition.setAddress(url);
endpoint.setEnableMBeanStats(false); endpoint.setName("DYNAMIC_RECIPIENT_LIST_EP_" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setReplicationDisabled(true); definition.setAddress(url);
EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); endpoint.init(synCtx.getEnvironment());
EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); endpoint.init(synCtx.getEnvironment());
EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); endpoint.init(newCtx.getEnvironment());
EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); endpoint.init(newCtx.getEnvironment());
endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress(serviceURL); ((AddressEndpoint) endpoint).setDefinition(endpointDefinition); endpointDefinition = new EndpointDefinition(); ((DefaultEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true;
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; } }
public void testContextProperties() throws Exception { SynapseXPath xpath = new SynapseXPath("$ctx:timeout"); AbstractEndpoint endpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); definition.setDynamicTimeoutExpression(xpath); MessageContext synCtx = new TestMessageContext(); synCtx.setProperty("timeout", "90000"); assertEquals(Long.valueOf((String) xpath.evaluate(synCtx)).longValue(), endpoint.getDefinition().evaluateDynamicEndpointTimeout(synCtx)); }
EndpointDefinition endpointDefinition = new EndpointDefinition(); synInCtx.getEnvironment().send(endpointDefinition, synInCtx); } else {
/** * * @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; }
endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress(serviceURL); endpointDefinition.addSuspendErrorCode(-1); endpointDefinition = new EndpointDefinition(); ((DefaultEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true;
/** * * @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; }
public void setComponentStatisticsId(ArtifactHolder holder) { if (this instanceof IndirectEndpoint) { String sequenceId = StatisticIdentityGenerator .getIdReferencingComponent(((IndirectEndpoint) (this)).getKey(), ComponentType.ENDPOINT, holder); StatisticIdentityGenerator.reportingEndEvent(sequenceId, ComponentType.ENDPOINT, holder); } else { if (definition == null) { EndpointDefinition definition = new EndpointDefinition(); this.setDefinition(definition); } if (definition.getAspectConfiguration() == null) { definition.configure(new AspectConfiguration(getReportingName())); } String sequenceId = StatisticIdentityGenerator.getIdForComponent(getReportingName(), ComponentType.ENDPOINT, holder); definition.getAspectConfiguration().setUniqueId(sequenceId); StatisticIdentityGenerator.reportingEndEvent(sequenceId, ComponentType.ENDPOINT, holder); } } }
/** * 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 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()); } }
/** * 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)); }