It you are willing to ditch the ra.xml file from your testing, you can use a
service.xml to define your resource adapter for openejb and then use an
InitialContext property to define the resource adapter via that
service.xml...

Other than that I gave up after much hacking

On 6 April 2010 14:05, Laird Nelson <ljnel...@gmail.com> wrote:

> I have a Maven 2 rar project.  The rar project itself is "empty" except for
> its ra.xml file; it pulls in the actual resource adapter by way of Maven
> dependencies.  I understand from the Maven guys that this is the way to do
> it.
>
> Now I'm faced with figuring out how to test this thing.  I would like to
> add
> a test case in the rar project that gets annotated with the @LocalClient
> annotation, but now I have (apparently) an OpenEJB quandary.
>
> The quandary is this: to get my test case discovered by OpenEJB, I've
> put--in src/test/resources/META-INF--an ejb-jar.xml file that is empty
> except for the <ejb-jar/> element.  This has worked just fine in other
> OpenEJB-using tests I've done in the past.
>
> The problem now is that the rar project is not actually built--that is, my
> test has to pass before the .rar file will be assembled (after all, that's
> what a unit test is for).  So using some Maven hackery I manage to make the
> src/main/rar/META-INF/ra.xml file show up in the test classpath.
>
> If you're keeping score, OpenEJB can now see a META-INF directory with
> *both* an ejb-jar.xml and an ra.xml file in there.
>
> As it turns out, OpenEJB discovers the ejb-jar.xml file, and, apparently
> satisfied that its discovery is complete, stops right there and doesn't
> pick
> up the ra.xml.
>
> Is there a way to tell OpenEJB in a Maven unit test setting that it should
> look for BOTH the ejb-jar.xml file (i.e. find the @LocalClient test) AND
> the
> ra.xml (i.e. realize that there's an exploded rar that should be deployed?
>
> Thanks,
> Laird
>

Reply via email to