aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-02-19 11:24:29 +0100
committerr.bogacki <r.bogacki@samsung.com>2019-02-19 11:32:29 +0100
commit2108abf11dd00f1190a7fb3630b8555381b616cf (patch)
tree2317be61ebb5f8fab7a0547479a9ffef1625771e
parent50bd365f7e30337a21806cd292e75c3f03985b79 (diff)
Fixed major Sonar issues in JsonDelete
Removed unnecessary imports. Changed return type from ArrayList to List. Change-Id: I9a17c9848b33be9f6ca5a2d51ee4b3f18abfcc38 Issue-ID: MUSIC-338 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java10
-rwxr-xr-xsrc/main/java/org/onap/music/rest/RestMusicDataAPI.java6
-rw-r--r--src/test/java/org/onap/music/unittests/jsonobjects/JsonDeleteTest.java15
3 files changed, 14 insertions, 17 deletions
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
index c90dd005..b98a391d 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property
* ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
* 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
@@ -22,7 +24,7 @@
package org.onap.music.datastore.jsonobjects;
-import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -34,7 +36,7 @@ import io.swagger.annotations.ApiModelProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonDelete {
- private ArrayList<String> columns = null;
+ private List<String> columns = null;
private Map<String, String> consistencyInfo;
private Map<String, Object> conditions;
String ttl, timestamp;
@@ -59,11 +61,11 @@ public class JsonDelete {
}
@ApiModelProperty(value = "Column values")
- public ArrayList<String> getColumns() {
+ public List<String> getColumns() {
return columns;
}
- public void setColumns(ArrayList<String> columns) {
+ public void setColumns(List<String> columns) {
this.columns = columns;
}
diff --git a/src/main/java/org/onap/music/rest/RestMusicDataAPI.java b/src/main/java/org/onap/music/rest/RestMusicDataAPI.java
index 0010ed1a..80654935 100755
--- a/src/main/java/org/onap/music/rest/RestMusicDataAPI.java
+++ b/src/main/java/org/onap/music/rest/RestMusicDataAPI.java
@@ -25,12 +25,10 @@
package org.onap.music.rest;
import java.nio.ByteBuffer;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@@ -41,7 +39,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
@@ -73,7 +70,6 @@ import org.onap.music.main.MusicUtil;
import org.onap.music.main.ResultType;
import org.onap.music.main.ReturnType;
import org.onap.music.response.jsonobjects.JsonResponse;
-import org.onap.music.service.impl.MusicZKCore;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.ResultSet;
@@ -1204,7 +1200,7 @@ public class RestMusicDataAPI {
StringBuilder columnString = new StringBuilder();
int counter = 0;
- ArrayList<String> columnList = delObj.getColumns();
+ List<String> columnList = delObj.getColumns();
if (columnList != null) {
for (String column : columnList) {
columnString.append(column);
diff --git a/src/test/java/org/onap/music/unittests/jsonobjects/JsonDeleteTest.java b/src/test/java/org/onap/music/unittests/jsonobjects/JsonDeleteTest.java
index 4c5af38f..a069b81d 100644
--- a/src/test/java/org/onap/music/unittests/jsonobjects/JsonDeleteTest.java
+++ b/src/test/java/org/onap/music/unittests/jsonobjects/JsonDeleteTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property
* ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
* 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
@@ -25,25 +27,24 @@ package org.onap.music.unittests.jsonobjects;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.onap.music.datastore.jsonobjects.JsonDelete;
public class JsonDeleteTest {
-
+
JsonDelete jd = null;
-
+
@Before
public void init() {
jd = new JsonDelete();
}
-
-
+
@Test
public void testGetConditions() {
Map<String,Object> mapSo = new HashMap<>();
- mapSo = new HashMap<>();
mapSo.put("key1","one");
mapSo.put("key2","two");
jd.setConditions(mapSo);
@@ -53,7 +54,6 @@ public class JsonDeleteTest {
@Test
public void testGetConsistencyInfo() {
Map<String,String> mapSs = new HashMap<>();
- mapSs = new HashMap<>();
mapSs.put("key3","three");
mapSs.put("key4","four");
jd.setConsistencyInfo(mapSs);
@@ -62,8 +62,7 @@ public class JsonDeleteTest {
@Test
public void testGetColumns() {
- ArrayList<String> ary = new ArrayList<>();
- ary = new ArrayList<>();
+ List<String> ary = new ArrayList<>();
ary.add("e1");
ary.add("e2");
ary.add("e3");