[OLINGO-1333]ODataResponse for delta client throws NPE on Asynchronous calls
This commit is contained in:
parent
256b14f02b
commit
3395683b5a
|
@ -333,4 +333,5 @@ public interface Constants {
|
|||
String REMOVED = "removed";
|
||||
String ENTITY = "/$entity";
|
||||
String REASON = "Reason";
|
||||
String ID = "@id";
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class JsonDeltaSerializer implements EdmDeltaSerializer {
|
|||
}
|
||||
json.writeStartObject();
|
||||
json.writeStringField(Constants.JSON_CONTEXT, HASH + deletedEntity.getId().toASCIIString() + DELETEDENTITY);
|
||||
json.writeStringField(Constants.JSON_ID, deletedEntity.getId().toASCIIString());
|
||||
json.writeStringField(Constants.ATOM_ATTR_ID, deletedEntity.getId().toASCIIString());
|
||||
json.writeStringField(Constants.ELEM_REASON, deletedEntity.getReason().name());
|
||||
json.writeEndObject();
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ public class JsonDeltaSerializerWithNavigations implements EdmDeltaSerializer {
|
|||
json.writeStringField(property.getName(), property.getValue().toString());
|
||||
}
|
||||
}
|
||||
json.writeStringField(Constants.AT + Constants.ATOM_ATTR_ID, deletedEntity.getId().toASCIIString());
|
||||
json.writeStringField(Constants.ID, deletedEntity.getId().toASCIIString());
|
||||
json.writeEndObject();
|
||||
|
||||
}
|
||||
|
|
|
@ -144,9 +144,9 @@ public class JsonDeltaSerializerTest {
|
|||
final String expectedResult = "{"
|
||||
+"\"@odata.context\":\"$metadata#ESDelta/$delta\",\"value\":[{"
|
||||
+ "\"@odata.context\":\"#ESDelta(100)/$deletedEntity\","
|
||||
+ "\"@odata.id\":\"ESDelta(100)\",\"reason\":\"deleted\"},{"
|
||||
+ "\"id\":\"ESDelta(100)\",\"reason\":\"deleted\"},{"
|
||||
+ "\"@odata.context\":\"#ESDelta(-32768)/$deletedEntity\","
|
||||
+ "\"@odata.id\":\"ESDelta(-32768)\",\"reason\":\"changed\"}]"
|
||||
+ "\"id\":\"ESDelta(-32768)\",\"reason\":\"changed\"}]"
|
||||
+ "}";
|
||||
Assert.assertNotNull(jsonString);
|
||||
Assert.assertEquals(expectedResult, jsonString);
|
||||
|
@ -231,8 +231,8 @@ public class JsonDeltaSerializerTest {
|
|||
+ "\"@odata.id\":\"ESDelta(32767)\",\"PropertyInt16\":32767,"
|
||||
+ "\"PropertyString\":\"Number:32767\"},{\"@odata.id\":\"ESDelta(-32768)\","
|
||||
+ "\"PropertyString\":\"Number:-32768\"},{\"@odata.context\":\"#ESDelta(100)/$deletedEntity\","
|
||||
+ "\"@odata.id\":\"ESDelta(100)\",\"reason\":\"deleted\"},"
|
||||
+ "{\"@odata.context\":\"#ESDelta(-32768)/$deletedEntity\",\"@odata.id\":\"ESDelta(-32768)\","
|
||||
+ "\"id\":\"ESDelta(100)\",\"reason\":\"deleted\"},"
|
||||
+ "{\"@odata.context\":\"#ESDelta(-32768)/$deletedEntity\",\"id\":\"ESDelta(-32768)\","
|
||||
+ "\"reason\":\"changed\"},{\"@odata.context\":\"#ESDelta/$link\",\"source\":\"ESDelta(100)\","
|
||||
+ "\"relationship\":\"NavPropertyETAllPrimOne\",\"target\":\"ESAllPrim(0)\"},{\"@odata.context\":"
|
||||
+ "\"#ESDelta/$deletedLink\",\"source\":\"ESDelta(100)\",\"relationship\":\"NavPropertyETAllPrimOne\","
|
||||
|
|
Loading…
Reference in New Issue