Search in sources :

Example 76 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class PermissionsRESTControllerTest method testGetgetAssignmentsForPrincipalNullPrincipal.

@Test(expected = NullPointerException.class)
public void testGetgetAssignmentsForPrincipalNullPrincipal() throws Exception {
    String principal = "principal";
    boolean includeInherited = true;
    JsonEntityBean entity = buildJsonPersonEntityBean();
    Mockito.when(groupListHelper.getEntityForPrincipal(principal)).thenReturn(entity);
    Mockito.when(this.authorizationService.newPrincipal(entity.getId(), entity.getEntityType().getClazz())).thenReturn(null);
    ModelAndView modelAndView = permissionsRESTController.getAssignmentsForPrincipal(principal, includeInherited, req, res);
    Collection<IPermissionTarget> targets = (Collection<IPermissionTarget>) modelAndView.getModel().get("assignments");
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean) IPermissionTarget(org.apereo.portal.permission.target.IPermissionTarget) ModelAndView(org.springframework.web.servlet.ModelAndView) Collection(java.util.Collection) Test(org.junit.Test)

Example 77 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class AssignmentTest method setup.

@Before
public void setup() {
    String principal = "principal";
    JsonEntityBean principalBean = buildJsonGroupEntityBean();
    assignment = new Assignment(principal, principalBean);
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean) Before(org.junit.Before)

Example 78 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class AssignmentTest method testFindDecendentOrSelfIfExists.

@Test
public void testFindDecendentOrSelfIfExists() {
    JsonEntityBean bean = buildJsonGroupEntityBean();
    Assignment newAssignment = this.assignment.findDecendentOrSelfIfExists(bean);
    Assert.assertNotNull(newAssignment);
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean) Test(org.junit.Test)

Example 79 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class EntitiesRESTControllerTest method buildJsonEntityBean.

private JsonEntityBean buildJsonEntityBean() {
    JsonEntityBean bean = new JsonEntityBean();
    bean.setEntityType(ENTITY_TYPE);
    bean.setId(ENTITY_ID_101);
    bean.setName("test");
    bean.setDescription("Testing bean");
    return bean;
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean)

Example 80 with JsonEntityBean

use of org.apereo.portal.layout.dlm.remoting.JsonEntityBean in project uPortal by Jasig.

the class EntitiesRESTControllerTest method testFindEntity.

@Test
public void testFindEntity() {
    Mockito.when(groupListHelper.getEntity(ENTITY_TYPE, ENTITY_ID_101, true)).thenReturn(new JsonEntityBean());
    JsonEntityBean entityBean = entitiesRESTController.findEntity(req, res, ENTITY_TYPE, ENTITY_ID_101);
    Assert.assertNotNull(entityBean);
}
Also used : JsonEntityBean(org.apereo.portal.layout.dlm.remoting.JsonEntityBean) Test(org.junit.Test)

Aggregations

JsonEntityBean (org.apereo.portal.layout.dlm.remoting.JsonEntityBean)86 Test (org.junit.Test)53 EntityEnum (org.apereo.portal.portlets.groupselector.EntityEnum)13 ModelAndView (org.springframework.web.servlet.ModelAndView)10 IEntityGroup (org.apereo.portal.groups.IEntityGroup)9 IGroupMember (org.apereo.portal.groups.IGroupMember)9 IAuthorizationPrincipal (org.apereo.portal.security.IAuthorizationPrincipal)9 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 IPermission (org.apereo.portal.security.IPermission)4 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 List (java.util.List)3 IPermissionTarget (org.apereo.portal.permission.target.IPermissionTarget)3 PortletCategory (org.apereo.portal.portlet.om.PortletCategory)3 IPerson (org.apereo.portal.security.IPerson)3 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 GroupListHelperImpl (org.apereo.portal.layout.dlm.remoting.GroupListHelperImpl)2 IPermissionActivity (org.apereo.portal.permission.IPermissionActivity)2