This project demonstrates the use of the Asciidoctor Java integration library in a Servlet. The integration is bootstrapped and configured in an application-scoped CDI bean. The Servlet then invokes that bean to render the AsciiDoc source submitted from a web form.
All of the functionality is tested by Arquillian.
-
Import the project into your IDE
-
Run the project on a Java EE 6 server (e.g., GlassFish 3.1.2)
-
Submit the form to see the HTML Asciidoctor generates from the AsciiDoc source
Warning
|
At the moment, the Asciidoctor Java integration does not work in some modular environments, such as Wildfly (i.e., JBoss AS 7). The Asciidoctor team is exploring this issue and will update these instructions once a solution is found. |
You can also deploy demo to Tomcat 7 server.
-
Start your Tomcat server
-
Run mvn clean install tomcat7:deploy -Ptomcat
-
Submit the form to see the HTML Asciidoctor generates from the AsciiDoc source
The tests are configured to run in GlassFish. If there is a GlassFish server already running, Arquillian will use that one. Otherwise, you need to specify the path to your GlassFish installation in [path]'src/main/resources/arquillian.xml'
Tip
|
If your GlassFish installation is located at [path]'${user.home}/opt/glassfish', no configuration is required. |
Once GlassFish is ready to go, simply run the tests using the normal Maven test goal:
$ mvn test
There tests are run:
- AsciidoctorProcessorInContainerTest
-
An in-container Arquillian test that tests the AsciidoctorProcessor CDI bean
- AsciidoctorServletDroneTest
-
A WebDriver test, orchestrated by Arquillian Drone, that tests the web UI using Firefox
- AsciidoctorServletWarpTest
-
An Arquillian Warp test that tests the web UI and Servlet simultaneously
Note
|
You may notice that the tests run quite slowly. That delay is due to the fact that JRuby has to bootstrap for each new deployment. You can make JRuby boot quicker by setting the JRUBY_OPTS environment variable, as shown below, in the terminal where you start GlassFish. $ export JRUBY_OPTS="-client -J-Xverify:none -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1" |