コード例 #1
0
 private void addRenderStackMetaDataResponse() {
   final String requestPath = getRenderStackRequestPath();
   final StackMetaData stackMetaData = new StackMetaData(acquireStackId, null);
   stackMetaData.setState(StackMetaData.StackState.LOADING);
   final JsonBody responseBody = json(stackMetaData.toJson());
   mockServer
       .when(HttpRequest.request().withMethod("GET").withPath(requestPath), Times.once())
       .respond(
           HttpResponse.response()
               .withStatusCode(HttpStatus.SC_OK)
               .withHeader("Content-Type", responseBody.getContentType())
               .withBody(responseBody));
 }
コード例 #2
0
  private void addAcqNextTileResponse(final AcquisitionTileList acquisitionTileList) {

    final JsonBody responseBody = json(acquisitionTileList.toJson());

    mockServer
        .when(
            HttpRequest.request()
                .withMethod("POST")
                .withPath(getBaseAcquisitionPath() + "/next-tile"),
            Times.once())
        .respond(
            HttpResponse.response()
                .withStatusCode(HttpStatus.SC_OK)
                .withHeader("Content-Type", responseBody.getContentType())
                .withBody(responseBody));
  }
コード例 #3
0
 @Override
 public void serialize(JsonBody jsonBody, JsonGenerator jgen, SerializerProvider provider)
     throws IOException {
   jgen.writeStartObject();
   if (jsonBody.getNot() != null && jsonBody.getNot()) {
     jgen.writeBooleanField("not", jsonBody.getNot());
   }
   if (jsonBody.getCharset() != null
       && !jsonBody.getCharset().equals(ContentTypeMapper.DEFAULT_HTTP_CHARACTER_SET)) {
     jgen.writeStringField("charset", jsonBody.getCharset().name());
   }
   jgen.writeStringField("type", jsonBody.getType().name());
   jgen.writeStringField("json", jsonBody.getValue());
   if (jsonBody.getMatchType() != JsonBody.DEFAULT_MATCH_TYPE) {
     jgen.writeStringField("matchType", jsonBody.getMatchType().name());
   }
   jgen.writeEndObject();
 }