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 ...
随机推荐
- java 22 - 8 多线程之线程生命周期图解
- 实例讲解表单验证插件Validation的应用
jquery.Validation是一款优秀的jquery插件,它能对客户端表单进行验证,并且提供了许多可以定制的属性和方法,良好的扩展性.现在 结合实际情况,我把项目中经常要用到的验证整理成一个实例 ...
- C语言:关于socket的基础知识点
/** * ---结构体--- * * #include <sys/socket.h> * struct sockaddr { * unsigned short sa_family; * ...
- java工程中的.classpathaaaaaaaaaaaaaaaa<转载>
第一部分:classpath是系统的环境变量,就是说JVM加载类的时候要按这个路径下去找,当然这个路径下可以有jar包,那么就是jar包里所有的class. eclipse build path是ec ...
- AngularJS中的事件
欢迎大家指导与讨论 : ) 前言 Angular的作用域在本质上是分层次的(有的住户在低层, 有的住户在高层), 它们可以通过父子关系很自然地进行沟通.但通常, 这种沟通是单向的(父->子的单 ...
- 转:如何在32位程序中突破地址空间4G的限制
//如何在32位程序中突破地址空间4G的限制 //首先要获得内存中锁定页的权限 #define _WIN32_WINNT 0x0501 //xp系统 #include <windows.h> ...
- 如何配置多个ssh key
上一篇简单学习了下怎样利用git bash上传文件到指定的github项目中,我们来回顾下.首先在本地安装好git,设置好用户名和邮箱(提交时的显示),接着我们生成SSH key把它添加到该项目own ...
- node 学习笔记 - Modules 模块加载系统 (2)
本文同步自我的个人博客:http://www.52cik.com/2015/12/14/learn-node-modules-module.html 上一篇讲了模块是如何被寻找到然后加载进来的,这篇则 ...
- web安全——数据库(mysql)
简介 数据安全是现在互联网安全非常重要一个环节.而且一旦数据出现问题是不可逆的,甚至是灾难性的. 有一些防护措施应该在前面几个博文说过了,就不再赘述.比如通过防火墙控制,通过系统的用户控制,通过web ...
- 曼慧尼特u检验(两个样本数据间有无差异)
曼-惠特尼U检验(Mann-Whitney检验) How the Mann-Whitney test works Mann-Whitney检验又叫做秩和检验,是比较没有配对的两个独立样本的非参数检验. ...