aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapters-rest-interface/src/main/java
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2017-12-28 14:19:52 +0100
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2017-12-28 18:35:52 +0100
commita79579d14a4446d4a6f67bd48f650bfa8ed05486 (patch)
treebe4e36ed0f3fb2583743ad6166c0c61deb41ed32 /adapters/mso-adapters-rest-interface/src/main/java
parentfffbc99f5d7ce51601204076f77882cb298f4275 (diff)
refactoring - adding junit coverage
Change-Id: I712afd8ff4e403829ee51b87d76ed38dda027ace Issue-ID: SO-360 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'adapters/mso-adapters-rest-interface/src/main/java')
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java18
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java4
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java6
3 files changed, 6 insertions, 22 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
index f51cb0dd64..2a3a64ce1b 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
@@ -21,7 +21,6 @@ package org.openecomp.mso.adapters.json;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.ObjectMapper;
@@ -48,27 +47,22 @@ import java.util.Map;
* </pre>
*/
public class MapDeserializer extends JsonDeserializer<Map<String, String>> {
+
@Override
public Map<String, String> deserialize(JsonParser parser,
- DeserializationContext context) throws IOException,
- JsonProcessingException {
+ DeserializationContext context) throws IOException {
ObjectMapper mapper = new ObjectMapper();
JsonNode tree = mapper.readTree(parser);
-
Map<String, String> map = new LinkedHashMap<>();
- Iterator<JsonNode> iterator = tree.iterator();
-
- while (iterator.hasNext()) {
- JsonNode element = iterator.next();
- Iterator<JsonNode> arrayIterator = element.iterator();
- while (arrayIterator.hasNext()) {
- JsonNode arrayElement = arrayIterator.next();
+ if (tree == null)
+ return map;
+ for (JsonNode element : tree) {
+ for (JsonNode arrayElement : element) {
String key = arrayElement.get("key").getTextValue();
String value = arrayElement.get("value").getTextValue();
map.put(key, value);
}
}
-
return map;
}
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java
index 83c31336bb..2d359e059f 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java
@@ -37,10 +37,6 @@ public class RollbackTenantError implements Serializable {
public RollbackTenantError () {}
- public RollbackTenantError (String message) {
- this.message = message;
- }
-
public RollbackTenantError (String message, MsoExceptionCategory category, boolean rolledBack) {
this.message = message;
this.category = category;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java
index d7b02e028a..c5105aa683 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java
@@ -20,8 +20,6 @@
package org.openecomp.mso.adapters.tenantrest;
-
-
import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
@@ -39,10 +37,6 @@ public class TenantExceptionResponse implements Serializable {
public TenantExceptionResponse () {}
- public TenantExceptionResponse (String message) {
- this.message = message;
- }
-
public TenantExceptionResponse (String message, MsoExceptionCategory category, boolean rolledBack) {
this.message = message;
this.category = category;