spring 元单测试
来源:互联网 发布:外贸常用聊天软件 编辑:程序博客网 时间:2024/05/17 23:24
package jnuit.test;
import java.util.List;
import org.hibernate.SessionFactory;
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.huawei.bean.Person;
import com.huawei.common.dao.CommonDao;
import com.huawei.person.PersonAction;
import com.huawei.service.PersonService;
/********************************************************* *
Copy right (c) 2005-2008 RLL RIGHTS RESSERVED BY SYNICS Ltd.
* All rights reserved
* @author 吴文来 E-mail:wenlaixl@163.com
* @version 1.0
* Create Date: 2009-12-22 19:05:43
* Update Date: 2009-12-22 19:05:43
*
* **********************************************************/
public class MyTest
{
private static PersonService personService;
private static CommonDao commonDaos;
private static PersonAction personAction;
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
//ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml");
String string = "F:/worspace/ssh2/WebRoot/WEB-INF/conf/";
String s1 = string+"spring_beans.xml";
String s2 = string+"test/spring_dao.xml";
String s3 = string+"test/spring_facade.xml";
String[] files = {s1,s2,s3};
ApplicationContext ac = new FileSystemXmlApplicationContext(files);
personService = (PersonService)ac.getBean("personService");
commonDaos = (CommonDao)ac.getBean("commonDaos");
personAction = (PersonAction)ac.getBean("personList");
}
@Test
public void testAction()
{
String aa= personAction.paginBy();
System.out.println("aa "+aa);
System.out.println("cc"+personAction.getPageBar());
}
@Test
public void testcommondao()
{
List<Person> person =commonDaos.getPageins(0, 1, "from Person");
for(Person sp:person)
System.out.println("sp "+sp.getName());
}
// @Test
// public void testget()
// {
// Person person = (Person)personService.getPerson(2);
// try
// {
// System.out.println(person.getName());
// System.out.println("???????");
// Thread.sleep(1000*16);
// } catch (InterruptedException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// System.out.println("????????");
// System.out.println(person.getName());
// }
//
// @Test
// public void testsave()
// {
// Person person = new Person();
// person.setName("???1");
// personService.add(person);
// }
//
// @Test
// public void testupdate()
// {
// Person person = (Person)personService.getPerson(1);
// person.setName("ok2!");
// personService.update(person);
// }
//
// @Test
// public void testdelete()
// {
// personService.delete(1);
// }
//
// @Test
// public void testPersonList()
// {
// List<Person> person = (List<Person>)personService.getPersonList();
// for(Person ps:person)
// System.out.println(ps.getName());
// }
@Test
public void testPersonPageid()
{
Person personbean = new Person();
personbean.setName("abc");
List<Person> person = (List<Person>)personService.getPagein(0,10,personbean);
for(Person ps:person)
System.out.println(ps.getId());
List<Person> person2 = (List<Person>)personService.getTest("From Person b where 1=1");
for(Person ps2:person2)
System.out.println(ps2.getId());
}
}
- spring 元单测试
- 3.spring bean的作用域(是否单例):测试
- 测试spring管理的action单实例问题
- boost元组测试
- SpringBoot5-spring高级话题-组合注解与元注解,@Enable*注解的工作原理,测试
- spring 测试
- spring 测试
- Spring测试
- Spring测试
- Spring 测试
- Spring测试
- v 测试提问单
- 测试提问单
- 测试提问单
- 测试提问单
- 单例多线程测试!
- 测试单笔数据
- 单例模式测试
- Windows平台内核级文件访问
- 计算机学习者的思考
- Barn Repair(usaco)
- Java IO 操作与字节流
- lightbox 模板的简单修改
- spring 元单测试
- struts2 所需jar包详解
- 第一天上来,留个印子
- IPC之 - C#中用NamedPipe进程间通信
- Spr咖啡的创业之道
- struts2 + spring + hibernate 所需的jar包
- Wireshark插件开发小结
- gzip 命令例子
- 优秀网站源码