Search in sources :

Example 6 with FacetLabel

use of org.alfresco.repo.search.impl.solr.facet.handler.FacetLabel in project alfresco-repository by Alfresco.

the class SolrFacetQueriesDisplayHandlersTest method testGetUserNameDisplayHandler.

/**
 * User name display handler test.
 *
 * @throws Exception
 */
@Test
public void testGetUserNameDisplayHandler() throws Exception {
    FacetLabelDisplayHandler userNameHandler = displayHandlerRegistry.getDisplayHandler("@{http://www.alfresco.org/model/content/1.0}creator");
    assertNotNull(userNameHandler);
    String randomUserName = "randomUserName" + System.currentTimeMillis();
    FacetLabel name = userNameHandler.getDisplayLabel(randomUserName);
    assertNotNull(name);
    assertEquals("There is no user with the username [" + randomUserName + "], hence, the handler should return the passed-in username.", randomUserName, name.getLabel());
    name = userNameHandler.getDisplayLabel(AuthenticationUtil.getAdminUserName());
    assertNotNull(name);
    assertEquals("Expected admin's full name.", "Administrator", name.getLabel());
}
Also used : FacetLabel(org.alfresco.repo.search.impl.solr.facet.handler.FacetLabel) FacetLabelDisplayHandler(org.alfresco.repo.search.impl.solr.facet.handler.FacetLabelDisplayHandler)

Aggregations

FacetLabel (org.alfresco.repo.search.impl.solr.facet.handler.FacetLabel)6 FacetLabelDisplayHandler (org.alfresco.repo.search.impl.solr.facet.handler.FacetLabelDisplayHandler)6 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)1 FacetLabelDisplayHandlerRegistry (org.alfresco.repo.search.impl.solr.facet.handler.FacetLabelDisplayHandlerRegistry)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 NodeService (org.alfresco.service.cmr.repository.NodeService)1 ResultSet (org.alfresco.service.cmr.search.ResultSet)1 ResultSetRow (org.alfresco.service.cmr.search.ResultSetRow)1 FieldFacet (org.alfresco.service.cmr.search.SearchParameters.FieldFacet)1 SpellCheckResult (org.alfresco.service.cmr.search.SpellCheckResult)1 Pair (org.alfresco.util.Pair)1