parent
538b2711e8
commit
09caff8e8c
Binary file not shown.
Binary file not shown.
@ -0,0 +1,48 @@
|
||||
package xyz.wbsite;
|
||||
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.module.admin.mgr.ConfigManager;
|
||||
import xyz.wbsite.module.admin.req.ConfigCreateRequest;
|
||||
import xyz.wbsite.module.admin.rsp.ConfigCreateResponse;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@Transactional
|
||||
public class DataInit {
|
||||
@Autowired
|
||||
private Token token;
|
||||
@Autowired
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Test
|
||||
@Rollback(false)
|
||||
public void init() {
|
||||
create("记录客户端的IP地址","LOCATION","$remote_addr","","","");
|
||||
create("记录客户端的IP地址","LOCATION","$remote_addr","","","");
|
||||
create("记录客户端的IP地址","LOCATION","$http_x_forwarded_for","","","");
|
||||
create("记录客户端用户名称","LOCATION","$remote_user","","","");
|
||||
create("记录访问时间与时区","LOCATION","$time_local","","","");
|
||||
create("记录请求的url与http协议","LOCATION","$request","","","");
|
||||
create("用来记录请求状态;成功是200","LOCATION","$status","","","");
|
||||
create("从哪个链接访问过来","LOCATION","$http_referer","","","");
|
||||
create("客户端浏览器信息","LOCATION","$http_user_agent","","","");
|
||||
}
|
||||
|
||||
private void create(String... data) {
|
||||
ConfigCreateRequest request = new ConfigCreateRequest();
|
||||
request.setConfName(data[0]);
|
||||
request.setConfType(data[1]);
|
||||
request.setConfKey(data[2]);
|
||||
request.setConfValue(data[3]);
|
||||
request.setConfNote(data[4]);
|
||||
ConfigCreateResponse configCreateResponse = configManager.create(request, token);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue