mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
84902: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 83412: Preliminary implementation of ACE-2639. This check-in allows any user to hit the repo at http://localhost:8080/alfresco/service/api/facet/facetable-properties or at http://localhost:8080/alfresco/service/api/facet/classes/cm:thumbnail/facetable-properties and get details on facetable properties for all properties in the system or all properties on the specified type/aspect, respectively. I'm checking this in in order to start to get some feedback on what the global list contains and how we might restrict it. The JSON response is very basic currently and it will be enhanced also. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85222 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -57,7 +57,9 @@ public class FacetRestApiTest extends BaseWebScriptTest
|
||||
private static final String NON_SEARCH_ADMIN_USER = "nonSearchAdmin";
|
||||
|
||||
private static final String FACETS = "facets";
|
||||
|
||||
|
||||
private final static String GET_ALL_FACETABLE_PROPERTIES_URL = "/api/facet/facetable-properties";
|
||||
private final static String GET_SPECIFIC_FACETABLE_PROPERTIES_URL = "/api/facet/classes/{classname}/facetable-properties";
|
||||
private final static String GET_FACETS_URL = "/api/facet/facet-config";
|
||||
private final static String PUT_FACET_URL_FORMAT = "/api/facet/facet-config/{0}?relativePos={1}";
|
||||
private final static String POST_FACETS_URL = GET_FACETS_URL;
|
||||
@@ -620,7 +622,53 @@ public class FacetRestApiTest extends BaseWebScriptTest
|
||||
}
|
||||
}, SEARCH_ADMIN_USER);
|
||||
}
|
||||
|
||||
|
||||
public void testGetAllFacetableProperties() throws Exception
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
{
|
||||
@Override public Void doWork() throws Exception
|
||||
{
|
||||
final Response rsp = sendRequest(new GetRequest(GET_ALL_FACETABLE_PROPERTIES_URL), 200);
|
||||
|
||||
// For now, we'll only perform limited testing of the response as we primarily
|
||||
// want to know that the GET call succeeded and that it correctly identified
|
||||
// *some* facetable properties.
|
||||
JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString()));
|
||||
|
||||
JSONObject properties = jsonRsp.getJSONObject(FacetablePropertiesGet.PROPERTIES_KEY);
|
||||
|
||||
final int arbitraryLimit = 25;
|
||||
assertTrue("Expected 'many' properties, but found 'not very many'", properties.length() > arbitraryLimit);
|
||||
|
||||
return null;
|
||||
}
|
||||
}, SEARCH_ADMIN_USER);
|
||||
}
|
||||
|
||||
public void testGetFacetablePropertiesForSpecificContentClasses() throws Exception
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
{
|
||||
@Override public Void doWork() throws Exception
|
||||
{
|
||||
final Response rsp = sendRequest(new GetRequest(GET_SPECIFIC_FACETABLE_PROPERTIES_URL.replace("{classname}", "cm:content")), 200);
|
||||
|
||||
// For now, we'll only perform limited testing of the response as we primarily
|
||||
// want to know that the GET call succeeded and that it correctly identified
|
||||
// *some* facetable properties.
|
||||
JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString()));
|
||||
|
||||
JSONObject properties = jsonRsp.getJSONObject(FacetablePropertiesGet.PROPERTIES_KEY);
|
||||
|
||||
final int arbitraryLimit = 100;
|
||||
assertTrue("Expected 'not very many' properties, but found 'many'", properties.length() < arbitraryLimit);
|
||||
|
||||
return null;
|
||||
}
|
||||
}, SEARCH_ADMIN_USER);
|
||||
}
|
||||
|
||||
private List<String> getListFromJsonArray(JSONArray facetsArray) throws JSONException
|
||||
{
|
||||
List<String> result = new ArrayList<>();
|
||||
|
Reference in New Issue
Block a user