Package org.apache.activemq.util.URISupport

Examples of org.apache.activemq.util.URISupport.CompositeData


        assertEquals(2, data.getComponents().length);
    }

    public void testEmptyCompositeWithParenthesisInParam() throws Exception {
        URI uri = new URI("failover://()?updateURIsURL=file:/C:/Dir(1)/a.csv");
        CompositeData data = URISupport.parseComposite(uri);
        assertEquals(0, data.getComponents().length);
        assertEquals(1, data.getParameters().size());
        assertTrue(data.getParameters().containsKey("updateURIsURL"));
        assertEquals("file:/C:/Dir(1)/a.csv", data.getParameters().get("updateURIsURL"));
    }
View Full Code Here


        assertEquals("file:/C:/Dir(1)/a.csv", data.getParameters().get("updateURIsURL"));
    }

    public void testCompositeWithParenthesisInParam() throws Exception {
        URI uri = new URI("failover://(test)?updateURIsURL=file:/C:/Dir(1)/a.csv");
        CompositeData data = URISupport.parseComposite(uri);
        assertEquals(1, data.getComponents().length);
        assertEquals(1, data.getParameters().size());
        assertTrue(data.getParameters().containsKey("updateURIsURL"));
        assertEquals("file:/C:/Dir(1)/a.csv", data.getParameters().get("updateURIsURL"));
    }
View Full Code Here

        assertTrue(data.getParameters().containsKey("updateURIsURL"));
        assertEquals("file:/C:/Dir(1)/a.csv", data.getParameters().get("updateURIsURL"));
    }

    public void testCompositeWithComponentParam() throws Exception {
        CompositeData data = URISupport.parseComposite(new URI("test:(part1://host?part1=true)?outside=true"));
        assertEquals(1, data.getComponents().length);
        assertEquals(1, data.getParameters().size());
        Map<String, String> part1Params = URISupport.parseParameters(data.getComponents()[0]);
        assertEquals(1, part1Params.size());
        assertTrue(part1Params.containsKey("part1"));
    }
View Full Code Here

    protected void assertMapKey(Map<String, String> map, String key, Object expected) {
        assertEquals("Map key: " + key, map.get(key), expected);
    }

    public void testParsingCompositeURI() throws URISyntaxException {
        CompositeData data = URISupport.parseComposite(new URI("broker://(tcp://localhost:61616)?name=foo"));
        assertEquals("one component", 1, data.getComponents().length);
        assertEquals("Size: " + data.getParameters(), 1, data.getParameters().size());
    }
View Full Code Here

     *
     * @param _uri
     *            LDAP server URI
     */
    public void setUri(URI uri) throws Exception {
        CompositeData data = URISupport.parseComposite(uri);
        if (data.getScheme().equals("failover")) {
            availableURIs = data.getComponents();
            failover = true;
        } else {
            availableURIs = new URI[] { uri };
        }
    }
View Full Code Here

    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];
View Full Code Here

    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];
View Full Code Here

        assertEquals("incorrect value for parameter added to discovered service", parameters.get(extraParameterName), extraParameterValue);
    }

    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);
View Full Code Here

        } else {

            // It might be a composite URI.
            try {
                CompositeData data = URISupport.parseComposite(this.brokerURL);
                Map<String,Object> jmsOptionsMap = IntrospectionSupport.extractProperties(data.getParameters(), "jms.");
                if (buildFromMap(jmsOptionsMap)) {
                    if (!jmsOptionsMap.isEmpty()) {
                        String msg = "There are " + jmsOptionsMap.size()
                            + " jms options that couldn't be set on the ConnectionFactory."
                            + " Check the options are spelled correctly."
                            + " Unknown parameters=[" + jmsOptionsMap + "]."
                            + " This connection factory cannot be started.";
                        throw new IllegalArgumentException(msg);
                    }

                    this.brokerURL = data.toURI();
                }
            } catch (URISyntaxException e) {
            }
        }
    }
View Full Code Here

        } else {

            // It might be a composite URI.
            try {
                CompositeData data = URISupport.parseComposite(this.brokerURL);
                Map<String,Object> jmsOptionsMap = IntrospectionSupport.extractProperties(data.getParameters(), "jms.");
                if (buildFromMap(jmsOptionsMap)) {
                    if (!jmsOptionsMap.isEmpty()) {
                        String msg = "There are " + jmsOptionsMap.size()
                            + " jms options that couldn't be set on the ConnectionFactory."
                            + " Check the options are spelled correctly."
                            + " Unknown parameters=[" + jmsOptionsMap + "]."
                            + " This connection factory cannot be started.";
                        throw new IllegalArgumentException(msg);
                    }

                    this.brokerURL = data.toURI();
                }
            } catch (URISyntaxException e) {
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.util.URISupport.CompositeData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.