aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapters-rest-interface
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2017-09-18 11:47:20 +0530
committerseshukm <seshu.kumar.m@huawei.com>2017-09-18 11:47:20 +0530
commit5e2aa1fec3c51e8eb0e6b43285c8414105a51b2f (patch)
tree291e6a39ce0cf6e9b0e60c5645fa816226c3c974 /adapters/mso-adapters-rest-interface
parent5d8490e4c2aabebe4e34a28bc47a42a17fbfa1f1 (diff)
Fixed Issues In adapter code.
Issue-Id : SO-141 Change-Id: I0e901537013634dfc3f0950921c2ebbc2afa411f Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'adapters/mso-adapters-rest-interface')
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java10
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java9
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java7
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java5
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java3
8 files changed, 38 insertions, 16 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java
index 0b62be6dd0..d9b09fa1b0 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,11 +30,13 @@ import javax.xml.bind.Marshaller;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Everything that is common between all Network Requests.
*/
public abstract class NetworkRequestCommon {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
private Boolean skipAAI = false;
private String messageId;
private String notificationUrl;
@@ -63,7 +66,7 @@ public abstract class NetworkRequestCommon {
}
public boolean isSynchronous() {
- return notificationUrl == null || (notificationUrl != null && notificationUrl.isEmpty());
+ return notificationUrl == null || (notificationUrl.isEmpty());
}
public String toJsonString() {
@@ -73,7 +76,7 @@ public abstract class NetworkRequestCommon {
mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
jsonString = mapper.writeValueAsString(this);
} catch (Exception e) {
- // ignore
+ LOGGER.debug("Exception:", e);
}
return jsonString;
}
@@ -87,8 +90,7 @@ public abstract class NetworkRequestCommon {
marshaller.marshal(this, bs);
return bs.toString();
} catch (Exception e) {
- // Shouldn't happen...
- e.printStackTrace();
+ LOGGER.debug("Exception:", e);
return "";
}
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java
index 40d2aba1c8..56ec73d94a 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,12 +30,13 @@ import javax.xml.bind.Marshaller;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
-
+import org.openecomp.mso.logger.MsoLogger;
/**
* Everything that is common between all Volume Group Responses, except for QueryVolumeGroupResponse.
*/
public abstract class NetworkResponseCommon {
private String messageId;
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
public NetworkResponseCommon() {
messageId = null;
@@ -59,7 +61,7 @@ public abstract class NetworkResponseCommon {
mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
jsonString = mapper.writeValueAsString(this);
} catch (Exception e) {
- // ignore
+ LOGGER.debug("Exception:", e);
}
return jsonString;
}
@@ -73,8 +75,7 @@ public abstract class NetworkResponseCommon {
marshaller.marshal(this, bs);
return bs.toString();
} catch (Exception e) {
- // Shouldn't happen...
- e.printStackTrace();
+ LOGGER.debug("Exception:", e);
return "";
}
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java
index 418a15abf2..1ca36aface 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +32,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.codehaus.jackson.map.ObjectMapper;
import org.jboss.resteasy.annotations.providers.NoJackson;
+import org.openecomp.mso.logger.MsoLogger;
@XmlRootElement(name = "queryNetworkResponse")
@NoJackson
@@ -44,6 +46,7 @@ public class QueryNetworkResponse {
private List<String> routeTargets;
private Map<String, String> subnetIdMap;
private Map<String, String> networkOutputs;
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
public QueryNetworkResponse() {
super();
@@ -138,7 +141,9 @@ public class QueryNetworkResponse {
ObjectMapper mapper = new ObjectMapper();
jsonString = mapper.writeValueAsString(this);
}
- catch (Exception e) {}
+ catch (Exception e) {
+ LOGGER.debug("Exception:", e);
+ }
return jsonString;
}
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java
index ed10540491..09c1b3ee38 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java
@@ -32,6 +32,7 @@ import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import org.jboss.resteasy.annotations.providers.NoJackson;
import org.codehaus.jackson.map.annotate.JsonRootName;
+import org.openecomp.mso.logger.MsoLogger;
@JsonRootName("updateNetworkRequest")
@XmlRootElement(name = "updateNetworkRequest")
@@ -50,9 +51,10 @@ public class UpdateNetworkRequest extends NetworkRequestCommon {
private ProviderVlanNetwork providerVlanNetwork;
private ContrailNetwork contrailNetwork;
private Boolean backout = true;
- private Map<String,String> networkParams = new HashMap<String, String>();
+ private Map<String,String> networkParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
-
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
public UpdateNetworkRequest() {
super();
}
@@ -129,7 +131,7 @@ public class UpdateNetworkRequest extends NetworkRequestCommon {
try {
this.networkTechnology = NetworkTechnology.valueOf(networkTechnology.toUpperCase());
} catch (IllegalArgumentException e) {
- // ignore
+ LOGGER.debug("Exception:", e);
}
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java
index 2cf5ca2638..9b9c214129 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +37,7 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
+import org.openecomp.mso.logger.MsoLogger;
// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy,
// even though we are using JSON exclusively. The @NoJackson annotation
@@ -61,6 +63,8 @@ import java.util.Map;
@NoJackson
public class SDNCEvent implements Serializable {
private static final long serialVersionUID = 1L;
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
// Event type
private String eventType;
@@ -143,7 +147,7 @@ public class SDNCEvent implements Serializable {
mapper.setSerializationInclusion(Inclusion.NON_NULL);
return mapper.writeValueAsString(this);
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.debug("Exception:", e);
throw new UnsupportedOperationException("Cannot convert "
+ getClass().getSimpleName() + " to JSON", e);
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java
index 4a756aeccd..45609168ee 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java
@@ -28,12 +28,15 @@ import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
import javax.xml.bind.annotation.XmlElement;
import java.io.IOException;
import java.io.Serializable;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Base class for all SDNC adapter requests.
*/
public abstract class SDNCRequestCommon implements Serializable {
private static final long serialVersionUID = 1L;
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
// Endpoint on which BPMN can receive notifications from the SDNC adapter.
private String bpNotificationUrl;
@@ -101,7 +104,7 @@ public abstract class SDNCRequestCommon implements Serializable {
mapper.setSerializationInclusion(Inclusion.NON_NULL);
return mapper.writeValueAsString(this);
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.debug("Exception:", e);
throw new UnsupportedOperationException("Cannot convert "
+ getClass().getSimpleName() + " to JSON", e);
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java
index f141116aeb..5e6b9394a6 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,12 +28,15 @@ import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
import javax.xml.bind.annotation.XmlElement;
import java.io.IOException;
import java.io.Serializable;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Base class for all SDNC adapter responses, including errors.
*/
public abstract class SDNCResponseCommon implements Serializable {
private static final long serialVersionUID = 1L;
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
// Identifies the MSO transaction with SDNC.
private String sdncRequestId;
@@ -109,7 +113,7 @@ public abstract class SDNCResponseCommon implements Serializable {
mapper.setSerializationInclusion(Inclusion.NON_NULL);
return mapper.writeValueAsString(this);
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.debug("Exception:", e);
throw new UnsupportedOperationException("Cannot convert "
+ getClass().getSimpleName() + " to JSON", e);
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java
index 75668143e2..aa6af56082 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +46,7 @@ public abstract class VfRequestCommon extends VfResponseCommon {
}
public boolean isSynchronous() {
- return notificationUrl == null || (notificationUrl != null && notificationUrl.isEmpty());
+ return notificationUrl == null || notificationUrl.isEmpty();
}
// getMessageId, setMessageId, toJsonString, toJsonString are all defined in VfResponseCommon.