Examples of key()


Examples of org.sonar.api.batch.rule.Rule.key()

    assertThat(rules.findByRepository("checkstyle")).hasSize(1);
    assertThat(rules.findByRepository("unknown")).isEmpty();

    Rule rule = rules.find(RuleKey.of("checkstyle", "AvoidNull"));
    assertThat(rule).isNotNull();
    assertThat(rule.key()).isEqualTo(RuleKey.of("checkstyle", "AvoidNull"));
    assertThat(rule.name()).isEqualTo("Avoid Null");
    assertThat(rule.description()).isEqualTo("Should avoid NULL");
    assertThat(rule.severity()).isEqualTo(Severity.MINOR);
    assertThat(rule.internalKey()).isNull();
    assertThat(rule.params()).hasSize(1);
View Full Code Here

Examples of org.sonar.api.batch.sensor.issue.internal.DefaultIssue.key()

  }

  @Override
  public void put(Value value, Object object, CoderContext context) {
    DefaultIssue issue = (DefaultIssue) object;
    value.putString(issue.key());
    InputPath inputPath = issue.inputPath();
    if (inputPath != null) {
      if (inputPath instanceof InputDir) {
        value.put(0);
        value.putString(((DefaultInputDir) inputPath).moduleKey());
View Full Code Here

Examples of org.sonar.api.component.Component.key()

  public void should_return_null_on_null_component() throws Exception {

    String componentKey = "org.foo.Bar";

    Component component = mock(Component.class);
    when(component.key()).thenReturn(componentKey);

    ScanGraph graph = mock(ScanGraph.class);
    when(graph.getComponent(componentKey)).thenReturn(null);

    GraphPerspectiveLoader perspectiveLoader = mock(GraphPerspectiveLoader.class);
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan.key()

  public void plan_with_no_existing_plan() throws Exception {
    ActionPlan newActionPlan = DefaultActionPlan.create("newName");

    boolean updated = updater.plan(issue, newActionPlan, context);
    assertThat(updated).isTrue();
    assertThat(issue.actionPlanKey()).isEqualTo(newActionPlan.key());

    FieldDiffs.Diff diff = issue.currentChange().get(ACTION_PLAN);
    assertThat(diff.oldValue()).isEqualTo(UNUSED);
    assertThat(diff.newValue()).isEqualTo("newName");
    assertThat(issue.mustSendNotifications()).isTrue();
View Full Code Here

Examples of org.sonar.api.issue.Issue.key()

    assertThat(issueDoc.resolution()).isEqualTo(issue.getResolution());
    assertThat(issueDoc.ruleKey()).isEqualTo(RuleKey.of(issue.getRuleRepo(), issue.getRule()));
    assertThat(issueDoc.line()).isEqualTo(issue.getLine());
    assertThat(issueDoc.message()).isEqualTo(issue.getMessage());
    assertThat(issueDoc.reporter()).isEqualTo(issue.getReporter());
    assertThat(issueDoc.key()).isEqualTo(issue.getKey());
    assertThat(issueDoc.updateDate()).isEqualTo(issue.getIssueUpdateDate());
    assertThat(issueDoc.status()).isEqualTo(issue.getStatus());
    assertThat(issueDoc.severity()).isEqualTo(issue.getSeverity());
    assertThat(issueDoc.attributes()).isEqualTo(KeyValueFormat.parse(issue.getIssueAttributes()));
    assertThat(issueDoc.attribute("key")).isEqualTo("value");
View Full Code Here

Examples of org.sonar.api.issue.action.Action.key()

      .setProjectKey("sample")
      .setRuleKey(RuleKey.of("squid", "AvoidCycle"));

    MockUserSession.set().setLogin("john");
    Action action = mock(Action.class);
    when(action.key()).thenReturn("link-to-jira");
    when(actionService.listAvailableActions(eq(issue))).thenReturn(newArrayList(action));

    testActions(issue,
      "{\"actions\": " +
        "[" +
View Full Code Here

Examples of org.sonar.api.issue.internal.DefaultIssue.key()

      .attribute("JIRA", "FOO-123")
      .attribute("YOUTRACK", "YT-123")
      .build();

    assertThat(issue).isNotNull();
    assertThat(issue.key()).isNotNull();
    assertThat(issue.effortToFix()).isEqualTo(10000.0);
    assertThat(issue.componentKey()).isEqualTo(componentKey);
    assertThat(issue.projectKey()).isEqualTo(projectKey);
    assertThat(issue.message()).isEqualTo("the message");
    assertThat(issue.line()).isEqualTo(123);
View Full Code Here

Examples of org.sonar.api.issue.internal.DefaultIssueComment.key()

      .setIssueKey("ABCDE")
      .setCreatedAt(new Date())
      .setUpdatedAt(new Date());

    DefaultIssueComment comment = changeDto.toComment();
    assertThat(comment.key()).isEqualTo("EFGH");
    assertThat(comment.markdownText()).isEqualTo("Some text");
    assertThat(comment.createdAt()).isNotNull();
    assertThat(comment.updatedAt()).isNotNull();
    assertThat(comment.userLogin()).isEqualTo("emmerik");
    assertThat(comment.issueKey()).isEqualTo("ABCDE");
View Full Code Here

Examples of org.sonar.api.measures.Metric.key()

      Metric metric = metricFinder.findByKey(measure.getMetricKey());
      if (metric == null) {
        throw new SonarException("Unknown metric: " + measure.getMetricKey());
      }
      if (!isTechnicalProjectCopy(resource) && !measure.isFromCore() && DefaultSensorContext.INTERNAL_METRICS.contains(metric)) {
        LOG.debug("Metric " + metric.key() + " is an internal metric computed by SonarQube. Please update your plugin.");
        return measure;
      }
      measure.setMetric(metric);
      if (measureCache.contains(resource, measure)) {
        throw new SonarException("Can not add the same measure twice on " + resource + ": " + measure);
View Full Code Here

Examples of org.sonar.api.server.debt.DebtCharacteristic.key()

    RuleDebt ruleDebt = new RuleDebt().setRuleKey(RuleKey.of(rule.getRepositoryKey(), rule.getRuleKey()));
    Integer effectiveSubCharacteristicId = rule.getSubCharacteristicId() != null ? rule.getSubCharacteristicId() : rule.getDefaultSubCharacteristicId();
    DebtCharacteristic subCharacteristic = (effectiveSubCharacteristicId != null && !RuleDto.DISABLED_CHARACTERISTIC_ID.equals(effectiveSubCharacteristicId)) ?
      debtModel.characteristicById(effectiveSubCharacteristicId) : null;
    if (subCharacteristic != null) {
      ruleDebt.setSubCharacteristicKey(subCharacteristic.key());

      String overriddenFunction = rule.getRemediationFunction();
      String defaultFunction = rule.getDefaultRemediationFunction();
      if (overriddenFunction != null) {
        ruleDebt.setFunction(overriddenFunction);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.