From be7a9b3e008b95cbe107b523eabdf0c1ff05b345 Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Sun, 21 May 2017 23:02:02 +0800 Subject: [PATCH] update --- .../upms/rpc/service/UpmsServiceTest.java | 75 ------------------- .../server/ZhengUpmsServerApplication.java | 13 ++++ .../zheng/upms/server/UpmsServiceTest.java | 33 -------- 3 files changed, 13 insertions(+), 108 deletions(-) delete mode 100644 zheng-upms/zheng-upms-rpc-service/src/test/java/com/zheng/upms/rpc/service/UpmsServiceTest.java create mode 100644 zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/ZhengUpmsServerApplication.java delete mode 100644 zheng-upms/zheng-upms-server/src/test/java/com/zheng/upms/server/UpmsServiceTest.java diff --git a/zheng-upms/zheng-upms-rpc-service/src/test/java/com/zheng/upms/rpc/service/UpmsServiceTest.java b/zheng-upms/zheng-upms-rpc-service/src/test/java/com/zheng/upms/rpc/service/UpmsServiceTest.java deleted file mode 100644 index 0972e2fd..00000000 --- a/zheng-upms/zheng-upms-rpc-service/src/test/java/com/zheng/upms/rpc/service/UpmsServiceTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.zheng.upms.rpc.service; - -import com.zheng.upms.dao.mapper.UpmsUserMapper; -import com.zheng.upms.dao.model.*; -import com.zheng.upms.rpc.api.UpmsPermissionService; -import com.zheng.upms.rpc.api.UpmsSystemService; -import com.zheng.upms.rpc.api.UpmsUserService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.transaction.TransactionConfiguration; - -import java.util.List; - -/** - * 单元测试 - * Created by shuzheng on 2017/2/19. - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({ - "classpath:applicationContext.xml", - "classpath:META-INF/spring/applicationContext-jdbc.xml", - "classpath:META-INF/spring/applicationContext-listener.xml" -}) -@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) -public class UpmsServiceTest { - - @Autowired - private UpmsSystemService upmsSystemService; - - @Autowired - private UpmsUserMapper upmsUserMapper; - - @Autowired - private UpmsUserService upmsUserService; - - @Autowired - private UpmsPermissionService upmsPermissionService; - - @Test - public void index() { - UpmsUser upmsUser = new UpmsUser(); - upmsUser.setAvatar(""); - upmsUser.setCtime(System.currentTimeMillis()); - upmsUser.setEmail(""); - upmsUser.setLocked((byte) 0); - upmsUser.setPassword("xxx"); - upmsUser.setPhone(""); - upmsUser.setRealname("zsz"); - upmsUser.setSex((byte) 1); - upmsUser.setSalt(""); - upmsUser.setUsername("zsz"); - upmsUserService.insertSelective(upmsUser); - System.out.println(upmsUser.getUserId()); - } - - @Test - public void selectForPage() { - // 根据条件,按页码+每页条数分页 - UpmsPermissionExample upmsPermissionExample = new UpmsPermissionExample(); - upmsPermissionExample.createCriteria() - .andSystemIdEqualTo(1); - List upmsPermissions = upmsPermissionService.selectByExampleForStartPage(upmsPermissionExample, 2, 20); - System.out.println(upmsPermissions.size()); - // 根据条件,按offset+limit分页 - upmsPermissionExample = new UpmsPermissionExample(); - upmsPermissionExample.createCriteria() - .andSystemIdEqualTo(2); - upmsPermissions = upmsPermissionService.selectByExampleForOffsetPage(upmsPermissionExample, 3, 5); - System.out.println(upmsPermissions.size()); - } - -} diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/ZhengUpmsServerApplication.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/ZhengUpmsServerApplication.java new file mode 100644 index 00000000..1b2cb07a --- /dev/null +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/ZhengUpmsServerApplication.java @@ -0,0 +1,13 @@ +package com.zheng.upms.server; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ZhengUpmsServerApplication { + + public static void main(String[] args) { + SpringApplication.run(ZhengUpmsServerApplication.class, args); + } + +} diff --git a/zheng-upms/zheng-upms-server/src/test/java/com/zheng/upms/server/UpmsServiceTest.java b/zheng-upms/zheng-upms-server/src/test/java/com/zheng/upms/server/UpmsServiceTest.java deleted file mode 100644 index 4e0f8b41..00000000 --- a/zheng-upms/zheng-upms-server/src/test/java/com/zheng/upms/server/UpmsServiceTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.zheng.upms.server; - -import com.zheng.upms.dao.model.UpmsSystemExample; -import com.zheng.upms.rpc.api.UpmsSystemService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.transaction.TransactionConfiguration; - -/** - * 单元测试 - * Created by shuzheng on 2017/2/19. - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({ - "classpath:applicationContext.xml", - "classpath:applicationContext-dubbo-consumer.xml" -}) -@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) -public class UpmsServiceTest { - - @Autowired - private UpmsSystemService upmsSystemService; - - @Test - public void index() { - int count = upmsSystemService.countByExample(new UpmsSystemExample()); - System.out.println(count); - } - -}