Struts2+Spring+Mybatis+Junit 测试
- package com.action.kioskmonitor;
- /**
- * Junit群体测试Struts2 、spring、Mybatis
- */
- import static org.junit.Assert.assertNotNull;
- import java.util.List;
- import java.util.UUID;
- import org.apache.log4j.Logger;
- import org.junit.Before;
- import org.junit.Test;
- import org.springframework.context.ApplicationContext;
- import org.springframework.context.support.ClassPathXmlApplicationContext;
- import org.springframework.dao.DataAccessException;
- import com.entity.custQuery.SearchRequire;
- import com.entity.kioskmonitor.Monitor;
- import com.service.kioskmonitor.MonitorService;
- import com.util.Page;
- public class TestAccountService {
- Logger logger = Logger.getLogger("TestAccountService");
- MonitorService service=null;
- @Before
- public void init() {
- //这里获取spring总配置文件
- ApplicationContext aCtx = new ClassPathXmlApplicationContext (
- "classpath:applicationContext.xml");
- //获取在spring注入的service名字
- MonitorService service = (MonitorService) aCtx
- .getBean("monitorService");
- assertNotNull(service);
- this.service = service;
- }
- @Test
- public void testInsertAccount() {
- //添加
- SearchRequire gcj = new SearchRequire();
- Page pg =new Page();
- Monitor mk=new Monitor();
- gcj.setMonitor(mk);
- pg.setSrc(gcj);
- String uuid2 = UUID.randomUUID().toString().trim().replaceAll("-", "");
- pg.getSrc().getMonitor().setType_id(uuid2);
- String uuid1 = UUID.randomUUID().toString().trim().replaceAll("-", "");
- pg.getSrc().getMonitor().setKiosk_id(uuid1);
- System.out.println(uuid1);
- System.out.println(uuid2);
- //////////////////////////////////////////////////////////////////////////
- //////
- //////kiosk表操作
- //////
- ///////////////////////////////////////////////////////////////////////////
- //获取总记录数
- // service.getCountByMonitor(pg);
- // // 分页查询
- // List<Monitor> dd= service.getMonitorByFenYe(pg);
- //添加kiosk
- int fdf=service.addMonitor(pg.getSrc().getMonitor());
- //修改kiosk
- int uMonitor= service.updateMonitor(pg.getSrc().getMonitor());
- //删除Kiosk
- // int aa= service.delMonitor(pg.getSrc().getMonitor());
- //////////////////////////////////////////////////////////////////////////
- //////
- //////kiosk_type表操作
- //////
- ///////////////////////////////////////////////////////////////////////////
- //添加kiosk_type
- int fdas=service.addMonitorT(pg.getSrc().getMonitor());
- //删除kiosk_type
- // int delky=service.delMonitorT(pg.getSrc().getMonitor());
- //修改kiosk_type
- int uty= service.updateMonitorT(pg.getSrc().getMonitor());
- //////////////////////////////////////////////////////////////////////////
- //////
- //////kiosk_type_detail表操作
- //////
- ///////////////////////////////////////////////////////////////////////////
- //删除kiosk_type_detail
- //int ktyd=service.delMonitorTD(pg.getSrc().getMonitor());
- //添加kiosk_type_detail
- int ktyda=service.addMonitorTD(pg.getSrc().getMonitor());
- //修改kiosk_type_detail
- int ktyu=service.updateMonitorTD(pg.getSrc().getMonitor());
- }
- }
Struts2+Spring+Mybatis+Junit 测试的更多相关文章
- Maven聚合、Maven仓库jar包以及Spring+MyBatis+JUnit+Maven整合测试的搭建过程
一.Maven将父项目创建到父项目的内部 在父项目的pom.xml上 点右键,选择maven-->new-->maven module project 二.Maven聚合 在某个项目的p ...
- 【整理】JavaEE基本框架(Struts2+Spring+MyBatis三层,Struts MVC)之间的关系
#[整理]JavaEE基本框架(Struts2+Spring+MyBatis三层,Struts MVC)之间的关系 之间的关系
郭晨 软件151 1531610114 [整理]JavaEE基本框架(Struts2+Spring+MyBatis三层,Struts MVC)之间的关系 visio文件下载 概述 一个JavaEE的项 ...
- struts2 + spring + mybatis 框架整合详细介绍
struts2 + spring + mybatis 框架整合详细介绍 参考地址: https://blog.csdn.net/qq_22028771/article/details/5149898 ...
- Spring整合junit测试
本节内容: Spring整合junit测试的意义 Spring整合junit测试 一.Spring与整合junit测试的意义 在没整合junit之前,我们在写测试方法时,需要在每个方法中手动创建容器, ...
- struts2 spring mybatis 整合(test)
这几天搭了个spring+struts2+mybatis的架子,练练手,顺便熟悉熟悉struts2. 环境:myEclipse10+tomcat7+jdk1.6(1.8的jre报错,所以换成了1.6) ...
- Struts2框架07 Struts2 + Spring + Mybatis 整合
1 导包 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.o ...
- Spring集成JUnit测试
1.程序中有Junit环境2.导入一个jar包.spring与junit整合jar包 spring-test-3.2.0.RELEASE.jar3.测试代码 @RunWith(SpringJUnit4 ...
- 原创:Spring整合junit测试框架(简易教程 基于myeclipse,不需要麻烦的导包)
我用的是myeclipse 10,之前一直想要用junit来测试含有spring注解或动态注入的类方法,可是由于在网上找的相关的jar文件进行测试,老是报这样那样的错误,今天无意中发现myeclips ...
随机推荐
- AWS CLI 中使用S3存储
登录 通过控制面板, 在S3管理器中创建一个新的bucket 所有AWS服务 -> 安全&身份 -> IAM -> 组, 创建一个新的组, 例如 "s3-user& ...
- windows 10磁盘占用100%解决方案
可以试试在 控制面板–管理工具–服务– HomeGroup Listener和HomeGroup Provider禁用. (这2项服务是家庭组共享用的,一般我们也不会去共享什么的.) 效果:我的磁盘是 ...
- selmodel
selmodel不仅可以设置checkbox,还可以设置单元格选中模式,列选择模式,行选择模式
- 在 C# App 中嵌入 Chrome 浏览器使用 CefSharp
介绍 以前曾试过在app中整合一个可靠又快速的web浏览器吗? 在本文中,你会学到如何轻松地将奇妙的CefSharp网页浏览器组件(基于Chromium)集成到你的C# app中. 然后,你可以使用此 ...
- 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 ...
- css3属性书写顺序
今天写了个小demo想要利用transition 和transform以及transition-delay来实现鼠标移上去的延时动画,结果发现不能实现transition的变化效果.调试后发现只有把 ...
- JS明确指定函数的接受者
由于方法和值为对象的属性值没什么区别,因此很容易提取对象的方法作为回调函数直接传递给高阶函数.但这也很容易忘记应明确指定方法的接受者.例如,一个字符串缓冲对象使用数组来存储字符串. var buffe ...
- silverlight 4 tools for vs2010无法在vs2010 SP1上安装的解决办法
环境:英文版vs2010 sp1 + vs2013 RC 90天体验版 原来可以正常做silverilght 4 项目开发,今天因为vs2013 RC过了90天体验期,卸载时顺带把Silverlihg ...
- 【语言基础】c++ 备忘录
1. C++ 整数类型范围 可以参照头文件limits.h定义的宏 #define INT_MAX 2147483647(32bit, 最大10位十进制) #define UINT_MAX ...
- stack overflow错误分析
stack overflow(堆栈溢出)就是不顾堆栈中分配的局部数据块大小,向该数据块写入了过多的数据,导致数据越界,结果覆盖了老的堆栈数据. 或者解释为 在长字符串中嵌入一段代码,并将过程的返回地址 ...