package com.yumeng.ssidemo.test;
import java.sql.SQLException;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import com.yumeng.ssidemo.dao.StudentDAO;
import com.yumeng.ssidemo.po.Student;
public class StudentDAOTest extends TestCase {
Student student = null;
StudentDAO studentDAO = null;
public StudentDAOTest(String arg0) {
super(arg0);
ApplicationContext context = new FileSystemXmlApplicationContext(
"/WebRoot/WEB-INF/applicationContext.xml");
studentDAO = (StudentDAO) context.getBean("studentDAO");
student = new Student();
student.setName("小龙");
student.setSex("男");
student.setAge(20);
student.setNationality("汉族");
student.setAddress("中国湖北武汉黄陂");
student.setPhonenumber(65200293);
}
public void testDeleteStudent() {
System.out.println("has deleted");
}
public void testInsertStudent() {
try {
studentDAO.insertStudent(student);
} catch (SQLException e) {
e.printStackTrace();
}
}
public void testUpdateStudent() {
Student st = new Student();
st.setId(3);
st.setName("大龙");
st.setSex("女");
st.setAge(18);
st.setNationality("苗族");
st.setAddress("四川成都");
try {
studentDAO.updateStudent(st);
} catch (SQLException e) {
e.printStackTrace();
}
}
public void testSelectAllStudent() {
fail("Not yet implemented");
}
public void testSelectStudentById() {
Student s = null ;
try {
s = studentDAO.selectStudentById(12);
} catch (SQLException e) {
e.printStackTrace();
}
System.out.println(s.getId());
System.out.println(s.getName());
System.out.println(s.getSex());
System.out.println(s.getAge());
System.out.println(s.getNationality());
System.out.println(s.getAddress());
System.out.println(s.getPhonenumber());
}
public void testSelectStudentByName() {
Student s = null ;
try {
String name="2";
s = studentDAO.selectStudentByName(name);
} catch (SQLException e) {
e.printStackTrace();
}
System.out.println(s.getId());
System.out.println(s.getName());
System.out.println(s.getSex());
System.out.println(s.getAge());
System.out.println(s.getNationality());
System.out.println(s.getAddress());
System.out.println(s.getPhonenumber());
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SSIDemo.rar (67个子文件)
SSIDemo
.project 1KB
.mymetadata 294B
WebRoot
WEB-INF
struts-tiles.tld 8KB
validation.xml 2KB
.struts-config.mex 7KB
web.xml 1KB
struts-config.xml 3KB
struts-bean.tld 9KB
spring-form.tld 51KB
struts-nested.tld 70KB
applicationContext.xml 3KB
struts-html.tld 72KB
sql-map-config.xml 862B
spring.tld 13KB
struts-logic.tld 14KB
validator-rules.xml 13KB
lib
classes
log4j.properties 332B
com
yumeng
ssidemo
dao
StudentDAOI.class 2KB
StudentDAO.class 537B
test
TestURL.class 1KB
MainTest.class 2KB
StudentDAOTest.class 3KB
action
SelectStuInfoByIdAction.class 2KB
InsertStudentAction.class 2KB
UpdateStuAction.class 2KB
DeleteAction.class 2KB
SelectStudentAction.class 3KB
SelectAllStudentAction.class 2KB
mapping
database.properties 95B
ApplicationResources.properties 2KB
form
StudentForm.class 2KB
po
Student.xml 2KB
Student.class 2KB
service
StudentServiceI.class 2KB
StudentService.class 449B
util
EncodingFilter.class 1KB
index.jsp 2KB
META-INF
MANIFEST.MF 39B
student.sql
student.sql 259B
add.jsp 2KB
home.jsp 500B
select.jsp 2KB
update.jsp 2KB
bianji.jsp 2KB
.myeclipse
src
log4j.properties 332B
com
yumeng
ssidemo
dao
StudentDAO.java 551B
StudentDAOI.java 1KB
test
MainTest.java 1KB
StudentDAOTest.java 2KB
TestURL.java 590B
action
InsertStudentAction.java 1KB
SelectStuInfoByIdAction.java 1KB
DeleteAction.java 967B
SelectStudentAction.java 2KB
SelectAllStudentAction.java 1KB
UpdateStuAction.java 1KB
mapping
database.properties 95B
ApplicationResources.properties 2KB
form
StudentForm.java 1KB
po
Student.xml 2KB
Student.java 1KB
service
StudentServiceI.java 2KB
StudentService.java 426B
util
EncodingFilter.java 846B
.mystrutsdata 266B
.springBeans 332B
.classpath 7KB
共 67 条
- 1
hlyaowan
- 粉丝: 4
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- main.c
- Unity 创建快捷方式自动启动
- 一分钟一条原创视频,蹭热点撸收益,条条爆款,狂撸各大平台,轻松日入1000+-教程网盘链接提取码下载 .txt
- 51单片机实现万年历,包括闹钟的设置与秒表功能(汇编)
- STM32单片机FPGA毕设电路原理论文报告铁合金电炉单片机电力监控系统的研究
- STM32单片机FPGA毕设电路原理论文报告贴片元件封装机的智能控制系统设计
- STM32单片机FPGA毕设电路原理论文报告体育高考投篮自动测试系统的设计与实现
- STM32单片机FPGA毕设电路原理论文报告提高放疗精度的单片机控制方法
- C++ matplot学习及demo实操
- STM32单片机FPGA毕设电路原理论文报告提高单晶炉加热电源控制电路精度的研究
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页