Search in sources :

Example 46 with Project

use of com.webank.wedatasphere.qualitis.project.entity.Project in project Qualitis by WeBankFinTech.

the class ProjectUserRepositoryTest method test.

@Test
@Transactional
public void test() {
    // 保存是否成功
    Project project = new Project();
    project.setName("junitProject");
    project.setCreateUser("setCreateUser");
    project.setCreateUserFullName("setCreateUserFullName");
    project.setDescription("setDescription");
    project.setUserDepartment("setUserDepartment");
    Project saveProject = projectRepository.save(project);
    assertTrue(saveProject.getId() != 0);
    ProjectUser saveEntity = new ProjectUser(ProjectUserPermissionEnum.CREATOR.getCode(), project, "v_wblwyan_test", "颜龙武");
    ProjectUser entity = repository.save(saveEntity);
    // 根据username查询的数据库对象是否和保存的值一致
    List<ProjectUser> findByUserNameList = repository.findByUserName(entity.getUserName());
    assertTrue(findByUserNameList.size() > 0);
    assertEquals(findByUserNameList.get(0).getUserName(), entity.getUserName());
    // 删除后,是否还能找到对象
    repository.deleteByProject(project);
    List<ProjectUser> deleteEntity = repository.findByUserName(entity.getUserName());
    assertTrue(deleteEntity.isEmpty());
}
Also used : Project(com.webank.wedatasphere.qualitis.project.entity.Project) ProjectUser(com.webank.wedatasphere.qualitis.project.entity.ProjectUser) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Project (com.webank.wedatasphere.qualitis.project.entity.Project)46 UnExpectedRequestException (com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException)33 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)28 Transactional (org.springframework.transaction.annotation.Transactional)25 Rule (com.webank.wedatasphere.qualitis.rule.entity.Rule)22 ArrayList (java.util.ArrayList)17 User (com.webank.wedatasphere.qualitis.entity.User)13 PermissionDeniedRequestException (com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException)11 ExcelMultiTemplateRuleByProject (com.webank.wedatasphere.qualitis.project.excel.ExcelMultiTemplateRuleByProject)11 Date (java.util.Date)11 ExcelCustomRuleByProject (com.webank.wedatasphere.qualitis.project.excel.ExcelCustomRuleByProject)9 ExcelTemplateRuleByProject (com.webank.wedatasphere.qualitis.project.excel.ExcelTemplateRuleByProject)9 RuleGroup (com.webank.wedatasphere.qualitis.rule.entity.RuleGroup)9 RuleResponse (com.webank.wedatasphere.qualitis.rule.response.RuleResponse)9 AlarmConfig (com.webank.wedatasphere.qualitis.rule.entity.AlarmConfig)8 RuleDataSource (com.webank.wedatasphere.qualitis.rule.entity.RuleDataSource)8 IOException (java.io.IOException)8 ClusterInfoNotConfigException (com.webank.wedatasphere.qualitis.exception.ClusterInfoNotConfigException)6 TaskNotExistException (com.webank.wedatasphere.qualitis.exception.TaskNotExistException)6 MetaDataAcquireFailedException (com.webank.wedatasphere.qualitis.metadata.exception.MetaDataAcquireFailedException)6