Package org.apache.camel

Examples of org.apache.camel.EndpointConfiguration


    @Test
    public void testDummyConfiguration() throws Exception {
       
        String configUri = "dummy://foobar?first=one&second=2";
       
        EndpointConfiguration config = ConfigurationHelper.createConfiguration(configUri, context);
        assertNotNull(config);
        assertTrue(config instanceof DummyConfiguration);
        assertEquals("one", config.getParameter("first"));
        assertEquals(2, config.getParameter("second"));
    }
View Full Code Here


        context = null;
    }

    @Test
    public void testUrnNoQuery() throws Exception {
        EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump:foo", context);
        logConfigurationObject(cfg);
        assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
        assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
        assertEquals("URNs don't set the authority field", null, cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
        assertEquals("URNs don't set the userInfo field", null, cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
        assertEquals("URNs don't set the host field", null, cfg.getParameter(EndpointConfiguration.URI_HOST));
        assertEquals("URNs don't set the port field", -1, cfg.getParameter(EndpointConfiguration.URI_PORT));
        assertEquals("URNs don't set the path field", null, cfg.getParameter(EndpointConfiguration.URI_PATH));
        assertEquals("URNs don't set the query field", null, cfg.getParameter(EndpointConfiguration.URI_QUERY));
        assertEquals("URNs don't set the fragment field", null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }
View Full Code Here

        assertEquals("URNs don't set the fragment field", null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }

    @Test
    public void testUrnWithQuery() throws Exception {
        EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump:hadrian@localhost:9001/context/path/?bar=true&baz=2#1234", context);
        logConfigurationObject(cfg);
        assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
        assertEquals("hadrian@localhost:9001/context/path/?bar=true&baz=2#1234", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
        assertEquals("URNs don't set the authority field", null, cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
        assertEquals("URNs don't set the userInfo field", null, cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
        assertEquals("URNs don't set the host field", null, cfg.getParameter(EndpointConfiguration.URI_HOST));
        assertEquals("URNs don't set the port field", -1, cfg.getParameter(EndpointConfiguration.URI_PORT));
        assertEquals("URNs don't set the path field", null, cfg.getParameter(EndpointConfiguration.URI_PATH));
        assertEquals("URNs don't set the query field", null, cfg.getParameter(EndpointConfiguration.URI_QUERY));
        assertEquals("URNs don't set the fragment field", null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }
View Full Code Here

        assertEquals("URNs don't set the fragment field", null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }

    @Test
    public void testUrlSimple() throws Exception {
        EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump://foo", context);
        logConfigurationObject(cfg);
        assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
        assertEquals("//foo", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
        assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
        assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_HOST));
        assertEquals(-1, cfg.getParameter(EndpointConfiguration.URI_PORT));
        assertEquals("", cfg.getParameter(EndpointConfiguration.URI_PATH));
        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_QUERY));
        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }
View Full Code Here

        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }

    @Test
    public void testUrlWithPath() throws Exception {
        EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump://foo/bar#defrag", context);
        logConfigurationObject(cfg);
        assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
        assertEquals("//foo/bar#defrag", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
        assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
        assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_HOST));
        assertEquals(-1, cfg.getParameter(EndpointConfiguration.URI_PORT));
        assertEquals("/bar#defrag", cfg.getParameter(EndpointConfiguration.URI_PATH));
        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_QUERY));
        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }
View Full Code Here

        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }

    @Test
    public void testUrlWithQuery() throws Exception {
        EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump://hadrian@localhost:9001/context/path/?bar=true&baz=2#none", context);
        logConfigurationObject(cfg);
        assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
        assertEquals("//hadrian@localhost:9001/context/path/?bar=true&baz=2#none", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
        assertEquals("hadrian@localhost:9001", cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
        assertEquals("hadrian", cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
        assertEquals("localhost", cfg.getParameter(EndpointConfiguration.URI_HOST));
        assertEquals(9001, cfg.getParameter(EndpointConfiguration.URI_PORT));
        assertEquals("/context/path/", cfg.getParameter(EndpointConfiguration.URI_PATH));
        assertEquals("bar=true&baz=2#none", cfg.getParameter(EndpointConfiguration.URI_QUERY));
        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }
View Full Code Here

        assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
    }

    @Test
    public void testConfigurationFormat() throws Exception {
        EndpointConfiguration config = ConfigurationHelper.createConfiguration("uri-dump:foo", context);
        assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Canonical));
        assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Provider));
        assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Consumer));
        assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Complete));
    }
View Full Code Here

        context = null;
    }

    @Test
    public void testConfigurationInstanceType() throws Exception {
        EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("mapped:foo", context);
        assertEquals("EndpointConfiguration instance not of expected type", MappedEndpointConfiguration.class, cfg.getClass());
    }
View Full Code Here

        assertEquals("EndpointConfiguration instance not of expected type", MappedEndpointConfiguration.class, cfg.getClass());
    }

    @Test
    public void testConfigurationEquals() throws Exception {
        EndpointConfiguration cfg1 = ConfigurationHelper.createConfiguration("mapped://foo?one=true&two=2", context);
        EndpointConfiguration cfg2 = ConfigurationHelper.createConfiguration("mapped://foo?two=2&one=true", context);
        String uri1 = cfg1.toUriString(EndpointConfiguration.UriFormat.Complete);
        String uri2 = cfg2.toUriString(EndpointConfiguration.UriFormat.Complete);
        assertEquals("Query parameter order should not matter", uri1, uri2);
    }
View Full Code Here

    }

    @Test
    @Ignore("Fails due CAMEL-5183")
    public void testConfigurationPortParameter() throws Exception {
        EndpointConfiguration cfg1 = ConfigurationHelper.createConfiguration("mapped://foo:8080?one=true&two=2&port=123", context);
        String uri1 = cfg1.toUriString(EndpointConfiguration.UriFormat.Complete);
        assertEquals("mapped://foo:8080?one=true&port=123&two=2", uri1);
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.EndpointConfiguration

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.