}
@Deployment
public static Archive<?> deploy() throws Exception {
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, ARCHIVE_NAME + ".ear");
addHibernate3JarsToEar(ear);
JavaArchive lib = ShrinkWrap.create(JavaArchive.class, "beans.jar");
lib.addClasses(SFSB1.class, HttpRequest.class);
ear.addAsModule(lib);
lib = ShrinkWrap.create(JavaArchive.class, "entities.jar");
lib.addClasses(Employee.class);
lib.addAsManifestResource(new StringAsset(persistence_xml), "persistence.xml");
ear.addAsLibraries(lib);
final WebArchive main = ShrinkWrap.create(WebArchive.class, "main.war");
main.addClasses(Hibernate3EmbeddedProviderNullDataSourceTestCase.class);
ear.addAsModule(main);
// add war that contains its own pu
WebArchive war = ShrinkWrap.create(WebArchive.class, ARCHIVE_NAME + ".war");
war.addClasses(SimpleServlet.class, WebLink.class);
war.addAsResource(new StringAsset(web_persistence_xml), "META-INF/persistence.xml");
war.addAsWebInfResource(
new StringAsset("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"\n" +
"<web-app version=\"3.0\"\n" +
" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd\"\n" +
" metadata-complete=\"false\">\n" +
"<servlet-mapping>\n" +
" <servlet-name>SimpleServlet</servlet-name>\n" +
" <url-pattern>/simple/*</url-pattern>\n" +
" </servlet-mapping>\n" +
"</web-app>"),
"web.xml");
ear.addAsModule(war);
// add application dependency on H2 JDBC driver, so that the Hibernate classloader (same as app classloader)
// will see the H2 JDBC driver.
// equivalent hack for use of shared Hiberante module, would be to add the H2 dependency directly to the
// shared Hibernate module.
// also add dependency on org.slf4j
ear.addAsManifestResource(new StringAsset(
"<jboss-deployment-structure>" +
" <deployment>" +
" <dependencies>" +
" <module name=\"com.h2database.h2\" />" +
" <module name=\"org.slf4j\"/>" +