Package com.agiletec.plugins.jpcalendar.aps.services.calendar.util

Examples of com.agiletec.plugins.jpcalendar.aps.services.calendar.util.MockEventsOfDayDataBean


    assertEquals(2, eventsForMonth[27]);// Contenuto EVN192 (free) e EVN103
    // (coach)
  }

  public void testLoadEventsOfDayId() throws Throwable {
    MockEventsOfDayDataBean bean = new MockEventsOfDayDataBean();
    bean.setAttributeNameStart(this._calendarManager.getConfig().getStartAttributeName());
    bean.setAttributeNameEnd(this._calendarManager.getConfig().getEndAttributeName());
    bean.setContentType(this._calendarManager.getConfig().getContentTypeCode());
    this.setUserOnSession("guest");
    UserDetails user = (UserDetails) this.getRequestContext().getRequest()
        .getSession().getAttribute(
            SystemConstants.SESSIONPARAM_CURRENT_USER);
    List<Group> userGroups = _authorizatorManager.getUserGroups(user);
    Set allowedGroup = new HashSet();
    allowedGroup.add(Group.FREE_GROUP_NAME);
    for (Group group : userGroups) {
      allowedGroup.add(group.getName());
    }
    bean.setAllowedGroups(allowedGroup);
    // bean.setAllowedGroups(user.getAuthorities().getGroups());
    Calendar requiredDay = this.createCalendar(3, Calendar.APRIL, 1999);
    bean.setRequiredDay(requiredDay.getTime());
    List list = this._calendarManager.loadEventsOfDayId(bean);
    assertTrue(list.isEmpty());

    requiredDay = this.createCalendar(13, Calendar.APRIL, 1999);
    bean.setRequiredDay(requiredDay.getTime());
    list = this._calendarManager.loadEventsOfDayId(bean);
    assertTrue(list.isEmpty());

    requiredDay = this.createCalendar(14, Calendar.APRIL, 1999);
    bean.setRequiredDay(requiredDay.getTime());
    list = this._calendarManager.loadEventsOfDayId(bean);
    assertFalse(list.isEmpty());
    assertEquals(1, list.size());
    assertTrue(list.contains("EVN192"));

    requiredDay = this.createCalendar(15, Calendar.APRIL, 1999);
    bean.setRequiredDay(requiredDay.getTime());
    list = this._calendarManager.loadEventsOfDayId(bean);
    assertFalse(list.isEmpty());
    assertEquals(1, list.size());
    assertTrue(list.contains("EVN192"));
   
    this.setUserOnSession("admin");
    user = (UserDetails) this.getRequestContext().getRequest().getSession()
        .getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    userGroups = _authorizatorManager.getGroupsOfUser(user);
    allowedGroup = new HashSet();
    allowedGroup.add(Group.FREE_GROUP_NAME);
    for (Group group : userGroups) {
      allowedGroup.add(group.getName());
    }
    bean.setAllowedGroups(allowedGroup);   
    //bean.setAllowedGroups(user.getGroups());
    list = this._calendarManager.loadEventsOfDayId(bean);
    assertFalse(list.isEmpty());
    assertEquals(2, list.size());
    assertTrue(list.contains("EVN192"));
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpcalendar.aps.services.calendar.util.MockEventsOfDayDataBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.