Пример #1
0
 /**
  * Create a basic deployment containing API classes, the Extension class and test persistence /
  * beans descriptor.
  *
  * @return Basic web archive.
  */
 public static WebArchive initDeployment() {
   Logging.reconfigure();
   return ShrinkWrap.create(WebArchive.class, "test.war")
       .addClasses(QueryExtension.class)
       .addPackage(DaoComponents.class.getPackage())
       .addPackage(QueryBuilder.class.getPackage())
       .addAsWebInfResource(
           "test-persistence.xml", ArchivePaths.create("classes/META-INF/persistence.xml"))
       .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
       .addAsWebInfResource("glassfish-resources.xml");
   // TODO: Adding the datasource was somehow refusing to work with arquillian.xml.
   // Switched to web deployment for the time being.
 }
Пример #2
0
  /**
   * Create a basic deployment containing API classes, the Extension class and test persistence /
   * beans descriptor.
   *
   * @return Basic web archive.
   */
  public static WebArchive initDeployment(String testFilter) {
    Logging.reconfigure();
    WebArchive archive =
        ShrinkWrap.create(WebArchive.class, "test.war")
            .addAsLibrary(createApiArchive())
            .addClasses(QueryExtension.class)
            .addClasses(TransactionalTestCase.class)
            .addPackages(true, TEST_FILTER, createImplPackages())
            .addPackages(true, AuditedEntity.class.getPackage())
            .addPackages(
                true, new ExcludeRegExpPaths(testFilter), TransactionalTestCase.class.getPackage())
            .addAsResource(
                "test-settings.properties", ArchivePaths.create("test-settings.properties"))
            .addAsWebInfResource(
                classpathResource("test-persistence.xml", "META-INF/persistence.xml"),
                ArchivePaths.create("classes/META-INF/persistence.xml"))
            .addAsWebInfResource(
                "META-INF/services/javax.enterprise.inject.spi.Extension",
                ArchivePaths.create(
                    "classes/META-INF/services/javax.enterprise.inject.spi.Extension"))
            .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));

    return addDependencies(archive);
  }