• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResolveEndpointFailedException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.camel.ResolveEndpointFailedException的典型用法代码示例。如果您正苦于以下问题:Java ResolveEndpointFailedException类的具体用法?Java ResolveEndpointFailedException怎么用?Java ResolveEndpointFailedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResolveEndpointFailedException类属于org.apache.camel包,在下文中一共展示了ResolveEndpointFailedException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createJettyHttpClient

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
protected HttpClient createJettyHttpClient() throws Exception {
    // create a new client
    // thread pool min/max from endpoint take precedence over from component
    Integer min = httpClientMinThreads != null ? httpClientMinThreads : getComponent().getHttpClientMinThreads();
    Integer max = httpClientMaxThreads != null ? httpClientMaxThreads : getComponent().getHttpClientMaxThreads();
    HttpClient httpClient = getComponent().createHttpClient(this, min, max, sslContextParameters);

    // set optional http client parameters
    if (httpClientParameters != null) {
        // copy parameters as we need to re-use them again if creating a new producer later
        Map<String, Object> params = new HashMap<String, Object>(httpClientParameters);
        // Can not be set on httpClient for jetty 9
        params.remove("timeout");
        IntrospectionSupport.setProperties(httpClient, params);
        // validate we could set all parameters
        if (params.size() > 0) {
            throw new ResolveEndpointFailedException(getEndpointUri(), "There are " + params.size()
                    + " parameters that couldn't be set on the endpoint."
                    + " Check the uri if the parameters are spelt correctly and that they are properties of the endpoint."
                    + " Unknown parameters=[" + params + "]");
        }
    }
    return httpClient;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:25,代码来源:JettyHttpEndpoint.java


示例2: configurePollingConsumer

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
@Override
protected void configurePollingConsumer(PollingConsumer consumer) throws Exception {
    Map<String, Object> copy = new HashMap<String, Object>(getConsumerProperties());
    Map<String, Object> throwaway = new HashMap<String, Object>();

    // filter out unwanted options which is intended for the scheduled poll consumer
    // as these options are not supported on the polling consumer
    configureScheduledPollConsumerProperties(copy, throwaway);

    // set reference properties first as they use # syntax that fools the regular properties setter
    EndpointHelper.setReferenceProperties(getCamelContext(), consumer, copy);
    EndpointHelper.setProperties(getCamelContext(), consumer, copy);

    if (!isLenientProperties() && copy.size() > 0) {
        throw new ResolveEndpointFailedException(this.getEndpointUri(), "There are " + copy.size()
                + " parameters that couldn't be set on the endpoint polling consumer."
                + " Check the uri if the parameters are spelt correctly and that they are properties of the endpoint."
                + " Unknown consumer parameters=[" + copy + "]");
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:ScheduledPollEndpoint.java


示例3: validateURI

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
/**
 * Strategy for validation of the uri when creating the endpoint.
 *
 * @param uri        the uri
 * @param path       the path - part after the scheme
 * @param parameters the parameters, an empty map if no parameters given
 * @throws ResolveEndpointFailedException should be thrown if the URI validation failed
 */
protected void validateURI(String uri, String path, Map<String, Object> parameters) {
    // check for uri containing double && markers without include by RAW
    if (uri.contains("&&")) {
        Pattern pattern = Pattern.compile("RAW(.*&&.*)");
        Matcher m = pattern.matcher(uri);
        // we should skip the RAW part
        if (!m.find()) {
            throw new ResolveEndpointFailedException(uri, "Invalid uri syntax: Double && marker found. "
                + "Check the uri and remove the duplicate & marker.");
        }
    }

    // if we have a trailing & then that is invalid as well
    if (uri.endsWith("&")) {
        throw new ResolveEndpointFailedException(uri, "Invalid uri syntax: Trailing & marker found. "
            + "Check the uri and remove the trailing & marker.");
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:DefaultComponent.java


示例4: onCamelContextStarted

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
@Override
public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception {
    // new services may be added while starting a service
    // so use a while loop to get the newly added services as well
    while (!services.isEmpty()) {
        Service service = services.iterator().next();
        try {
            ServiceHelper.startService(service);
        } catch (Exception e) {
            if (service instanceof Endpoint) {
                Endpoint endpoint = (Endpoint) service;
                throw new ResolveEndpointFailedException(endpoint.getEndpointUri(), e);
            } else {
                throw e;
            }
        } finally {
            services.remove(service);
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:DeferServiceStartupListener.java


示例5: testInvalidOption

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testInvalidOption() throws Exception {
    try {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                errorHandler(deadLetterChannel("direct:error?foo=bar"));

                from("direct:start").to("mock:foo");
            }
        });

        fail("Should have thrown an exception");
    } catch (ResolveEndpointFailedException e) {
        assertTrue(e.getMessage().endsWith("Unknown parameters=[{foo=bar}]"));
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:DeadLetterChannelBuilderWithInvalidDeadLetterUriTest.java


示例6: testRecipientListWithoutIgnoreInvalidEndpointsOption

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testRecipientListWithoutIgnoreInvalidEndpointsOption() throws Exception {
    MockEndpoint result = getMockEndpoint("mock:result");
    result.expectedMessageCount(0);
    
    MockEndpoint endpointA = getMockEndpoint("mock:endpointA");
    endpointA.expectedMessageCount(0);
    
    try {
        template.requestBody("direct:startB", "Hello World", String.class);
        fail("Expect the exception here.");
    } catch (Exception ex) {
        assertTrue("Get a wrong cause of the exception", ex.getCause() instanceof ResolveEndpointFailedException);                         
    }

    assertMockEndpointsSatisfied();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:RecipientListIgnoreInvalidEndpointsTest.java


示例7: testNoSuchEndpoint

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testNoSuchEndpoint() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:hello").to("mock:result");

                // unknown component
                endpoint("mistyped:hello");
            }
        });
        fail("Should have thrown a ResolveEndpointFailedException");
    } catch (ResolveEndpointFailedException e) {
        // expected
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:RouteWithMistypedComponentNameTest.java


示例8: testNoSuchEndpointType

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testNoSuchEndpointType() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:hello").to("mock:result");

                // unknown component
                endpoint("mistyped:hello", Endpoint.class);
            }
        });
        fail("Should have thrown a ResolveEndpointFailedException");
    } catch (ResolveEndpointFailedException e) {
        // expected
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:RouteWithMistypedComponentNameTest.java


示例9: testEndpointInjectProducerTemplateFieldUrlUnknown

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testEndpointInjectProducerTemplateFieldUrlUnknown() throws Exception {
    CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);

    MyEndpointInjectProducerTemplateUrlUnknown bean = new MyEndpointInjectProducerTemplateUrlUnknown();
    Field field = bean.getClass().getField("producer");

    EndpointInject endpointInject = field.getAnnotation(EndpointInject.class);
    Class<?> type = field.getType();
    String propertyName = "producer";

    try {
        helper.getInjectionValue(type, endpointInject.uri(), endpointInject.ref(), endpointInject.property(), propertyName, bean, "foo");
        fail("Should throw exception");
    } catch (ResolveEndpointFailedException e) {
        assertEquals("Failed to resolve endpoint: xxx://foo due to: No component found with scheme: xxx", e.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:CamelPostProcessorHelperTest.java


示例10: testHasEndpoint

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testHasEndpoint() throws Exception {
    DefaultCamelContext ctx = new DefaultCamelContext();
    ctx.disableJMX();
    ctx.getEndpoint("mock://foo");

    assertNotNull(ctx.hasEndpoint("mock://foo"));
    assertNull(ctx.hasEndpoint("mock://bar"));

    Map<String, Endpoint> map = ctx.getEndpointMap();
    assertEquals(1, map.size());
    
    try {
        ctx.hasEndpoint(null);
        fail("Should have thrown exception");
    } catch (ResolveEndpointFailedException e) {
        // expected
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:DefaultCamelContextTest.java


示例11: testCustomFormatterInRegistryUnknownOption

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
@Test
public void testCustomFormatterInRegistryUnknownOption() throws Exception {
    context.stop();

    exchangeFormatter = new TestExchangeFormatter();
    JndiRegistry registry = getRegistryAsJndi();
    registry.bind("logFormatter", exchangeFormatter);
    assertEquals("", exchangeFormatter.getPrefix());

    context.start();

    // unknown parameter
    try {
        String endpointUri2 = "log:" + LogCustomFormatterTest.class.getCanonicalName() + "?prefix=foo&bar=no";
        template.requestBody(endpointUri2, "Hello World");
        fail("Should have thrown exception");
    } catch (Exception e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        assertTrue(cause.getMessage().endsWith("Unknown parameters=[{bar=no}]"));
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:LogCustomFormatterTest.java


示例12: testPropertiesComponentDefaultNoFileFound

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testPropertiesComponentDefaultNoFileFound() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/unknown.properties");
        }
    });
    try {
        context.start();
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        FileNotFoundException fnfe = assertIsInstanceOf(FileNotFoundException.class, cause.getCause());
        assertEquals("Properties file org/apache/camel/component/properties/unknown.properties not found in classpath", fnfe.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:PropertiesComponentDefaultTest.java


示例13: testPropertiesComponentInvalidKey

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testPropertiesComponentInvalidKey() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("properties:{{foo.unknown}}");
        }
    });
    try {
        context.start();
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
        assertEquals("Property with key [foo.unknown] not found in properties from text: {{foo.unknown}}", iae.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:PropertiesComponentTest.java


示例14: testPropertiesComponentCircularReference

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testPropertiesComponentCircularReference() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("properties:cool.a");
        }
    });
    try {
        context.start();
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
        assertEquals("Circular reference detected with key [cool.a] from text: {{cool.a}}", iae.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:PropertiesComponentTest.java


示例15: testPropertiesComponentPropertyPrefixFallbackDefaultNotFound

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testPropertiesComponentPropertyPrefixFallbackDefaultNotFound() throws Exception {
    PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
    pc.setPropertyPrefix("cool.");
    
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("properties:doesnotexist");
        }
    });
    
    try {
        context.start();
        
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
        assertEquals("Property with key [cool.doesnotexist] (and original key [doesnotexist]) not found in properties from text: {{doesnotexist}}", iae.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:PropertiesComponentTest.java


示例16: testPropertiesComponentPropertyPrefixFallbackFalse

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testPropertiesComponentPropertyPrefixFallbackFalse() throws Exception {
    PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
    pc.setPropertyPrefix("cool.");
    pc.setFallbackToUnaugmentedProperty(false);
    
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("properties:cool.end");
            from("direct:foo").to("properties:mock:{{result}}");
        }
    });
    
    try {
        context.start();
        
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
        assertEquals("Property with key [cool.cool.end] not found in properties from text: {{cool.end}}", iae.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:PropertiesComponentTest.java


示例17: testPropertiesComponentPropertySuffixFallbackFalse

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testPropertiesComponentPropertySuffixFallbackFalse() throws Exception {
    PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
    pc.setPropertySuffix(".end");
    pc.setFallbackToUnaugmentedProperty(false);
    
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("properties:cool.end");
        }
    });
    
    try {
        context.start();
        
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
        assertEquals("Property with key [cool.end.end] not found in properties from text: {{cool.end}}", iae.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:PropertiesComponentTest.java


示例18: testClassNotFound

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testClassNotFound() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .to("class:org.apache.camel.component.bean.XXX")
                .to("mock:result");
        }
    });
    try {
        context.start();
        fail("Should have thrown exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        ClassNotFoundException not = assertIsInstanceOf(ClassNotFoundException.class, cause.getCause());
        assertEquals("org.apache.camel.component.bean.XXX", not.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:ClassComponentInvalidConfigurationTest.java


示例19: testPropertyNotFoundOnClass

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
public void testPropertyNotFoundOnClass() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .to("class:org.apache.camel.component.bean.MyPrefixBean?bean.foo=bar")
                .to("mock:result");
        }
    });
    try {
        context.start();
        fail("Should have thrown exception");
    } catch (FailedToCreateRouteException e) {
        ResolveEndpointFailedException cause = assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
        assertTrue(cause.getMessage().contains("Unknown parameters"));
        assertTrue(cause.getMessage().contains("foo=bar"));
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:ClassComponentInvalidConfigurationTest.java


示例20: testHttpEndpointHttpUri

import org.apache.camel.ResolveEndpointFailedException; //导入依赖的package包/类
@Test
public void testHttpEndpointHttpUri() throws Exception {
    HttpEndpoint http1 = context.getEndpoint("http4://www.google.com", HttpEndpoint.class);
    HttpEndpoint http2 = context.getEndpoint("https4://www.google.com?test=parameter&proxyAuthHost=myotherproxy&proxyAuthPort=2345", HttpEndpoint.class);
    HttpEndpoint http3 = context.getEndpoint("https4://www.google.com?test=parameter", HttpEndpoint.class);
    
    assertEquals("Get a wrong HttpUri of http1", "http://www.google.com", http1.getHttpUri().toString());
    assertEquals("Get a wrong HttpUri of http2", "https://www.google.com?test=parameter", http2.getHttpUri().toString());
    assertEquals("Get a wrong HttpUri of http2 andhttp3", http2.getHttpUri(), http3.getHttpUri());
    
    try {
        // need to catch the exception here
        context.getEndpoint("https4://http://www.google.com", HttpEndpoint.class);
        fail("need to throw an exception here");
    } catch (ResolveEndpointFailedException ex) {
        assertTrue("Get a wrong exception message", ex.getMessage().indexOf("You have duplicated the http(s) protocol") > 0);
    }
     
    
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:HttpEndpointURLTest.java



注:本文中的org.apache.camel.ResolveEndpointFailedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PrologCodeWriter类代码示例发布时间:2022-05-23
下一篇:
Java Item类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap