Remove deprecated constructor usage for JsonCloudEventData (#483)
Fixes #482 Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
This commit is contained in:
parent
a491c85eb2
commit
9132a13d81
|
@ -118,7 +118,7 @@ class CloudEventDeserializer extends StdDeserializer<CloudEvent> {
|
|||
if (JsonFormat.dataIsJsonContentType(contentType)) {
|
||||
// This solution is quite bad, but i see no alternatives now.
|
||||
// Hopefully in future we can improve it
|
||||
data = new JsonCloudEventData(node.remove("data"));
|
||||
data = JsonCloudEventData.wrap(node.remove("data"));
|
||||
} else {
|
||||
JsonNode dataNode = node.remove("data");
|
||||
assertNodeType(dataNode, JsonNodeType.STRING, "data", "Because content type is not a json, only a string is accepted as data");
|
||||
|
@ -136,7 +136,7 @@ class CloudEventDeserializer extends StdDeserializer<CloudEvent> {
|
|||
if (JsonFormat.dataIsJsonContentType(contentType)) {
|
||||
// This solution is quite bad, but i see no alternatives now.
|
||||
// Hopefully in future we can improve it
|
||||
data = new JsonCloudEventData(node.remove("data"));
|
||||
data = JsonCloudEventData.wrap(node.remove("data"));
|
||||
} else {
|
||||
JsonNode dataNode = node.remove("data");
|
||||
assertNodeType(dataNode, JsonNodeType.STRING, "data", "Because content type is not a json, only a string is accepted as data");
|
||||
|
|
|
@ -37,7 +37,7 @@ public class JsonCloudEventDataTest {
|
|||
@MethodSource("textContentArguments")
|
||||
public void testMapper(String contentType) {
|
||||
CloudEvent event = CloudEventBuilder.v1(Data.V1_MIN)
|
||||
.withData(contentType, new JsonCloudEventData(JsonNodeFactory.instance.numberNode(10)))
|
||||
.withData(contentType, JsonCloudEventData.wrap(JsonNodeFactory.instance.numberNode(10)))
|
||||
.build();
|
||||
|
||||
byte[] serialized = EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE)
|
||||
|
|
|
@ -330,7 +330,7 @@ class JsonFormatTest {
|
|||
builder = CloudEventBuilder.v03(event);
|
||||
}
|
||||
return builder
|
||||
.withData(new JsonCloudEventData(JsonNodeFactory.instance.objectNode()))
|
||||
.withData(JsonCloudEventData.wrap(JsonNodeFactory.instance.objectNode()))
|
||||
.build();
|
||||
} else {
|
||||
return event;
|
||||
|
|
|
@ -46,7 +46,7 @@ public class PojoCloudEventDataMapperTest {
|
|||
public void testWithJson(PojoCloudEventDataMapper<MyPojo> mapper) {
|
||||
|
||||
CloudEvent event = CloudEventBuilder.v1(Data.V1_MIN)
|
||||
.withData("application/json", new JsonCloudEventData(myPojoJson))
|
||||
.withData("application/json", JsonCloudEventData.wrap(myPojoJson))
|
||||
.build();
|
||||
|
||||
PojoCloudEventData<MyPojo> mappedData = CloudEventUtils.mapData(
|
||||
|
|
Loading…
Reference in New Issue