package com.tarena.oss.selfservice.dao;

import java.util.Collection;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.tarena.oss.userservice.pojo.UserService;

public class UserSelfserviceMgmtDAOTest extends TestCase {

	private ApplicationContext ctx = null;
	private UserSelfserviceMgmtDAO dao;
	
	public UserSelfserviceMgmtDAOTest(String arg0) {
		super(arg0);
	}

	protected void setUp() throws Exception {
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
		dao = (UserSelfserviceMgmtDAO) ctx.getBean("selfDAO");
	}

	protected void tearDown() throws Exception {
		ctx = null;
		dao =null;
	}

	public void testQueryBill() {
		UserService us = dao.queryBill();
		System.out.println(us);
	}

	public void testQueryBillByLoginname() {
		String str = " and us.loginname=admin";
		Collection<UserService> us = dao.queryBillByLoginname(str);
		System.out.println(us);
	}
	public void testQueryBillByUserid(){
		dao.queryBillByUserid(1);
	}
	public void testQueryDetailmonths_intByMonth(){
		int year = 2008;
		int month = 12;
		System.out.println(dao.queryDetailmonths_intByMonth(year, month, 0));
	}
	public static Test suite(){
		TestSuite suite = new TestSuite();
		suite.addTest(new UserSelfserviceMgmtDAOTest("testQueryDetailmonths_intByMonth"));
		
		return suite;
	}
}
