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. AWS CLI 中使用S3存储

    登录 通过控制面板, 在S3管理器中创建一个新的bucket 所有AWS服务 -> 安全&身份 -> IAM -> 组, 创建一个新的组, 例如 "s3-user& ...

  2. windows 10磁盘占用100%解决方案

    可以试试在 控制面板–管理工具–服务– HomeGroup Listener和HomeGroup Provider禁用. (这2项服务是家庭组共享用的,一般我们也不会去共享什么的.) 效果:我的磁盘是 ...

  3. selmodel

    selmodel不仅可以设置checkbox,还可以设置单元格选中模式,列选择模式,行选择模式

  4. 在 C# App 中嵌入 Chrome 浏览器使用 CefSharp

    介绍 以前曾试过在app中整合一个可靠又快速的web浏览器吗? 在本文中,你会学到如何轻松地将奇妙的CefSharp网页浏览器组件(基于Chromium)集成到你的C# app中. 然后,你可以使用此 ...

  5. Lowest Common Ancestor of a Binary Search Tree

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...

  6. css3属性书写顺序

    今天写了个小demo想要利用transition 和transform以及transition-delay来实现鼠标移上去的延时动画,结果发现不能实现transition的变化效果.调试后发现只有把 ...

  7. JS明确指定函数的接受者

    由于方法和值为对象的属性值没什么区别,因此很容易提取对象的方法作为回调函数直接传递给高阶函数.但这也很容易忘记应明确指定方法的接受者.例如,一个字符串缓冲对象使用数组来存储字符串. var buffe ...

  8. silverlight 4 tools for vs2010无法在vs2010 SP1上安装的解决办法

    环境:英文版vs2010 sp1 + vs2013 RC 90天体验版 原来可以正常做silverilght 4 项目开发,今天因为vs2013 RC过了90天体验期,卸载时顺带把Silverlihg ...

  9. 【语言基础】c++ 备忘录

    1. C++ 整数类型范围 可以参照头文件limits.h定义的宏 #define INT_MAX       2147483647(32bit, 最大10位十进制) #define UINT_MAX ...

  10. stack overflow错误分析

    stack overflow(堆栈溢出)就是不顾堆栈中分配的局部数据块大小,向该数据块写入了过多的数据,导致数据越界,结果覆盖了老的堆栈数据. 或者解释为 在长字符串中嵌入一段代码,并将过程的返回地址 ...