@Override
 public void applyTo(IRepositoryQuery query) {
   query.setSummary(getQueryTitle());
   query.setAttribute(WebRepositoryConnector.KEY_QUERY_TEMPLATE, queryUrlText.getText());
   query.setAttribute(WebRepositoryConnector.KEY_QUERY_PATTERN, queryPatternText.getText());
   query.setAttribute(
       WebRepositoryConnector.KEY_TASK_PREFIX,
       getTaskRepository().getProperty(WebRepositoryConnector.PROPERTY_TASK_URL));
   Map<String, String> params = parametersEditor.getParameters();
   query.setUrl(
       WebRepositoryConnector.evaluateParams(queryUrlText.getText(), params, getTaskRepository()));
   for (Map.Entry<String, String> entry : params.entrySet()) {
     query.setAttribute(entry.getKey(), entry.getValue());
   }
 }
  /** test for bug 335278: enhance search result handler to handle additional attributes */
  public void testQueryRealName_Bug335278() throws Exception {
    IRepositoryQuery query =
        new RepositoryQuery(BugzillaFixture.current().getConnectorKind(), "query");
    UrlBuilder urlBuilder =
        UrlBuilder.build(BugzillaFixture.current().repository()).append("/buglist.cgi");

    urlBuilder.parameter(
        "columnlist",
        "bug_severity,priority,assigned_to,bug_status,resolution,short_desc,changeddate,reporter,assigned_to_realname,reporter_realname,product,component");
    query.setUrl(urlBuilder.toString());

    final Set<TaskData> returnedData = new HashSet<TaskData>();
    TaskDataCollector collector =
        new TaskDataCollector() {

          @Override
          public void accept(TaskData taskData) {
            returnedData.add(taskData);
          }
        };
    TaskAttributeMapper mapper =
        BugzillaFixture.current()
            .connector()
            .getTaskDataHandler()
            .getAttributeMapper(BugzillaFixture.current().repository());

    client.getSearchHits(query, collector, mapper, new NullProgressMonitor());

    assertTrue(returnedData.size() > 0);
    for (TaskData taskData : returnedData) {
      TaskAttribute reporterName =
          taskData.getRoot().getAttribute(BugzillaAttribute.REPORTER_NAME.getKey());
      TaskAttribute assignedToName =
          taskData.getRoot().getAttribute(BugzillaAttribute.ASSIGNED_TO_NAME.getKey());
      assertHasValue(reporterName);
      assertHasValue(assignedToName);
    }
  }
Beispiel #3
0
 @Override
 public void applyTo(IRepositoryQuery query) {
   query.setAttribute(RequestTrackerTaskDataHandler.QUERY_ID, queryString);
   query.setUrl(urls.getBrowseTicketSearchUrl(queryString));
   query.setSummary(getQueryTitle());
 }