@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; }
@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; }
@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; }
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; }
@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()); }
@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; }
@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; }
@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; }
@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); } }; }
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; }
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"); } }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); registry.bind("my-bean", new ComponentProxyComponentTest.MyBean()); return registry; }
/** * 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(); }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); URIResolver customURIResolver = getCustomURIResolver(); registry.bind("customURIResolver", customURIResolver); return registry; }
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; }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); registry.bind("amazonSQSClient", new AmazonSQSClientMock()); return registry; }
@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; }
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; }
@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; }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); registry.bind("cpf", new TestClientChannelPipelineFactory(null)); registry.bind("spf", new TestServerChannelPipelineFactory(null)); return registry; }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); client = new AmazonS3ClientMock(); registry.bind("amazonS3Client", client); return registry; }
@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; }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry jndi = super.createRegistry(); repository.setFileStore(new File("target/repo.txt")); jndi.bind("repo", repository); return jndi; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry jndi = super.createRegistry(); ExecutorService someone = Executors.newCachedThreadPool(); jndi.bind("someonesPool", someone); return jndi; }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); registry.bind("amazonS3Client", new DummyAmazonS3Client()); return registry; }
@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; }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry jndi = super.createRegistry(); jndi.bind("cool", cool); jndi.bind("agg", new UseLatestAggregationStrategy()); return jndi; }
@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; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); AmazonS3ClientMock clientMock = new AmazonS3ClientMock(); registry.bind("amazonS3Client", clientMock); return registry; }
@Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); amazonSWClient = mock(AmazonSimpleWorkflowClient.class); registry.bind("amazonSWClient", amazonSWClient); return registry; }