org.apache.activemq.util.URISupport.CompositeData Java Examples
The following examples show how to use
org.apache.activemq.util.URISupport.CompositeData.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmsFactory.java From localization_nifi with Apache License 2.0 | 6 votes |
private static boolean isSSL(URI uri) { try { CompositeData compositeData = URISupport.parseComposite(uri); if ("ssl".equals(compositeData.getScheme())) { return true; } for(URI component : compositeData.getComponents()){ if ("ssl".equals(component.getScheme())) { return true; } } } catch (URISyntaxException e) { throw new IllegalArgumentException("Attempting to initiate JMS with invalid composite URI [" + uri + "]", e); } return false; }
Example #2
Source File: DiscoveryTransportNoBrokerTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
public void testSetDiscoveredBrokerProperties() throws Exception { final String extraParameterName = "connectionTimeout"; final String extraParameterValue = "3000"; final URI uri = new URI("discovery:(multicast://default)?initialReconnectDelay=100&" + DiscoveryListener.DISCOVERED_OPTION_PREFIX + extraParameterName + "=" + extraParameterValue); CompositeData compositeData = URISupport.parseComposite(uri); StubCompositeTransport compositeTransport = new StubCompositeTransport(); DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport, compositeData, compositeData.getParameters()); discoveryTransport.onServiceAdd(new DiscoveryEvent("tcp://localhost:61616")); assertEquals("expected added URI after discovery event", compositeTransport.getTransportURIs().length, 1); URI discoveredServiceURI = compositeTransport.getTransportURIs()[0]; Map<String, String> parameters = URISupport.parseParameters(discoveredServiceURI); assertTrue("unable to add parameter to discovered service", parameters.containsKey(extraParameterName)); assertEquals("incorrect value for parameter added to discovered service", parameters.get(extraParameterName), extraParameterValue); }
Example #3
Source File: DiscoveryTransportNoBrokerTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
public void testSetDiscoveredStaticBrokerProperties() throws Exception { final String extraParameterName = "connectionTimeout"; final String extraParameterValue = "3000"; final URI uri = new URI("discovery:(static:tcp://localhost:61616)?initialReconnectDelay=100&" + DiscoveryListener.DISCOVERED_OPTION_PREFIX + extraParameterName + "=" + extraParameterValue); CompositeData compositeData = URISupport.parseComposite(uri); StubCompositeTransport compositeTransport = new StubCompositeTransport(); DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport, compositeData, compositeData.getParameters()); discoveryTransport.start(); assertEquals("expected added URI after discovery event", 1, compositeTransport.getTransportURIs().length); URI discoveredServiceURI = compositeTransport.getTransportURIs()[0]; Map<String, String> parameters = URISupport.parseParameters(discoveredServiceURI); assertTrue("unable to add parameter to discovered service", parameters.containsKey(extraParameterName)); assertEquals("incorrect value for parameter added to discovered service", parameters.get(extraParameterName), extraParameterValue); }
Example #4
Source File: JmsFactory.java From nifi with Apache License 2.0 | 6 votes |
private static boolean isSSL(URI uri) { try { CompositeData compositeData = URISupport.parseComposite(uri); if ("ssl".equals(compositeData.getScheme())) { return true; } for(URI component : compositeData.getComponents()){ if ("ssl".equals(component.getScheme())) { return true; } } } catch (URISyntaxException e) { throw new IllegalArgumentException("Attempting to initiate JMS with invalid composite URI [" + uri + "]", e); } return false; }
Example #5
Source File: DiscoveryTransportNoBrokerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
public void testAddRemoveDiscoveredBroker() throws Exception { final URI uri = new URI("discovery:(multicast://default)?initialReconnectDelay=100&connectionTimeout=3000"); CompositeData compositeData = URISupport.parseComposite(uri); StubCompositeTransport compositeTransport = new StubCompositeTransport(); DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport, compositeData, compositeData.getParameters()); final String serviceName = "tcp://localhost:61616"; discoveryTransport.onServiceAdd(new DiscoveryEvent(serviceName)); assertEquals("expected added URI after discovery event", 1, compositeTransport.getTransportURIs().length); discoveryTransport.onServiceRemove(new DiscoveryEvent(serviceName)); assertEquals("expected URI removed after discovery event", 0, compositeTransport.getTransportURIs().length); }