|
From: Ove R. <ora...@gm...> - 2014-03-10 22:29:58
|
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
|
|
From: Ove R. <ora...@gm...> - 2014-03-11 10:24:53
|
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...> 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
>
|
|
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
|
|
From: Ove R. <ora...@gm...> - 2014-03-11 19:11:34
|
Hi Bill,
Well, at least it's lightweight and does not impose a container. Looking forward to the client adapter whenever you get a chance to make it.
Arquillian is great for its purpose, but the mock req/res is a great way to test.
Ove
Sent from my iPad
> On 11. mars 2014, at 13:56, Bill Burke <bb...@re...> wrote:
>
> 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
>
> ------------------------------------------------------------------------------
> 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
|