summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorkaty.rotman <katy.rotman@amdocs.com>2018-05-24 14:09:26 +0300
committerOren Kleks <orenkle@amdocs.com>2018-05-28 08:15:19 +0000
commit6c72be9effaeff9f2b6dbc843b2d4d1ec1b60b1b (patch)
treec12f52038556398175f7a4ee64a821aa44659644 /catalog-be
parentd981ef67e956f1e5a28ca77f2841f49e468c5b1b (diff)
fixing sonar violations
Issue-ID: SDC-1363 Change-Id: I29b8df69d49d6ca0ba953b362f7574213e931183 Signed-off-by: katy.rotman <katy.rotman@amdocs.com>
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java26
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java2
2 files changed, 14 insertions, 14 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
index 5a8aa7e1d5..8c9c63af03 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
@@ -47,12 +47,15 @@ public class InterfacesOperationsToscaUtil {
private static final String OPERATIONS_KEY = "operations";
private static final String DEFAULT = "default";
- private static final String _DEFAULT = "_default";
+ private static final String DEFAULT_HAS_UNDERSCORE = "_default";
private static final String DOT = ".";
private static final String DEFAULT_INPUT_TYPE = "string";
private static final String SELF = "SELF";
private static final String GET_PROPERTY = "get_property";
- public static final String DEFAULTP = "defaultp";
+ private static final String DEFAULTP = "defaultp";
+
+ private InterfacesOperationsToscaUtil() {
+ }
/**
* Creates the interface_types element
@@ -67,7 +70,7 @@ public class InterfacesOperationsToscaUtil {
}
final Map<String, InterfaceDefinition> interfaces = ((Resource) component).getInterfaces();
- if ( MapUtils.isEmpty(interfaces)) {
+ if (MapUtils.isEmpty(interfaces)) {
return null;
}
@@ -78,8 +81,8 @@ public class InterfacesOperationsToscaUtil {
final Map<String, OperationDataDefinition> operations = interfaceDefinition.getOperations();
Map<String, Object> toscaOperations = new HashMap<>();
- for (String operationId : operations.keySet()) {
- toscaOperations.put(operations.get(operationId).getName(),
+ for (Map.Entry<String, OperationDataDefinition> operationEntry : operations.entrySet()) {
+ toscaOperations.put(operationEntry.getValue().getName(),
null); //currently not initializing any of the operations' fields as it is not needed
}
@@ -108,7 +111,7 @@ public class InterfacesOperationsToscaUtil {
}
final Map<String, InterfaceDefinition> interfaces = ((Resource) component).getInterfaces();
- if ( MapUtils.isEmpty(interfaces)) {
+ if (MapUtils.isEmpty(interfaces)) {
return;
}
for (InterfaceDefinition interfaceDefinition : interfaces.values()) {
@@ -150,23 +153,21 @@ public class InterfacesOperationsToscaUtil {
* @param operationsMap the map to update
*/
private static void handleDefaults(Map<String, Object> operationsMap) {
- for (String key : operationsMap.keySet()) {
- Object value = operationsMap.get(key);
+ for (Map.Entry<String, Object> operationEntry : operationsMap.entrySet()) {
+ final Object value = operationEntry.getValue();
if (value instanceof Map) {
handleDefaults((Map<String, Object>) value);
}
+ final String key = operationEntry.getKey();
if (key.equals(DEFAULTP)) {
Object removed = operationsMap.remove(key);
operationsMap.put(DEFAULT, removed);
}
}
-
-
}
private static String getLastPartOfName(String toscaResourceName) {
return toscaResourceName.substring(toscaResourceName.lastIndexOf(DOT) + 1);
-
}
private static boolean isArtifactPresent(Map.Entry<String, OperationDataDefinition> operationEntry) {
@@ -215,9 +216,8 @@ public class InterfacesOperationsToscaUtil {
if (objectAsMap.containsKey(DEFAULT)) {
Object defaultValue = objectAsMap.get(DEFAULT);
objectAsMap.remove(DEFAULT);
- objectAsMap.put(_DEFAULT, defaultValue);
+ objectAsMap.put(DEFAULT_HAS_UNDERSCORE, defaultValue);
}
return objectAsMap;
}
-
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
index 57fe098972..67b27f678f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
@@ -43,7 +43,7 @@ import org.openecomp.sdc.be.tosca.model.ToscaTemplate;
public class InterfacesOperationsToscaUtilTest {
@BeforeClass
- public static void setUp() throws Exception {
+ public static void setUp() {
new DummyConfigurationManager();
}
pache 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. ~ ============LICENSE_END========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <licenses> <license> <name>The Apache Software License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> </license> </licenses> <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>hv-collector-sources</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>hv-collector-configuration</artifactId> <description>VES HighVolume Collector :: Configuration</description> <build> <plugins> <plugin> <artifactId>kotlin-maven-plugin</artifactId> <groupId>org.jetbrains.kotlin</groupId> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <groupId>org.apache.maven.plugins</groupId> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>hv-collector-commandline</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>hv-collector-ssl</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>hv-collector-test-utils</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId> <artifactId>cbs-client</artifactId> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib-jdk8</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </dependency> </dependencies> </project>