private void checkExplicitContextualService(User user) { Assert.assertEquals(null, contextualUserDisplayService.getUserDisplayId(user, standardSiteUid)); Assert.assertEquals( null, contextualUserDisplayService.getUserDisplayName(user, standardSiteUid)); Assert.assertEquals( user.getEid() + CONTEXTUAL_SITE_NAME, contextualUserDisplayService.getUserDisplayId(user, contextualSiteUid)); Assert.assertEquals( user.getFirstName() + " " + user.getLastName() + CONTEXTUAL_SITE_NAME, contextualUserDisplayService.getUserDisplayName(user, contextualSiteUid)); }
public void testContextualDisplayProvision() throws Exception { User unadvisedUser = userDirectoryService.getUserByEid(UNADVISED_USER_EID); User displayAdvisedUser = userDirectoryService.getUserByEid(DISPLAY_ADVISED_USER_EID); User notInSiteUser = userDirectoryService.getUserByEid(NOT_IN_SITE_USER_EID); // Test for default handling of display ID and name outside a site context. checkForUnadvisedProperties(unadvisedUser); // Test that the user directory provider handles display ID and name outside // a site context. checkForAdvisedProperties(displayAdvisedUser); // This should give the same result in or out of the site context, // but check, just in case.... checkForAdvisedProperties(notInSiteUser); // Test explicit calls to the test support code.... checkExplicitContextualService(unadvisedUser); checkExplicitContextualService(displayAdvisedUser); Assert.assertEquals( null, contextualUserDisplayService.getUserDisplayId(notInSiteUser, standardSiteUid)); Assert.assertEquals( null, contextualUserDisplayService.getUserDisplayName(notInSiteUser, standardSiteUid)); Assert.assertEquals( null, contextualUserDisplayService.getUserDisplayId(notInSiteUser, contextualSiteUid)); Assert.assertEquals( null, contextualUserDisplayService.getUserDisplayName(notInSiteUser, contextualSiteUid)); // Set the current site context to make sure the User Directory Service // does the right thing. currentSiteUid = contextualSiteUid; checkForContextualProperties(unadvisedUser); checkForContextualProperties(displayAdvisedUser); checkForAdvisedProperties(notInSiteUser); currentSiteUid = null; }