예제 #1
0
  public void testUserProfile() throws Exception {
    String userName = "******";
    UserProfile userProfile = createdUserProfile(userName);

    // save UserProfile
    forumService_.saveUserProfile(userProfile, true, true);

    // getUserInfo
    userProfile = forumService_.getUserInfo(userName);
    assertNotNull("Get info UserProfile is null", userProfile);

    // get Default
    userProfile = forumService_.getDefaultUserProfile(userName, "");
    assertNotNull("Get default UserProfile is null", userProfile);

    // getUserInformations
    userProfile = forumService_.getUserInformations(userProfile);
    assertNotNull("Get informations UserProfile is null", userProfile);

    // getUserSettingProfile
    userProfile = forumService_.getUserSettingProfile(userName);
    assertNotNull("Get Setting UserProfile is not null", userProfile);

    // saveUserSettingProfile
    assertEquals("Default AutoWatchMyTopics is false", userProfile.getIsAutoWatchMyTopics(), false);
    userProfile.setIsAutoWatchMyTopics(true);
    forumService_.saveUserSettingProfile(userProfile);
    userProfile = forumService_.getUserSettingProfile(userName);
    assertEquals(
        "Edit AutoWatchMyTopics and can't save this property. AutoWatchMyTopics is false",
        userProfile.getIsAutoWatchMyTopics(),
        true);
    //
  }
예제 #2
0
 protected UserProfile getUserProfile() throws Exception {
   if (this.userProfile == null) {
     try {
       this.userProfile = this.getAncestorOfType(UIForumPortlet.class).getUserProfile();
     } catch (Exception e) {
       ForumService forumService =
           (ForumService)
               ExoContainerContext.getCurrentContainer()
                   .getComponentInstanceOfType(ForumService.class);
       userProfile =
           forumService.getDefaultUserProfile(UserHelper.getCurrentUser(), ForumUtils.EMPTY_STR);
     }
   }
   return this.userProfile;
 }