|
|
|
@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.dao.mapper;
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.BaseDaoTest; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.Project; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProjectUser; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
@ -39,6 +40,9 @@ public class ProjectMapperTest extends BaseDaoTest {
|
|
|
|
|
@Autowired |
|
|
|
|
private UserMapper userMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ProjectUserMapper projectUserMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* insert |
|
|
|
|
* |
|
|
|
@ -168,7 +172,7 @@ public class ProjectMapperTest extends BaseDaoTest {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* test query authed prject list by userId |
|
|
|
|
* test query authed project list by userId |
|
|
|
|
*/ |
|
|
|
|
@Test |
|
|
|
|
public void testQueryAuthedProjectListByUserId() { |
|
|
|
@ -192,4 +196,26 @@ public class ProjectMapperTest extends BaseDaoTest {
|
|
|
|
|
|
|
|
|
|
Assert.assertNotEquals(projects.size(), 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testQueryAllProject() { |
|
|
|
|
User user = new User(); |
|
|
|
|
user.setUserName("ut user"); |
|
|
|
|
userMapper.insert(user); |
|
|
|
|
|
|
|
|
|
Project project = insertOne(); |
|
|
|
|
project.setUserId(user.getId()); |
|
|
|
|
projectMapper.updateById(project); |
|
|
|
|
|
|
|
|
|
ProjectUser projectUser = new ProjectUser(); |
|
|
|
|
projectUser.setProjectId(project.getId()); |
|
|
|
|
projectUser.setUserId(user.getId()); |
|
|
|
|
projectUser.setCreateTime(new Date()); |
|
|
|
|
projectUser.setUpdateTime(new Date()); |
|
|
|
|
projectUserMapper.insert(projectUser); |
|
|
|
|
|
|
|
|
|
List<Project> allProject = projectMapper.queryAllProject(user.getId()); |
|
|
|
|
|
|
|
|
|
Assert.assertNotEquals(allProject.size(), 0); |
|
|
|
|
} |
|
|
|
|
} |