[arquillian-issues] [JBoss JIRA] Created: (ARQ-585) Support for adding a beans.xml without discarding the original beans.xml with .mergeAsResource()

Geoffrey De Smet (JIRA) jira-events at lists.jboss.org
Mon Sep 12 05:21:26 EDT 2011


Support for adding a beans.xml without discarding the original beans.xml with .mergeAsResource()
------------------------------------------------------------------------------------------------

                 Key: ARQ-585
                 URL: https://issues.jboss.org/browse/ARQ-585
             Project: Arquillian
          Issue Type: Enhancement
      Security Level: Public (Everyone can see)
            Reporter: Geoffrey De Smet
            Priority: Critical


Presume these 2 beans.xml files:

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

Test addition: test-beans.xml:
{code}
<beans xmlns="http://java.sun.com/xml/ns/javaee" ...>
  <alternatives>
    <class>org.drools.guvnor.server.repository.TestRepositoryStartupService</class>
  </alternatives>
</beans>
{code}

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:
{code}
<beans xmlns="http://java.sun.com/xml/ns/javaee" ...>
  <!-- 100 lines that change regularly during development -->
  <alternatives>
    <class>org.drools.guvnor.server.repository.TestRepositoryStartupService</class>
  </alternatives>
</beans>
{code}

It would be nice if we do something like mergeAsResource(), shown in this example:
{code}
    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;
    }
{code}

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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the arquillian-issues mailing list