james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darrell DeBoer <darrell.deb...@mathiasco.co.uk>
Subject Re: [PATCH] JDBC-backed UsersRepository implementation.
Date Sun, 10 Jun 2001 18:58:49 GMT
Hi,

> I've got your UsersJDBCRepository up and working with mysql. Cool!
> I've committed AbstractUsersRepository, UsersJDBCRepository and
> mysql.jar.

So quickly...!

>
> However ... aliasing and forwarding doesn't seem to work. :-(
>

Hmmm... this was something I hadn't added to the tests yet, since it wasn't 
being used. When I added tests for this, 3 of the 4 database configurations 
passed (including MySQL with JDBC/ODBC) but MySQL with MM Jdbc driver failed. 
It seems like the Jdbc driver won't accept a PreparedStatement.setBoolean() 
call on a SMALLINT column (I use SMALLINT as a widely available boolean 
column type in SQL).

I've patched UsersJDBCRepository to use PreparedStatement.setInt() instead, 
and it seems to work OK. (Patch included). I'll submit the patch for the 
updated tests when/if they are added to cvs.

> I've added junit-3.2.jar (copied from jakarta-turbine) but I get a bunch
> of compile errors. Hence haven't committed testing classes yet. What
> exact version are you using?

Two reasons for failure:
1) I built this on the latest JUnit (v3.7) and somewhere along the line the 
method "assert(boolean)" was deprecated and replaced with 
"assertTrue(boolean)". We can either use the latest JUnit version, or replace 
"assertTrue" with "assert" in the source.

2) You need to add JUnit to the tools/lib directory, so ant can run the 
<junit> task. I guess ant then adds JUnit to the classpath for the <javac> 
target.

>(stdout-based) DefaultLogger.java
> WRT testlets, long-term they may be better but short term we can use
> anything.
> No idea on ComponentManager q, off hand.

Unfortunately, having getLogger() calls in UsersJDBCRepository causes the 
tests to return a null pointer exception, since the component isn't properly 
composed/configured. Where should I look to work out how to properly 
initialise a Component for testing? eg I'd like to have a simple Logger 
implementation to use for testing.

ciao
Daz

Index: 
proposals/v1.3/java/org/apache/james/userrepository/UsersJDBCRepository.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-james/proposals/v1.3/java/org/apache/james/userrepository/UsersJDBCRepository.java,v
retrieving revision 1.1
diff -r1.1 UsersJDBCRepository.java
87c87
< 	getLogger().debug("Loading driver :" + driverName);
---
>         getLogger().debug("Loading driver :" + driverName);
90c90
< 	    getLogger().info("Database driver " + driverName + " loaded");
---
> 	        getLogger().info("Database driver " + driverName + " loaded");
140c140
< 		getLogger().info("Created \'JamesUsers\' table.");
---
>                 getLogger().info("Created \'JamesUsers\' table.");
212c212
<         boolean useForwarding = user.getForwarding();
---
>         int useForwarding = user.getForwarding() ? 1 : 0 ; // boolean 
causes problems.
218c218
<         boolean useAlias = user.getAliasing();
---
>         int useAlias = user.getAliasing() ? 1 : 0 ;
230c230
<             addUserStatement.setBoolean(4, useForwarding);
---
>             addUserStatement.setInt(4, useForwarding);
232c232
<             addUserStatement.setBoolean(6, useAlias);
---
>             addUserStatement.setInt((stdout-based) 
DefaultLogger.java(stdout-based) DefaultLogger.java6, useAlias);
345c345
<         boolean useForwarding = user.getForwarding();
---
>         int useForwarding = user.getForwarding() ? 1 : 0 ; // boolean 
causes problems.
351c351
<         boolean useAlias = user.getAliasing();
---
>         int useAlias = user.getAliasing() ? 1 : 0 ;
362c362
<             updateUserStatement.setBoolean(3, useForwarding);
---
>             updateUserStatement.setInt(3, useForwarding);
364c364
<             updateUserStatement.setBoolean(5, useAlias);
---
>             updateUserStatement.setInt(5, useAlias);



---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Mime
View raw message