|
|
|
@ -10,8 +10,14 @@ 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.mgr.LocationsManager;
|
|
|
|
|
import xyz.wbsite.module.admin.mgr.ServicesManager;
|
|
|
|
|
import xyz.wbsite.module.admin.req.ConfigCreateRequest;
|
|
|
|
|
import xyz.wbsite.module.admin.req.LocationsCreateRequest;
|
|
|
|
|
import xyz.wbsite.module.admin.req.ServicesCreateRequest;
|
|
|
|
|
import xyz.wbsite.module.admin.rsp.ConfigCreateResponse;
|
|
|
|
|
import xyz.wbsite.module.admin.rsp.LocationsCreateResponse;
|
|
|
|
|
import xyz.wbsite.module.admin.rsp.ServicesCreateResponse;
|
|
|
|
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
|
@SpringBootTest
|
|
|
|
@ -21,19 +27,35 @@ public class DataInit {
|
|
|
|
|
private Token token;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ConfigManager configManager;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ServicesManager servicesManager;
|
|
|
|
|
@Autowired
|
|
|
|
|
private LocationsManager locationsManager;
|
|
|
|
|
|
|
|
|
|
@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","","","");
|
|
|
|
|
{
|
|
|
|
|
ServicesCreateRequest servicesCreateRequest = new ServicesCreateRequest();
|
|
|
|
|
servicesCreateRequest.setTitle("默认主机");
|
|
|
|
|
servicesCreateRequest.setDomain("location");
|
|
|
|
|
servicesCreateRequest.setPort(80);
|
|
|
|
|
servicesCreateRequest.setValid(true);
|
|
|
|
|
servicesCreateRequest.setFilter(false);
|
|
|
|
|
servicesCreateRequest.setFilterConf("");
|
|
|
|
|
ServicesCreateResponse servicesCreateResponse = servicesManager.create(servicesCreateRequest, token);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
LocationsCreateRequest locationsCreateRequest = new LocationsCreateRequest();
|
|
|
|
|
locationsCreateRequest.setServicesId(servicesCreateResponse.getId());
|
|
|
|
|
locationsCreateRequest.setLocalTitle("默认路径");
|
|
|
|
|
locationsCreateRequest.setLocalPath("/");
|
|
|
|
|
locationsCreateRequest.setLocalValid(true);
|
|
|
|
|
locationsCreateRequest.setFilter(false);
|
|
|
|
|
locationsCreateRequest.setFilterConf("");
|
|
|
|
|
LocationsCreateResponse locationsCreateResponse = locationsManager.create(locationsCreateRequest, token);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void create(String... data) {
|
|
|
|
|