Re: Very Confused.

2005-05-17 Thread Matt Raible
I've created a couple of web applications designed to help you get  
started using frameworks like iBATIS quickly.

http://equinox.dev.java.net
http://appfuse.dev.java.net
Let me know if you'd like me to build one with a particular web  
framework (Struts, JSF, Spring, WebWork or Tapestry) and I'll upload it  
for you (or provide a link).

Matt
On May 17, 2005, at 12:08 PM, Dave Guzda wrote:
Hello,
 
I'm trying to get *anything* to work with the iBatis setup and I'm  
having very little success...
 
I've tried to follow the tutorial and setup the PetStore example but  
nothing runs for me. I'm sure it is some sort of configuration  
issue...
 
I'm very new to Java ... so I'm sure that isn't helping. (Other  
applets and .java files do successfully access my database)
 
When I try to enter the store (JPetStore) I get : 

HTTP Status 400 - Invalid path /pet/shop/index was requested
I also tried the example from this mailing list found here. It also  
won't run for me.
http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/ 
msg01759.html
 
Any guidance would be greatly appreciated.
 
Dave
 


Re: JDBCRealm using iBATIS?

2005-03-17 Thread Matt Raible
FWIW, I recently switched from using container-managed security (i.e. 
JDBCRealm in Tomcat) to using Acegi Security and it's working great so 
far.  Not only is it portable between app servers, but it allows you to 
easily plugin in your own authentication provider.

Matt
On Mar 17, 2005, at 8:24 AM, Brett Gorres wrote:
Brandon:
 
- ability to potentially switch db connection parameters in only one 
ibatis database.properties file (don't repeat yourself)
 
- ability to change your user auth data model in one ibatis XML file 
instead of potentially multiple web.xml files
 
- wouldn't this provide good inversion of control / dependency 
injection: if the realm implementation itself were configurable, 
you'd presumably tweak that realm implementation in one place (if, for 
example, you wanted to temporarily read in user information from an 
XML file during db maintenance.)  Your ibatis realm implementation may 
be a singleton used by more than one app--and you could get away with 
configuring that in only one spot if that's what floats your boat...
 
It seems worthwhile to me--in fact I had already considered doing 
something like this...
But I wasn't using Tomcat at the time.  My only reservation is that I 
would be more likely to develop and use something like this if it were 
made to be portable across Java app servers.
 
Agree? Disagree?
 
-Brett

Brandon Goodin [EMAIL PROTECTED] wrote:
i don't see why you would need to use ibatis for that. If you wanted
to you could write a Realm implementation that took advantage of
ibatis... but, why?
Brandon
On Thu, 17 Mar 2005 15:37:03 +, Tim Christopher
wrote:
 Hi,

 Can anyone let me know if it is possible to use iBATIS for
 implementing JDBCRealm, or do I have to access the database directly?

 I've looked on Google and in the Developer Notes for iBATIS and have
 found nothing on this topic.

 Any help would be much appreciated.

 Tim Christopher




Re: JDBCRealm using iBATIS?

2005-03-17 Thread Matt Raible
On Mar 17, 2005, at 10:47 AM, Brett Gorres wrote:
Does anyone know enough to recommend the (new?) apress
Spring book?  As I recall, there may be a section on
Spring in the aforementioned Wiley book, but I haven't
taken time to work through it.
Sorry, you gave me quite an opportunity to plug Spring Live 
(www.springlive.com).  It has lots of code samples, is updated monthly 
and will have a new chapter published on Acegi at the end of this 
month.  Of course, it shows how to use iBATIS with Spring too. ;-)

Matt


Re: Dao unit testing?

2005-02-10 Thread Matt Raible
AppFuse uses DBUnit and you can install iBATIS instead of Hibernate 
(the default).

http://appfuse.dev.java.net
Hope this helps,
Matt
On Feb 10, 2005, at 8:41 AM, Nathan Maves wrote:
I have been trying for two day to get DBunit to work with only partial 
success.  The support for this project is nonexistent.  Anyone know of 
a more supported project or have any experience with this one?  How do 
most of you test your database layer?

Nathan



Re: Dao unit testing?

2005-02-10 Thread Matt Raible
Here's what I've used in the past.
protected void setUp() throws Exception {
DataSource ds = (DataSource) ctx.getBean(dataSource);
conn = new DatabaseConnection(ds.getConnection());
dataSet = new XmlDataSet(new  
FileInputStream(test/data/sample-data.xml));
// clear table and insert only sample data
DatabaseOperation.CLEAN_INSERT.execute(conn, dataSet);
}

protected  void tearDown() throws Exception {
// clear out database
DatabaseOperation.DELETE.execute(conn, dataSet);
conn.close();
conn = null;
}
In most cases, I've found using the Ant tasks is easier - then you can  
load up your database for a whole suite of tests, or just a single test  
- rather than each test re-loading the database.

Matt
On Feb 10, 2005, at 9:44 AM, Nathan Maves wrote:
Kris,
I am really close to getting everything to work with dbunit.   
Everything works fine from an Ant task. I created my first Junit test  
and this is where the trouble started.

public class UserDaoTest extends DatabaseTestCase {
private static Log log = LogFactory.getLog(UserDaoTest.class);
private DaoManager daoManager = DaoConfig.getDaomanager();
private UserDao userDao = (UserDao)  
daoManager.getDao(UserDao.class);
public UserDaoTest(String testName) {
super(testName);
}

protected IDatabaseConnection getConnection() throws Exception {
log.debug(Creating Connection);
Properties props =  
Resources.getResourceAsProperties(giveservice/resources/ 
database.properties);
SimpleDataSource dataSource = new SimpleDataSource(props);
IDatabaseConnection connection = new  
DatabaseDataSourceConnection(dataSource);
DatabaseConfig config = connection.getConfig();
 
config.setFeature(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, true);
return connection;
}

protected IDataSet getDataSet() throws Exception {
log.debug(Read DataSet);
return new  
XmlDataSet(Resources.getResourceAsStream(dbunit/GST_USERS.xml));
}

testMothods.
}
Everything runs fine but I can never see the data that should get  
inserted into the db.  Hence all of my test fail!

Does everything look ok to you?
Can you send me any example that is like this?
Nathan
On Feb 10, 2005, at 8:56 AM, Kris Jenkins wrote:
Nathan Maves wrote:
I have been trying for two day to get DBunit to work with only  
partial success.  The support for this project is nonexistent.   
Anyone know of a more supported project or have any experience with  
this one?  How do most of you test your database layer?
I use DBunit, and I'm happy with it.  Have you seen this onjava  
article?

   http://www.onjava.com/pub/a/onjava/2004/01/21/dbunit.html
It got me started pretty quickly.  I could send you some sample files  
from one of my projects if you like, but you'll find that that  
article is much better documented. :-)

Hope that helps,
Kris
--
Kris Jenkins
Email:  [EMAIL PROTECTED]
Blog:   http://cafe.jenkster.com/
Wiki:   http://wiki.jenkster.com/