Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 69683 invoked from network); 1 Sep 2009 01:10:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Sep 2009 01:10:42 -0000 Received: (qmail 60589 invoked by uid 500); 1 Sep 2009 01:10:41 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 60556 invoked by uid 500); 1 Sep 2009 01:10:41 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 60548 invoked by uid 99); 1 Sep 2009 01:10:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2009 01:10:41 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rickcr@gmail.com designates 209.85.218.208 as permitted sender) Received: from [209.85.218.208] (HELO mail-bw0-f208.google.com) (209.85.218.208) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2009 01:10:33 +0000 Received: by bwz4 with SMTP id 4so3471805bwz.0 for ; Mon, 31 Aug 2009 18:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=AxxBqaDBKSveQ36EH90ngSSfp4d//qKUNaYqNOGpjb4=; b=W/wSAYHUQaGXxnl6UZ9o16rpiBgCbRWG3qCdJR3X9XkxwKXkrEc1c8lOcdkLzwFJ2q HlILsM0B/hlaQyusv7D3dYe4C0B9X22JwVFf3tOO+Ukq5VU2g6XwXblGykQ8kjB4TX2k A7gYppLBUlmULESiBd+oo0wpwqAhFC1PPev+8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=emYZIx8LPZBbe1KF1hE7JlbN4y6gBm6eVOe+RVh2/hv/AXpX23lbnRQjYBl/mBu6nc KraLC0f9UCuBQnNJOM1WPEL2k9VbnN9ttbfsT6uWcys9ONhEuCkipX5jxiMcZA89Ur0E AT1tX/HAUiZHPGjxk9zZozbmFrqpi5VDIKRY8= MIME-Version: 1.0 Received: by 10.204.34.203 with SMTP id m11mr4917226bkd.79.1251767411502; Mon, 31 Aug 2009 18:10:11 -0700 (PDT) In-Reply-To: <25220912.post@talk.nabble.com> References: <25167237.post@talk.nabble.com> <583d4dff0908271147pe145bb0u6830f90ab63836f2@mail.gmail.com> <25220912.post@talk.nabble.com> Date: Mon, 31 Aug 2009 21:10:11 -0400 Message-ID: <583d4dff0908311810u7e1cff3t75c5faa41bbe6236@mail.gmail.com> Subject: Re: Maven and iBatis 3.0 - Excuse me for the stupid question From: Rick To: user-java@ibatis.apache.org Content-Type: multipart/alternative; boundary=00032555a272e76d54047279cf9f X-Virus-Checked: Checked by ClamAV on apache.org --00032555a272e76d54047279cf9f Content-Type: text/plain; charset=ISO-8859-1 On Mon, Aug 31, 2009 at 5:57 AM, Richard Bibb wrote: > > I'm not running separate sql during test and real. My problem comes from > the > fact that I'm trying to use iBatis to set my test data up proior to running > the real code. (i.e. in the @BeforeClass part of my unit test). The issue I > have is that during testing the resources seem to get loaded from > src/test/resources and when running normally from src/main/resources. This > means that the .xml files for the "real" code do not seem to be seen when I > run my tests > > Can you paste your pom.xml? I only have my mapper.xm files in src/main/resources/ and they are read fine by main src daos during tests. I'm no maven expert so I 'think' (and someone correct me if I'm wrong), your src/main/resources always get compiled into your main classes directory (even during tests.) The test/resources are available on the classpath during testing but are obviously not compiled into your final build. Are you absolutely certain that it's the xml file it's not finding and not something else? To prove it's the xml it's not finding, take one of your xml queries and make it as annotation on the Mapper class select itself. The run your test that calls a dao that uses that mapper. I think it'll help if you paste a screen shot of your exploded directory structure and your pom. > It's quite possible that I have something wrong here in my configuration. > Maybe a better question would have been "How do you unit test your iBatis > code if you use Maven?" > > I just create some Test classes that call my service classes or daos that are part of the src/main tree and they work. If you need more help let me know. --00032555a272e76d54047279cf9f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Mon, Aug 31, 2009 at 5:57 AM, Richard= Bibb <richard.bibb@aimhedge.com> wrote:

I'm not running separate sql during test and real. My problem comes fro= m the
fact that I'm trying to use iBatis to set my test data up proior to run= ning
the real code. (i.e. in the @BeforeClass part of my unit test). The issue I=
have is that during testing the resources seem to get loaded from
src/test/resources and when running normally from src/main/resources. This<= br> means that the .xml files for the "real" code do not seem to be s= een when I
run my tests


Can you paste your pom.xml? I only have my mapper= .xm files in src/main/resources/ and they are read fine by main src daos du= ring tests. I'm no maven expert so I 'think' (and someone corre= ct me if I'm wrong), your src/main/resources always get compiled into y= our main classes directory (even during tests.) The test/resources are avai= lable on the classpath during testing but are obviously not compiled into y= our final build.

Are you absolutely certain that it's the xml file it's not find= ing and not something else? To prove it's the xml it's not finding,= take one of your xml queries and make it as annotation on the Mapper class= select itself. The run your test that calls a dao that uses that mapper. <= br>
I think it'll help if you paste a screen shot of your exploded dire= ctory structure and your pom.
=A0
It's quite possible that I have something wrong here in my configuratio= n.
Maybe a better question would have been "How do you unit test your iBa= tis
code if you use Maven?"

=A0
I just create some Test = classes that call my service classes or daos that are part of the src/main = tree and they work. If you need more help let me know.
--00032555a272e76d54047279cf9f--