aboutsummaryrefslogtreecommitdiffstats
path: root/prh-commons/src/main
diff options
context:
space:
mode:
authorwasala <przemyslaw.wasala@nokia.com>2018-06-13 11:39:14 +0200
committerwasala <przemyslaw.wasala@nokia.com>2018-06-15 11:34:41 +0200
commit5b38b56d8b6a7fca299e0243a7dc91d460f4735c (patch)
treebcdca27ef1443b633d0b540f36bbb593de7fec9d /prh-commons/src/main
parent3b630ca529d11bf6f158a71898583395e5c3ef75 (diff)
Added simply logs from tasks.
*Logging responsed object from DmaaP *Logging parsed oject from DmaaP *Logging sended object to AAI *Logging sended object and topic To DmaaP Change-Id: I33de0cd751762ac004f9d8a09beee921f4026af6 Issue-ID: DCAEGEN2-545 Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-commons/src/main')
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java13
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java8
2 files changed, 12 insertions, 9 deletions
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java
index c78146f7..9e5a73da 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java
@@ -20,17 +20,20 @@
package org.onap.dcaegen2.services.prh.model;
-import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import com.google.gson.TypeAdapterFactory;
+import java.util.ServiceLoader;
public class CommonFunctions {
- private static Gson gson = new GsonBuilder().create();
-
- private CommonFunctions() {}
+ private CommonFunctions() {
+ }
public static String createJsonBody(ConsumerDmaapModel consumerDmaapModel) {
- return gson.toJson(consumerDmaapModel);
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
+ return gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder().ipv4(consumerDmaapModel.getIpv4())
+ .ipv6(consumerDmaapModel.getIpv6()).pnfName(consumerDmaapModel.getPnfName()).build());
}
}
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
index dae0e59e..7dba211f 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
@@ -28,15 +28,15 @@ import org.immutables.value.Value;
*/
@Value.Immutable
-@Gson.TypeAdapters
+@Gson.TypeAdapters(fieldNamingStrategy = true)
public interface ConsumerDmaapModel {
- @SerializedName("pnf-name")
+ @SerializedName(value = "pnf-name", alternate = "pnf-name")
String getPnfName();
- @SerializedName("ipaddress-v4-oam")
+ @SerializedName(value = "ipaddress-v4-oam", alternate = "ipaddress-v4-oam")
String getIpv4();
- @SerializedName("ipaddress-v6-oam")
+ @SerializedName(value = "ipaddress-v6-oam", alternate = "ipaddress-v6-oam")
String getIpv6();
}