Yep, I realized that after I sent the example. I'll have to wait to get
back to work to get the full example down to demo.
On Thu, Jul 4, 2013 at 4:39 AM, Martin Kouba <mkouba(a)redhat.com> wrote:
John, in fact the "HandlerTest" deployment archive is not a
CDI
deployment (final WAR does not contain a beans.xml file in its WEB-INF)
and so the Weld is not started at all and CDIInjectionEnricher just
fails (no BeanManager available).
Also I wouldn't use the ShrinkWrap JavaArchive (return type of
@Deployment method) if the default Arquillian protocol is "Servlet 3.0"
and the resulting deployment will surely be WebArchive - IMHO it's not
entirely clear what the structure of the resulting test deployment
should be (in your test case the deployment is added to the WEB-INF/lib
of the final deployment) and moreover Arquillian must do some more
"magic" (e.g. for WebArchive the BeansXMLProtocolProcessor adds empty
beans.xml to WEB-INF if the test deployment contains beans.xml but is
not WebArchive).
And finally I would also use
ManifestContainer.addAsServiceProvider(Class<?>, Class<?>...) instead of
addAsManifestResource() to add CDI extension...
M
Dne 4.7.2013 02:42, John D. Ament napsal(a):
> Ok, so I was able to reproduce my issue, but it doesn't match Aslak's
case.
>
>
https://github.com/johnament/cdifoo
>
> It's a very simple project. I used AS7 as my deployment container.
>
> In one test, I use beans.xml to autoregister the archive.
> That passes fine.
>
> In the other test, I don't use a beans.xml, instead I use
>
> public void addHandlers(@Observes BeforeBeanDiscovery bbd,BeanManager
> beanManager) {
>
> to register the classes in my archive. I even go the extra step of
> registering my interface and test case, just in case.
>
> Could you take a look at the project and let me know if you see
> something I did wrong?
>
> - John
>
>
> On Tue, Jul 2, 2013 at 9:46 AM, John D. Ament <john.d.ament(a)gmail.com
> <mailto:john.d.ament@gmail.com>> wrote:
>
> Yeah... Aslak's the one who brought this to my attention. It was
> something I saw happening in AS7 as well. Let me see if I can
> create a simple project that demos this.
>
>
> On Tue, Jul 2, 2013 at 9:18 AM, Pete Muir <pmuir(a)redhat.com
> <mailto:pmuir@redhat.com>> wrote:
>
> Yes, if you use @EJB, all bets are off :-) I was assuming John
> had an EJB that he wanted to @Inject.
>
> On 2 Jul 2013, at 14:13, Romain Manni-Bucau
> <rmannibucau(a)gmail.com <mailto:rmannibucau@gmail.com>> wrote:
>
> > Hi
> >
> > i think @EJB Foo<Bar> ignores Bar (or at least the ejb spec
doesnt define it)
> >
> > Romain Manni-Bucau
> > Twitter: @rmannibucau
> > Blog:
http://rmannibucau.wordpress.com/
> > LinkedIn:
http://fr.linkedin.com/in/rmannibucau
> > Github:
https://github.com/rmannibucau
> >
> >
> >
> > 2013/7/2 Pete Muir <pmuir(a)redhat.com <mailto:pmuir@redhat.com
>>
> >
> > On 2 Jul 2013, at 11:28, John D. Ament
<john.d.ament(a)gmail.com<mailto:
john.d.ament(a)gmail.com>> wrote:
> >
> > > Hi all
> > >
> > > In section 4.2 of the CDI spec (both 1.0 and 1.1) there are
references to injection around generic types. I was wondering if someone
could clarify this case?
> > >
> > > I have an interface:
> > >
> > > public interface Handler<? extends Foo> { ... }
> > >
> > > and then I have two implementations
> > >
> > > public class FarlowHandler implements Handler<Farlow> { ..
}
> > >
> > > public class BagelHandler implements Handler<Bagel> { ... }
> > >
> > > Is it expected that I should be able to inject references to
these by doing:
> > >
> > > @Inject
> > > private Handler<Farlow> fHandler;
> > >
> > > @Inject
> > > private Handler<Bagel> bHandler;
> >
> > Yes.
> >
> > >
> > > ? Is there any expected difference when using EJBs?
> >
> > Assuming the interface is part of the local client view of the
EJB, then no. Obviously, if EJB has any rules around declaring generic
types in local interfaces, then you need to respect those (IIRC, it
doesn't).
> >
> >
> > _______________________________________________
> > cdi-dev mailing list
> > cdi-dev(a)lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
> >
https://lists.jboss.org/mailman/listinfo/cdi-dev
> >
>
>
>
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/cdi-dev
>