public static WebArchive createJackrabbitCDI10Webapp ( ) { // extract the jackrabbit webapp final File jackrabbitWarFile = Maven . resolver ( ) . loadPomFromFile ( "pom.xml" ) . resolve ( "org.apache.jackrabbit:jackrabbit-webapp:war:?" ) . withTransitivity ( ) . asSingleFile ( ) ; // obtain the CDI1.0 compatible guava 15 jar final File guava15CDIJarFile = Maven . resolver ( ) . loadPomFromFile ( "pom.xml" ) . resolve ( "com.google.guava:guava:jar:cdi1.0:15.0" ) . withTransitivity ( ) . asSingleFile ( ) ; // get the custom web.xml final URL webXml = ScribbleShrinkwrapHelper . class . getResource ( "jackrabbit_webapp_web.xml" ) ; // create a patched war file with the custom web.xml and the guava jar final WebArchive jackrabbitWar = ShrinkWrap . createFromZipFile ( WebArchive . class , jackrabbitWarFile ) . setWebXML ( webXml ) . addAsLibraries ( guava15CDIJarFile ) ; // delete the incompatible guava jar jackrabbitWar . delete ( "/WEB-INF/lib/guava-15.0.jar" ) ; return jackrabbitWar ; }
Creates a Jackrabbit WebArchive for a CDI 1 . 0 container that may be deployed along with the web app under test . The jackrabbit web app uses a customized web . xml to provide a repository that is available as JNDI resource .