Package org.sonar.api.utils.text

Examples of org.sonar.api.utils.text.JsonWriter.endObject()


  private void testActions(Issue issue, String expected) throws JSONException {
    StringWriter output = new StringWriter();
    JsonWriter jsonWriter = JsonWriter.of(output);
    jsonWriter.beginObject();
    writer.writeActions(issue, jsonWriter);
    jsonWriter.endObject();
    JSONAssert.assertEquals(output.toString(), expected, true);
  }

  private void testTransitions(Issue issue, String expected) throws JSONException {
    StringWriter output = new StringWriter();
View Full Code Here


  private void testTransitions(Issue issue, String expected) throws JSONException {
    StringWriter output = new StringWriter();
    JsonWriter jsonWriter = JsonWriter.of(output);
    jsonWriter.beginObject();
    writer.writeTransitions(issue, jsonWriter);
    jsonWriter.endObject();
    JSONAssert.assertEquals(output.toString(), expected, true);
  }

}
View Full Code Here

  private void test(List<DuplicationsParser.Block> blocks, String expected) throws JSONException {
    StringWriter output = new StringWriter();
    JsonWriter jsonWriter = JsonWriter.of(output);
    jsonWriter.beginObject();
    writer.write(blocks, jsonWriter, session);
    jsonWriter.endObject();
    JSONAssert.assertEquals(output.toString(), expected, true);
  }

}
View Full Code Here

        if (user != null) {
          json.name("owner").beginObject();
          // TODO to be shared and extracted from here
          json.prop("login", user.getLogin());
          json.prop("name", user.getName());
          json.endObject();
        }
      }
      // load widgets and related properties
      json.name("widgets").beginArray();
      Collection<WidgetDto> widgets = dbClient.widgetDao().findByDashboard(dbSession, dashboard.getKey());
View Full Code Here

        json.name("props").beginArray();
        for (WidgetPropertyDto prop : propertiesByWidget.get(widget.getKey())) {
          json.beginObject();
          json.prop("key", prop.getPropertyKey());
          json.prop("val", prop.getTextValue());
          json.endObject();
        }
        json.endArray().endObject();
      }

      json.endArray();
View Full Code Here

        }
        json.endArray().endObject();
      }

      json.endArray();
      json.endObject();
      json.close();
    } finally {
      dbSession.close();
    }
  }
View Full Code Here

      appendManualRules(json);
    } finally {
      MyBatis.closeQuietly(session);
    }

    json.endObject();
    json.close();
  }

  private void appendComponent(JsonWriter json, ComponentDto component, UserSession userSession, DbSession session) {
    List<PropertyDto> propertyDtos = dbClient.propertiesDao().selectByQuery(PropertyQuery.builder()
View Full Code Here

  private void writeResponse(BulkChangeResult result, Response response) {
    JsonWriter json = response.newJsonWriter().beginObject();
    json.prop("succeeded", result.countSucceeded());
    json.prop("failed", result.countFailed());
    result.getErrors().writeJsonAsWarnings(json, i18n, UserSession.get().locale());
    json.endObject().close();
  }
}
View Full Code Here

    JsonWriter json = JsonWriter.of(new OutputStreamWriter(stream.output()));

    try {
      json.beginObject();
      errors.writeJson(json, i18n, UserSession.get().locale());
      json.endObject();
    } finally {
      // TODO if close() fails, the runtime exception should not hide the
      // potential exception raised in the try block.
      json.close();
    }
View Full Code Here

      Map<Integer, Integer> conditions = coverageService.getConditions(fileKey, type);
      Map<Integer, Integer> coveredConditions = coverageService.getCoveredConditions(fileKey, type);
      writeCoverage(hits, testCases, conditions, coveredConditions, from, to, json);
    }

    json.endObject().close();
  }

  private void writeCoverage(Map<Integer, Integer> hitsByLine,
                             Map<Integer, Integer> testCasesByLines,
                             Map<Integer, Integer> conditionsByLine,
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.