@john:

you changed it to:

@Test
public void
testAmbiguousFileLookup(@ExternalResource(storage=ClasspathStorage.class,
location="META-INF/beans.xml") InputStream inputStream) {/*...*/}

-> the exception still occurs, but junit can't handle it any longer
(because it occurs too early).

regards,
gerhard



2013/12/29 John D. Ament <[email protected]>

> That's no big deal (& fixed).  I had to add a separate SE & WebProfile
> test since now we're checking for duplicates and the embedded/SE
> containers are picking up the target folders are bean archives (I hope
> TomEE embedded doesn't do this... >_< ).  Using method injection
> delays the injection, however we have a catch that /tmp must be your
> tmpdir (I haven't checked on windows yet, but I'm assuming c:/tmp
> should be fine..)
>
> @gerhard for some reason now your test doesn't throw a
> RuntimeException, but instead the injected instance is null.
>
> On Sun, Dec 29, 2013 at 6:18 AM, Mark Struberg <[email protected]> wrote:
> >
> >
> > Well, the explanation is not in the spec but in the JavaDoc.
> >
> > Compare
> >
> http://docs.jboss.org/cdi/api/1.0/javax/enterprise/inject/spi/InjectionPoint.html
> >
> > with the new wording in CDI-1.1
> >
> >
> http://docs.oracle.com/javaee/7/api/javax/enterprise/inject/spi/InjectionPoint.html
> >
> > I refer to the new sentence
> >
> > "If the injection point is a dynamically selected reference obtained
> then the metadata obtain reflects the injection point of the Instance, with
> the required type and any additional required qualifers defined by
> Instance.select()."
> >
> >
> > This theoretically should work in CDI-1.1 containers. Sadly there is no
> single implementation which implements this right now.
> > Weld does provide a synthetic InjectionPoint though, but it only
> contains the qualifiers and type of the select but misses all the
> information from the Instance<> injection.
> >
> >
> > As this is only needed for the test it might be a minor problem for us.
> Still thinking how we could improve this DeltaSpike test to not rely on
> this method.
> >
> >
> > Weld-folks, is there already a report on this in Weld, or should I
> create one?
> > I think the wording is clear, do we need to improve it in the CDI MR?
> >
> >
> > LieGrue,
> > strub
> >
> >
> > ----- Original Message -----
> >> From: John D. Ament <[email protected]>
> >> To: [email protected]; Mark Struberg <[email protected]>
> >> Cc:
> >> Sent: Saturday, 28 December 2013, 15:43
> >> Subject: Re: Fwd: Support of Instance<> in OWB
> >>
> >> Mark,
> >>
> >> Thanks for confirming.  I don't particularly see anything in 3.2 that
> >> clarifies this, but I'll take your word on it.
> >>
> >>
> >> On Fri, Dec 27, 2013 at 2:25 PM, Mark Struberg <[email protected]>
> wrote:
> >>>  Looked at it and did a few tests. And also checked what we have in the
> >> spec.
> >>>
> >>>  For CDI-1.0 containers a producer bean with an InjectionPoint should
> not be
> >> triggered manually. This is not required in CDI-1.0 (which OWB-1.2.x
> still is)
> >> but only got changed in CDI-1.1.
> >>>
> >>>  Please compare the JavaDocs of InjectionPoint for CDI-1.0 and 1.1 to
> see
> >> the difference.
> >>>
> >>>  I will nonetheless add it to OWB trunk as it is really useful feature.
> >>>
> >>>  thanks for the report!
> >>>  I've created OWB-921 for it.
> >>>
> >>>  LieGrue,
> >>>  strub
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>  ----- Original Message -----
> >>>>  From: Mark Struberg <[email protected]>
> >>>>  To: "[email protected]"
> >> <[email protected]>
> >>>>  Cc:
> >>>>  Sent: Friday, 27 December 2013, 17:45
> >>>>  Subject: Re: Fwd: Support of Instance<> in OWB
> >>>>
> >>>>
> >>>>
> >>>>  Thanks John, we will investigate!
> >>>>
> >>>>  LieGrue,
> >>>>  strub
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>  ________________________________
> >>>>
> >>>>>   From: John D. Ament <[email protected]>
> >>>>>  To: [email protected]
> >>>>>  Sent: Friday, 27 December 2013, 15:11
> >>>>>  Subject: Fwd: Support of Instance<> in OWB
> >>>>>
> >>>>>
> >>>>>  Hi all,
> >>>>>
> >>>>>  I'm cross-posting this from dev@deltaspike to see if anyone has
> >> any
> >>>>>  additional thoughts.
> >>>>>
> >>>>>
> >>>>>
> >>>>>  ---------- Forwarded message ----------
> >>>>>  From: John D. Ament <[email protected]>
> >>>>>  Date: Thu, Dec 26, 2013 at 10:36 PM
> >>>>>  Subject: Support of Instance<> in OWB
> >>>>>  To: [email protected]
> >>>>>
> >>>>>
> >>>>>  Hi all
> >>>>>
> >>>>>  I added a new test, FileResourceTest.  It fails in OWB, but passes
> >> in
> >>>>>  Weld.  AFAIK it's supposed to pass in both.
> >>>>>
> >>>>>  The one catch I noticed, since it has a similar test
> >>>>>  ClasspathResourceTest, is that I'm using Instances/literals vs
> >>>>>  annotations.  I need to use Instance since the actual file name is
> >>>>>  dynamic at runtime.  In the test right now, I have this:
> >>>>>
> >>>>>      @Inject
> >>>>>      @Any
> >>>>>      private Instance<InputStream> inputStreamInst;
> >>>>>
> >>>>>      @Inject
> >>>>>      @Any
> >>>>>      private Instance<Properties> propsInst;
> >>>>>
> >>>>>  and when I switch to this:
> >>>>>
> >>>>>      @Inject
> >>>>>      @ExternalResource(storage =
> >>>>>
> >> FileSystemStorage.class,location="/tmp/myconfig.properties")
> >>>>>      private InputStream inputStream;
> >>>>>
> >>>>>      @Inject
> >>>>>      @ExternalResource(storage =
> >>>>>
> >> FileSystemStorage.class,location="/tmp/myconfig.properties")
> >>>>>      private Properties props;
> >>>>>
> >>>>>  The test works fine (assuming I create the file).  I don't
> >> typically
> >>>>>  play with OWB that much, but this should be the right format for
> >>>>>  Instances, right?  Feedback is much appreciated.
> >>>>>
> >>>>>  Thanks,
> >>>>>
> >>>>>  John
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>
>

Reply via email to