[arquillian-issues] [JBoss JIRA] Issue Comment Edited: (ARQ-585) Support for adding a test-beans.xml without discarding the original beans.xml or seam-beans.xml

Geoffrey De Smet (JIRA) jira-events at lists.jboss.org
Fri Sep 30 03:20:26 EDT 2011


    [ https://issues.jboss.org/browse/ARQ-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12631475#comment-12631475 ] 

Geoffrey De Smet edited comment on ARQ-585 at 9/30/11 3:18 AM:
---------------------------------------------------------------

Working workaround (hack actually):
Put the real beans.xml in
  src/main/resources/META-INF/beans.xml
Make sure there is no src/main/webapp/WEB-INF/beans.xml
put the test beans.xml somewhere, for example
  src/test/resources/META-INF/beans.xml
then add this to @Deployment:
  .addAsWebInfResource(new File("target/test-classes/META-INF/beans.xml"), ArchivePaths.create("beans.xml"))

Note: if you have this problem too and this workaround works for you, then still vote for this issue anyway.


      was (Author: ge0ffrey):
    Working workaround:
Put the real beans.xml in
  src/main/resources/META-INF/beans.xml
Make sure there is no src/main/webapp/WEB-INF/beans.xml
put the test beans.xml somewhere, for example
  src/test/resources/META-INF/beans.xml
then add this to @Deployment:
  .addAsWebInfResource(new File("target/test-classes/META-INF/beans.xml"), ArchivePaths.create("beans.xml"))

Note: if you have this problem too and this workaround works for you, then still vote for this issue anyway.

  
> Support for adding a test-beans.xml without discarding the original beans.xml or seam-beans.xml
> -----------------------------------------------------------------------------------------------
>
>                 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