You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
3.4 KiB
108 lines
3.4 KiB
package ${domain}.wsys;
|
|
|
|
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.context.junit4.SpringRunner;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import ${domain}.frame.auth.Token;
|
|
import ${domain}.module.wsys.mgr.ProfilesManager;
|
|
import ${domain}.module.wsys.req.ProfilesCreateRequest;
|
|
import ${domain}.module.wsys.req.ProfilesDeleteRequest;
|
|
import ${domain}.module.wsys.req.ProfilesFindRequest;
|
|
import ${domain}.module.wsys.req.ProfilesUpdateRequest;
|
|
import ${domain}.module.wsys.rsp.ProfilesCreateResponse;
|
|
import ${domain}.module.wsys.rsp.ProfilesDeleteResponse;
|
|
import ${domain}.module.wsys.rsp.ProfilesFindResponse;
|
|
import ${domain}.module.wsys.rsp.ProfilesUpdateResponse;
|
|
|
|
import static junit.framework.TestCase.assertTrue;
|
|
|
|
/**
|
|
* ProfilesTest - - 系统配置测试用例
|
|
*
|
|
* @author wangbing
|
|
* @version 0.0.1
|
|
* @since 2020-07-06
|
|
*/
|
|
@RunWith(SpringRunner.class)
|
|
@SpringBootTest
|
|
@Transactional
|
|
public class ProfilesTest {
|
|
|
|
@Autowired
|
|
private Token token;
|
|
|
|
@Autowired
|
|
private ProfilesManager profilesManager;
|
|
|
|
@Test
|
|
public void testCreate() {
|
|
ProfilesCreateRequest request = new ProfilesCreateRequest();
|
|
request.setActive("value");
|
|
request.setKey("配置键");
|
|
request.setValue("配置值");
|
|
|
|
ProfilesCreateResponse response = profilesManager.create(request,token);
|
|
|
|
assertTrue(!response.hasError());
|
|
}
|
|
|
|
@Test
|
|
public void testDelete() {
|
|
|
|
//创建数据
|
|
ProfilesCreateRequest createRequest = new ProfilesCreateRequest();
|
|
createRequest.setActive("value");
|
|
createRequest.setKey("配置键");
|
|
createRequest.setValue("配置值");
|
|
|
|
ProfilesCreateResponse createResponse = profilesManager.create(createRequest,token);
|
|
|
|
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
|
|
//删除数据
|
|
ProfilesDeleteRequest request = new ProfilesDeleteRequest();
|
|
request.setId(createResponse.getId());
|
|
|
|
ProfilesDeleteResponse response = profilesManager.delete(request,token);
|
|
|
|
assertTrue(!response.hasError() && response.getResult() == 1L);
|
|
}
|
|
|
|
@Test
|
|
public void testUpdate() {
|
|
//创建数据
|
|
ProfilesCreateRequest createRequest = new ProfilesCreateRequest();
|
|
createRequest.setActive("value");
|
|
createRequest.setKey("配置键");
|
|
createRequest.setValue("配置值");
|
|
|
|
ProfilesCreateResponse createResponse = profilesManager.create(createRequest, token);
|
|
|
|
assertTrue(!createResponse.hasError());
|
|
|
|
//更新数据
|
|
ProfilesUpdateRequest request = new ProfilesUpdateRequest();
|
|
request.setId(createResponse.getId());
|
|
request.setActive("value");
|
|
request.setKey("配置键");
|
|
request.setValue("配置值");
|
|
|
|
ProfilesUpdateResponse response = profilesManager.update(request,token);
|
|
|
|
assertTrue(!response.hasError() && response.getResult() == 1L);
|
|
}
|
|
|
|
@Test
|
|
public void testFind() {
|
|
ProfilesFindRequest request = new ProfilesFindRequest();
|
|
request.setActive("value");
|
|
request.setKey("配置键");
|
|
|
|
ProfilesFindResponse response = profilesManager.find(request,token);
|
|
|
|
assertTrue(!response.hasError());
|
|
}
|
|
}
|