deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gpetra...@apache.org>
Subject Re: Location of beans.xml in maven war project when testing with CdiTestRunner
Date Tue, 15 Mar 2016 18:29:23 GMT
hi jens,

yes - ds-test-control is java-se based (including the possibility to use
e.g. mocked containers like myfaces-test).
however, to avoid duplication you can move WEB-INF/beans.xml to
META-INF/beans.xml (-> WEB-INF/classes/META-INF/beans.xml).
in case of weld-based servers which have issues with that, you can use a
corresponding build-config (with maven e.g. build/resources/...).

regards,
gerhard



2016-03-15 16:44 GMT+01:00 Jens Teglhus Møller <djarnis@gmail.com>:

> Hi
>
> I'm trying to get my environment setup correctly but keep running into
> having duplicated beans.xml
>
> I have junit tests that uses CdiTestRunner and for them to work I'm forced
> to have a beans.xml in src/main/resources/META-INF (it took me a while to
> figure out that I needed it there if I wanted to inject them in my unit
> test classes). I'm not doing any mocking.
>
> But since it is a webapp, the correct location is in WEB-INF/ so I need a
> copy there as well.
>
> The documentation for the Test-Control module states that I should put my
> beans.xml in src/test/resources/META-INF/beans.xml but if I do that I
> cannot inject my beans from src/main (I tried setting
> org.jboss.weld.se.archive.isolation
> to false but that did not help)
>
> Question is: Am I forced to have beans.xml in src/main/resources/META-INF
> if I want to run unit tests or am I doing something wrong?
>
> I'm running ds v1.5.4 and weld-se-core v2.3.3-Final.
>
> I have been googling for a while and did not find anything, any pointers
> are welcome.
>
> Best regards Jens
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message