|
From: Bill B. <bb...@re...> - 2014-03-11 12:57:03
|
Our mock framework sucks...Sorry its so horrible. I've been meaning to
write an in-memory Client adapter for a LOOONNNNG time just never got
around to it.
On 3/11/2014 6:24 AM, Ove Ranheim wrote:
> Reading RESTEasy sources is always a great thing!
>
> With Narayana JTA.
>
> // Bind BeanManager to JNDI
> NAMING_BEAN.getNamingInstance().createSubcontext(new
> NamingParser().parse("app"));
> InitialContext context = new InitialContext();
> context.bind("java:app/BeanManager",
> BeanManagerProvider.getInstance().getBeanManager());
>
> // Register CdiInjectorFactory
> Dispatcher dispatcher = MockDispatcherFactory.createDispatcher();
> dispatcher.getProviderFactory().setInjectorFactory(new
> CdiInjectorFactory());
>
> Now it works like a charm.
>
> Cheers,
> Ove
>
>
> On 10 Mar 2014, at 23:29, Ove Ranheim <ora...@gm...
> <mailto:ora...@gm...>> wrote:
>
>> Hi,
>>
>> I'm trying out the RESTEasy Mock framework, but POJOResourceFactory
>> fails with CDI.
>>
>> POJOResourceFactory noDefaults = new
>> POJOResourceFactory(RestUserServiceImpl.class);
>> dispatcher.getRegistry().addResourceFactory(noDefaults);
>>
>> org.jboss.resteasy.spi.UnhandledException:
>> java.lang.NullPointerException
>> at
>> com.parts.profile.test.rest.user.RestUserServiceImpl.getUser(RestUserServiceImpl.java:38)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> Does RESTEasy support CDI in mock?
>>
>> Cheers,
>> Ove
>>
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
>
>
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|