Search in sources :

Example 1 with WriterPermission

use of com.bc.pmpheep.back.po.WriterPermission in project pmph by BCSquad.

the class WriterPermissionServiceTest method getPmphPermissionTest.

/**
 * PmphPermission 查询Test
 */
@Test
@Rollback(Const.ISROLLBACK)
public void getPmphPermissionTest() {
    WriterPermission pp = new WriterPermission();
    pp.setMenuName("用户管理4");
    pp.setUrl("admin/user/add");
    pp.setPermissionName("用户管理添加");
    pp.setPath("admin:add");
    pp.setParentId(4L);
    writerPermissionService.addWriterPermission(pp);
    pp.setId(pp.getId());
    Assert.assertNotNull("getWriterPermissionByPermissionName是否为空", // 按ID查询资源
    writerPermissionService.getWriterPermissionByPermissionName("用户管理添加"));
    Assert.assertNotNull("get是否为空", writerPermissionService.get(pp.getId()));
    // 查询所有资源
    Assert.assertNotNull("getListResource是否为空", writerPermissionService.getListResource());
// Assert.assertNotNull("WriterPermission是否为空", writerPermissionService.getListAllParentMenu());
// Assert.assertNotNull("WriterPermissionByParentId是否为空", writerPermissionService.getListChildMenuByParentId(0L));
}
Also used : WriterPermission(com.bc.pmpheep.back.po.WriterPermission) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 2 with WriterPermission

use of com.bc.pmpheep.back.po.WriterPermission in project pmph by BCSquad.

the class WriterPermissionServiceTest method updatePmphPermissionTest.

/**
 * PmphPermission 更新Test
 */
@Test
@Rollback(Const.ISROLLBACK)
public void updatePmphPermissionTest() {
    WriterPermission pp = new WriterPermission();
    pp.setMenuName("用户管理2");
    pp.setUrl("admin/user/add");
    pp.setPermissionName("用户管理添加2");
    pp.setPath("admin:add");
    pp.setParentId(2L);
    writerPermissionService.addWriterPermission(pp);
    pp.setId(pp.getId());
    pp.setMenuName("用户管理2");
    // 按ID更新资源目录
    Integer aInteger = writerPermissionService.updateWriterPermissionById(pp);
    Assert.assertTrue("是否更新成功", aInteger > 0 ? true : false);
}
Also used : WriterPermission(com.bc.pmpheep.back.po.WriterPermission) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 3 with WriterPermission

use of com.bc.pmpheep.back.po.WriterPermission in project pmph by BCSquad.

the class WriterPermissionServiceTest method deletePmphPermissionTest.

/**
 * PmphPermission 删除Test
 */
@Test
@Rollback(Const.ISROLLBACK)
public void deletePmphPermissionTest() {
    WriterPermission pp = new WriterPermission();
    pp.setMenuName("用户管理3");
    pp.setUrl("admin/user/add");
    pp.setPermissionName("用户管理添加3");
    pp.setPath("admin:add");
    pp.setParentId(3L);
    writerPermissionService.addWriterPermission(pp);
    pp.setId(pp.getId());
    // String[] ids = { "2L" };
    // 按ID删除资源
    Integer aInteger = writerPermissionService.delete(pp.getId());
    Assert.assertTrue("delete是否删除成功", aInteger > 0 ? true : false);
// Integer bInteger = writerPermissionService.deleteWriterPermissionById(ids);
// Assert.assertTrue("deleteWriterPermissionById是否删除成功", bInteger > 0 ? true : false);
}
Also used : WriterPermission(com.bc.pmpheep.back.po.WriterPermission) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 4 with WriterPermission

use of com.bc.pmpheep.back.po.WriterPermission in project pmph by BCSquad.

the class WriterRoleServiceTest method testGetListRoleResource.

@Test
@Rollback(Const.ISROLLBACK)
public void testGetListRoleResource() {
    WriterRole writerRole = this.addWriterRole();
    List<WriterPermission> list = writerRoleService.getListRoleResource(writerRole.getId());
    Assert.assertNotNull("是否查询成功", list);
    List<WriterRolePermission> list1 = writerRoleService.getListWriterRolePermission(writerRole.getId());
    Assert.assertNotNull("是否查询成功", list1);
    List<Long> ids = writerRoleService.getListPmphWriterPermissionIdByRoleId(writerRole.getId());
    Assert.assertNotNull("是否查询成功", ids);
}
Also used : WriterPermission(com.bc.pmpheep.back.po.WriterPermission) WriterRolePermission(com.bc.pmpheep.back.po.WriterRolePermission) WriterRole(com.bc.pmpheep.back.po.WriterRole) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 5 with WriterPermission

use of com.bc.pmpheep.back.po.WriterPermission in project pmph by BCSquad.

the class WriterUserServiceTest method testGetListAllResource.

@Test
@Rollback(Const.ISROLLBACK)
public void testGetListAllResource() {
    WriterUser writerUser = this.addWriterUser();
    Integer writerPermission = writerPermissionService.addWriterPermission(new WriterPermission(2L, "PATH", "name", "menu_name", "url", false, null, null, null, null));
    // 查询所有
    Assert.assertNotNull("查询失败", writerUserService.getListAllResource(writerUser.getId()));
}
Also used : WriterPermission(com.bc.pmpheep.back.po.WriterPermission) WriterUser(com.bc.pmpheep.back.po.WriterUser) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Aggregations

WriterPermission (com.bc.pmpheep.back.po.WriterPermission)8 BaseTest (com.bc.pmpheep.test.BaseTest)6 Test (org.junit.Test)6 Rollback (org.springframework.test.annotation.Rollback)6 WriterUser (com.bc.pmpheep.back.po.WriterUser)2 LogDetail (com.bc.pmpheep.annotation.LogDetail)1 WriterRole (com.bc.pmpheep.back.po.WriterRole)1 WriterRolePermission (com.bc.pmpheep.back.po.WriterRolePermission)1 ResponseBean (com.bc.pmpheep.controller.bean.ResponseBean)1 HashMap (java.util.HashMap)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1