@Test
  public void testGetSeverities() {
    query.setAttribute(SonarQuery.SEVERITIES, "BLOCKER");
    assertThat(SonarQuery.getSeverities(query), is(new String[] {"BLOCKER"}));

    query.setAttribute(SonarQuery.SEVERITIES, "BLOCKER,MAJOR");
    assertThat(SonarQuery.getSeverities(query), is(new String[] {"BLOCKER", "MAJOR"}));
  }
  @Test
  public void testGetStatuses() {
    query.setAttribute(SonarQuery.STATUSES, "OPEN");
    assertThat(SonarQuery.getStatuses(query), is(new String[] {"OPEN"}));

    query.setAttribute(SonarQuery.STATUSES, "OPEN,REOPENED");
    assertThat(SonarQuery.getStatuses(query), is(new String[] {"OPEN", "REOPENED"}));
  }
 @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
  public void testGetAssignee() {
    try {
      SonarQuery.getAssignee(query, "foo");
    } catch (IllegalStateException e) {
      // expected
    }

    query.setAttribute(SonarQuery.ASSIGNEE, SonarQuery.ANY_USER);
    assertThat(SonarQuery.getAssignee(query, "foo"), nullValue());

    query.setAttribute(SonarQuery.ASSIGNEE, SonarQuery.UNASSIGNED);
    assertThat(SonarQuery.getAssignee(query, "foo"), is(new String[] {""}));

    query.setAttribute(SonarQuery.ASSIGNEE, SonarQuery.CURRENT_USER);
    assertThat(SonarQuery.getAssignee(query, "foo"), is(new String[] {"foo"}));

    query.setAttribute(SonarQuery.ASSIGNEE, SonarQuery.SPECIFIED_USER);
    query.setAttribute(SonarQuery.ASSIGNEE_USER, "bar");
    assertThat(SonarQuery.getAssignee(query, "foo"), is(new String[] {"bar"}));
  }
Beispiel #5
0
 @Override
 public void applyTo(IRepositoryQuery query) {
   query.setAttribute(RequestTrackerTaskDataHandler.QUERY_ID, queryString);
   query.setUrl(urls.getBrowseTicketSearchUrl(queryString));
   query.setSummary(getQueryTitle());
 }
Beispiel #6
0
 @Override
 void saveQueryParameters(IRepositoryQuery query) {
   query.setAttribute(ATTR_FILTER_ID, filterID.toString());
 }