Search in sources :

Example 1 with RoleDTO

use of org.simbasecurity.core.service.manager.dto.RoleDTO in project simba-os by cegeka.

the class RoleDTOAssemblerTest method testAssembleSingleRole.

@Test
public void testAssembleSingleRole() {
    Role role = new RoleEntity("role name");
    RoleDTO roleData = RoleDTOAssembler.assemble(role);
    assertNotNull(roleData);
    assertEquals(0, roleData.getId());
    assertEquals(role.getName(), roleData.getName());
    assertEquals(0, role.getId());
    assertEquals(0, role.getVersion());
}
Also used : Role(org.simbasecurity.core.domain.Role) RoleEntity(org.simbasecurity.core.domain.RoleEntity) RoleDTO(org.simbasecurity.core.service.manager.dto.RoleDTO) Test(org.junit.Test)

Example 2 with RoleDTO

use of org.simbasecurity.core.service.manager.dto.RoleDTO in project simba-os by cegeka.

the class RoleDTOAssemblerTest method testAssembleMultipleRoles.

@Test
public void testAssembleMultipleRoles() {
    Role role = new RoleEntity("role name");
    Collection<RoleDTO> roleDataList = RoleDTOAssembler.assemble(Arrays.asList(role));
    assertNotNull(roleDataList);
    assertEquals(1, roleDataList.size());
}
Also used : Role(org.simbasecurity.core.domain.Role) RoleEntity(org.simbasecurity.core.domain.RoleEntity) RoleDTO(org.simbasecurity.core.service.manager.dto.RoleDTO) Test(org.junit.Test)

Example 3 with RoleDTO

use of org.simbasecurity.core.service.manager.dto.RoleDTO in project simba-os by cegeka.

the class RoleDTOAssembler method assemble.

public static RoleDTO assemble(Role role) {
    RoleDTO roleDTO = new RoleDTO();
    applyVersionAndId((AbstractVersionedEntity) role, roleDTO);
    roleDTO.setName(role.getName());
    return roleDTO;
}
Also used : RoleDTO(org.simbasecurity.core.service.manager.dto.RoleDTO)

Aggregations

RoleDTO (org.simbasecurity.core.service.manager.dto.RoleDTO)3 Test (org.junit.Test)2 Role (org.simbasecurity.core.domain.Role)2 RoleEntity (org.simbasecurity.core.domain.RoleEntity)2