parent
80c57bfa3e
commit
e947f95ffd
@ -0,0 +1,131 @@
|
|||||||
|
package com.example.system;
|
||||||
|
|
||||||
|
import com.example.frame.base.Token;
|
||||||
|
import com.example.module.system.mgr.DictItemManager;
|
||||||
|
import com.example.module.system.req.*;
|
||||||
|
import com.example.module.system.rsp.*;
|
||||||
|
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 static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DictItemTest - - 字典项测试用例
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2019-07-22
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
@Transactional
|
||||||
|
public class DictItemTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Token token;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DictItemManager dictItemManager;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreate() {
|
||||||
|
DictItemCreateRequest request = new DictItemCreateRequest();
|
||||||
|
request.setDictName("字典名称");
|
||||||
|
request.setKey("字典KEY");
|
||||||
|
request.setValue("字典VALUE");
|
||||||
|
request.setSort(1);
|
||||||
|
request.setValid(true);
|
||||||
|
|
||||||
|
DictItemCreateResponse response = dictItemManager.create(request,token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete() {
|
||||||
|
|
||||||
|
//创建数据
|
||||||
|
DictItemCreateRequest createRequest = new DictItemCreateRequest();
|
||||||
|
createRequest.setDictName("字典名称");
|
||||||
|
createRequest.setKey("字典KEY");
|
||||||
|
createRequest.setValue("字典VALUE");
|
||||||
|
createRequest.setSort(1);
|
||||||
|
createRequest.setValid(true);
|
||||||
|
|
||||||
|
DictItemCreateResponse createResponse = dictItemManager.create(createRequest,token);
|
||||||
|
|
||||||
|
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
|
||||||
|
//删除数据
|
||||||
|
DictItemDeleteRequest request = new DictItemDeleteRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
|
||||||
|
DictItemDeleteResponse response = dictItemManager.delete(request,token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getResult() == 1L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate() {
|
||||||
|
//创建数据
|
||||||
|
DictItemCreateRequest createRequest = new DictItemCreateRequest();
|
||||||
|
createRequest.setDictName("字典名称");
|
||||||
|
createRequest.setKey("字典KEY");
|
||||||
|
createRequest.setValue("字典VALUE");
|
||||||
|
createRequest.setSort(1);
|
||||||
|
createRequest.setValid(true);
|
||||||
|
|
||||||
|
DictItemCreateResponse createResponse = dictItemManager.create(createRequest, token);
|
||||||
|
|
||||||
|
//更新数据
|
||||||
|
DictItemUpdateRequest request = new DictItemUpdateRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
request.setKey("字典KEY");
|
||||||
|
request.setValue("字典VALUE");
|
||||||
|
request.setSort(1);
|
||||||
|
request.setValid(true);
|
||||||
|
|
||||||
|
DictItemUpdateResponse response = dictItemManager.update(request,token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getResult() == 1L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFind() {
|
||||||
|
DictItemFindRequest request = new DictItemFindRequest();
|
||||||
|
request.setDictName("字典名称");
|
||||||
|
request.setKey("字典KEY");
|
||||||
|
request.setValue("字典VALUE");
|
||||||
|
request.setSort(1);
|
||||||
|
request.setValid(true);
|
||||||
|
|
||||||
|
DictItemFindResponse response = dictItemManager.find(request,token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGet() {
|
||||||
|
//创建数据
|
||||||
|
DictItemCreateRequest createRequest = new DictItemCreateRequest();
|
||||||
|
createRequest.setDictName("字典名称");
|
||||||
|
createRequest.setKey("字典KEY");
|
||||||
|
createRequest.setValue("字典VALUE");
|
||||||
|
createRequest.setSort(1);
|
||||||
|
createRequest.setValid(true);
|
||||||
|
|
||||||
|
DictItemCreateResponse createResponse = dictItemManager.create(createRequest, token);
|
||||||
|
|
||||||
|
//获得数据
|
||||||
|
DictItemGetRequest request = new DictItemGetRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
|
||||||
|
DictItemGetResponse response = dictItemManager.get(request,token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getDictItem() != null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,158 @@
|
|||||||
|
package com.example.system;
|
||||||
|
|
||||||
|
import com.example.frame.base.Token;
|
||||||
|
import com.example.module.system.mgr.DictItemManager;
|
||||||
|
import com.example.module.system.mgr.DictItemManagerImpl;
|
||||||
|
import com.example.module.system.mgr.DictManager;
|
||||||
|
import com.example.module.system.req.*;
|
||||||
|
import com.example.module.system.rsp.*;
|
||||||
|
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 static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DictTest - - 字典测试用例
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2019-07-22
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
@Transactional
|
||||||
|
public class DictTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Token token;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DictManager dictManager;
|
||||||
|
@Autowired
|
||||||
|
private DictItemManager dictItemManager;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreate() {
|
||||||
|
DictCreateRequest request = new DictCreateRequest();
|
||||||
|
request.setDictName("字典名称");
|
||||||
|
request.setDictComment("字典描述");
|
||||||
|
request.setVersion("字典版本号");
|
||||||
|
request.setValid(true);
|
||||||
|
|
||||||
|
DictCreateResponse response = dictManager.create(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete() {
|
||||||
|
|
||||||
|
//创建数据
|
||||||
|
DictCreateRequest createRequest = new DictCreateRequest();
|
||||||
|
createRequest.setDictName("字典名称");
|
||||||
|
createRequest.setDictComment("字典描述");
|
||||||
|
createRequest.setVersion("字典版本号");
|
||||||
|
createRequest.setValid(true);
|
||||||
|
|
||||||
|
DictCreateResponse createResponse = dictManager.create(createRequest, token);
|
||||||
|
|
||||||
|
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
|
||||||
|
//删除数据
|
||||||
|
DictDeleteRequest request = new DictDeleteRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
|
||||||
|
DictDeleteResponse response = dictManager.delete(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getResult() == 1L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdate() {
|
||||||
|
//创建数据
|
||||||
|
DictCreateRequest createRequest = new DictCreateRequest();
|
||||||
|
createRequest.setDictName("字典名称");
|
||||||
|
createRequest.setDictComment("字典描述");
|
||||||
|
createRequest.setVersion("字典版本号");
|
||||||
|
createRequest.setValid(true);
|
||||||
|
|
||||||
|
DictCreateResponse createResponse = dictManager.create(createRequest, token);
|
||||||
|
|
||||||
|
//更新数据
|
||||||
|
DictUpdateRequest request = new DictUpdateRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
request.setDictName("字典名称");
|
||||||
|
request.setDictComment("字典描述");
|
||||||
|
request.setVersion("字典版本号");
|
||||||
|
request.setValid(true);
|
||||||
|
|
||||||
|
DictUpdateResponse response = dictManager.update(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getResult() == 1L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFind() {
|
||||||
|
DictFindRequest request = new DictFindRequest();
|
||||||
|
request.setDictName("字典名称");
|
||||||
|
request.setDictComment("字典描述");
|
||||||
|
request.setValid(true);
|
||||||
|
|
||||||
|
DictFindResponse response = dictManager.find(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGet() {
|
||||||
|
//创建数据
|
||||||
|
DictCreateRequest createRequest = new DictCreateRequest();
|
||||||
|
createRequest.setDictName("字典名称");
|
||||||
|
createRequest.setDictComment("字典描述");
|
||||||
|
createRequest.setVersion("字典版本号");
|
||||||
|
createRequest.setValid(true);
|
||||||
|
|
||||||
|
DictCreateResponse createResponse = dictManager.create(createRequest, token);
|
||||||
|
|
||||||
|
//获得数据
|
||||||
|
DictGetRequest request = new DictGetRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
|
||||||
|
DictGetResponse response = dictManager.get(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getDict() != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLoad() {
|
||||||
|
//创建数据
|
||||||
|
DictCreateRequest createRequest = new DictCreateRequest();
|
||||||
|
createRequest.setDictName("字典名称");
|
||||||
|
createRequest.setDictComment("字典描述");
|
||||||
|
createRequest.setVersion("字典版本号");
|
||||||
|
createRequest.setValid(true);
|
||||||
|
|
||||||
|
DictCreateResponse createResponse = dictManager.create(createRequest, token);
|
||||||
|
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
|
||||||
|
|
||||||
|
DictItemCreateRequest dictItemCreateRequest = new DictItemCreateRequest();
|
||||||
|
dictItemCreateRequest.setDictName("字典名称");
|
||||||
|
dictItemCreateRequest.setKey("1");
|
||||||
|
dictItemCreateRequest.setValue("1");
|
||||||
|
dictItemCreateRequest.setSort(1);
|
||||||
|
dictItemCreateRequest.setValid(true);
|
||||||
|
DictItemCreateResponse dictItemCreateResponse = dictItemManager.create(dictItemCreateRequest, token);
|
||||||
|
assertTrue(!dictItemCreateResponse.hasError() && dictItemCreateResponse.getId() > 0);
|
||||||
|
|
||||||
|
//获取字典及字典项数据
|
||||||
|
DictLoadRequest request = new DictLoadRequest();
|
||||||
|
request.setDictName("字典名称");
|
||||||
|
|
||||||
|
DictLoadResponse response = dictManager.load(request, token);
|
||||||
|
assertTrue(!response.hasError() && response.getDict() != null && response.getDictItems().size() > 0);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
package com.example.system;
|
||||||
|
|
||||||
|
import com.example.frame.base.Token;
|
||||||
|
import com.example.module.system.mgr.FileManager;
|
||||||
|
import com.example.module.system.req.FileCreateRequest;
|
||||||
|
import com.example.module.system.req.FileDeleteRequest;
|
||||||
|
import com.example.module.system.req.FileFindRequest;
|
||||||
|
import com.example.module.system.req.FileGetRequest;
|
||||||
|
import com.example.module.system.rsp.FileCreateResponse;
|
||||||
|
import com.example.module.system.rsp.FileDeleteResponse;
|
||||||
|
import com.example.module.system.rsp.FileFindResponse;
|
||||||
|
import com.example.module.system.rsp.FileGetResponse;
|
||||||
|
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 static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileTest - - 字典测试用例
|
||||||
|
*
|
||||||
|
* @author wangbing
|
||||||
|
* @version 0.0.1
|
||||||
|
* @since 2019-07-22
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
@Transactional
|
||||||
|
public class FileTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Token token;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileManager fileManager;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreate() {
|
||||||
|
FileCreateRequest request = new FileCreateRequest();
|
||||||
|
request.setName("字文件名称");
|
||||||
|
request.setFileType(null);
|
||||||
|
request.setUrl("http://example.com/a.zip");
|
||||||
|
request.setUrlDownload("http://example.com/a.zip");
|
||||||
|
request.setAttribute1("Attribute1");
|
||||||
|
request.setAttribute2("Attribute2");
|
||||||
|
request.setAttribute2("Attribute3");
|
||||||
|
|
||||||
|
FileCreateResponse response = fileManager.create(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelete() {
|
||||||
|
|
||||||
|
//创建数据
|
||||||
|
FileCreateRequest createRequest = new FileCreateRequest();
|
||||||
|
createRequest.setName("字文件名称");
|
||||||
|
createRequest.setFileType(null);
|
||||||
|
createRequest.setUrl("http://example.com/a.zip");
|
||||||
|
createRequest.setUrlDownload("http://example.com/a.zip");
|
||||||
|
createRequest.setAttribute1("Attribute1");
|
||||||
|
createRequest.setAttribute2("Attribute2");
|
||||||
|
createRequest.setAttribute2("Attribute3");
|
||||||
|
|
||||||
|
FileCreateResponse createResponse = fileManager.create(createRequest, token);
|
||||||
|
|
||||||
|
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
|
||||||
|
//删除数据
|
||||||
|
FileDeleteRequest request = new FileDeleteRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
|
||||||
|
FileDeleteResponse response = fileManager.delete(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getResult() == 1L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFind() {
|
||||||
|
FileFindRequest request = new FileFindRequest();
|
||||||
|
request.setName("字文件名称");
|
||||||
|
request.setFileType(null);
|
||||||
|
request.setAttribute1("Attribute1");
|
||||||
|
request.setAttribute2("Attribute2");
|
||||||
|
request.setAttribute2("Attribute3");
|
||||||
|
|
||||||
|
FileFindResponse response = fileManager.find(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGet() {
|
||||||
|
//创建数据
|
||||||
|
FileCreateRequest createRequest = new FileCreateRequest();
|
||||||
|
createRequest.setName("字文件名称");
|
||||||
|
createRequest.setFileType(null);
|
||||||
|
createRequest.setUrl("http://example.com/a.zip");
|
||||||
|
createRequest.setUrlDownload("http://example.com/a.zip");
|
||||||
|
createRequest.setAttribute1("Attribute1");
|
||||||
|
createRequest.setAttribute2("Attribute2");
|
||||||
|
createRequest.setAttribute2("Attribute3");
|
||||||
|
|
||||||
|
FileCreateResponse createResponse = fileManager.create(createRequest, token);
|
||||||
|
|
||||||
|
//获得数据
|
||||||
|
FileGetRequest request = new FileGetRequest();
|
||||||
|
request.setId(createResponse.getId());
|
||||||
|
|
||||||
|
FileGetResponse response = fileManager.get(request, token);
|
||||||
|
|
||||||
|
assertTrue(!response.hasError() && response.getFile() != null);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue