Not able to map ServiceLocator class which is actually mapped with faces-managed-beans.xml through JUnit Test cases
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   novino_b
Posted On:   Thursday, November 13, 2008 11:01 AM

Hi I'm doing project in Icefaces with spring and hibernate. For that i m writing junit test. i wrote test cases for DAO as well as services classes. I have Bean Class which calls Service locator that have been actually mapped with faces-managed-beans.xml as Backing bean that contains user informaiton. userBean com.....view.bean.UserBean request serviceLocator #{serviceLocatorBean} My problem is when i wrote the Junit test case for that bean class and run it , it is not calling Service locator protected ServiceLocator serviceLocator; public void meth   More>>



Hi


I'm doing project in Icefaces with spring and hibernate. For that i m writing junit test. i wrote test cases for DAO as well as services classes.


I have Bean Class which calls Service locator that have been actually mapped with faces-managed-beans.xml as





Backing bean that contains user informaiton.

userBean

com.....view.bean.UserBean

request

serviceLocator
#{serviceLocatorBean}





My problem is when i wrote the Junit test case for that bean class and run it , it is not calling Service locator



protected ServiceLocator serviceLocator;
public void method(){
User user = this.serviceLocator.getUserService().login(this.username.trim(), this.password.trim());
}



i'm getting null pointer exception on user


Actually in the case of Service class test cases i mapped it as :



protected void setUp() throws Exception {
super.setUp();
org.springframework.context.ApplicationContext ctxService = new FileSystemXmlApplicationContext("D:/...../.../Web Content/WEB-INF/applicationContext.xml");
this.UserService = (UserService ctxService.getBean("userService");
}



In this set up method i have mapped the service class using application context.xml. But i cant map the bean class (Service locator ) plz give me a solution...
Thanks..

   <<Less
About | Sitemap | Contact