Package com.tcs.hrr.junit

Source Code of com.tcs.hrr.junit.UserDAOTest

package com.tcs.hrr.junit;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.tcs.hrr.dao.UserDAO;
import com.tcs.hrr.domain.User;

public class UserDAOTest {
  private static ApplicationContext ctx = null;
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    System.out.println("Before setUpBeforeClass");
    //ctx = new ClassPathXmlApplicationContext("applicationContext-dao.xml");
    ctx =new FileSystemXmlApplicationContext("D:\\development\\workspace\\HRR\\WebContent\\WEB-INF\\conf\\spring\\applicationContext-dao.xml");//
    System.out.println("After setUpBeforeClass");
  }

  @Test
  public void testSave() {
    UserDAO ud = (UserDAO)ctx.getBean("userDaO");
    User t_User = new User("test2","test2");
    ud.save(t_User);
    System.out.println("testSave getIdUser="+t_User.getUserId());
  }

  @Test
  public void testDelete() {
    System.out.println("testDelete");
  }

  @Test
  public void testFindById() {
    UserDAO ud = (UserDAO)ctx.getBean("userDaO");
    User t_User = (User)ud.findById(1);
    System.out.println("testFindById : "+t_User.getName()+"/"+t_User.getPassword());
  }


}
TOP

Related Classes of com.tcs.hrr.junit.UserDAOTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.