|
|
|
@ -35,7 +35,6 @@ import org.apache.dolphinscheduler.dao.mapper.UserMapper;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Locale; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
import org.junit.Assert; |
|
|
|
@ -81,7 +80,7 @@ public class TenantServiceTest {
|
|
|
|
|
try { |
|
|
|
|
//check tenantCode
|
|
|
|
|
Map<String, Object> result = |
|
|
|
|
tenantService.createTenant(getLoginUser(), "%!1111", 1, "TenantServiceTest"); |
|
|
|
|
tenantService.createTenant(getLoginUser(), "%!1111", 1, "TenantServiceTest"); |
|
|
|
|
logger.info(result.toString()); |
|
|
|
|
Assert.assertEquals(Status.VERIFY_OS_TENANT_CODE_ERROR, result.get(Constants.STATUS)); |
|
|
|
|
|
|
|
|
@ -109,7 +108,7 @@ public class TenantServiceTest {
|
|
|
|
|
page.setRecords(getList()); |
|
|
|
|
page.setTotal(1L); |
|
|
|
|
Mockito.when(tenantMapper.queryTenantPaging(Mockito.any(Page.class), Mockito.eq("TenantServiceTest"))) |
|
|
|
|
.thenReturn(page); |
|
|
|
|
.thenReturn(page); |
|
|
|
|
Map<String, Object> result = tenantService.queryTenantList(getLoginUser(), "TenantServiceTest", 1, 10); |
|
|
|
|
logger.info(result.toString()); |
|
|
|
|
PageInfo<Tenant> pageInfo = (PageInfo<Tenant>) result.get(Constants.DATA_LIST); |
|
|
|
@ -124,7 +123,7 @@ public class TenantServiceTest {
|
|
|
|
|
try { |
|
|
|
|
// id not exist
|
|
|
|
|
Map<String, Object> result = |
|
|
|
|
tenantService.updateTenant(getLoginUser(), 912222, tenantCode, 1, "desc"); |
|
|
|
|
tenantService.updateTenant(getLoginUser(), 912222, tenantCode, 1, "desc"); |
|
|
|
|
logger.info(result.toString()); |
|
|
|
|
// success
|
|
|
|
|
Assert.assertEquals(Status.TENANT_NOT_EXIST, result.get(Constants.STATUS)); |
|
|
|
@ -143,7 +142,7 @@ public class TenantServiceTest {
|
|
|
|
|
|
|
|
|
|
Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); |
|
|
|
|
Mockito.when(processInstanceMapper.queryByTenantIdAndStatus(1, Constants.NOT_TERMINATED_STATES)) |
|
|
|
|
.thenReturn(getInstanceList()); |
|
|
|
|
.thenReturn(getInstanceList()); |
|
|
|
|
Mockito.when(processDefinitionMapper.queryDefinitionListByTenant(2)).thenReturn(getDefinitionsList()); |
|
|
|
|
Mockito.when(userMapper.queryUserListByTenant(3)).thenReturn(getUserList()); |
|
|
|
|
|
|
|
|
@ -191,14 +190,7 @@ public class TenantServiceTest {
|
|
|
|
|
Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); |
|
|
|
|
// tenantCode exist
|
|
|
|
|
result = tenantService.verifyTenantCode(getTenant().getTenantCode()); |
|
|
|
|
String resultString; |
|
|
|
|
if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())) { |
|
|
|
|
resultString = "操作系统租户[TenantServiceTest]已存在"; |
|
|
|
|
} else { |
|
|
|
|
resultString = "tenant code TenantServiceTest already exists"; |
|
|
|
|
} |
|
|
|
|
logger.info(result.toString()); |
|
|
|
|
Assert.assertEquals(resultString, result.getMsg()); |
|
|
|
|
Assert.assertEquals(Status.OS_TENANT_CODE_EXIST.getCode(), result.getCode().intValue()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|