コード例 #1
0
  public void testConsumerSingletonism() throws Exception {
    // given
    Endpoint endpoint = context.getEndpoint("smslib://asdf");
    Processor mockProcessor = mock(Processor.class);
    endpoint.createConsumer(mockProcessor);
    Processor anotherMockProcessor = mock(Processor.class);

    // when then
    try {
      endpoint.createConsumer(anotherMockProcessor);
      fail("Should only be able to create a single consumer.");
    } catch (Exception e) {
      // expected
    }
  }
コード例 #2
0
ファイル: CMISConsumerTest.java プロジェクト: JSantosP/camel
 private Consumer createConsumerFor(String path) throws Exception {
   Endpoint endpoint = context.getEndpoint("cmis://" + path);
   return endpoint.createConsumer(
       new Processor() {
         public void process(Exchange exchange) throws Exception {
           template.send("mock:result", exchange);
         }
       });
 }
コード例 #3
0
 /**
  * Factory method to lazily create the complete list of services required for this route such as
  * adding the processor or consumer
  */
 @Override
 protected void addServices(List<Service> services) throws Exception {
   Endpoint endpoint = getEndpoint();
   consumer = endpoint.createConsumer(processor);
   if (consumer != null) {
     services.add(consumer);
     if (consumer instanceof RouteAware) {
       ((RouteAware) consumer).setRoute(this);
     }
   }
   Processor processor = getProcessor();
   if (processor instanceof Service) {
     services.add((Service) processor);
   }
 }