summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/main/java/org
diff options
context:
space:
mode:
authorYiLi <li.yi101@zte.com.cn>2018-02-11 09:45:57 +0800
committerYiLi <li.yi101@zte.com.cn>2018-02-11 10:02:21 +0800
commitd4a991ad631f16831d380eef8e7405d9c2ea85c5 (patch)
treecfee5a189c07c98105f1f22c168518a32b038ab4 /holmes-actions/src/main/java/org
parent37630177bc70661ce86cb12e9af34e8c09893f4d (diff)
Test Replace Jackson with GSON
Change-Id: I2b4ada41d7a35d3427d574000bf1b3753e4d8d32 Issue-ID: HOLMES-115 Signed-off-by: YiLi <li.yi101@zte.com.cn>
Diffstat (limited to 'holmes-actions/src/main/java/org')
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java11
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java6
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/JacksonUtil.java40
3 files changed, 3 insertions, 54 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
index e1b333b..2ade152 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
@@ -16,24 +16,13 @@
package org.onap.holmes.common.config;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.HashMap;
-import java.util.Map;
-import javax.validation.constraints.NotNull;
-
public class MQConfig {
- @JsonProperty
- @NotNull
public String brokerIp;
- @JsonProperty
- @NotNull
public int brokerPort;
- @JsonProperty
public String brokerUsername;
- @JsonProperty
public String brokerPassword;
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java
index 6955d90..6c3189c 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/entity/PolicyMsg.java
@@ -16,7 +16,7 @@
package org.onap.holmes.common.dmaap.entity;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.gson.annotations.SerializedName;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
@@ -37,10 +37,10 @@ public class PolicyMsg {
private String policyName;
private String policyScope;
private String from = "DCAE";
- @JsonProperty(value = "target_type")
+ @SerializedName(value = "target_type")
private String targetType = "VM";
private String target;
- @JsonProperty(value = "AAI")
+ @SerializedName(value = "AAI")
private Map<String, Object> aai = new HashMap<>();
public static enum EVENT_STATUS {
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/JacksonUtil.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/JacksonUtil.java
deleted file mode 100644
index c5c52c2..0000000
--- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/JacksonUtil.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright 2017 ZTE Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.holmes.common.utils;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-
-public class JacksonUtil {
-
- private JacksonUtil() {
-
- }
-
- public static String beanToJson(Object obj) throws JsonProcessingException {
- ObjectMapper objectMapper = new ObjectMapper();
- return objectMapper.writeValueAsString(obj);
- }
-
- public static <T> T jsonToBean(String json, Class<T> cls) throws IOException {
- ObjectMapper objectMapper = new ObjectMapper();
- if (json == null) {
- return objectMapper.readValue("{}", cls);
- }
- return objectMapper.readValue(json, cls);
- }
-}