protected XmlModel assertRoutes(File file, int expected, String ns) throws Exception {
    if (ns == null || ns.trim().length() == 0) {
      ns = CamelNamespaces.springNS;
    }
    XmlModel x = assertLoadModel(file, expected);

    // now lets add a route and write it back again...
    DefaultCamelContext tmpContext = new DefaultCamelContext();
    tmpContext.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            from("seda:newFrom").to("seda:newTo");
          }
        });
    x.getContextElement().getRoutes().addAll(tmpContext.getRouteDefinitions());

    List<RouteDefinition> routes = x.getRouteDefinitionList();
    assertEquals("routes: " + routes, expected + 1, routes.size());

    // now lets write to XML      model
    outDir.mkdirs();
    File outFile = new File(outDir, file.getName());
    System.out.println("Generating file: " + outFile);
    tool.marshal(outFile, x);

    assertFileExists(outFile);

    // lets check the file has the correct namespace inside it
    String text = FileCopyUtils.copyToString(new FileReader(outFile));
    assertTrue("Namespace " + ns + " not present in output file\n" + text, text.contains(ns));

    return x;
  }
  @Override
  protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    // lets create our black box as a camel context and a set of routes
    DefaultCamelContext blackBox = new DefaultCamelContext(registry);
    blackBox.setName("blackBox");
    blackBox.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            // receive purchase orders, lets process it in some way then
            // send an invoice to our invoice endpoint
            from("direct:purchaseOrder")
                .setHeader("received")
                .constant("true")
                .to("direct:invoice");
          }
        });
    blackBox.start();

    registry.bind("accounts", blackBox);
    return registry;
  }
 public void start() throws Exception {
   DefaultCamelContext context = new DefaultCamelContext();
   context.addRoutes(getRoute());
   addBeans(context);
   context.start();
 }