core里单元测试支持类添加
This commit is contained in:
@@ -16,6 +16,7 @@ import org.apache.shiro.subject.Subject;
|
|||||||
import org.apache.shiro.web.util.WebUtils;
|
import org.apache.shiro.web.util.WebUtils;
|
||||||
|
|
||||||
import com.jeesite.common.config.Global;
|
import com.jeesite.common.config.Global;
|
||||||
|
import com.jeesite.common.lang.StringUtils;
|
||||||
import com.jeesite.common.web.http.ServletUtils;
|
import com.jeesite.common.web.http.ServletUtils;
|
||||||
import com.jeesite.common.web.http.wrapper.GetHttpServletRequestWrapper;
|
import com.jeesite.common.web.http.wrapper.GetHttpServletRequestWrapper;
|
||||||
|
|
||||||
@@ -66,7 +67,11 @@ public class PermissionsAuthorizationFilter extends org.apache.shiro.web.filter.
|
|||||||
public static void redirectToDefaultPath(ServletRequest request, ServletResponse response) throws IOException {
|
public static void redirectToDefaultPath(ServletRequest request, ServletResponse response) throws IOException {
|
||||||
// AJAX不支持Redirect改用Forward
|
// AJAX不支持Redirect改用Forward
|
||||||
String loginUrl = Global.getProperty("shiro.defaultPath");
|
String loginUrl = Global.getProperty("shiro.defaultPath");
|
||||||
if (ServletUtils.isAjaxRequest((HttpServletRequest) request)) {
|
HttpServletRequest req = ((HttpServletRequest) request);
|
||||||
|
if (StringUtils.equals(req.getContextPath()+loginUrl, req.getRequestURI())){
|
||||||
|
loginUrl = Global.getProperty("shiro.loginUrl");
|
||||||
|
}
|
||||||
|
if (ServletUtils.isAjaxRequest(req)) {
|
||||||
try {
|
try {
|
||||||
request.getRequestDispatcher(loginUrl).forward(
|
request.getRequestDispatcher(loginUrl).forward(
|
||||||
new GetHttpServletRequestWrapper(request), response);
|
new GetHttpServletRequestWrapper(request), response);
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||||
|
*/
|
||||||
|
package com.jeesite.test;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
|
import com.jeesite.common.io.PropertiesUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JeeSite Web
|
||||||
|
* @author ThinkGem
|
||||||
|
* @version 2018-1-8
|
||||||
|
*/
|
||||||
|
@ActiveProfiles("test")
|
||||||
|
@SpringBootApplication(scanBasePackages={"com.jeesite.modules"})
|
||||||
|
public class ApplicationTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication app = new SpringApplication(ApplicationTest.class);
|
||||||
|
app.setDefaultProperties(PropertiesUtils.getInstance().getProperties());
|
||||||
|
app.run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ import com.jeesite.modules.sys.entity.User;
|
|||||||
* @author ThinkGem
|
* @author ThinkGem
|
||||||
* @version 2017年2月25日
|
* @version 2017年2月25日
|
||||||
*/
|
*/
|
||||||
public class DaoTest extends BaseSpringContextTests {
|
public class DaoMapperTest extends BaseSpringContextTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfigDao configDao;
|
private ConfigDao configDao;
|
||||||
11
modules/core/src/test/resource/config/jeesite.yml
Normal file
11
modules/core/src/test/resource/config/jeesite.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# 数据库连接
|
||||||
|
jdbc:
|
||||||
|
|
||||||
|
# Mysql 数据库配置
|
||||||
|
type: mysql
|
||||||
|
driver: com.mysql.jdbc.Driver
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/jeesite?useSSL=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
|
||||||
|
username: root
|
||||||
|
password: 123456
|
||||||
|
testSql: SELECT 1
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration debug="false" scan="false">
|
<configuration debug="false" scan="false">
|
||||||
|
|
||||||
|
<!-- Spring boot default -->
|
||||||
|
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||||
|
|
||||||
<!-- Console log output -->
|
<!-- Console log output -->
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
|
|||||||
Reference in New Issue
Block a user