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 ...
随机推荐
- Linq语法详细(转)
原文地址:http://www.cnblogs.com/knowledgesea/p/3897665.html 开门见山 读这篇文章之前,我先说下,每一种搜索结果集,我都以三种方式变现出来,为啦更好的 ...
- eclipse服务器add and remove 工程时出现there are no resources that can be added or removed from the server
网上的解决方法: 解决方法: 第1步.新建一个“Dynamic Web Project” 第2步.把新建项目里面的.project文件和.settings文件夹复制到导入的那个项目里面. 可是我发现: ...
- 二叉树的遍历(递归,迭代,Morris遍历)
二叉树的三种遍历方法: 先序,中序,后序,这三种遍历方式每一个都可以用递归,迭代,Morris三种形式实现,其中Morris效率最高,空间复杂度为O(1). 主要参考博客: 二叉树的遍历(递归,迭代, ...
- 程序开发使用docker部署
我们公司自己研发了一套 grand-line 系统,使用 docker 来部署项目. 我是第一批小白鼠,一开始网络差,build 一次要半个小时,连接进入 web shell 也很慢,部署一个微信项目 ...
- Android 开发1000问笔记
11.android使用全局变量 定义Data类继承Application 在manifest.xml中声明 http://blog.csdn.net/feiyangxiaomi/article/de ...
- unity3d 扩展NGUI Tweener —— TweenTime
这是今天做的一个小功能 策划想要一个时间滚动效果 那就搞呗!思路和之前写的tweenFillAmount一样 传送门:http://www.cnblogs.com/shenggege/p/479892 ...
- ASP.NET MVC3入门教程之ajax交互
本文转载自:http://www.youarebug.com/forum.php?mod=viewthread&tid=100&extra=page%3D1 随着web技术的不断发展与 ...
- MySQL5.6 实现主从复制,读写分离,分散单台服务器压力
闲来无事,在本地搭建几台虚拟机,准备配一个mysql读写分离的主从配置,版本选用最新版的,mysql.5.6.28 版本,本处使用源码安装(鄙人一向喜欢源码安装,因为centos中鄙人不知道yum安装 ...
- word-wrap,word-break和white-space总结
最近网页布局中遇到得比较多,所以打算总结总结. word-wrap: 1.normal(使用浏览器默认的换行规则) 2.break-word(内容将在边界内换行,但是英文换行会按词断句) word-b ...
- C# 调用一个按钮的Click事件(利用反射)
最基本的调用方法 (1)button1.PerformClick();(2)button1_Click(null,null);(3)button_Click(null,new EventArgs()) ...