Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-585

Support for adding a beans-test.xml without discarding the original beans.xml or seam-beans.xml

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Do
    • Critical
    • None
    • None
    • None
    • None

    Description

      Presume these 2 beans.xml files:

      Production code: beans.xml:

      <beans xmlns="http://java.sun.com/xml/ns/javaee" ...>
        <!-- 100 lines that change regularly during development -->
      </beans>
      

      Test addition: test-beans.xml:

      <beans xmlns="http://java.sun.com/xml/ns/javaee" ...>
        <alternatives>
          <class&gt;org.drools.guvnor.server.repository.TestRepositoryStartupService</class&gt;
        </alternatives>
      </beans>
      

      Now, for non-test runs (such as in the IDE or in production), only the beans.xml is activated through weld and the test-only alternative should not be activated.
      For test runs, the test-only alternative should be activated, yet the rest of the content from beans.xml should be in there too.
      So it should be merged to something like this:

      <beans xmlns="http://java.sun.com/xml/ns/javaee" ...>
        <!-- 100 lines that change regularly during development -->
        <alternatives>
          <class&gt;org.drools.guvnor.server.repository.TestRepositoryStartupService</class&gt;
        </alternatives>
      </beans>
      

      It would be nice if we do something like mergeAsResource(), shown in this example:

          public static WebArchive createDeployment() {
              WebArchive webArchive = ShrinkWrap.create(ExplodedImporter.class, "guvnor-webapp-5.3.0-SNAPSHOT.war")
                      .importDirectory(new File("target/guvnor-webapp-5.3.0-SNAPSHOT/"))
                      .as(WebArchive.class)
                      .mergeAsResource(new File("target/test-classes/META-INF/test-beans.xml"), "META-INF/beans.xml")
                      .addAsResource(new File("target/test-classes/"), ArchivePaths.create(""))
                      .addAsLibraries(
                              DependencyResolvers.use(MavenDependencyResolver.class)
                                      .includeDependenciesFromPom("pom.xml")
                                      .resolveAsFiles(new ScopeFilter("test")));
              return webArchive;
          }
      

      Because of maintenance, copying everything from beans.xml to test-beans.xml on every change to beans.xml is NOT an option.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: