org.apache.camel.MultipleConsumersSupport的实例源码

项目:Camel    文件DefaultCamelContext.java   
private boolean doCheckMultipleConsumerSupportClash(Endpoint endpoint,List<Endpoint> routeInputs) {
    // is multiple consumers supported
    boolean multipleConsumeRSSupported = false;
    if (endpoint instanceof MultipleConsumeRSSupport) {
        multipleConsumeRSSupported = ((MultipleConsumeRSSupport) endpoint).isMultipleConsumeRSSupported();
    }

    if (multipleConsumeRSSupported) {
        // multiple consumer allowed,so return true
        return true;
    }

    // check in progress list
    if (routeInputs.contains(endpoint)) {
        return false;
    }

    return true;
}
项目:Camel    文件QuickfixjComponentTest.java   
@Test
public void createEndpointBeforeComponentStart() throws Exception {
    setUpComponent();

    settings.setString(sessionID,SessionFactory.SETTING_CONNECTION_TYPE,SessionFactory.INITIATOR_CONNECTION_TYPE);
    settings.setLong(sessionID,Initiator.SETTING_SOCKET_CONNECT_PORT,1234);

    writeSettings(settings,true);

    // Should use cached QFJ engine
    Endpoint e1 = component.createEndpoint(getEndpointUri(settingsFile.getName(),null));
    assertthat(component.getProvisionalEngines().size(),is(1));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()),is(notNullValue()));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()).isInitialized(),is(true));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()).isstarted(),is(false));
    assertthat(component.getEngines().size(),is(0));
    assertthat(((QuickfixjEndpoint)e1).getSessionID(),is(nullValue()));

    writeSettings(settings,false);

    // Should use cached QFJ engine
    Endpoint e2 = component.createEndpoint(getEndpointUri(settingsFile2.getName(),is(2));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()),is(0));
    assertthat(((QuickfixjEndpoint)e2).getSessionID(),is(nullValue()));

    // will start the component
    camelContext.start();

    assertthat(component.getProvisionalEngines().size(),is(0));
    assertthat(component.getEngines().size(),is(2));
    assertthat(component.getEngines().get(settingsFile.getName()).isInitialized(),is(true));
    assertthat(component.getEngines().get(settingsFile.getName()).isstarted(),is(true));

    // Move these too an endpoint testcase if one exists
    assertthat(e1.isSingleton(),is(true));
    assertthat(((MultipleConsumeRSSupport)e1).isMultipleConsumeRSSupported(),is(true));
    assertthat(e2.isSingleton(),is(true));
    assertthat(((MultipleConsumeRSSupport)e2).isMultipleConsumeRSSupported(),is(true));
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...