Exemple #1
0
 static {
   SimpleRegistry registry = new SimpleRegistry();
   registry.put("customBinding", new GTaskBinding() {}); // subclass
   context = new DefaultCamelContext(registry);
   component = new GTaskComponent();
   component.setCamelContext(context);
 }
  public void testLoadRegistry() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("myBean", "This is a log4j logging configuation file");

    CamelContext context = new DefaultCamelContext(registry);
    context.start();

    InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context, "ref:myBean");
    assertNotNull(is);

    String text = context.getTypeConverter().convertTo(String.class, is);
    assertNotNull(text);
    assertTrue(text.contains("log4j"));
    is.close();

    context.stop();
  }
  @Override
  protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("aggStrategy", AggregationStrategies.groupedExchange());

    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
    connectionFactory.setBrokerURL(broker.getTcpConnectorUri());

    SjmsComponent sjmsComponent = new SjmsComponent();
    sjmsComponent.setConnectionFactory(connectionFactory);

    SjmsBatchComponent sjmsBatchComponent = new SjmsBatchComponent();
    sjmsBatchComponent.setConnectionFactory(connectionFactory);

    CamelContext context = new DefaultCamelContext(registry);
    context.addComponent("sjms-batch", sjmsBatchComponent);
    context.addComponent("sjms", sjmsComponent);

    return context;
  }
 @Override
 protected void doBindings(SimpleRegistry registry) {
   registry.put("transactionManager", new JmsTransactionManager(getConnectionFactory()));
 }
 @Before
 public void setup() throws Exception {
   SimpleRegistry registry = new SimpleRegistry();
   registry.put("kinesisClient", amazonKinesisClient);
   camelContext = new DefaultCamelContext(registry);
 }