unit testing dao etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
unit testing dao etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

18 Ekim 2009 Pazar

unit testing dao with actual postgre db settings

the environment is netbeans 6.5 ide, postgre db, junit for unit testing..
when i try to execute unit tests over postgre, i get the following error:
3196 [main] FATAL org.hibernate.connection.DatasourceConnectionProvider  - Could not find datasource: blshilaltarakci
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
....

i think the reason for this is the lack of jndi properties file. when the project is deployed to any server, the server mostly already has a jndi properties file and this is not a problem..  ( i think..) in my case, there is no jndi properties file in classpath, since the (dao) project is not deployed to server in the time of testing.. 
so, i moved back to unit testing using an in memory database..

Edit on 05/11/2009 at 10:27 : Sometimes, the reason the error does not disappear is badly formed named queries..