1. package com.action.kioskmonitor;
  2. /**
  3. * Junit群体测试Struts2 、spring、Mybatis
  4. */
  5. import static org.junit.Assert.assertNotNull;
  6. import java.util.List;
  7. import java.util.UUID;
  8. import org.apache.log4j.Logger;
  9. import org.junit.Before;
  10. import org.junit.Test;
  11. import org.springframework.context.ApplicationContext;
  12. import org.springframework.context.support.ClassPathXmlApplicationContext;
  13. import org.springframework.dao.DataAccessException;
  14. import com.entity.custQuery.SearchRequire;
  15. import com.entity.kioskmonitor.Monitor;
  16. import com.service.kioskmonitor.MonitorService;
  17. import com.util.Page;
  18. public class TestAccountService  {
  19. Logger logger = Logger.getLogger("TestAccountService");
  20. MonitorService service=null;
  21. @Before
  22. public void init() {
  23. //这里获取spring总配置文件
  24. ApplicationContext aCtx = new ClassPathXmlApplicationContext  (
  25. "classpath:applicationContext.xml");
  26. //获取在spring注入的service名字
  27. MonitorService service = (MonitorService) aCtx
  28. .getBean("monitorService");
  29. assertNotNull(service);
  30. this.service = service;
  31. }
  32. @Test
  33. public void testInsertAccount() {
  34. //添加
  35. SearchRequire gcj = new SearchRequire();
  36. Page pg =new Page();
  37. Monitor mk=new Monitor();
  38. gcj.setMonitor(mk);
  39. pg.setSrc(gcj);
  40. String uuid2 =  UUID.randomUUID().toString().trim().replaceAll("-", "");
  41. pg.getSrc().getMonitor().setType_id(uuid2);
  42. String uuid1 =  UUID.randomUUID().toString().trim().replaceAll("-", "");
  43. pg.getSrc().getMonitor().setKiosk_id(uuid1);
  44. System.out.println(uuid1);
  45. System.out.println(uuid2);
  46. //////////////////////////////////////////////////////////////////////////
  47. //////
  48. //////kiosk表操作
  49. //////
  50. ///////////////////////////////////////////////////////////////////////////
  51. //获取总记录数
  52. //      service.getCountByMonitor(pg);
  53. //      // 分页查询
  54. //       List<Monitor> dd= service.getMonitorByFenYe(pg);
  55. //添加kiosk
  56. int fdf=service.addMonitor(pg.getSrc().getMonitor());
  57. //修改kiosk
  58. int uMonitor= service.updateMonitor(pg.getSrc().getMonitor());
  59. //删除Kiosk
  60. // int aa= service.delMonitor(pg.getSrc().getMonitor());
  61. //////////////////////////////////////////////////////////////////////////
  62. //////
  63. //////kiosk_type表操作
  64. //////
  65. ///////////////////////////////////////////////////////////////////////////
  66. //添加kiosk_type
  67. int fdas=service.addMonitorT(pg.getSrc().getMonitor());
  68. //删除kiosk_type
  69. //  int delky=service.delMonitorT(pg.getSrc().getMonitor());
  70. //修改kiosk_type
  71. int  uty= service.updateMonitorT(pg.getSrc().getMonitor());
  72. //////////////////////////////////////////////////////////////////////////
  73. //////
  74. //////kiosk_type_detail表操作
  75. //////
  76. ///////////////////////////////////////////////////////////////////////////
  77. //删除kiosk_type_detail
  78. //int ktyd=service.delMonitorTD(pg.getSrc().getMonitor());
  79. //添加kiosk_type_detail
  80. int ktyda=service.addMonitorTD(pg.getSrc().getMonitor());
  81. //修改kiosk_type_detail
  82. int ktyu=service.updateMonitorTD(pg.getSrc().getMonitor());
  83. }
  84. }

Struts2+Spring+Mybatis+Junit 测试的更多相关文章

  1. Maven聚合、Maven仓库jar包以及Spring+MyBatis+JUnit+Maven整合测试的搭建过程

    一.Maven将父项目创建到父项目的内部 在父项目的pom.xml上 点右键,选择maven-->new-->maven module  project 二.Maven聚合 在某个项目的p ...

  2. 【整理】JavaEE基本框架(Struts2+Spring+MyBatis三层,Struts MVC)之间的关系

    #[整理]JavaEE基本框架(Struts2+Spring+MyBatis三层,Struts MVC)之间的关系 ![关系图解](http://images.cnitblog.com/blog/84 ...

  3. JavaEE基本框架(Struts2+Spring+MyBatis三层,Struts MVC)之间的关系

    郭晨 软件151 1531610114 [整理]JavaEE基本框架(Struts2+Spring+MyBatis三层,Struts MVC)之间的关系 visio文件下载 概述 一个JavaEE的项 ...

  4. struts2 + spring + mybatis 框架整合详细介绍

    struts2 + spring + mybatis  框架整合详细介绍 参考地址: https://blog.csdn.net/qq_22028771/article/details/5149898 ...

  5. Spring整合junit测试

    本节内容: Spring整合junit测试的意义 Spring整合junit测试 一.Spring与整合junit测试的意义 在没整合junit之前,我们在写测试方法时,需要在每个方法中手动创建容器, ...

  6. struts2 spring mybatis 整合(test)

    这几天搭了个spring+struts2+mybatis的架子,练练手,顺便熟悉熟悉struts2. 环境:myEclipse10+tomcat7+jdk1.6(1.8的jre报错,所以换成了1.6) ...

  7. Struts2框架07 Struts2 + Spring + Mybatis 整合

    1 导包 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.o ...

  8. Spring集成JUnit测试

    1.程序中有Junit环境2.导入一个jar包.spring与junit整合jar包 spring-test-3.2.0.RELEASE.jar3.测试代码 @RunWith(SpringJUnit4 ...

  9. 原创:Spring整合junit测试框架(简易教程 基于myeclipse,不需要麻烦的导包)

    我用的是myeclipse 10,之前一直想要用junit来测试含有spring注解或动态注入的类方法,可是由于在网上找的相关的jar文件进行测试,老是报这样那样的错误,今天无意中发现myeclips ...

随机推荐

  1. linux进入软连接所指向的原目录

    软连接就是一个快捷方式,建立软连接的方法 ln -s source-path-or-file link-file 建立硬连接 ln source-path-or-file link-file linu ...

  2. row_number()over(partition by 字段 order by 字段)ID,修改重复行的字段值。

    案例分析: 现在要查询一个表单里面的运费结果,但是他还有分录,为了显示分录,必须把表头显示出来,问题是,他要查询运费的合计, 但是这样就会导致重复行也加进去了,这样显然数据不准,为此,可以把重复的行设 ...

  3. java工程中的.classpath<转载>

    第一部分:classpath是系统的环境变量,就是说JVM加载类的时候要按这个路径下去找,当然这个路径下可以有jar包,那么就是jar包里所有的class. eclipse build path是ec ...

  4. PAT 1005. 继续(3n+1)猜想 (25) JAVA

    当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数.例如对n=3进行验证的时候,我们需要计算3.5.8.4.2.1,则当我们对n=5.8.4.2进行验证的时候,就可以直接 ...

  5. php常用函数(不定时更新)

    一,数据操作类 1,天花板函数(ceil)和地板函数(floor) 这两个函数是对数据进行向上取整和向下取整的操作的,比如说 echo ceil("3.01"); //这里输出的是 ...

  6. jQuery offset,position,offsetParent,scrollLeft,scrollTop html控件定位 css position

    定位应用:点击一个按钮,然后在按钮的右边弹出一个提示框 1,提示框相对于屏幕进行定位,那么使用offset来取得当前按钮相对于body的top和left,然后通过$('body').prepend(t ...

  7. Log4net在类库中的用法

    app.config应当放置在解决方案的根目录下.具体流程如下: 第一步:应该下载log4net.dll并引入到你的项目中,下载见附件 第二步:需要配置相关的配置文件App.config或Web.co ...

  8. C#/JS 获取二维数组组合

    C#获取二维数组组合 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...

  9. mysql查看数据库和表的占用空间大小

    mysql查看数据库和表的占用空间大小   第一部分-任务 将线上db,导出后,导入到office db 一. 两种方案: 1,将数据直接从online-->office,通过mysqldump ...

  10. mac OS X Yosemite 上编译hadoop 2.6.0/2.7.0及TEZ 0.5.2/0.7.0 注意事项

    1.jdk 1.7问题 hadoop 2.7.0必须要求jdk 1.7.0,而oracle官网已经声明,jdk 1.7 以后不准备再提供更新了,所以趁现在还能下载,赶紧去down一个mac版吧 htt ...