@Override
  protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    context.addEndpoint(
        "fail",
        new DefaultEndpoint() {
          public Producer createProducer() throws Exception {
            return new DefaultProducer(this) {
              public void process(Exchange exchange) throws Exception {
                exchange.setException(new IllegalArgumentException("Damn"));
              }
            };
          }

          public Consumer createConsumer(Processor processor) throws Exception {
            return null;
          }

          @Override
          protected String createEndpointUri() {
            return "fail";
          }

          public boolean isSingleton() {
            return true;
          }
        });

    context.addEndpoint(
        "not-fail",
        new DefaultEndpoint() {
          public Producer createProducer() throws Exception {
            return new DefaultProducer(this) {
              public void process(Exchange exchange) throws Exception {
                // noop
              }
            };
          }

          public Consumer createConsumer(Processor processor) throws Exception {
            return null;
          }

          @Override
          protected String createEndpointUri() {
            return "not-fail";
          }

          public boolean isSingleton() {
            return true;
          }
        });

    return context;
  }
  public void testMultipleLifecycleStrategies() throws Exception {
    CamelContext context = createCamelContext();
    context.start();

    Component log = new LogComponent();
    context.addComponent("log", log);
    context.addEndpoint("log:/foo", log.createEndpoint("log://foo"));
    context.removeComponent("log");
    context.stop();

    List<String> expectedEvents =
        Arrays.asList(
            "onContextStart",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onServiceAdd",
            "onComponentAdd",
            "onEndpointAdd",
            "onComponentRemove",
            "onContextStop");

    assertEquals(expectedEvents, dummy1.getEvents());
    assertEquals(expectedEvents, dummy2.getEvents());
  }