package neu.integration.ctic.test;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

//import neu.cse.ctic.supervise.dao.BotnetDao;
//import neu.cse.ctic.supervise.dao.CnvdDao;
//import neu.cse.ctic.supervise.vo.Cnvd;
//import neu.cse.ctic.supervise.vo.WatcherlabBotnet;




import neu.integration.ctic.dao.BotnetDao;
import neu.integration.ctic.vo.WatcherlabBotnet;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.GenericXmlApplicationContext;

public class BotnetDaoImplTest {
	private GenericXmlApplicationContext ctx;
	@Resource(name="botnetDao")
	private BotnetDao botnetDao;
//	public void setUp() throws Exception {
//		ctx = new GenericXmlApplicationContext();
//		ctx.load("classpath:applicationContext.xml");
//		ctx.refresh();
//		Dao = (Dao) ctx.getBean("Dao");
//	}
	@Before
	public void setUp() throws Exception {
		ctx = new GenericXmlApplicationContext();
		ctx.load("classpath:applicationContext.xml");
		ctx.refresh();
		botnetDao = (BotnetDao) ctx.getBean("botnetDao");
	}
	
	//@Test
//	public void testGet(){
//		WatcherlabBotnet botnet = new WatcherlabBotnet();
//		botnet = botnetDao.get(1);
//		System.out.println("id:"+botnet.getId()+"ip:"+botnet.getBotnetIp());
//		long i = botnetDao.countAll();
//		System.out.println(i);
//	}
//	
	@Test
	public void testFindAll(){
		List<WatcherlabBotnet> botnetList = new ArrayList<WatcherlabBotnet>();
		botnetList = botnetDao.findAll();//		System.out.println("id:"+botnet.getId()+"ip:"+botnet.getBotnetIp());
//		long i = botnetDao.countAll();
//		System.out.println(i);
//		for(WatcherlabBotnet botnet : botnetList){
//			System.out.println("id:"+botnet.getId()+"  ip:"+botnet.getBotnetIp());
//			
//		}
	}
	
//	@SuppressWarnings("unchecked")
	//@Test
//	public void testCountryNum(){
//		System.out.println("aaa");
//		List<Object[]> botnetList = new ArrayList<Object[]>();
//		botnetList = (List<Object[]>)botnetDao.countryNum();
//		for(int i = 0 ; i<botnetList.size();i++){
//			Object[] temp = new Object[2];
//			temp = botnetList.get(i);
//			System.out.println("nation:"+temp[0]+"  num:"+temp[1]);
//		}
//		System.out.println("id:"+botnet.getId()+"ip:"+botnet.getBotnetIp());
//		long i = botnetDao.countAll();
//		System.out.println(i);
//		for(WatcherlabBotnet botnet : botnetList){
//			System.out.println("id:"+botnet.getId()+"  ip:"+botnet.getBotnetIp());
//			
//		}
//		System.out.println( );
//	}
//
//	@Test
//	public void testCreateSql(){
//		String sql = botnetDao.createFindSql("2016-6-10", "2016-6-20", "http", "https", null,"CN", "US", null, 1, 10000);
//		System.out.println(sql);
//		
//	}

}
