コード例 #1
0
ファイル: RuleMappingTest.java プロジェクト: ihr/sonarqube
  @Test
  public void toQueryOptions_load_all_fields() {
    RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel, userSessionRule);
    SimpleGetRequest request = new SimpleGetRequest();
    request.setParam(Param.PAGE, "1");
    request.setParam(Param.PAGE_SIZE, "10");
    QueryContext queryContext = mapping.newQueryOptions(SearchOptions.create(request));

    assertThat(queryContext.getFieldsToReturn()).isEmpty();
  }
コード例 #2
0
ファイル: RuleMappingTest.java プロジェクト: ihr/sonarqube
  @Test
  public void toQueryOptions_html_note_requires_markdown_note() {
    RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel, userSessionRule);
    SimpleGetRequest request = new SimpleGetRequest();
    request.setParam(Param.PAGE, "1");
    request.setParam(Param.PAGE_SIZE, "10");
    request.setParam(Param.FIELDS, "htmlNote");
    QueryContext queryContext = mapping.newQueryOptions(SearchOptions.create(request));

    assertThat(queryContext.getFieldsToReturn())
        .containsOnly(RuleNormalizer.RuleField.NOTE.field());
  }
コード例 #3
0
ファイル: RuleMappingTest.java プロジェクト: ihr/sonarqube
  @Test
  public void toQueryOptions_debt_characteristics() {
    RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel, userSessionRule);
    SimpleGetRequest request = new SimpleGetRequest();
    request.setParam(Param.PAGE, "1");
    request.setParam(Param.PAGE_SIZE, "10");
    request.setParam(Param.FIELDS, "debtChar");
    QueryContext queryContext = mapping.newQueryOptions(SearchOptions.create(request));

    assertThat(queryContext.getFieldsToReturn())
        .containsOnly(RuleNormalizer.RuleField.CHARACTERISTIC.field());
  }
コード例 #4
0
ファイル: RuleMappingTest.java プロジェクト: ihr/sonarqube
  @Test
  public void toQueryOptions_debt_requires_group_of_fields() {
    RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel, userSessionRule);
    SimpleGetRequest request = new SimpleGetRequest();
    request.setParam(Param.PAGE, "1");
    request.setParam(Param.PAGE_SIZE, "10");
    request.setParam(Param.FIELDS, "debtRemFn");
    QueryContext queryContext = mapping.newQueryOptions(SearchOptions.create(request));

    assertThat(queryContext.getFieldsToReturn())
        .containsOnly(
            RuleNormalizer.RuleField.DEBT_FUNCTION_COEFFICIENT.field(),
            RuleNormalizer.RuleField.DEBT_FUNCTION_OFFSET.field(),
            RuleNormalizer.RuleField.DEBT_FUNCTION_TYPE.field());
  }
コード例 #5
0
ファイル: RuleMappingTest.java プロジェクト: ihr/sonarqube
  @Test
  public void toQueryOptions_load_only_few_simple_fields() {
    RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel, userSessionRule);
    SimpleGetRequest request = new SimpleGetRequest();
    request.setParam(Param.PAGE, "1");
    request.setParam(Param.PAGE_SIZE, "10");
    request.setParam(Param.FIELDS, "repo,name,lang");
    QueryContext queryContext = mapping.newQueryOptions(SearchOptions.create(request));

    assertThat(queryContext.getFieldsToReturn())
        .containsOnly(
            RuleNormalizer.RuleField.REPOSITORY.field(),
            RuleNormalizer.RuleField.NAME.field(),
            RuleNormalizer.RuleField.LANGUAGE.field());
  }
コード例 #6
0
ファイル: RuleMappingTest.java プロジェクト: ihr/sonarqube
  @Test
  public void toQueryOptions_debt_overloaded() {
    RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel, userSessionRule);
    SimpleGetRequest request = new SimpleGetRequest();
    request.setParam(Param.PAGE, "1");
    request.setParam(Param.PAGE_SIZE, "10");
    request.setParam(Param.FIELDS, "debtOverloaded");
    QueryContext queryContext = mapping.newQueryOptions(SearchOptions.create(request));

    assertThat(queryContext.getFieldsToReturn())
        .containsOnly(
            RuleNormalizer.RuleField.CHARACTERISTIC_OVERLOADED.field(),
            RuleNormalizer.RuleField.SUB_CHARACTERISTIC_OVERLOADED.field(),
            RuleNormalizer.RuleField.DEBT_FUNCTION_TYPE_OVERLOADED.field());
  }