summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/JacksonUtilTest.java59
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/Md5UtilTest.java1
5 files changed, 3 insertions, 114 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);
- }
-}
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/utils/JacksonUtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/JacksonUtilTest.java
deleted file mode 100644
index 6fa9c11..0000000
--- a/holmes-actions/src/test/java/org/onap/holmes/common/utils/JacksonUtilTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright 2016 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 static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-import java.lang.reflect.Type;
-import org.junit.Test;
-import org.onap.holmes.common.utils.bean.TestBean;
-
-public class JacksonUtilTest {
-
- @Test
- public void testBeanToJson() throws Exception {
- TestBean o = new TestBean();
- o.setId("id");
- String result = GsonUtil.beanToJson(o);
- assertThat("{\"id\":\"id\"}", equalTo(result));
- }
-
- @Test
- public void jsonToBean_json_null() throws Exception {
- String jsonNull = null;
- TestBean testBean = GsonUtil.jsonToBean(jsonNull, TestBean.class);
- assertThat(testBean, equalTo(null));
- }
-
- @Test
- public void jsonToBean_json_normal() throws Exception {
- String json = "{\"id\":\"id\"}";
- TestBean testBean = GsonUtil.jsonToBean(json, TestBean.class);
- assertThat(testBean.getId(), equalTo("id"));
- }
-
-} \ No newline at end of file
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/utils/Md5UtilTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/Md5UtilTest.java
index af81a11..f6680a3 100644
--- a/holmes-actions/src/test/java/org/onap/holmes/common/utils/Md5UtilTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/Md5UtilTest.java
@@ -20,7 +20,6 @@ import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;
-import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.Test;
import org.onap.holmes.common.dcae.entity.DcaeConfigurations;
import org.onap.holmes.common.dcae.entity.SecurityInfo;