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)) {
|
if (JsonFormat.dataIsJsonContentType(contentType)) {
|
||||||
// This solution is quite bad, but i see no alternatives now.
|
// This solution is quite bad, but i see no alternatives now.
|
||||||
// Hopefully in future we can improve it
|
// Hopefully in future we can improve it
|
||||||
data = new JsonCloudEventData(node.remove("data"));
|
data = JsonCloudEventData.wrap(node.remove("data"));
|
||||||
} else {
|
} else {
|
||||||
JsonNode dataNode = node.remove("data");
|
JsonNode dataNode = node.remove("data");
|
||||||
assertNodeType(dataNode, JsonNodeType.STRING, "data", "Because content type is not a json, only a string is accepted as 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)) {
|
if (JsonFormat.dataIsJsonContentType(contentType)) {
|
||||||
// This solution is quite bad, but i see no alternatives now.
|
// This solution is quite bad, but i see no alternatives now.
|
||||||
// Hopefully in future we can improve it
|
// Hopefully in future we can improve it
|
||||||
data = new JsonCloudEventData(node.remove("data"));
|
data = JsonCloudEventData.wrap(node.remove("data"));
|
||||||
} else {
|
} else {
|
||||||
JsonNode dataNode = node.remove("data");
|
JsonNode dataNode = node.remove("data");
|
||||||
assertNodeType(dataNode, JsonNodeType.STRING, "data", "Because content type is not a json, only a string is accepted as 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")
|
@MethodSource("textContentArguments")
|
||||||
public void testMapper(String contentType) {
|
public void testMapper(String contentType) {
|
||||||
CloudEvent event = CloudEventBuilder.v1(Data.V1_MIN)
|
CloudEvent event = CloudEventBuilder.v1(Data.V1_MIN)
|
||||||
.withData(contentType, new JsonCloudEventData(JsonNodeFactory.instance.numberNode(10)))
|
.withData(contentType, JsonCloudEventData.wrap(JsonNodeFactory.instance.numberNode(10)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
byte[] serialized = EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE)
|
byte[] serialized = EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE)
|
||||||
|
|
|
@ -330,7 +330,7 @@ class JsonFormatTest {
|
||||||
builder = CloudEventBuilder.v03(event);
|
builder = CloudEventBuilder.v03(event);
|
||||||
}
|
}
|
||||||
return builder
|
return builder
|
||||||
.withData(new JsonCloudEventData(JsonNodeFactory.instance.objectNode()))
|
.withData(JsonCloudEventData.wrap(JsonNodeFactory.instance.objectNode()))
|
||||||
.build();
|
.build();
|
||||||
} else {
|
} else {
|
||||||
return event;
|
return event;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class PojoCloudEventDataMapperTest {
|
||||||
public void testWithJson(PojoCloudEventDataMapper<MyPojo> mapper) {
|
public void testWithJson(PojoCloudEventDataMapper<MyPojo> mapper) {
|
||||||
|
|
||||||
CloudEvent event = CloudEventBuilder.v1(Data.V1_MIN)
|
CloudEvent event = CloudEventBuilder.v1(Data.V1_MIN)
|
||||||
.withData("application/json", new JsonCloudEventData(myPojoJson))
|
.withData("application/json", JsonCloudEventData.wrap(myPojoJson))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
PojoCloudEventData<MyPojo> mappedData = CloudEventUtils.mapData(
|
PojoCloudEventData<MyPojo> mappedData = CloudEventUtils.mapData(
|
||||||
|
|
Loading…
Reference in New Issue