Beispiel #1
0
  private JSONArray searchPagesForTag(String tagID) throws ClientException, JSONException {
    String query = "tag:\"" + tagID + "\"";
    // built the URL parameters
    URLParameterBuilder params = new URLParameterBuilder();
    params.add(new BasicNameValuePair("query", query));
    params.add(new BasicNameValuePair("type", "cq:Page"));
    params.add(new BasicNameValuePair("_charset", "utf-8"));

    RequestExecutor exec =
        authorAuthor.http.doGet(CONTENTFINDER_PAGE_VIEW + "/content", params, 200);
    // verify via hits length
    JSONObject searchResultJson = new JSONObject(exec.getContent());
    return searchResultJson.getJSONArray("hits");
  }
Beispiel #2
0
  /** Seach images in contentfinder below /content/dam */
  @Test
  public void testDamSearch() throws JSONException, ClientException {
    String query = ".jpg";
    // built the URL parameters
    URLParameterBuilder params = new URLParameterBuilder();
    params.add(new BasicNameValuePair("query", query));
    params.add(new BasicNameValuePair("mimeType", "image"));
    params.add(new BasicNameValuePair("_charset", "utf-8"));

    RequestExecutor exec =
        authorAuthor.http.doGet(CONTENTFINDER_ASSET_VIEW + "/content/dam", params, 200);

    // verify via hits length
    JSONObject searchResultJson = new JSONObject(exec.getContent());
    JSONArray hits = searchResultJson.getJSONArray("hits");
    Assert.assertTrue("No hits found for search with query 'geometrixx'", hits.length() > 0);
  }