[shrinkwrap-issues] [JBoss JIRA] (SHRINKDESC-115) Descriptors 2.0 module creates duplicate <alternatives/> entries (test case attached)

Andrew Rubinger (JIRA) jira-events at lists.jboss.org
Mon May 7 03:51:18 EDT 2012


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

Andrew Rubinger commented on SHRINKDESC-115:
--------------------------------------------

Keep in mind that the notion of "getOrCreate" as an API is likely to change to be more clear in the API refactoring of SWD 2.0 in parallel with SHRINKDESC-116 and SHRINKDESC-21 (prototype work-in-progress in upstream/SHRINKDESC-21).
                
> Descriptors 2.0 module creates duplicate <alternatives/> entries (test case attached)
> -------------------------------------------------------------------------------------
>
>                 Key: SHRINKDESC-115
>                 URL: https://issues.jboss.org/browse/SHRINKDESC-115
>             Project: ShrinkWrap Descriptors
>          Issue Type: Bug
>         Environment: java version "1.7.0_01"
> Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
> Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)
> Linux ayaki.localdomain 3.3.0-4.fc16.x86_64 #1 SMP Tue Mar 20 18:05:40 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
>            Reporter: Craig Ringer
>            Assignee: Ralf Battenfeld
>              Labels: alternative, arquillian, beans, beans.xml, descriptors, shrinkwrap
>         Attachments: ArquillianShrinkwrapDuplicateAlternatives.zip
>
>
> Using: org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-impl-javaee:jar:2.0.0-alpha-2
> The attached test case produces an invalid beans.xml with a duplicate <alternatives/> entry with the code:
> {code}
>         BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
>                 .from(new File("src/main/webapp/WEB-INF/beans.xml"))
>                 .getOrCreateAlternatives();
> {code}
> 'getOrCreate' is in fact always creating an alternatives entry, so the following beans.xml is produced in the example:
> {code}
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
> <alternatives>
>            <alternative>com.example.shrinkwraptestskeleton.Production</alternative>
>   </alternatives>
>   <alternatives/>
> </beans>
> {code}
> The produced beans.xml descriptor fails at deployment time with:
> org.jboss.weld.exceptions.DefinitionException: WELD-001203 <alternatives> can only be specified once, but appears multiple times:  vfs:/content/demo.jar/META-INF/beans.xml at 6
> Also: Since there can only ever be one <alternatives/> block, it's not clear what the difference between getOrCreateAlternatives() and createAlternatives() is. Is the latter supposed to *replace* any existing block?
> The API for managing alternatives is in Descriptors 2.0 is IMO difficult to use and understand. Issues with examples pending.

--
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 shrinkwrap-issues mailing list