You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/12/06 08:52:52 UTC

[07/44] tomee git commit: TOMEE-2316 Convert Markdown files to Asciidoc in the docs folder - 5

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/embedded-and-remotable.md
----------------------------------------------------------------------
diff --git a/docs/embedded-and-remotable.md b/docs/embedded-and-remotable.md
deleted file mode 100644
index 23158c8..0000000
--- a/docs/embedded-and-remotable.md
+++ /dev/null
@@ -1,181 +0,0 @@
-index-group=Unrevised
-type=page
-status=published
-title=Embedded and Remotable
-~~~~~~
-<a name="EmbeddedandRemotable-Overview"></a>
-# Overview
-
-This example shows how to use OpenEJB3's remoting capabilities in an
-embedded scenario.  By remoting we mean that you wish to allow *clients in
-other vms* access your ejbs.  _Note, you do not need to go to this extreme
-to unit test ejbs with remote interfaces._
-
-The basic recipe is the same for a standard embedded scenario but with
-these added ingreditents:
-
-  * *openejb.embedded.remotable* property
-  * *openejb-ejbd* jar
-
-While creating the InitialContext, pass in the openejb.embedded.remotable
-property with the value of "true".  When this is seen by the
-LocalInitialContextFactory, it will boot up the Server ServiceManager in
-the VM which will in turn look for ServerServices in the classpath.
-
-Provided you have the openejb-ejbd jar in your classpath along with it's
-dependencies (openejb-server, openejb-client, openejb-core), then those
-services will be brought online and remote clients will be able to connect
-into your vm and invoke beans.
-
-If you want to add more ServerServices such as the http version of the ejbd
-protocol you'd simply add the openejb-httpejbd jar to your classpath.  A
-number of ServerServices are available currently:
-
-  * openejb-ejbd
-  * openejb-http
-  * openejb-telnet
-  * openejb-derbynet
-  * openejb-hsql
-  * openejb-activemq
-
-_The source for this example is in the "telephone-stateful" directory
-located in the [openejb-examples.zip](openejb:download.html)
- available on the [download page](http://tomee.apache.org/downloads.html)._
-
-{note}
-If your goal is simply to unit test beans with remote interfaces, this is
-*not* the right example for you.  The LocalInitialContextFactory completely
-supports remote interfaces and all spec required pass-by-value
-(serialization) semantics without the need for network sockets.  This
-example shows the use of OpenEJB in an embedded environment where
-connection *outside* the 
-vm is required.{note}
-
-<a name="EmbeddedandRemotable-TheCode"></a>
-# The Code
-
-For this example we have a simple Stateful bean called TelephoneBean as
-defined below.	As a simple way of demonstrating the state we have to
-methods: speak and listen.  You call _speak_ and pass in some text, then
-you call _listen_ to get your answer.
-
-<a name="EmbeddedandRemotable-bean"></a>
-## bean
-
-{snippet:id=code|url=openejb3/examples/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java|lang=java}
-
-<a name="EmbeddedandRemotable-businessinterface"></a>
-## business interface
-
-{snippet:id=code|url=openejb3/examples/telephone-stateful/src/main/java/org/superbiz/telephone/Telephone.java|lang=java}
-
-{tip:title=EJB3 Notes}
-The bean class uses the annotation *@Remote* but does not specify a list of
-interfaces as is normally required.  Per EJB3 rules, if the bean implements
-exactly *one business interface* it may use @Remote with no other values
-and that business interface is then implied to be a remote business
-interface.  The same rule applies to identical usage of @Local.
-
-The critical thing to know is that if you add another interface the rules
-change and require that you specify both interfaces in the @Remote
-annotation as in @Remote(\{Telephone.class, SecondInterface.class\}).
-{tip}
-
-<a name="EmbeddedandRemotable-Embedding"></a>
-# Embedding
-
-We're going to embed OpenEJB3 into a plain JUnit TestCase as a simple means
-of demonstrating the remote capabilities.  We'll do the embedding in our
-test setUp method, then will make two test methods: 
- - one for invoking the bean's remote interface via the
-*LocalInitialContextFactory* which goes straight against the embedded
-container system
- - one for invoking the bean's remote interface via the
-*RemoteInitialContextFactory* which connects to a Socket and communicates
-to the embedded container system over the ejbd protocol.
-
-<a name="EmbeddedandRemotable-setUp"></a>
-## setUp
-
-{snippet:id=setup|url=openejb3/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java|lang=java}
-
-## LocalInitialContextFactory: making in-vm calls to a remote business
-interface
-
-{snippet:id=localcontext|url=openejb3/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java|lang=java}
-
-## RemoteInitialContextFactory: making networked calls to a remote
-business interface
-
-This is the part you would want to do in apps that are running a different
-VM than the one in which the ejb container is embedded.  These "client" VMs
-need only have the the *openejb-client jar* in their classpath and connect
-to OpenEJB via the RemoteInitialContextFactory like any other remote EJB
-client.
-
-{snippet:id=remotecontext|url=openejb3/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java|lang=java}
-
-<a name="EmbeddedandRemotable-Mavensetup"></a>
-#  Maven setup
-
-{snippet:id=desc|url=openejb3/examples/telephone-stateful/pom.xml}
-
-{snippet:id=openejbdep|url=openejb3/examples/telephone-stateful/pom.xml|lang=xml}
-
-
-<a name="EmbeddedandRemotable-Running"></a>
-#  Running
-
-Running the example is fairly simple.  In the "telephone-stateful"
-directory of the [examples zip](openejb:download.html)
-, just run:
-
-$ mvn clean install
-
-Which should create output like the following.
-
-
-    -------------------------------------------------------
-     T E S T S
-    -------------------------------------------------------
-    Running org.superbiz.telephone.TelephoneTest
-    Apache OpenEJB 3.0    build: 20080408-04:13
-    http://tomee.apache.org/
-    INFO - openejb.home =
-/Users/dblevins/work/openejb-3.0/examples/telephone-stateful
-    INFO - openejb.base =
-/Users/dblevins/work/openejb-3.0/examples/telephone-stateful
-    INFO - Configuring Service(id=Default Security Service,
-type=SecurityService, provider-id=Default Security Service)
-    INFO - Configuring Service(id=Default Transaction Manager,
-type=TransactionManager, provider-id=Default Transaction Manager)
-    INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
-type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
-    INFO - Found EjbModule in classpath:
-/Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes
-    INFO - Configuring app:
-/Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes
-    INFO - Configuring Service(id=Default Stateful Container, type=Container,
-provider-id=Default Stateful Container)
-    INFO - Auto-creating a container for bean TelephoneBean:
-Container(type=STATEFUL, id=Default Stateful Container)
-    INFO - Loaded Module:
-/Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes
-    INFO - Assembling app:
-/Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes
-    INFO - Jndi(name=TelephoneBeanRemote) --> Ejb(deployment-id=TelephoneBean)
-    INFO - Created Ejb(deployment-id=TelephoneBean, ejb-name=TelephoneBean,
-container=Default Stateful Container)
-    INFO - Deployed
-Application(path=/Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes)
-      ** Starting Services **
-      NAME		       IP	       PORT  
-      ejbd		       127.0.0.1       4201  
-      admin thread	       127.0.0.1       4200  
-    -------
-    Ready!
-    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.89 sec
-    
-    Results :
-    
-    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/embedded-configuration.adoc
----------------------------------------------------------------------
diff --git a/docs/embedded-configuration.adoc b/docs/embedded-configuration.adoc
new file mode 100644
index 0000000..47c4356
--- /dev/null
+++ b/docs/embedded-configuration.adoc
@@ -0,0 +1,135 @@
+# Embedded Configuration
+:index-group: Testing Techniques
+:jbake-date: 2018-12-05
+:jbake-type: page
+:jbake-status: published
+
+
+# Defaults, Overrides and Order
+
+When booting up OpenEJB for testing via the `LocalInitialContextFactory`
+or the newer `EJBContainer.createEJBContainer()` API part of EJB 3.1
+there is quite a bit of flexibility to how things are configured.
+
+OpenEJB will function fine with no configuration at all and will happily
+create things as needed and select defaults for everything. So in a real
+sense configuration is all about overriding those defaults. There are
+several places to put your overrides and an a specific order how they
+are applied. Here they are in order of preference; 1 = highest, 5 =
+lowest.
+
+\{row \{span8 *InitialContext*
+
+[arabic]
+. InitialContext properties
+. jndi.properties from the classpath
+. System properties
+. openejb.xml declarations/properties
+. service-jar.xml declarations/properties (internal concept) }
+
+\{span8 *EJBContainer API* 1. EJBContainer.createEJBContainer(Map)
+entries 1. System properties 1. openejb.xml declarations/properties 1.
+service-jar.xml declarations/properties (internal concept)
+
+} }
+
+It opens up some interesting possibilities in how you configure your
+environment. You could do 100% of your configuration in your test case
+via InitialContext propertes, or you could do say 80% in a
+jndi.properties file or openejb.xml file and 20% in your test case via
+InitialContext properties. You can put 100% of your configuration in a
+`jndi.properties` or `openejb.xml` file and override them via
+`InitialContext` properties.
+
+You can manage the properties how you wish and there is no need for
+redundant definitions if you do not want them.
+
+# What is configurable?
+
+Everything you can configure via an openejb.xml (minus the element) can
+be configured/overridden via properties. See
+link:configuring-containers-in-tests.html[Configuring Containers in
+Tests] and link:configuring-datasources-in-tests.html[Configuring
+DataSources in Tests].
+
+Everything in your logging.properties can be configured/overridden via
+properties. See link:configuring-logging-in-tests.html[Configuring
+Logging in Tests].
+
+The properties of persistence units declared in a persistence.xml can be
+configured/overridden via properties. See
+link:configuring-persistenceunits-in-tests.html[Configuring
+PersistenceUnits in Tests].
+
+OpenEJB has many flags that can also be set as properties. See
+link:properties-listing.html[OpenEJB Properties] for details on those.
+
+# Example of using InitialContext properties
+
+....
+Properties p = new Properties();
+
+// set the initial context factory
+p.put("java.naming.factory.initial ", "org.apache.openejb.client.LocalInitialContextFactory");
+
+// change some logging
+p.put("log4j.category.OpenEJB.options ", " debug");
+p.put("log4j.category.OpenEJB.startup ", " debug");
+p.put("log4j.category.OpenEJB.startup.config ", " debug");
+
+// create some resources
+p.put("movieDatabase", "new://Resource?type=DataSource");
+p.put("movieDatabase.JdbcDriver ", " org.hsqldb.jdbcDriver");
+p.put("movieDatabase.JdbcUrl ", " jdbc:hsqldb:mem:moviedb");
+
+// override properties on your "movie-unit" persistence unit
+p.put("movie-unit.hibernate.dialect ", "org.hibernate.dialect.HSQLDialect");
+
+// set some openejb flags
+p.put("openejb.jndiname.format ", " {ejbName}/{interfaceClass}");
+p.put("openejb.descriptors.output ", " true");
+p.put("openejb.validation.output.level ", " verbose");
+
+InitialContext initialContext = new InitialContext(p);
+....
+
+# Example of using jndi.properties
+
+Here's an example of the same properties being specified via a
+`jndi.properties file`. This file just needs to be placed in the
+classpath, not in a subdirectory of a path in the classpath such as
+META-INF, but at the root of any of the paths in the classpath.
+
+....
+# set the initial context factory
+java.naming.factory.initial = org.apache.openejb.client.LocalInitialContextFactory
+
+# change some logging
+log4j.category.OpenEJB.options = debug
+log4j.category.OpenEJB.startup = debug
+log4j.category.OpenEJB.startup.config = debug
+
+# create some resources
+movieDatabase = new://Resource?type=DataSource
+movieDatabase.JdbcDriver = org.hsqldb.jdbcDriver
+movieDatabase.JdbcUrl = jdbc:hsqldb:mem:moviedb
+
+# override properties on your "movie-unit" persistence unit
+movie-unit.hibernate.dialect = org.hibernate.dialect.HSQLDialect
+
+# set some openejb flags
+openejb.jndiname.format = {ejbName}/{interfaceClass}
+openejb.descriptors.output = true
+openejb.validation.output.level = verbose
+....
+
+Then OpenEJB can be booted via the `InitialContext` as normal.
+Properties can still be used to override any of the above properties:
+
+....
+Properties p = new Properties();
+
+p.put("openejb.validation.output.level ", " medium");
+
+InitialContext initialContext = new InitialContext(p);
+....

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/embedded-configuration.md
----------------------------------------------------------------------
diff --git a/docs/embedded-configuration.md b/docs/embedded-configuration.md
deleted file mode 100644
index 00117a3..0000000
--- a/docs/embedded-configuration.md
+++ /dev/null
@@ -1,135 +0,0 @@
-index-group=Testing Techniques
-type=page
-status=published
-title=Embedded Configuration
-~~~~~~
-
-<a name="EmbeddedConfiguration-Defaults,OverridesandOrder"></a>
-#  Defaults, Overrides and Order
-
-When booting up OpenEJB for testing via the `LocalInitialContextFactory`
-or the newer `EJBContainer.createEJBContainer()` API part of EJB 3.1 there
-is quite a bit of flexibility to how things are configured.
-
-OpenEJB will function fine with no configuration at all and will happily
-create things as needed and select defaults for everything.  So in a real
-sense configuration is all about overriding those defaults.  There are
-several places to put your overrides and an a specific order how they are
-applied.  Here they are in order of preference; 1 = highest, 5 = lowest.
-
-{row
-{span8
-**InitialContext**
-
-1. InitialContext properties
-1. jndi.properties from the classpath
-1. System properties
-1. openejb.xml declarations/properties
-1. service-jar.xml declarations/properties (internal concept)
-}
-
-{span8
-**EJBContainer API**
-1. EJBContainer.createEJBContainer(Map) entries
-1. System properties
-1. openejb.xml declarations/properties
-1. service-jar.xml declarations/properties (internal concept)
-
-}
-}
-
-It opens up some interesting possibilities in how you configure your
-environment.  You could do 100% of your configuration in your test case via
-InitialContext propertes, or you could do say 80% in a jndi.properties file
-or openejb.xml file and 20% in your test case via InitialContext
-properties.  You can put 100% of your configuration in a `jndi.properties` or
-`openejb.xml` file and override them via `InitialContext` properties.
-
-You can manage the properties how you wish and there is no need for
-redundant definitions if you do not want them.
-
-<a name="EmbeddedConfiguration-Whatisconfigurable?"></a>
-#  What is configurable?
-
-Everything you can configure via an openejb.xml (minus the <Deployment>
-element) can be configured/overridden via properties. See [Configuring Containers in Tests](configuring-containers-in-tests.html)
- and [Configuring DataSources in Tests](configuring-datasources-in-tests.html).
-
-Everything in your logging.properties can be configured/overridden via
-properties.  See [Configuring Logging in Tests](configuring-logging-in-tests.html).
-
-The properties of persistence units declared in a persistence.xml can be
-configured/overridden via properties.  See [Configuring PersistenceUnits in Tests](configuring-persistenceunits-in-tests.html).
-
-OpenEJB has many flags that can also be set as properties.  See [OpenEJB Properties](properties-listing.html)
- for details on those.
-
-<a name="EmbeddedConfiguration-ExampleofusingInitialContextproperties"></a>
-# Example of using InitialContext properties
-
-
-    Properties p = new Properties();
-    
-    // set the initial context factory
-    p.put("java.naming.factory.initial ", "org.apache.openejb.client.LocalInitialContextFactory");
-    
-    // change some logging
-    p.put("log4j.category.OpenEJB.options ", " debug");
-    p.put("log4j.category.OpenEJB.startup ", " debug");
-    p.put("log4j.category.OpenEJB.startup.config ", " debug");
-    
-    // create some resources
-    p.put("movieDatabase", "new://Resource?type=DataSource");
-    p.put("movieDatabase.JdbcDriver ", " org.hsqldb.jdbcDriver");
-    p.put("movieDatabase.JdbcUrl ", " jdbc:hsqldb:mem:moviedb");
-    
-    // override properties on your "movie-unit" persistence unit
-    p.put("movie-unit.hibernate.dialect ", "org.hibernate.dialect.HSQLDialect");
-    
-    // set some openejb flags
-    p.put("openejb.jndiname.format ", " {ejbName}/{interfaceClass}");
-    p.put("openejb.descriptors.output ", " true");
-    p.put("openejb.validation.output.level ", " verbose");
-    
-    InitialContext initialContext = new InitialContext(p);
-
-
-<a name="EmbeddedConfiguration-Exampleofusingjndi.properties"></a>
-# Example of using jndi.properties
-
-Here's an example of the same properties being specified via a
-`jndi.properties file`.  This file just needs to be placed in the classpath,
-not in a subdirectory of a path in the classpath such as META-INF, but at
-the root of any of the paths in the classpath.
-
-    # set the initial context factory
-    java.naming.factory.initial = org.apache.openejb.client.LocalInitialContextFactory
-    
-    # change some logging
-    log4j.category.OpenEJB.options = debug
-    log4j.category.OpenEJB.startup = debug
-    log4j.category.OpenEJB.startup.config = debug
-    
-    # create some resources
-    movieDatabase = new://Resource?type=DataSource
-    movieDatabase.JdbcDriver = org.hsqldb.jdbcDriver
-    movieDatabase.JdbcUrl = jdbc:hsqldb:mem:moviedb
-    
-    # override properties on your "movie-unit" persistence unit
-    movie-unit.hibernate.dialect = org.hibernate.dialect.HSQLDialect
-    
-    # set some openejb flags
-    openejb.jndiname.format = {ejbName}/{interfaceClass}
-    openejb.descriptors.output = true
-    openejb.validation.output.level = verbose
-
-
-Then OpenEJB can be booted via the `InitialContext` as normal.  Properties
-can still be used to override any of the above properties:
-
-
-    Properties p = new Properties();
-    
-    p.put("openejb.validation.output.level ", " medium");
-    
-    InitialContext initialContext = new InitialContext(p);

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/embedding.adoc
----------------------------------------------------------------------
diff --git a/docs/embedding.adoc b/docs/embedding.adoc
new file mode 100644
index 0000000..516826d
--- /dev/null
+++ b/docs/embedding.adoc
@@ -0,0 +1,34 @@
+# Embedding
+:index-group: Unrevised
+:jbake-date: 2018-12-05
+:jbake-type: page
+:jbake-status: published
+
+The basic process for embedding OpenEJB:
+
+[arabic]
+. Add the OpenEJB libraries to your classpath
+. Ensure your EJB modules are discoverable
+. Use the LocalInitialContextFactory to boot OpenEJB
+
+== Important docs
+
+* link:application-discovery-via-the-classpath.html[Application
+discovery via the classpath]
+* link:embedded-configuration.html[Embedded Configuration]
+* link:configuring-datasources-in-tests.html[Configuring DataSources in
+Tests]
+* link:configuring-persistenceunits-in-tests.html[Configuring
+PersistenceUnits in Tests]
+* link:configuring-containers-in-tests.html[Configuring Containers in
+Tests]
+* link:configuring-logging-in-tests.html[Configuring Logging in Tests]
+* link:alternate-descriptors.html[Alternate Descriptors]
+* link:unit-testing-transactions.html[Unit Testing Transactions]
+* link:testcase-with-testbean-inner-class.html[TestCase with TestBean
+inner-class]
+* [TestCase Injection (@LocalClient)](local-client-injection.html)
+
+== Examples
+
+\{include:Examples Table}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/embedding.md
----------------------------------------------------------------------
diff --git a/docs/embedding.md b/docs/embedding.md
deleted file mode 100644
index aa8e32b..0000000
--- a/docs/embedding.md
+++ /dev/null
@@ -1,30 +0,0 @@
-index-group=Unrevised
-type=page
-status=published
-title=Embedding
-~~~~~~
-The basic process for embedding OpenEJB:
-
-1. Add the OpenEJB libraries to your classpath
-1. Ensure your EJB modules are discoverable
-1. Use the LocalInitialContextFactory to boot OpenEJB
-
-
-<a name="Embedding-Importantdocs"></a>
-## Important docs
-
-- [Application discovery via the classpath](application-discovery-via-the-classpath.html)
-- [Embedded Configuration](embedded-configuration.html)
-- [Configuring DataSources in Tests](configuring-datasources-in-tests.html)
-- [Configuring PersistenceUnits in Tests](configuring-persistenceunits-in-tests.html)
-- [Configuring Containers in Tests](configuring-containers-in-tests.html)
-- [Configuring Logging in Tests](configuring-logging-in-tests.html)
-- [Alternate Descriptors](alternate-descriptors.html)
-- [Unit Testing Transactions](unit-testing-transactions.html)
-- [TestCase with TestBean inner-class](testcase-with-testbean-inner-class.html)
-- [TestCase Injection (@LocalClient)](local-client-injection.html)
-
-<a name="Embedding-Examples"></a>
-## Examples
-
-{include:Examples Table}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/failover-logging.adoc
----------------------------------------------------------------------
diff --git a/docs/failover-logging.adoc b/docs/failover-logging.adoc
new file mode 100644
index 0000000..76c23a9
--- /dev/null
+++ b/docs/failover-logging.adoc
@@ -0,0 +1,54 @@
+:index-group: Discovery
+and Failover
+:jbake-date: 2018-12-05
+:jbake-type: page
+:jbake-status: published
+
+Setting the following logging category to "debug" will open up some new
+logging information.
+
+....
+log4j.category.OpenEJB.server.discovery = debug
+....
+
+Or more specifically as:
+
+....
+log4j.category.OpenEJB.server.discovery.multipoint = debug
+log4j.category.OpenEJB.server.discovery.multicast = debug
+....
+
+The nature of the debug output is to display all configuration
+information at startup:
+
+....
+DEBUG - Using default 'heart_rate=500'
+DEBUG - Using default 'max_missed_heartbeats=10'
+DEBUG - Using default 'max_reconnect_delay=30000'
+DEBUG - Using default 'reconnect_delay=5000'
+DEBUG - Using default 'exponential_backoff=0'
+DEBUG - Using default 'max_reconnect_attempts=10'
+INFO - Created Tracker{group='default', groupPrefix='default:', heartRate=500, maxMissedHeartbeats=10, reconnectDelay=5000, maxReconnectDelay=30000, maxReconnectAttempts=10, exponentialBackoff=0, useExponentialBackOff=false, registeredServices=0, discoveredServices=0}
+....
+
+Changing the configuration should reflect in the logging as follows:
+
+....
+INFO - Using 'heart_rate=200'
+INFO - Using 'max_missed_heartbeats=2'
+DEBUG - Using default 'max_reconnect_delay=30000'
+DEBUG - Using default 'reconnect_delay=5000'
+DEBUG - Using default 'exponential_backoff=0'
+DEBUG - Using default 'max_reconnect_attempts=10'
+INFO - Created Tracker{group='default', groupPrefix='default:', heartRate=200, maxMissedHeartbeats=2, reconnectDelay=5000, maxReconnectDelay=30000, maxReconnectAttempts=10, exponentialBackoff=0, useExponentialBackOff=false, registeredServices=0, discoveredServices=0}
+....
+
+As well as any events at runtime:
+
+....
+DEBUG - Expired Service{uri=green://localhost:0, broadcastString='default:green://localhost:0&#39;} Timeout{lastSeen=-5005, threshold=5000}
+
+DEBUG - Added Service{uri=green://localhost:0}
+
+DEBUG - Removed Service{uri=green://localhost:0}
+....

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/failover-logging.md
----------------------------------------------------------------------
diff --git a/docs/failover-logging.md b/docs/failover-logging.md
deleted file mode 100644
index a21addd..0000000
--- a/docs/failover-logging.md
+++ /dev/null
@@ -1,42 +0,0 @@
-index-group=Discovery and Failover
-type=page
-status=published
-~~~~~~
-Setting the following logging category to "debug" will open up some new logging information.
-
-    log4j.category.OpenEJB.server.discovery = debug
-
-Or more specifically as:
-
-    log4j.category.OpenEJB.server.discovery.multipoint = debug
-    log4j.category.OpenEJB.server.discovery.multicast = debug
-
-The nature of the debug output is to display all configuration information at startup:
-
-    DEBUG - Using default 'heart_rate=500'
-    DEBUG - Using default 'max_missed_heartbeats=10'
-    DEBUG - Using default 'max_reconnect_delay=30000'
-    DEBUG - Using default 'reconnect_delay=5000'
-    DEBUG - Using default 'exponential_backoff=0'
-    DEBUG - Using default 'max_reconnect_attempts=10'
-    INFO - Created Tracker{group='default', groupPrefix='default:', heartRate=500, maxMissedHeartbeats=10, reconnectDelay=5000, maxReconnectDelay=30000, maxReconnectAttempts=10, exponentialBackoff=0, useExponentialBackOff=false, registeredServices=0, discoveredServices=0}
-
-Changing the configuration should reflect in the logging as follows:
-
-    INFO - Using 'heart_rate=200'
-    INFO - Using 'max_missed_heartbeats=2'
-    DEBUG - Using default 'max_reconnect_delay=30000'
-    DEBUG - Using default 'reconnect_delay=5000'
-    DEBUG - Using default 'exponential_backoff=0'
-    DEBUG - Using default 'max_reconnect_attempts=10'
-    INFO - Created Tracker{group='default', groupPrefix='default:', heartRate=200, maxMissedHeartbeats=2, reconnectDelay=5000, maxReconnectDelay=30000, maxReconnectAttempts=10, exponentialBackoff=0, useExponentialBackOff=false, registeredServices=0, discoveredServices=0}
-
-As well as any events at runtime:
-
-    DEBUG - Expired Service{uri=green://localhost:0, broadcastString='default:green://localhost:0&#39;} Timeout{lastSeen=-5005, threshold=5000}
-
-    DEBUG - Added Service{uri=green://localhost:0}
-
-    DEBUG - Removed Service{uri=green://localhost:0}
-
-

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/faq.adoc
----------------------------------------------------------------------
diff --git a/docs/faq.adoc b/docs/faq.adoc
new file mode 100644
index 0000000..d02d971
--- /dev/null
+++ b/docs/faq.adoc
@@ -0,0 +1,105 @@
+# FAQ 
+:index-group: Unrevised
+:jbake-date: 2018-12-05
+:jbake-type: page
+:jbake-status: published
+
+##
+ General
+
+ 
+
+=== What spec version does OpenEJB support?
+
+OpenEJB supports the Enterprise JavaBeans 3.0 specification and previous
+versions 2.1, 2.0 and 1.1.
+
+=== I don't plan to use EJBs, so why would I embed OpenEJB into Tomcat.
+
+Adding OpenEJB to Tomcat gives servlets several new Java EE 5
+capabilities such as JPA, JAX-WS, JMS, J2EE Connectors, transactions,
+and more as well as enhancing the injection features of Tomcat 6 to now
+support injection of JavaEE objects like Topics, Queues, EntityManagers,
+JMS ConnectionFactories, JavaMail Sessions, as well as simpler data
+types such as Dates, Classes, URI, URL, List, Map, Set, Properties, and
+more. In the case of Tomcat 5.5 which doesn't support dependency
+injection at all, even more is gained.
+
+=== Can I run OpenEJB with a JVM for any vendor?
+
+The Sun, Mac, and IBM vms are regularly tested, however any vm should
+work.
+
+=== Which version of Java is required to run OpenEJB?
+
+Java versions 5 or 6, aka Java 1.5 or 1.6.
+
+=== Do I need Apache Maven to work with OpenEJB?
+
+Definitely not. Most of the examples include both Maven and Ant build
+files. OpenEJB is usable as a plain library, much like an embedded
+database like Derby, so it is usable in any application regardless if
+that application is run via Maven, Ant, Intellij, Eclipse, NetBeans,
+JUnit, TestNG, etc.
+
+== Can I start and stop OpenEJB from an IDE? If yes, which IDE is
+
+supported by OpenEJB?
+
+The short answer is yes. The basic approach for all embedding scenarios
+is to 1) add OpenEJB to your classpath, and 2) construct your
+InitialContext using
+org.apache.openejb.client.LocalInitialContextFactory. The
+LocalInitialContextFactory will boot OpenEJB in your vm and all ejb
+applications visible in the classpath will be deployed. See
+http://tomee.apache.org/embedding-openejb.html for details on how to
+embed openejb in your application and IDE. See
+openejbx30:application-discovery-via-the-classpath.html[Application
+discovery via the classpath] for various ways to have your applications
+discovered.
+
+== During embedded testing, how can I externalize all my DataSource
+
+configuration?
+
+Create an openejb.xml file in any directory that gets added to your test
+classpath. For maven, something that winds up directly under
+"target/classes/" or "target/test-classes/" will work just fine. Then in
+your test case do this:
+
+....
+   protected void setUp() throws Exception {
+       Properties properties = new Properties();
+       properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
+....
+
+"org.apache.openejb.client.LocalInitialContextFactory");
+
+....
+       URL config =
+....
+
+this.getClass().getClassLoader().getResource("openejb.xml");
+properties.setProperty("openejb.configuration",
+config.toExternalForm());
+
+....
+       initialContext = new InitialContext(properties);
+   }
+....
+
+The file itself doesn't have to be called "openejb.xml", you could have
+a few different files like that for different testing scenarios each
+with a name that describes the basic setup.
+
+== Container-Managed Persistence
+
+=== What engine does OpenEJB use for CMP?
+
+The CMP engine is written as a layer over JPA with OpenJPA doing the
+persistence work.
+
+=== What is the format for the CMP mapping files?
+
+The standard JPA mapping file and annotations are also used for CMP
+mappings.

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/faq.md
----------------------------------------------------------------------
diff --git a/docs/faq.md b/docs/faq.md
deleted file mode 100644
index 5753125..0000000
--- a/docs/faq.md
+++ /dev/null
@@ -1,99 +0,0 @@
-index-group=Unrevised
-type=page
-status=published
-title=FAQ
-~~~~~~
-<a name="FAQ-&nbsp;General"></a>
-## &nbsp;General
-
-&nbsp;
-
-<a name="FAQ-WhatspecversiondoesOpenEJBsupport?"></a>
-### What spec version does OpenEJB support?
-
-OpenEJB supports the Enterprise JavaBeans 3.0 specification and previous
-versions 2.1, 2.0 and 1.1.
-
-<a name="FAQ-Idon'tplantouseEJBs,sowhywouldIembedOpenEJBintoTomcat."></a>
-###  I don't plan to use EJBs, so why would I embed OpenEJB into Tomcat.
-
-Adding OpenEJB to Tomcat gives servlets several new Java EE 5 capabilities
-such as JPA, JAX-WS, JMS, J2EE Connectors, transactions, and more as well
-as enhancing the injection features of Tomcat 6 to now support injection of
-JavaEE objects like Topics, Queues, EntityManagers, JMS
-ConnectionFactories, JavaMail Sessions, as well as simpler data types such
-as Dates, Classes, URI, URL, List, Map, Set, Properties, and more.  In the
-case of Tomcat 5.5 which doesn't support dependency injection at all, even
-more is gained.
-
-<a name="FAQ-CanIrunOpenEJBwithaJVMforanyvendor?"></a>
-### Can I run OpenEJB with a JVM for any vendor?
-
-The Sun, Mac, and IBM vms are regularly tested, however any vm should work.
-
-<a name="FAQ-WhichversionofJavaisrequiredtorunOpenEJB?"></a>
-### Which version of Java is required to run OpenEJB?
-
-Java versions 5 or 6, aka Java 1.5 or 1.6.
-
-<a name="FAQ-DoIneedApacheMaventoworkwithOpenEJB?"></a>
-### Do I need Apache Maven to work with OpenEJB?
-
-Definitely not. Most of the examples include both Maven and Ant build
-files.	OpenEJB is usable as a plain library, much like an embedded
-database like Derby, so it is usable in any application regardless if that
-application is run via Maven, Ant, Intellij, Eclipse, NetBeans, JUnit,
-TestNG, etc.
-
-### Can I start and stop OpenEJB from an IDE? If yes, which IDE is
-supported by OpenEJB?
-
-The short answer is yes.  The basic approach for all embedding scenarios is
-to 1) add OpenEJB to your classpath, and 2) construct your InitialContext
-using org.apache.openejb.client.LocalInitialContextFactory.  The
-LocalInitialContextFactory will boot OpenEJB in your vm and all ejb
-applications visible in the classpath will be deployed. See
-http://tomee.apache.org/embedding-openejb.html for details on how to
-embed openejb in your application and IDE.  See [Application discovery via the classpath](openejbx30:application-discovery-via-the-classpath.html)
- for various ways to have your applications discovered. 
-
-
-###  During embedded testing, how can I externalize all my DataSource
-configuration? 
-
-Create an openejb.xml file in any directory that gets added to your test
-classpath. For maven, something that winds up directly under
-"target/classes/" or "target/test-classes/" will work just fine.  Then in
-your test case do this:
-
-       protected void setUp() throws Exception {
-           Properties properties = new Properties();
-           properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
-"org.apache.openejb.client.LocalInitialContextFactory");
-    
-           URL config =
-this.getClass().getClassLoader().getResource("openejb.xml");
-           properties.setProperty("openejb.configuration",
-config.toExternalForm());
-    
-           initialContext = new InitialContext(properties);
-       }
-
-The file itself doesn't have to be called "openejb.xml", you could have a
-few different files like that for different testing scenarios each with a
-name that describes the basic setup.
-
-<a name="FAQ-Container-ManagedPersistence"></a>
-## Container-Managed Persistence
-
-<a name="FAQ-WhatenginedoesOpenEJBuseforCMP?"></a>
-### What engine does OpenEJB use for CMP?
-
-The CMP engine is written as a layer over JPA with OpenJPA doing the
-persistence work.
-
-<a name="FAQ-WhatistheformatfortheCMPmappingfiles?"></a>
-### What is the format for the CMP mapping files?
-
-The standard JPA mapping file and annotations are also used for CMP
-mappings.

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/features.adoc
----------------------------------------------------------------------
diff --git a/docs/features.adoc b/docs/features.adoc
new file mode 100644
index 0000000..a07b216
--- /dev/null
+++ b/docs/features.adoc
@@ -0,0 +1,6 @@
+# Features
+:index-group: Unrevised
+:jbake-date: 2018-12-05
+:jbake-type: page
+:jbake-status: published
+

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/features.md
----------------------------------------------------------------------
diff --git a/docs/features.md b/docs/features.md
deleted file mode 100644
index 7486ee3..0000000
--- a/docs/features.md
+++ /dev/null
@@ -1,6 +0,0 @@
-index-group=Unrevised
-type=page
-status=published
-title=Features
-~~~~~~
-

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/from-glassfish-to-tomee.adoc
----------------------------------------------------------------------
diff --git a/docs/from-glassfish-to-tomee.adoc b/docs/from-glassfish-to-tomee.adoc
new file mode 100644
index 0000000..2e1dcc9
--- /dev/null
+++ b/docs/from-glassfish-to-tomee.adoc
@@ -0,0 +1,11 @@
+:index-group: Unrevised
+:jbake-date: 2018-12-05
+:jbake-type: page
+:jbake-status: published
+
+
+# From Glassfish
+Application Server to TomEE (plus)
+
+This page aims at reporting feedback from users while migrating from
+Glassfish to Apache TomEE.

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/from-glassfish-to-tomee.md
----------------------------------------------------------------------
diff --git a/docs/from-glassfish-to-tomee.md b/docs/from-glassfish-to-tomee.md
deleted file mode 100644
index e41719b..0000000
--- a/docs/from-glassfish-to-tomee.md
+++ /dev/null
@@ -1,7 +0,0 @@
-index-group=Unrevised
-type=page
-status=published
-~~~~~~
-# From Glassfish Application Server to TomEE (plus)
-
-This page aims at reporting feedback from users while migrating from Glassfish to Apache TomEE.

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/functional-testing-with-openejb,-jetty-and-selenium.adoc
----------------------------------------------------------------------
diff --git a/docs/functional-testing-with-openejb,-jetty-and-selenium.adoc b/docs/functional-testing-with-openejb,-jetty-and-selenium.adoc
new file mode 100644
index 0000000..2e64527
--- /dev/null
+++ b/docs/functional-testing-with-openejb,-jetty-and-selenium.adoc
@@ -0,0 +1,243 @@
+# Functional testing with OpenEJB, Jetty and Selenium
+:index-group: Testing Techniques
+:jbake-date: 2018-12-05
+:jbake-type: page
+:jbake-status: published
+
+Obviously, OpenEJB is
+great for unit testing EJBs, but I wondered whether I might also be able
+to use this embedded functionality to functionally test my application.
+You can use tools like Selenium, or HtmlUnit to run functional tests as
+if the user were sat at their browser typing text, and clicking links
+and buttons. This however means you have to have your app running on
+your app server, and you need to have consistent test data - otherwise a
+test might pass on one developers machine, but fail on another. Here's
+one approach that you could take to completely deploy your webapp within
+a test, and functionally test it with a tool like Selenium. There's also
+some sample code demonstrating this, available
+http://people.apache.org/~jgallimore/PersonApp.zip[here] .
+
+=== Creating an embedded server
+
+I created a class to start my embedded OpenEJB and Jetty instances and
+configure them to see the EJB and WAR modules of my application:
+
+....
+public class EmbeddedServer {
+    private static EmbeddedServer instance = new EmbeddedServer();
+    private Server server;
+
+    private EmbeddedServer() {
+    try {
+        // initialize OpenEJB & add some test data
+        Properties properties = new Properties();
+        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+        InitialContext ic = new InitialContext(properties);
+        PeopleFacade facade = (PeopleFacade) ic.lookup("PeopleFacadeEJBRemote");
+        new TestFixture(facade).addTestData();
+
+        // setup web app
+        WebAppContext context = new WebAppContext();
+        context.setWar(computeWarPath());
+        InitialContext initialContext = setupJndi(context);
+
+        // start the server
+        context.setServletHandler(new EmbeddedServerServletHandler(initialContext));
+        context.setContextPath("/");
+        server = new Server(9091);
+        server.addHandler(context);
+
+        server.start();
+    } catch (Exception e) {
+        e.printStackTrace();
+    }
+    }
+
+    private InitialContext setupJndi(WebAppContext context) throws NamingException {
+    // setup local JNDI
+    InitialContext initialContext = new InitialContext();
+    WebApp webApp = getWebApp(context);
+    Collection<EjbRef> refs = webApp.getEjbRef();
+    for (EjbRef ref : refs) {
+        String ejbLink = ref.getEjbLink();
+
+        // get enterprise bean info
+        EnterpriseBeanInfo beanInfo = new EJBHelper().getEJBInfo(ejbLink);
+        if (beanInfo.jndiNames != null && beanInfo.jndiNames.size() > 0) {
+        String jndiName = "java:openejb/ejb/" + beanInfo.jndiNames.get(0);
+        initialContext.bind("java:comp/env/" + ref.getEjbRefName(), new LinkRef(jndiName));
+        }
+    }
+    return initialContext;
+    }
+
+    private String computeWarPath() {
+    String currentPath = new File(".").getAbsolutePath();
+    String warPath;
+
+        String[]  pathParts = currentPath.split("(\\\\|/)+");
+
+    int webPart = Arrays.asList(pathParts).indexOf("PersonWEB");
+    if (webPart == -1) {
+        warPath = "PersonWEB/src/main/webapp";
+    } else {
+        StringBuffer buffer = new StringBuffer();
+
+        for (int i = 0; i < webPart; i++) {
+                buffer.append(pathParts[i]);
+        buffer.append(File.separator);
+        }
+
+        buffer.append("PersonWEB/src/main/webapp");
+        warPath = buffer.toString();
+    }
+    return warPath;
+    }
+
+    public static EmbeddedServer getInstance() {
+    return instance;
+    }
+
+    public Server getServer() {
+    return server;
+    }
+
+    public static void main(String[]  args) {
+    try {
+        EmbeddedServer.getInstance().getServer().join();
+    } catch (Exception e) {
+        e.printStackTrace();
+    }
+    }
+
+    private WebApp getWebApp(WebAppContext context) {
+    WebApp webApp = null;
+
+    try {
+        FileInputStream is = new FileInputStream(new File(context.getWar() + "/WEB-INF/web.xml").getAbsolutePath());
+        webApp = (WebApp) JaxbJavaee.unmarshal(WebApp.class, is);
+    } catch (Exception e) {
+        e.printStackTrace();
+    }
+    return webApp;
+    }
+} 
+....
+
+This class sets up an embedded instance of Jetty, running on port 9091.
+You'll notice the setupJndi() method. This looks through the ejb-ref
+entries in web.xml (which we deserialize using the openejb-jee library),
+and adds relevant LinkRefs to the JNDI tree, so you can lookup beans
+using the java:comp/env/bean format. I've added a main() method here for
+convenience, so you can run this straight from an IDE, and record tests
+using tools like the Selenium Firefox plugin.
+
+=== Supporting @EJB Dependency injection
+
+In the last code sample, we also set up a custom ServletHandler in Jetty
+- this is to perform dependency injection. The custom ServletHandler
+looks like this:
+
+....
+public class EmbeddedServerServletHandler extends ServletHandler {
+    private InitialContext initialContext;
+
+    public EmbeddedServerServletHandler(InitialContext initialContext) {
+    this.initialContext = initialContext;
+    }
+
+    public Servlet customizeServlet(Servlet servlet) throws Exception {
+    Class<? extends Servlet> servletClass = servlet.getClass();
+        Field[]
+....
+
+declaredFields = servletClass.getDeclaredFields();
+
+....
+    for (Field declaredField : declaredFields) {
+            Annotation[]
+....
+
+annotations = declaredField.getAnnotations();
+
+....
+        for (Annotation annotation : annotations) {
+        if (EJB.class.equals(annotation.annotationType())) {
+            // inject into this field
+            Class<?> fieldType = declaredField.getType();
+            EnterpriseBeanInfo beanInfo = getBeanFor(fieldType);
+            if (beanInfo == null) {
+            continue;
+            }
+                   
+            String jndiName = "java:openejb/ejb/" + beanInfo.jndiNames.get(0);
+            Object o = initialContext.lookup(jndiName);
+
+            declaredField.setAccessible(true);
+            declaredField.set(servlet, o);
+        }
+        }
+    }
+
+    return super.customizeServlet(servlet);
+    }
+
+    private EnterpriseBeanInfo getBeanFor(Class<?> fieldType) {
+    return new EJBHelper().getBeanInfo(fieldType);
+    }
+} 
+....
+
+This looks up deployed beans that match the field type, and uses
+reflection to set the field.
+
+=== Writing a Functional test
+
+We can now write a functional test. I use a base abstract class to make
+sure the Embedded server is running, and start Selenium:
+
+....
+public abstract class FunctionalTestCase extends TestCase {
+    protected DefaultSelenium selenium;
+
+    protected void setUp() throws Exception {
+    super.setUp();
+    EmbeddedServer.getInstance();
+    selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost:9091/");
+    selenium.start();
+    }
+
+    protected void tearDown() throws Exception {
+    selenium.stop();
+    }
+}
+....
+
+and I can then I write a test like this:
+
+....
+public class AddPersonTest extends FunctionalTestCase {
+    public void testShouldAddAPerson() throws Exception {
+    selenium.open("/People");
+    selenium.type("firstname", "Jonathan");
+    selenium.type("lastname", "Gallimore");
+        selenium.click("//input[@name='add' and @value='Add']");
+    selenium.waitForPageToLoad("30000");
+    selenium.type("filter", "gallimore");
+    selenium.click("submit");
+    selenium.waitForPageToLoad("30000");
+        assertEquals(1, selenium.getXpathCount("//div[@id='people']/ul/li").intValue());
+        assertEquals("Jonathan Gallimore", selenium.getText("//div[@id='people']/ul/li[1]"));
+
+    }
+} 
+....
+
+=== Sample code
+
+I've made a sample project which demonstrates this, source is available
+http://people.apache.org/~jgallimore/PersonApp.zip[here] . You'll need
+Maven to build it, and you can build it and run the tests by running
+'mvn clean install'. If want to run the tests from your IDE, you'll need
+to have a Selenium server running, which you can do by running 'mvn
+selenium:start-server'.

http://git-wip-us.apache.org/repos/asf/tomee/blob/6bbcdc10/docs/functional-testing-with-openejb,-jetty-and-selenium.md
----------------------------------------------------------------------
diff --git a/docs/functional-testing-with-openejb,-jetty-and-selenium.md b/docs/functional-testing-with-openejb,-jetty-and-selenium.md
deleted file mode 100644
index 218848b..0000000
--- a/docs/functional-testing-with-openejb,-jetty-and-selenium.md
+++ /dev/null
@@ -1,240 +0,0 @@
-index-group=Testing Techniques
-type=page
-status=published
-title=Functional testing with OpenEJB, Jetty and Selenium
-~~~~~~
-Obviously, OpenEJB is great for unit testing EJBs, but I wondered whether I
-might also be able to use this embedded functionality to functionally test
-my application. You can use tools like Selenium, or HtmlUnit to run
-functional tests as if the user were sat at their browser typing text, and
-clicking links and buttons. This however means you have to have your app
-running on your app server, and you need to have consistent test data -
-otherwise a test might pass on one developers machine, but fail on another.
-Here's one approach that you could take to completely deploy your webapp
-within a test, and functionally test it with a tool like Selenium. There's
-also some sample code demonstrating this, available [here](http://people.apache.org/~jgallimore/PersonApp.zip)
-.
-
-
-<a name="FunctionaltestingwithOpenEJB,JettyandSelenium-Creatinganembeddedserver"></a>
-### Creating an embedded server
-
-I created a class to start my embedded OpenEJB and Jetty instances and
-configure them to see the EJB and WAR modules of my application:
-
-
-    public class EmbeddedServer {
-        private static EmbeddedServer instance = new EmbeddedServer();
-        private Server server;
-    
-        private EmbeddedServer() {
-    	try {
-    	    // initialize OpenEJB & add some test data
-    	    Properties properties = new Properties();
-    	    properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
-    	    InitialContext ic = new InitialContext(properties);
-    	    PeopleFacade facade = (PeopleFacade) ic.lookup("PeopleFacadeEJBRemote");
-    	    new TestFixture(facade).addTestData();
-    
-    	    // setup web app
-    	    WebAppContext context = new WebAppContext();
-    	    context.setWar(computeWarPath());
-    	    InitialContext initialContext = setupJndi(context);
-    
-    	    // start the server
-    	    context.setServletHandler(new EmbeddedServerServletHandler(initialContext));
-    	    context.setContextPath("/");
-    	    server = new Server(9091);
-    	    server.addHandler(context);
-    
-    	    server.start();
-    	} catch (Exception e) {
-    	    e.printStackTrace();
-    	}
-        }
-    
-        private InitialContext setupJndi(WebAppContext context) throws NamingException {
-    	// setup local JNDI
-    	InitialContext initialContext = new InitialContext();
-    	WebApp webApp = getWebApp(context);
-    	Collection<EjbRef> refs = webApp.getEjbRef();
-    	for (EjbRef ref : refs) {
-    	    String ejbLink = ref.getEjbLink();
-    
-    	    // get enterprise bean info
-    	    EnterpriseBeanInfo beanInfo = new EJBHelper().getEJBInfo(ejbLink);
-    	    if (beanInfo.jndiNames != null && beanInfo.jndiNames.size() > 0) {
-    		String jndiName = "java:openejb/ejb/" + beanInfo.jndiNames.get(0);
-    		initialContext.bind("java:comp/env/" + ref.getEjbRefName(), new LinkRef(jndiName));
-    	    }
-    	}
-    	return initialContext;
-        }
-    
-        private String computeWarPath() {
-    	String currentPath = new File(".").getAbsolutePath();
-    	String warPath;
-    
-            String[]  pathParts = currentPath.split("(\\\\|/)+");
-    
-    	int webPart = Arrays.asList(pathParts).indexOf("PersonWEB");
-    	if (webPart == -1) {
-    	    warPath = "PersonWEB/src/main/webapp";
-    	} else {
-    	    StringBuffer buffer = new StringBuffer();
-    
-    	    for (int i = 0; i < webPart; i++) {
-                    buffer.append(pathParts[i]);
-    		buffer.append(File.separator);
-    	    }
-    
-    	    buffer.append("PersonWEB/src/main/webapp");
-    	    warPath = buffer.toString();
-    	}
-    	return warPath;
-        }
-    
-        public static EmbeddedServer getInstance() {
-    	return instance;
-        }
-    
-        public Server getServer() {
-    	return server;
-        }
-    
-        public static void main(String[]  args) {
-    	try {
-    	    EmbeddedServer.getInstance().getServer().join();
-    	} catch (Exception e) {
-    	    e.printStackTrace();
-    	}
-        }
-    
-        private WebApp getWebApp(WebAppContext context) {
-    	WebApp webApp = null;
-    
-    	try {
-    	    FileInputStream is = new FileInputStream(new File(context.getWar() + "/WEB-INF/web.xml").getAbsolutePath());
-    	    webApp = (WebApp) JaxbJavaee.unmarshal(WebApp.class, is);
-    	} catch (Exception e) {
-    	    e.printStackTrace();
-    	}
-    	return webApp;
-        }
-    } 
-
-
-This class sets up an embedded instance of Jetty, running on port 9091.
-You'll notice the setupJndi() method. This looks through the ejb-ref
-entries in web.xml (which we deserialize using the openejb-jee library),
-and adds relevant LinkRefs to the JNDI tree, so you can lookup beans using
-the java:comp/env/bean format. I've added a main() method here for
-convenience, so you can run this straight from an IDE, and record tests
-using tools like the Selenium Firefox plugin.
-
-<a name="FunctionaltestingwithOpenEJB,JettyandSelenium-Supporting@EJBDependencyinjection"></a>
-### Supporting @EJB Dependency injection
-
-In the last code sample, we also set up a custom ServletHandler in Jetty -
-this is to perform dependency injection. The custom ServletHandler looks
-like this:
-
-
-    public class EmbeddedServerServletHandler extends ServletHandler {
-        private InitialContext initialContext;
-    
-        public EmbeddedServerServletHandler(InitialContext initialContext) {
-    	this.initialContext = initialContext;
-        }
-    
-        public Servlet customizeServlet(Servlet servlet) throws Exception {
-    	Class<? extends Servlet> servletClass = servlet.getClass();
-            Field[]
- declaredFields = servletClass.getDeclaredFields();
-    
-    	for (Field declaredField : declaredFields) {
-                Annotation[]
- annotations = declaredField.getAnnotations();
-    
-    	    for (Annotation annotation : annotations) {
-    		if (EJB.class.equals(annotation.annotationType())) {
-    		    // inject into this field
-    		    Class<?> fieldType = declaredField.getType();
-    		    EnterpriseBeanInfo beanInfo = getBeanFor(fieldType);
-    		    if (beanInfo == null) {
-    			continue;
-    		    }
-                       
-    		    String jndiName = "java:openejb/ejb/" + beanInfo.jndiNames.get(0);
-    		    Object o = initialContext.lookup(jndiName);
-    
-    		    declaredField.setAccessible(true);
-    		    declaredField.set(servlet, o);
-    		}
-    	    }
-    	}
-    
-    	return super.customizeServlet(servlet);
-        }
-    
-        private EnterpriseBeanInfo getBeanFor(Class<?> fieldType) {
-    	return new EJBHelper().getBeanInfo(fieldType);
-        }
-    } 
-    
-
-
-This looks up deployed beans that match the field type, and uses reflection
-to set the field.
-
-<a name="FunctionaltestingwithOpenEJB,JettyandSelenium-WritingaFunctionaltest"></a>
-### Writing a Functional test
-
-We can now write a functional test. I use a base abstract class to make
-sure the Embedded server is running, and start Selenium:
-
-
-    public abstract class FunctionalTestCase extends TestCase {
-        protected DefaultSelenium selenium;
-    
-        protected void setUp() throws Exception {
-    	super.setUp();
-    	EmbeddedServer.getInstance();
-    	selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost:9091/");
-    	selenium.start();
-        }
-    
-        protected void tearDown() throws Exception {
-    	selenium.stop();
-        }
-    }
-
-
-and I can then I write a test like this:
-
-
-    public class AddPersonTest extends FunctionalTestCase {
-        public void testShouldAddAPerson() throws Exception {
-    	selenium.open("/People");
-    	selenium.type("firstname", "Jonathan");
-    	selenium.type("lastname", "Gallimore");
-            selenium.click("//input[@name='add' and @value='Add']");
-    	selenium.waitForPageToLoad("30000");
-    	selenium.type("filter", "gallimore");
-    	selenium.click("submit");
-    	selenium.waitForPageToLoad("30000");
-            assertEquals(1, selenium.getXpathCount("//div[@id='people']/ul/li").intValue());
-            assertEquals("Jonathan Gallimore", selenium.getText("//div[@id='people']/ul/li[1]"));
-    
-        }
-    } 
-
-
-<a name="FunctionaltestingwithOpenEJB,JettyandSelenium-Samplecode"></a>
-### Sample code
-
-I've made a sample project which demonstrates this, source is available [here](http://people.apache.org/~jgallimore/PersonApp.zip)
-. You'll need Maven to build it, and you can build it and run the tests by
-running 'mvn clean install'. If want to run the tests from your IDE, you'll
-need to have a Selenium server running, which you can do by running 'mvn
-selenium:start-server'.