Java 类org.apache.camel.impl.JndiRegistry 实例源码

项目:Camel    文件:FileToFtpsExplicitSSLWithoutClientAuthAndSSLContextParametersTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    ksp.setPassword("password");

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setSecureSocketProtocol("SSL");
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
项目:Camel    文件:SqlTransactedRouteTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry reg = super.createRegistry();

    db = new EmbeddedDatabaseBuilder()
        .setType(EmbeddedDatabaseType.DERBY).build();
    reg.bind("testdb", db);

    DataSourceTransactionManager txMgr = new DataSourceTransactionManager();
    txMgr.setDataSource(db);
    reg.bind("txManager", txMgr);

    SpringTransactionPolicy txPolicy = new SpringTransactionPolicy();
    txPolicy.setTransactionManager(txMgr);
    txPolicy.setPropagationBehaviorName("PROPAGATION_REQUIRED");
    reg.bind("required", txPolicy);

    return reg;
}
项目:Camel    文件:FileToFtpsExplicitSSLWithClientAuthAndSSLContextParametersTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    ksp.setPassword("password");

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword("password");
    kmp.setKeyStore(ksp);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setSecureSocketProtocol("SSL");
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
项目:Camel    文件:HL7MLLPNettyCodecStandAndEndBytesTest.java   
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
    decoder.setCharset("iso-8859-1");
    // to test with different start and end bytes.
    decoder.setStartByte('*');
    decoder.setEndByte1('#');
    decoder.setEndByte2('*');
    decoder.setConvertLFtoCR(false);

    jndi.bind("hl7decoder", decoder);

    HL7MLLPNettyEncoderFactory encoder = new HL7MLLPNettyEncoderFactory();
    encoder.setCharset("iso-8859-1");
    // to test with different start and end bytes.
    encoder.setStartByte('*');
    encoder.setEndByte1('#');
    encoder.setEndByte2('*');
    encoder.setConvertLFtoCR(false);

    jndi.bind("hl7encoder", encoder);

    return jndi;
}
项目:Camel    文件:LogCustomFormatterTest.java   
@Test
public void testFormatterNotPickedUpWithDifferentKey() throws Exception {
    context.stop();

    exchangeFormatter = new TestExchangeFormatter();
    JndiRegistry registry = getRegistryAsJndi();
    registry.bind("anotherFormatter", exchangeFormatter);

    context.start();

    String endpointUri = "log:" + LogCustomFormatterTest.class.getCanonicalName();
    template.requestBody(endpointUri, "Hello World");
    template.requestBody(endpointUri, "Hello World");
    template.requestBody(endpointUri + "2", "Hello World");
    template.requestBody(endpointUri + "2", "Hello World");

    assertEquals(0, exchangeFormatter.getCounter());
}
项目:Camel    文件:NettyHttpGetWithInvalidMessageTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    // setup the String encoder and decoder 

    StringDecoder stringDecoder = new StringDecoder();
    registry.bind("string-decoder", stringDecoder);

    StringEncoder stringEncoder = new StringEncoder();
    registry.bind("string-encoder", stringEncoder);

    List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
    decoders.add(stringDecoder);

    List<ChannelHandler> encoders = new ArrayList<ChannelHandler>();
    encoders.add(stringEncoder);

    registry.bind("encoders", encoders);
    registry.bind("decoders", decoders);

    return registry;
}
项目:Camel    文件:NettyHttpBasicAuthConstraintMapperTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    NettyHttpSecurityConfiguration security = new NettyHttpSecurityConfiguration();
    security.setRealm("karaf");
    SecurityAuthenticator auth = new JAASSecurityAuthenticator();
    auth.setName("karaf");
    security.setSecurityAuthenticator(auth);

    SecurityConstraintMapping matcher = new SecurityConstraintMapping();
    matcher.addInclusion("/*");
    matcher.addExclusion("/public/*");
    security.setSecurityConstraint(matcher);

    jndi.bind("mySecurityConfig", security);

    return jndi;
}
项目:Camel    文件:NettyHttpTwoRoutesBootstrapConfigurationTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    // create NettyServerBootstrapConfiguration instance where we can configure the bootstrap
    // option we want to use in our Camel routes. This allows us to configure this once,
    // and also explicit
    bootstrapConfiguration = new NettyServerBootstrapConfiguration();
    bootstrapConfiguration.setBacklog(200);
    bootstrapConfiguration.setConnectTimeout(5000);
    bootstrapConfiguration.setKeepAlive(true);
    bootstrapConfiguration.setWorkerCount(4);

    // register the configuration in the registry with this key
    jndi.bind("myBootstrapOptions", bootstrapConfiguration);
    return jndi;
}
项目:Camel    文件:NettyRfc5425LongMessageTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());

    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            context.setTracing(true);
            DataFormat syslogDataFormat = new SyslogDataFormat();

            // we setup a Syslog listener on a random port.
            from(uri).unmarshal(syslogDataFormat).process(new Processor() {
                @Override
                public void process(Exchange ex) {
                    assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
                }
            }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
            // Here we need to turn the request body into channelbuffer
            from("direct:start").convertBodyTo(ChannelBuffer.class).to(uri);
        }
    };
}
项目:Camel    文件:HL7MLLPNettyCodecTest.java   
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    // START SNIPPET: e1
    HL7MLLPNettyDecoderFactory decoder = new HL7MLLPNettyDecoderFactory();
    decoder.setCharset("iso-8859-1");
    decoder.setConvertLFtoCR(true);
    jndi.bind("hl7decoder", decoder);

    HL7MLLPNettyEncoderFactory encoder = new HL7MLLPNettyEncoderFactory();
    decoder.setCharset("iso-8859-1");
    decoder.setConvertLFtoCR(true);
    jndi.bind("hl7encoder", encoder);
    // END SNIPPET: e1

    return jndi;
}
项目:drinkwater-java    文件:CamelContextFactory.java   
public static void registerBean(Registry registry, String beanName, Object bean) {
    if (registry instanceof SimpleRegistry) {
        ((SimpleRegistry) registry).put(beanName, bean);
    } else if (registry instanceof PropertyPlaceholderDelegateRegistry) {
        Registry wrappedRegistry = ((PropertyPlaceholderDelegateRegistry) registry).getRegistry();
        registerBean(wrappedRegistry, beanName, bean);
    } else if (registry instanceof JndiRegistry) {
        ((JndiRegistry) registry).bind(beanName, bean);
    } else {
        throw new RuntimeException("could not identify the registry type while registering core beans");
    }

}
项目:syndesis    文件:ComponentProxyComponentTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    Map<String, Object> properties = new HashMap<>();
    properties.put("beanName", "my-bean");

    ComponentProxyComponent component = new ComponentProxyComponent("my-bean-proxy", "bean");
    component.setOptions(properties);

    JndiRegistry registry = super.createRegistry();
    registry.bind("my-bean", new MyBean());
    registry.bind(component.getComponentId() + "-component", component);

    return registry;
}
项目:syndesis    文件:ComponentProxyRuntimeTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("my-bean", new ComponentProxyComponentTest.MyBean());

    return registry;
}
项目:syndesis    文件:ComponentProxyRuntimeCustomizerTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("my-bean", new ComponentProxyComponentTest.MyBean());

    return registry;
}
项目:syndesis    文件:ComponentProxyRuntimePlaceholdersTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("my-bean", new ComponentProxyComponentTest.MyBean());

    return registry;
}
项目:bitbreeds-webrtc    文件:SimpleSignalingExample.java   
/**
 * Application entry point
 * @param args application arguments
 * @throws Exception
 */
public static void main(String... args) throws Exception {
    JndiRegistry reg = new JndiRegistry(new JndiContext());

    reg.bind("sslContextParameters",sslParameters());

    CamelContext ctx = new DefaultCamelContext(reg);
    ctx.addRoutes(new WebsocketRouteNoSSL());
    ctx.setUseMDCLogging(true);
    ctx.setTracing(true);
    ctx.start();
}
项目:bitbreeds-webrtc    文件:SimpleSignalingExample.java   
/**
 * Application entry point
 * @param args application arguments
 * @throws Exception
 */
public static void main(String... args) throws Exception {

    JndiRegistry reg = new JndiRegistry(new JndiContext());

    reg.bind("sslContextParameters",sslParameters());

    CamelContext ctx = new DefaultCamelContext(reg);
    ctx.addRoutes(new WebsocketRouteNoSSL());
    ctx.setUseMDCLogging(true);
    ctx.setTracing(true);
    ctx.start();
}
项目:Camel    文件:XsltCustomizeURIResolverTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    URIResolver customURIResolver = getCustomURIResolver();
    registry.bind("customURIResolver", customURIResolver);
    return registry;
}
项目:Camel    文件:HL7MLLPCodecStandAndEndBytesTest.java   
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    HL7MLLPCodec codec = new HL7MLLPCodec();
    codec.setCharset("iso-8859-1");
    // to test with different start and end bytes.
    codec.setStartByte('*');
    codec.setEndByte1('#');
    codec.setEndByte2('*');
    codec.setConvertLFtoCR(false);

    jndi.bind("hl7codec", codec);

    return jndi;
}
项目:Camel    文件:UnsharableCodecsConflicts2Test.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    // create a single decoder
    ChannelHandlerFactory decoder = ChannelHandlerFactories.newLengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4);
    registry.bind("length-decoder", decoder);

    return registry;
}
项目:Camel    文件:SqsComponentTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("amazonSQSClient", new AmazonSQSClientMock());

    return registry;
}
项目:Camel    文件:SqlDataSourceTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    // this is the database we create with some initial data for our unit test
    db = new EmbeddedDatabaseBuilder()
        .setType(EmbeddedDatabaseType.DERBY).addScript("sql/createAndPopulateDatabase.sql").build();

    jndi.bind("dataSource", db);

    return jndi;
}
项目:Camel    文件:CafeRouteBuilder.java   
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = new JndiRegistry();
    jndi.bind("drinkRouter", new DrinkRouter());
    jndi.bind("orderSplitter", new OrderSplitter());
    jndi.bind("barista", new Barista());
    jndi.bind("waiter", new Waiter());
    jndi.bind("aggregatorStrategy", new CafeAggregationStrategy());
    return jndi;
}
项目:Camel    文件:CafeRouteBuilderTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("drinkRouter", driverRouter);
    jndi.bind("orderSplitter", new OrderSplitter());
    jndi.bind("barista", new Barista());
    jndi.bind("waiter", waiter);
    jndi.bind("aggregatorStrategy", new CafeAggregationStrategy());
    return jndi;
}
项目:Camel    文件:MailSortTermTwoTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("sortAscendingDate", new SortTerm[]{SortTerm.DATE});
    jndi.bind("sortDescendingDate", new SortTerm[]{SortTerm.REVERSE, SortTerm.DATE});
    jndi.bind("searchTerm", new SearchTermBuilder().subject("Camel").build());
    return jndi;
}
项目:Camel    文件:NettyCustomPipelineFactoryAsynchTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("cpf", new TestClientChannelPipelineFactory(null));
    registry.bind("spf", new TestServerChannelPipelineFactory(null));
    return registry;
}
项目:Camel    文件:HttpsTwoDifferentSslContextParametersGetTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("x509HostnameVerifier", new AllowAllHostnameVerifier());
    registry.bind("sslContextParameters", new SSLContextParameters());
    registry.bind("sslContextParameters2", new SSLContextParameters());

    return registry;
}
项目:Camel    文件:S3ComponentExistingBucketTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    client = new AmazonS3ClientMock();
    registry.bind("amazonS3Client", client);

    return registry;
}
项目:Camel    文件:SftpSimpleProduceThroughProxyTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    final ProxyHTTP proxyHTTP = new ProxyHTTP("localhost", proxyPort);
    proxyHTTP.setUserPasswd("user", "password");
    jndi.bind("proxy", proxyHTTP);
    return jndi;
}
项目:Camel    文件:JaxbMarshalNamespacePrefixMapperTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    Map<String, String> map = new HashMap<String, String>();
    map.put("http://www.camel.apache.org/jaxb/example/order/1", "o");
    map.put("http://www.camel.apache.org/jaxb/example/address/1", "a");

    JndiRegistry jndi = super.createRegistry();
    jndi.bind("myPrefix", map);
    return jndi;
}
项目:Camel    文件:SedaFileIdempotentIssueTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    repository.setFileStore(new File("target/repo.txt"));
    jndi.bind("repo", repository);
    return jndi;
}
项目:Camel    文件:ThreadPoolBuilderTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    ExecutorService someone = Executors.newCachedThreadPool();
    jndi.bind("someonesPool", someone);
    return jndi;
}
项目:Camel    文件:NettyCustomCodecTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("myCustomDecoder", MyCustomCodec.createMyCustomDecoder());
    jndi.bind("myCustomDecoder2", MyCustomCodec.createMyCustomDecoder2());
    jndi.bind("myCustomEncoder", MyCustomCodec.createMyCustomEncoder());
    return jndi;
}
项目:Camel    文件:S3IncludeBodyTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    registry.bind("amazonS3Client", new DummyAmazonS3Client());

    return registry;
}
项目:Camel    文件:AntPathMatcherGenericFileFilterTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    AntPathMatcherGenericFileFilter<File> filterNotCaseSensitive = new AntPathMatcherGenericFileFilter<File>("**/c*");
    filterNotCaseSensitive.setCaseSensitive(false);

    JndiRegistry jndi = super.createRegistry();
    jndi.bind("filter", new AntPathMatcherGenericFileFilter<File>("**/c*"));
    jndi.bind("caseInsensitiveFilter", filterNotCaseSensitive);
    return jndi;
}
项目:Camel    文件:BaseCacheTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    // use a file cache manager factory to load out test configuration
    cache = new CacheComponent();
    cache.setCacheManagerFactory(new FileCacheManagerFactory("src/test/resources/test-ehcache.xml"));
    jndi.bind("cache", cache);

    return jndi;
}
项目:Camel    文件:EnricherRefTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("cool", cool);
    jndi.bind("agg", new UseLatestAggregationStrategy());
    return jndi;
}
项目:Camel    文件:NettySingleCodecTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    StringEncoder stringEncoder = new StringEncoder();

    StringDecoder stringDecoder = new StringDecoder();

    registry.bind("encoder", stringEncoder);
    registry.bind("decoder", stringDecoder);
    return registry;
}
项目:Camel    文件:S3ConsumerCronTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    AmazonS3ClientMock clientMock = new AmazonS3ClientMock();        
    registry.bind("amazonS3Client", clientMock);

    return registry;
}
项目:Camel    文件:CamelSWFTestSupport.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    amazonSWClient = mock(AmazonSimpleWorkflowClient.class);
    registry.bind("amazonSWClient", amazonSWClient);
    return registry;
}