Interesting is the fact that if I "mock" the @Singleton bean by changing

@Inject // previously I was using @EJB
protected SystemPropertyBeanLocal propertyRegistry;

I create a new mock bean
@Stateless // @Startup
@Alternative // @Singleton
public class SystemPropertyBean implements SystemPropertyBeanLocal {...

And I define the <alternative> class in the bean.xml the test works.

That makes me suspect that there is something fishy somewhere


On Sat, Feb 23, 2013 at 11:28 AM, Luca Merolla <luca.mero...@gmail.com>wrote:

> I'll pack an example to reproduce the error but basically I have one bean
> which is very similar to the example from the TomEE Singleton
> documentation, I just dont have @ConcurrencyManagement(BEAN):
> https://tomee.apache.org/examples-trunk/simple-singleton/
>
> In my case I'm loading properties from a database and I'm adding them at
> the system properties on startup.
>
> The singleton bean gets injected and if I check
> the getDatabaseProperties().size() it works, so the DBUnit is loaded
> correctly.
> However, if I do getProperty(key) it always return null.
>
> I have thought that the applicationStartup() was not executed at the
> startup so I have tried to force that from the Arquillian test but the
> behaviour didn't change
>
> Here is my singleton bean class
>
> https://gist.github.com/lucamerolla/5019229
>
>
>
>
>
> On Sat, Feb 23, 2013 at 10:57 AM, Romain Manni-Bucau <
> rmannibu...@gmail.com> wrote:
>
>> Hi Luca,
>>
>> It works, what's the error?
>> Le 23 févr. 2013 10:54, "Luca Merolla" <luca.mero...@gmail.com> a écrit :
>>
>> > Hi all,
>> >
>> > are @Singleton and @Startup annotations working with Arquillian and
>> TomEE
>> > embedded.
>> > I have been testing for a while and the only beans that are causing me
>> > problems are the ones annotated with these two annotations.
>> >
>> > Is there something that I need to add, or simply it is not supported at
>> > that stage by Arquillian?
>> >
>> > Thanks in advance,
>> > Luca
>> >
>>
>
>
>
> --
>   *Luca Merolla*
> Management, Business & Technology Consultant
>
>
>  <http://maps.google.com/maps?q=&hl=en>  *Mobile:* +393774569974
> *Email:* l...@merollaconsulting.com
>  *www.linkedin.com/in/lucamerolla*
> *Website <http://www.merollaconsulting.com>*
>
>
> Merolla Consulting Limited
>



-- 
  *Luca Merolla*
Management, Business & Technology Consultant


 <http://maps.google.com/maps?q=&hl=en>  *Mobile:* +393774569974
*Email:* l...@merollaconsulting.com
 *www.linkedin.com/in/lucamerolla*
*Website <http://www.merollaconsulting.com>*


Merolla Consulting Limited

Reply via email to