[arquillian-issues] [JBoss JIRA] (ARQ-585) Support for adding a beans-test.xml without discarding the original beans.xml or seam-beans.xml
Geoffrey De Smet (Issue Comment Edited) (JIRA)
jira-events at lists.jboss.org
Mon Jan 9 04:56:14 EST 2012
[ https://issues.jboss.org/browse/ARQ-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654539#comment-12654539 ]
Geoffrey De Smet edited comment on ARQ-585 at 1/9/12 4:55 AM:
--------------------------------------------------------------
Good workaround:
There's a better way of making @Alternative usable for testing:
Don't use @Alternative, but use @Specializes. Just put the @Specializes bean only in your test classpath and it will automatically replace the real bean. No need to mess around with beans.xml.
Resolving this issue as "Deferred" because SHRINKDESC-6 will fix the @Alternative case mostly. Reopen if you don't agree.
was (Author: ge0ffrey):
Good workaround:
There's a better way of making @Alternative usable for testing:
Don't use @Alternative, but use @Specializes. Just put the @Specializes bean only in your test classpath and it will automatically replace the real bean. No need to mess around with beans.xml.
Resolving this issue as "Won't fix" because SHRINKDESC-6 will fix the @Alternative case mostly. Reopen if you don't agree.
> Support for adding a beans-test.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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the arquillian-issues
mailing list