[webbeans-dev] TCK- Event Tests

Gurkan Erdogdu gurkanerdogdu at yahoo.com
Fri Mar 13 14:19:12 EDT 2009


We are using this. But in tests, for example below test in the Event Test, this fails. Because, there are multiple implicit event beans are registered with the manager with the same types.

Because some of the test classes have same event firing fields, namely @Fires Event<String>. So the resolution finds more than one bean throwing
theAmbigiousDependencyException.


   @Test(groups = { "events" })
   @SpecAssertion(section = "7.6", id = "p")
   public void testImplicitEventBeanHasDependentScope() throws Exception
   {
      new RunInDependentContext()
      {
         @Override
         protected void execute() throws Exception
         {
            // Retrieve the implicit event bean from the manager only
            // by its API type (uses BlueFacedParrotFinch)
           Set<?> eventBeans = getCurrentManager().resolveByType(Event.class, new FiresBinding());
            assert eventBeans.size() == 1;
            Bean<?> eventBean = (Bean<?>) eventBeans.iterator().next();
            assert eventBean.getScopeType().equals(Dependent.class);
         }
      }.run();
   }




________________________________
From: Gavin King <gavin at hibernate.org>
To: Gurkan Erdogdu <gurkanerdogdu at yahoo.com>
Cc: webbeans-dev at lists.jboss.org
Sent: Friday, March 13, 2009 12:56:55 AM
Subject: Re: [webbeans-dev] TCK- Event Tests

Use TypeLiteral.

On Thu, Mar 12, 2009 at 6:48 PM, Gurkan Erdogdu <gurkanerdogdu at yahoo.com> wrote:
> Hi;
>
> When @Fires annotation exist in the field of the bean, there is an implicit
> bean and indeed this bean must be added to the Manager. But then
> how to differentiate  beans with the same API type (Event class) and Binding
> Type?
>
> For example;
>
> Class A{
>   @Fires Event<X> x;
> }
>
> Class B{
>  @Fires Event<Y> y;
> }
>
> In the tests using the resolveByType(Event.class, new FiresBinding(){}).
>
> But in this case it throws the AmbigiousDependencyException. How could we
> resolve this? Or we understood wrongly;
>
> Thanks;
>
> Gurkan
>
>
>
> _______________________________________________
> webbeans-dev mailing list
> webbeans-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/webbeans-dev
>
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20090313/9331f26b/attachment.html 


More information about the weld-dev mailing list