public void bootFrontend() {
    JettyServerDeployer webServer = builder.createDeployer(JettyServerDeployer.class);

    webServer.bindPort(8380);
    webServer.setName("WebServer");

    Realm realm = new Realm("testRealm");
    realm.config("teste", "pass", "admin", "user");
    webServer.addRealm(realm);

    ContextWebServer webContext = webServer.createContextWebServer();
    webContext.setContext("/test");
    webContext.setResources("src/main/webapp/");
    webContext.getListeners().add(ConfigureListener.class);
    webContext.getFilters().add(new FilterDesc(LogFilter.class, "/*"));
    webContext.getServlets().add(new ServletDesc(WebTestServlet.class, "/test.txt"));
    webContext.getFilters().add(new FilterDesc(WebTestFilter.class, "/*"));

    webContext = webServer.createContextWebServer();
    webContext.setContext("/test-other");
    webContext.setResources("src/main/webapp/");
    webContext.getListeners().add(ConfigureListener.class);
    webContext.getFilters().add(new FilterDesc(LogFilter.class, "/*"));
    webContext.getServlets().add(new ServletDesc(WebTestServlet.class, "/test.txt"));
    webContext.getFilters().add(new FilterDesc(WebTestFilter.class, "/*"));

    webServer.deploy();
  }
  public void bootBackend() throws Exception {
    builder = new ContainerBuilder();

    SessionInterceptorDeployer sessionInterceptorDeployer =
        builder.createDeployer(SessionInterceptorDeployer.class);
    sessionInterceptorDeployer.deploy();

    builder
        .createDeployer(MyTransactionManagerDeployer.class)
        .setName("TransactionManager")
        .deploy();

    DataSourceDeployer ds = builder.createDeployer(DataSourceDeployer.class);
    ds.setName("TestDS");
    ds.setDriver("org.hsqldb.jdbcDriver");
    ds.setUrl("jdbc:hsqldb:mem:.");
    ds.setUser("sa");
    ds.deploy();

    JPADeployer jpa = builder.createDeployer(HibernateJPADeployer.class);
    JPAInfoBuilder info = (JPAInfoBuilder) jpa.getInfo();
    info.setPersistenceUnitName("test-pu");
    info.setJtaDataSourceName("TestDS");
    info.addJarFileUrl(CustomerBean.class);
    info.setPersistenceUnitRootUrl(CustomerBean.class);
    Properties props = info.getProperties();
    props.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
    props.setProperty("hibernate.hbm2ddl.auto", "create-drop");
    props.setProperty("hibernate.show_sql", "true");
    jpa.deploy();

    ScannerDeployer scanner = builder.createDeployer(ScannerDeployer.class);
    scanner.add(new StatelessScannableDeployer());
    scanner.scan(EntityManagerWrapperBean.class);
    scanner.deploy();

    ctx = builder.getContext();
    tm = (TransactionManager) ctx.lookup("TransactionManager");
  }