Package ru.org.linux.user

Examples of ru.org.linux.user.User


  private IndexRequestBuilder processComment(Topic topic, Comment comment, String message) {
    Map<String, Object> doc = new HashMap<>();

    Section section = sectionService.getSection(topic.getSectionId());
    Group group = groupDao.getGroup(topic.getGroupId());
    User author = userDao.getUserCached(comment.getUserid());
    User topicAuthor = userDao.getUserCached(topic.getUid());

    doc.put("section", section.getUrlName());
    doc.put("topic_author", topicAuthor.getNick());
    doc.put("topic_id", topic.getId());
    doc.put("author", author.getNick());
    doc.put("group", group.getUrlName());

    String topicTitle = topic.getTitleUnescaped();
View Full Code Here


    }

    Timestamp ts = new Timestamp(calendar.getTimeInMillis());
    params.put("message", "Удаляем темы и сообщения после "+ts.toString()+" с IP "+ip+"<br>");

    User moderator = tmpl.getCurrentUser();

    DeleteCommentResult deleteResult = commentService.deleteCommentsByIPAddress(ip, ts, moderator, reason);

    params.put("topics", deleteResult.getDeletedTopicIds().size()); // кол-во удаленных топиков
    params.put("deleted", deleteResult.getDeleteInfo());
View Full Code Here

  private LorCodeService lorCodeService;

  @Before
  public void initTest() throws Exception {
    UserDao userDao = mock(UserDao.class);
    User splinter = mock(User.class);

    maxcom = mock(User.class);
    JB = mock(User.class);
    isden = mock(User.class);

    when(maxcom.isBlocked()).thenReturn(false);
    when(JB.isBlocked()).thenReturn(false);
    when(isden.isBlocked()).thenReturn(true);
    when(maxcom.getNick()).thenReturn("maxcom");
    when(JB.getNick()).thenReturn("JB");
    when(isden.getNick()).thenReturn("isden");

    when(splinter.isBlocked()).thenReturn(false);
    when(splinter.getNick()).thenReturn("splinter");
    when(userDao.getUser("splinter")).thenReturn(splinter);

    when(userDao.getUser("maxcom")).thenReturn(maxcom);
    when(userDao.getUser("JB")).thenReturn(JB);
    when(userDao.getUser("isden")).thenReturn(isden);
View Full Code Here

    when(resultSet.getInt("section")).thenReturn(3); // Галлерея
    when(resultSet.getBoolean("moderate")).thenReturn(true);
    when(resultSet.getInt("stat1")).thenReturn(0);

    User user = mock(User.class);
    when(user.isModerator()).thenReturn(false);
    when(user.getId()).thenReturn(13);

    Topic message = new Topic(resultSet);

    assertFalse(user.isModerator());
    assertEquals(user.getId(), resultSet.getInt("userid"));
    assertEquals(user.getId(), message.getUid());

    assertTrue(permissionService.isDeletable(message, user));
  }
View Full Code Here

    when(resultSet.getBoolean(anyString())).thenReturn(false);

    when(resultSet.getInt("section")).thenReturn(3); // Галлерея
    when(resultSet.getBoolean("moderate")).thenReturn(true);

    User user = mock(User.class);
    when(user.isModerator()).thenReturn(false);
    when(user.getId()).thenReturn(13);

    Topic message = new Topic(resultSet);

    assertFalse(user.isModerator());
    assertEquals(user.getId(), resultSet.getInt("userid"));
    assertEquals(user.getId(), message.getUid());

    assertFalse(permissionService.isDeletable(message, user));
  }
View Full Code Here

    when(resultSet.getBoolean(anyString())).thenReturn(false);

    when(resultSet.getInt("section")).thenReturn(3); // Галлерея
    when(resultSet.getBoolean("moderate")).thenReturn(true);

    User user = mock(User.class);
    when(user.isModerator()).thenReturn(false);
    when(user.getId()).thenReturn(14);

    Topic message = new Topic(resultSet);

    assertFalse(user.isModerator());
    assertFalse(user.getId() == resultSet.getInt("userid"));
    assertFalse(user.getId() == message.getUid());

    assertFalse(permissionService.isDeletable(message, user));
  }
View Full Code Here

    when(resultSet.getBoolean(anyString())).thenReturn(false);

    when(resultSet.getInt("section")).thenReturn(3); // Галлерея
    when(resultSet.getBoolean("moderate")).thenReturn(true);

    User user = mock(User.class);
    when(user.isModerator()).thenReturn(false);
    when(user.getId()).thenReturn(14);

    Topic message = new Topic(resultSet);

    assertFalse(user.isModerator());
    assertFalse(user.getId() == resultSet.getInt("userid"));
    assertFalse(user.getId() == message.getUid());

    assertFalse(permissionService.isDeletable(message, user));
  }
View Full Code Here

    when(resultSetNotModerateNew.getBoolean(anyString())).thenReturn(false);
    when(resultSetNotModerateNew.getBoolean("moderate")).thenReturn(false);
    when(resultSetNotModerateNew.getTimestamp("postdate")).thenReturn(new Timestamp(newTime));


    User user = mock(User.class);
    when(user.isModerator()).thenReturn(true);
    when(user.getId()).thenReturn(13);

    // проверка что данные в mock user верные
    assertTrue(user.isModerator());

    Section sectionModerate = mock(Section.class);
    when(sectionModerate.isPremoderated()).thenReturn(true);
    Section sectionNotModerate = mock(Section.class);
    when(sectionNotModerate.isPremoderated()).thenReturn(false);
View Full Code Here

TOP

Related Classes of ru.org.linux.user.User

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.