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. java 22 - 8 多线程之线程生命周期图解

  2. 实例讲解表单验证插件Validation的应用

    jquery.Validation是一款优秀的jquery插件,它能对客户端表单进行验证,并且提供了许多可以定制的属性和方法,良好的扩展性.现在 结合实际情况,我把项目中经常要用到的验证整理成一个实例 ...

  3. C语言:关于socket的基础知识点

    /** * ---结构体--- * * #include <sys/socket.h> * struct sockaddr { * unsigned short sa_family; * ...

  4. java工程中的.classpathaaaaaaaaaaaaaaaa<转载>

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

  5. AngularJS中的事件

    欢迎大家指导与讨论 : ) 前言  Angular的作用域在本质上是分层次的(有的住户在低层, 有的住户在高层), 它们可以通过父子关系很自然地进行沟通.但通常, 这种沟通是单向的(父->子的单 ...

  6. 转:如何在32位程序中突破地址空间4G的限制

    //如何在32位程序中突破地址空间4G的限制 //首先要获得内存中锁定页的权限 #define _WIN32_WINNT 0x0501 //xp系统 #include <windows.h> ...

  7. 如何配置多个ssh key

    上一篇简单学习了下怎样利用git bash上传文件到指定的github项目中,我们来回顾下.首先在本地安装好git,设置好用户名和邮箱(提交时的显示),接着我们生成SSH key把它添加到该项目own ...

  8. node 学习笔记 - Modules 模块加载系统 (2)

    本文同步自我的个人博客:http://www.52cik.com/2015/12/14/learn-node-modules-module.html 上一篇讲了模块是如何被寻找到然后加载进来的,这篇则 ...

  9. web安全——数据库(mysql)

    简介 数据安全是现在互联网安全非常重要一个环节.而且一旦数据出现问题是不可逆的,甚至是灾难性的. 有一些防护措施应该在前面几个博文说过了,就不再赘述.比如通过防火墙控制,通过系统的用户控制,通过web ...

  10. 曼慧尼特u检验(两个样本数据间有无差异)

    曼-惠特尼U检验(Mann-Whitney检验) How the Mann-Whitney test works Mann-Whitney检验又叫做秩和检验,是比较没有配对的两个独立样本的非参数检验. ...