@Test public void testToJson() { response.setStatus(OperationStatus.COMPLETE); response.setModifiedCount(Integer.MAX_VALUE); response.setMatchCount(Integer.MIN_VALUE); response.setTaskHandle("taskHandle"); response.setSessionInfo(null); response.setEntityData(JsonObject.getFactory().objectNode()); response.getDataErrors().addAll(getPopulatedDataErrors(3)); response.getErrors().addAll(getPopulatedErrors(3)); response.setHostname("localhost"); ObjectNode expectedNode = JsonObject.getFactory().objectNode(); expectedNode.put("status", OperationStatus.COMPLETE.name().toLowerCase()); expectedNode.put("modifiedCount", Integer.MAX_VALUE); expectedNode.put("matchCount", Integer.MIN_VALUE); expectedNode.put("taskHandle", "taskHandle"); expectedNode.set("session", JsonObject.getFactory().objectNode()); expectedNode.set("entityData", JsonObject.getFactory().objectNode()); expectedNode.put("hostname", "localhost"); ArrayNode arr = JsonObject.getFactory().arrayNode(); expectedNode.set("dataErrors", arr); for (DataError err : getPopulatedDataErrors(3)) { arr.add(err.toJson()); } ArrayNode arr2 = JsonObject.getFactory().arrayNode(); expectedNode.set("errors", arr2); for (Error err : getPopulatedErrors(3)) { arr2.add(err.toJson()); } assertFalse(response.toJson().equals(expectedNode)); }
@Override public JsonNode toJson() { ObjectNode node=(ObjectNode)super.toJson(); if(entityData!=null) { node.set(PROPERTY_PROCESSED, entityData); } if(resultMetadata!=null) { ArrayNode arr=jsonNodeFactory.arrayNode(); for(ResultMetadata x:resultMetadata) { arr.add(x==null?jsonNodeFactory.nullNode():x.toJson()); } node.set(PROPERTY_RESULT_METADATA,arr); } return node; }
Response extends BaseResponse { @Override public JsonNode toJson() { ObjectNode node=(ObjectNode)super.toJson(); if(entityData!=null) { node.set(PROPERTY_PROCESSED, entityData); } if(resultMetadata!=null) { ArrayNode arr=jsonNodeFactory.arrayNode(); for(ResultMetadata x:resultMetadata) { arr.add(x==null?jsonNodeFactory.nullNode():x.toJson()); } node.set(PROPERTY_RESULT_METADATA,arr); } return node; } }
Response extends BaseResponse { @Override public JsonNode toJson() { ObjectNode node=(ObjectNode)super.toJson(); if(entityData!=null) { node.set(PROPERTY_PROCESSED, entityData); } if(resultMetadata!=null) { ArrayNode arr=jsonNodeFactory.arrayNode(); for(ResultMetadata x:resultMetadata) { arr.add(x==null?jsonNodeFactory.nullNode():x.toJson()); } node.set(PROPERTY_RESULT_METADATA,arr); } return node; } Response(JsonNodeFactory jsonNodeFactory, OperationStatus status);  Response(Response r);  Response(BaseResponse r); }
Response extends BaseResponse { @Override public JsonNode toJson() { ObjectNode node=(ObjectNode)super.toJson(); if(entityData!=null) { node.set(PROPERTY_PROCESSED, entityData); } if(resultMetadata!=null) { ArrayNode arr=jsonNodeFactory.arrayNode(); for(ResultMetadata x:resultMetadata) { arr.add(x==null?jsonNodeFactory.nullNode():x.toJson()); } node.set(PROPERTY_RESULT_METADATA,arr); } return node; } Response(JsonNodeFactory jsonNodeFactory, OperationStatus status);  Response(Response r);  Response(BaseResponse r); void setResultSizeThresholds(int maxResultSetSizeB, int warnResultSetSizeB, final Request forRequest); JsonNode getEntityData(); void setEntityData(JsonNode node); void addEntityData(JsonNode doc); List<ResultMetadata> getResultMetadata(); void setResultMetadata(List<ResultMetadata> l); @Override JsonNode toJson(); int getResponseDataSizeB(); }
Response extends BaseResponse { @Override public JsonNode toJson() { ObjectNode node=(ObjectNode)super.toJson(); if(entityData!=null) { node.set(PROPERTY_PROCESSED, entityData); } if(resultMetadata!=null) { ArrayNode arr=jsonNodeFactory.arrayNode(); for(ResultMetadata x:resultMetadata) { arr.add(x==null?jsonNodeFactory.nullNode():x.toJson()); } node.set(PROPERTY_RESULT_METADATA,arr); } return node; } Response(JsonNodeFactory jsonNodeFactory, OperationStatus status);  Response(Response r);  Response(BaseResponse r); void setResultSizeThresholds(int maxResultSetSizeB, int warnResultSetSizeB, final Request forRequest); JsonNode getEntityData(); void setEntityData(JsonNode node); void addEntityData(JsonNode doc); List<ResultMetadata> getResultMetadata(); void setResultMetadata(List<ResultMetadata> l); @Override JsonNode toJson(); int getResponseDataSizeB(); static final String ERR_RESULT_SIZE_TOO_LARGE; }