From adfb0693ec18025abcd8b9036bafe20a25f2e496 Mon Sep 17 00:00:00 2001 From: "halil.cakal" Date: Mon, 3 Jul 2023 15:24:02 +0100 Subject: Subscription Creation: NCMP to DMI CloudEvent transformation - Add mapper to convert client event into ncmp event - Add sample json object of ncmp version - Change subscription event consumer to consume CloudEvents - Change subscription event forwarder to publish CloudEvents - Change test producer config to support CloudEvents - Change sample subscription event json to comply with new schema - Add more test for missing branches - Change packages of the mappers into relevant directory Issue-ID: CPS-1737 Change-Id: I8c9e6e7bf713a8fb530a0586dfb2bce796a462f5 Signed-off-by: halil.cakal --- .../java/org/onap/cps/ncmp/utils/KafkaDemoProducerConfig.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cps-ncmp-service/src/test/java') diff --git a/cps-ncmp-service/src/test/java/org/onap/cps/ncmp/utils/KafkaDemoProducerConfig.java b/cps-ncmp-service/src/test/java/org/onap/cps/ncmp/utils/KafkaDemoProducerConfig.java index 43d26e900f..a9fd6f09f3 100644 --- a/cps-ncmp-service/src/test/java/org/onap/cps/ncmp/utils/KafkaDemoProducerConfig.java +++ b/cps-ncmp-service/src/test/java/org/onap/cps/ncmp/utils/KafkaDemoProducerConfig.java @@ -20,17 +20,17 @@ package org.onap.cps.ncmp.utils; +import io.cloudevents.CloudEvent; +import io.cloudevents.kafka.CloudEventSerializer; import java.util.HashMap; import java.util.Map; import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.common.serialization.StringSerializer; -import org.onap.cps.ncmp.event.model.SubscriptionEvent; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.kafka.core.DefaultKafkaProducerFactory; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.ProducerFactory; -import org.springframework.kafka.support.serializer.JsonSerializer; @Configuration public class KafkaDemoProducerConfig { @@ -41,17 +41,17 @@ public class KafkaDemoProducerConfig { * @return kafka producer factory object of subscription event */ @Bean - public ProducerFactory producerFactory() { + public ProducerFactory producerFactory() { final Map configProps = new HashMap<>(); configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "PLAINTEXT://localhost:9092,CONNECTIONS_FROM_HOST://localhost:19092"); configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); - configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); + configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, CloudEventSerializer.class); return new DefaultKafkaProducerFactory<>(configProps); } @Bean - public KafkaTemplate kafkaTemplate() { + public KafkaTemplate kafkaTemplate() { return new KafkaTemplate<>(producerFactory()); } } -- cgit 1.2.3-korg