Remove deprecated constructor usage for JsonCloudEventData (#483)

Fixes #482

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
This commit is contained in:
Pierangelo Di Pilato 2022-10-12 08:58:41 +02:00 committed by GitHub
parent a491c85eb2
commit 9132a13d81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -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");

View File

@ -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)

View File

@ -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;

View File

@ -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(