parent
32213ae06b
commit
7a8937ddf4
@ -1,22 +0,0 @@
|
||||
package com.xxl.job.admin.controller;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
|
||||
public class IndexControllerTest extends AbstractSpringMvcTest {
|
||||
|
||||
@Test
|
||||
public void testLogin() throws Exception {
|
||||
MvcResult ret = mockMvc.perform(
|
||||
post("/login")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
.param("userName", "admin")
|
||||
.param("password", "123456")
|
||||
).andReturn();
|
||||
|
||||
System.out.println(ret.getResponse().getContentAsString());
|
||||
}
|
||||
}
|
@ -1,52 +1,47 @@
|
||||
package com.xxl.job.admin.controller;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import com.xxl.job.admin.controller.interceptor.PermissionInterceptor;
|
||||
import com.xxl.job.admin.core.util.PropertiesUtil;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
|
||||
public class JobInfoControllerTest extends AbstractSpringMvcTest {
|
||||
Cookie cookie;
|
||||
|
||||
private Cookie cookie;
|
||||
|
||||
@Before
|
||||
public void login() throws Exception {
|
||||
MvcResult ret = mockMvc.perform(
|
||||
post("/login")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
.param("userName", "admin")
|
||||
.param("password", "123456")
|
||||
.param("userName", PropertiesUtil.getString("xxl.job.login.username"))
|
||||
.param("password", PropertiesUtil.getString("xxl.job.login.password"))
|
||||
).andReturn();
|
||||
cookie = ret.getResponse().getCookie("LOGIN_IDENTITY");
|
||||
cookie = ret.getResponse().getCookie(PermissionInterceptor.LOGIN_IDENTITY_KEY);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdd() throws Exception {
|
||||
XxlJobInfo jobInfo = new XxlJobInfo();
|
||||
jobInfo.setJobGroup(1);
|
||||
jobInfo.setJobDesc("autoEnquiryStatisPerWeek");
|
||||
jobInfo.setExecutorRouteStrategy("FIRST");
|
||||
jobInfo.setJobCron("0 0 1 ? * MON");
|
||||
jobInfo.setGlueType("BEAN");
|
||||
jobInfo.setExecutorHandler("AutoEnquriy");
|
||||
jobInfo.setExecutorBlockStrategy("SERIAL_EXECUTION");
|
||||
jobInfo.setExecutorFailStrategy("FAIL_ALARM");
|
||||
jobInfo.setAuthor("listening");
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String jobInfoStr = mapper.writeValueAsString(jobInfo);
|
||||
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
|
||||
parameters.add("jobGroup", "1");
|
||||
|
||||
MvcResult ret = mockMvc.perform(
|
||||
post("/jobinfo/add")
|
||||
post("/jobinfo/pageList")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
.content(jobInfoStr)
|
||||
//.content(paramsJson)
|
||||
.params(parameters)
|
||||
.cookie(cookie)
|
||||
).andReturn();
|
||||
|
||||
System.out.println(ret.getResponse().getContentAsString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobGroup;
|
||||
import com.xxl.job.admin.dao.XxlJobGroupDao;
|
@ -1,4 +1,4 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||
import com.xxl.job.admin.dao.XxlJobLogDao;
|
@ -1,4 +1,4 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobLogGlue;
|
||||
import com.xxl.job.admin.dao.XxlJobLogGlueDao;
|
@ -1,4 +1,4 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
package com.xxl.job.admin.dao;
|
||||
|
||||
import com.xxl.job.admin.core.model.XxlJobRegistry;
|
||||
import com.xxl.job.admin.dao.XxlJobRegistryDao;
|
@ -1,4 +1,4 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
package com.xxl.job.admin.util;
|
||||
|
||||
import com.xxl.job.admin.core.util.MailUtil;
|
||||
import org.junit.Test;
|
@ -0,0 +1,18 @@
|
||||
package com.xxl.job.admin.util;
|
||||
|
||||
import com.xxl.job.admin.core.util.PropertiesUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* prop util test
|
||||
*
|
||||
* @author xuxueli 2017-12-25 15:17:36
|
||||
*/
|
||||
public class PropertiesUtilTest {
|
||||
|
||||
@Test
|
||||
public void registryTest() throws Exception {
|
||||
System.out.println(PropertiesUtil.getString("xxl.job.login.username"));
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.xxl.job.dao.impl;
|
||||
package com.xxl.job.adminbiz;
|
||||
|
||||
import com.xxl.job.core.biz.AdminBiz;
|
||||
import com.xxl.job.core.biz.model.RegistryParam;
|
Loading…
Reference in new issue