aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--checkstyle-suppressions.xml43
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java3
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java13
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java20
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java18
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java7
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java2
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java1
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java4
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java20
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java4
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java20
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java4
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java14
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java66
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExt.java4
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java6
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java4
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java6
30 files changed, 155 insertions, 126 deletions
diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
new file mode 100644
index 0000000000..c83a6fa498
--- /dev/null
+++ b/checkstyle-suppressions.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+ ============LICENSE_START=======================================================
+ SDC
+ ================================================================================
+ Copyright (C) 2019 Nokia. 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.
+ 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=========================================================
+ -->
+
+<!DOCTYPE suppressions PUBLIC
+ "-//Checkstyle//DTD SuppressionFilter Configuration 1.0//EN"
+ "https://checkstyle.org/dtds/suppressions_1_0.dtd">
+<suppressions>
+ <suppress checks=".*" files="\.java" lines="1-20"/>
+ <suppress checks=".*" files="\.properties"/>
+ <suppress checks="javadoc" files="\.java"/>
+ <suppress checks="LineLength" files="\.java"/>
+ <suppress checks="HiddenField" files="\.java"/>
+ <suppress checks="FinalClass" files="\.java"/>
+ <suppress checks="FinalParameters" files="\.java"/>
+ <suppress checks="AvoidInlineConditionals" files="\.java"/>
+ <suppress checks="DesignForExtension" files="\.java"/>
+ <suppress checks="ImportOrder" files="\.java"/>
+ <suppress checks="LocalVariableName" files="\.java"/>
+ <suppress checks="AbbreviationAsWordInName" files="\.java"/>
+ <!--Checkstyle requirements that don't match SnakeYAML parser requirements-->
+ <suppress checks="ParameterName" files="common/onap-tosca-datatype/.*/*.java"/>
+ <suppress checks="MethodName" files="common/onap-tosca-datatype/.*/*.java"/>
+ <suppress checks="MemberName" files="common/onap-tosca-datatype/.*/*.java"/>
+
+</suppressions> \ No newline at end of file
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java
index d84a470e1c..8d61701a9c 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java
@@ -27,6 +27,9 @@ import java.util.ServiceLoader;
*/
class ConfigurationLoader {
+ private ConfigurationLoader() {
+ }
+
static Configuration load() {
ServiceLoader<ConfigurationManager> loader = ServiceLoader.load(ConfigurationManager.class);
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java
index b18649181d..991ec5fc8b 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java
@@ -433,12 +433,13 @@ public class ConfigurationUtils {
Pattern pattern = Pattern.compile("^.*\\$\\{(.*)\\}.*");
Matcher matcher = pattern.matcher(data);
if (matcher.matches()) {
+ final int substringStartIndex = 4;
String key = matcher.group(1);
String value;
if (key.toUpperCase().startsWith("ENV:")) {
- value = System.getenv(key.substring(4));
+ value = System.getenv(key.substring(substringStartIndex));
} else if (key.toUpperCase().startsWith("SYS:")) {
- value = System.getProperty(key.substring(4));
+ value = System.getProperty(key.substring(substringStartIndex));
} else {
value = ConfigurationUtils.getCollectionString(
ConfigurationManager.lookup().getAsStringValues(tenant, namespace, key).toString());
@@ -513,8 +514,8 @@ public class ConfigurationUtils {
if (List.class.isAssignableFrom(clazz)) {
return getConcreteCollection(List.class);
}
- throw new IllegalArgumentException("Only corresponding array classes and any are allowed as argument." +
- "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
+ throw new IllegalArgumentException("Only corresponding array classes and any are allowed as argument."
+ + "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
}
public static Collection getConcreteCollection(Class clazz) {
@@ -535,8 +536,8 @@ public class ConfigurationUtils {
case "java.util.concurrent.BlockingQueue":
return new LinkedBlockingQueue<>();
default:
- throw new IllegalArgumentException("Only corresponding array classes and any are allowed as argument." +
- "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
+ throw new IllegalArgumentException("Only corresponding array classes and any are allowed as argument."
+ + "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
}
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
index 6cad62ef03..9a3fbd26fb 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
@@ -44,7 +44,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
private static final String KEY_CANNOT_BE_NULL = "Key can't be null.";
- private static final NonConfigResource nonConfigResource = new NonConfigResource();
+ private static final NonConfigResource NON_CONFIG_RESOURCE = new NonConfigResource();
static {
@@ -70,7 +70,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
}
moduleConfig.addConfig(url);
} else {
- nonConfigResource.add(url);
+ NON_CONFIG_RESOURCE.add(url);
}
}
String configLocation = System.getProperty("config.location");
@@ -88,7 +88,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
}
moduleConfig.addConfig(file);
} else {
- nonConfigResource.add(file);
+ NON_CONFIG_RESOURCE.add(file);
}
}
}
@@ -397,13 +397,17 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
clazzToInstantiate = field.getType();
}
Constructor construct = getConstructorWithArguments(clazzToInstantiate, Collection.class);
+
if (construct != null) {
construct.setAccessible(true);
field.set(objToReturn, construct.newInstance(list));
- } else if ((construct = getConstructorWithArguments(clazzToInstantiate, Integer.class,
- Boolean.class, Collection.class)) != null) {
- construct.setAccessible(true);
- field.set(objToReturn, construct.newInstance(list.size(), true, list));
+ } else {
+ construct = getConstructorWithArguments(clazzToInstantiate, Integer.class,
+ Boolean.class, Collection.class);
+ if (construct != null) {
+ construct.setAccessible(true);
+ field.set(objToReturn, construct.newInstance(list.size(), true, list));
+ }
}
}
} else if (Map.class.isAssignableFrom(field.getType())) {
@@ -454,7 +458,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
if (String.class.equals(clazz)) {
if (obj.toString().startsWith("@") && ConfigurationUtils.isExternalLookup(processingHint)) {
String contents = ConfigurationUtils.getFileContents(
- nonConfigResource.locate(obj.toString().substring(1).trim()));
+ NON_CONFIG_RESOURCE.locate(obj.toString().substring(1).trim()));
if (contents == null) {
contents = ConfigurationUtils.getFileContents(obj.toString().substring(1).trim());
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java
index 5863caef68..63c3b7563f 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java
@@ -35,7 +35,7 @@ import org.onap.config.Constants;
public final class ConfigurationRepository {
- private static final ConfigurationRepository repo = new ConfigurationRepository();
+ private static final ConfigurationRepository REPO = new ConfigurationRepository();
private final Set<String> tenants = Collections.synchronizedSet(new HashSet<>());
@@ -63,7 +63,7 @@ public final class ConfigurationRepository {
}
public static ConfigurationRepository lookup() {
- return repo;
+ return REPO;
}
public Set<String> getTenants() {
@@ -119,20 +119,20 @@ public final class ConfigurationRepository {
private final Map<String, FileBasedConfigurationBuilder<FileBasedConfiguration>> overrideConfiguration =
new LinkedHashMap<>();
- BasicConfigurationBuilder<Configuration> builder;
- Timestamp lastConfigurationBuildTime;
- Configuration config;
- Configuration composite;
+ private BasicConfigurationBuilder<Configuration> builder;
+ private Timestamp lastConfigurationBuildTime;
+ private Configuration config;
+ private Configuration composite;
- public ConfigurationHolder(BasicConfigurationBuilder builder) {
+ ConfigurationHolder(BasicConfigurationBuilder builder) {
this.builder = builder;
}
- public ConfigurationHolder(Configuration builder) {
+ ConfigurationHolder(Configuration builder) {
this.config = builder;
}
- public void addOverrideConfiguration(String path, BasicConfigurationBuilder<FileBasedConfiguration> builder) {
+ void addOverrideConfiguration(String path, BasicConfigurationBuilder<FileBasedConfiguration> builder) {
overrideConfiguration.put(path.toUpperCase(), (FileBasedConfigurationBuilder) builder);
getEffectiveConfiguration(config, overrideConfiguration.values());
}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java
index 7f6c3539e2..0a8a206e0b 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java
@@ -21,6 +21,7 @@
package org.onap.sdc.gab;
import java.io.IOException;
+
import org.onap.sdc.gab.model.GABQuery;
import org.onap.sdc.gab.model.GABQuery.GABQueryType;
import org.onap.sdc.gab.model.GABResults;
@@ -35,8 +36,8 @@ public class GABServiceImpl implements GABService {
}
}
- private GABYamlParser parse(GABQuery gabQuery, GABYamlParser gabYamlParser){
- return gabQuery.getType() == GABQueryType.PATH ?
- gabYamlParser.parseFile(gabQuery.getDocument()) : gabYamlParser.parseContent(gabQuery.getDocument());
+ private GABYamlParser parse(GABQuery gabQuery, GABYamlParser gabYamlParser) {
+ return gabQuery.getType() == GABQueryType.PATH
+ ? gabYamlParser.parseFile(gabQuery.getDocument()) : gabYamlParser.parseContent(gabQuery.getDocument());
}
}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java
index f306e09665..cbe7ef31cf 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java
@@ -35,7 +35,7 @@ public class GABQuery {
* PATH - when provided path to the yaml file
* CONTENT - when provided yaml file content
*/
- public enum GABQueryType{
+ public enum GABQueryType {
PATH, CONTENT
}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java
index 45b2412c1e..cc6abd5170 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java
@@ -23,7 +23,6 @@ package org.onap.sdc.gab.model;
import com.google.common.base.MoreObjects;
import lombok.AllArgsConstructor;
import lombok.Getter;
-import org.onap.sdc.gab.GABService;
/**
* See GABResultEntry.{@link #path}, GABResultEntry.{@link #data}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java
index 0d3575920c..ec4ff1319c 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java
@@ -53,7 +53,7 @@ import org.yaml.snakeyaml.Yaml;
*/
public class YamlParser implements AutoCloseable {
- private static Logger LOGGER = Logger.getLogger(YamlParser.class.getName());
+ private static final Logger LOGGER = Logger.getLogger(YamlParser.class.getName());
private Stream<Object> parsedYamlContent;
private InputStream inputStream;
@@ -121,7 +121,7 @@ public class YamlParser implements AutoCloseable {
List<List<SimpleEntry<String, ? extends Collection<Object>>>> collect() throws IOException {
try {
return parsedYamlContent.map(containsKeys).filter(notEmptyListPredicate()).collect(Collectors.toList());
- } catch(Exception e){
+ } catch (Exception e) {
LOGGER.log(Level.WARNING, "Unexpected document content. Please check body of the yaml file.", e);
throw new IOException("Unexpected document content");
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
index 4352f16ace..aa1392e2ce 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
@@ -26,7 +26,7 @@ import lombok.Setter;
@Getter
@Setter
-public class AttributeDefinition implements Cloneable{
+public class AttributeDefinition implements Cloneable {
private String type;
private String description;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java
index 152d9fb05e..4d0a38a77e 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java
@@ -25,7 +25,7 @@ import org.onap.sdc.tosca.services.DataModelCloneUtil;
import java.util.List;
import java.util.Map;
-public class CapabilityDefinition implements Cloneable{
+public class CapabilityDefinition implements Cloneable {
private String type;
private String description;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
index a394401112..f85ea5c7d2 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
@@ -22,7 +22,7 @@ import lombok.Data;
@Data
public class Condition {
- private Map<String,Constraint> constraint;
+ private Map<String, Constraint> constraint;
private String period;
private Integer evaluations;
private String method;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java
index 11bb6390fe..217af07d05 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java
@@ -29,7 +29,7 @@ public class Credential {
private Map<String, String> keys;
private String user;
- public Credential(){
+ public Credential() {
this.token_type = "password";
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java
index bf318a7d3e..acf11c25f9 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java
@@ -27,7 +27,7 @@ public class DataType {
private String derived_from;
private String version;
- Map<String, String> metadata;
+ private Map<String, String> metadata;
private String description;
private List<Constraint> constraints;
private Map<String, PropertyDefinition> properties;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
index 9d00532a30..44da720fc4 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
@@ -20,16 +20,16 @@ import java.util.List;
import java.util.Objects;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
-public class DefinitionOfDataType implements Cloneable{
-
- protected String type;
- protected String description;
- protected Object value;
- protected Boolean required;
- protected Object _default;
- protected Status status;
- protected List<Constraint> constraints;
- protected EntrySchema entry_schema;
+public class DefinitionOfDataType implements Cloneable {
+
+ private String type;
+ private String description;
+ private Object value;
+ private Boolean required;
+ private Object _default;
+ private Status status;
+ private List<Constraint> constraints;
+ private EntrySchema entry_schema;
public String getType() {
return type;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
index 1449f2086e..80a2a22b25 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
@@ -22,7 +22,7 @@ import java.util.Objects;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
-public class Implementation implements Cloneable{
+public class Implementation implements Cloneable {
private String primary;
private List<String> dependencies;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java
index c46cc6a5f5..9bb35d81eb 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java
@@ -52,8 +52,8 @@ public abstract class InterfaceDefinition extends Interface {
for (Map.Entry<String, Object> entry : interfaceAsMap.entrySet()) {
Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition =
createOperation(entry.getKey(), entry.getValue(), fieldNames,
- interfaceDefinition instanceof InterfaceDefinitionType ? OperationDefinitionType.class :
- OperationDefinitionTemplate.class);
+ interfaceDefinition instanceof InterfaceDefinitionType ? OperationDefinitionType.class
+ : OperationDefinitionTemplate.class);
operationDefinition
.ifPresent(operation -> interfaceDefinition.addOperation(operation.getKey(), operation.getValue()));
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
index 5f0ea6ae92..3d691bed0f 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
@@ -19,6 +19,7 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import org.apache.commons.collections4.MapUtils;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
@@ -70,27 +71,18 @@ public class InterfaceDefinitionType extends InterfaceDefinition {
if (this == o) {
return true;
}
- if (!(o instanceof InterfaceDefinitionType)) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
-
InterfaceDefinitionType that = (InterfaceDefinitionType) o;
-
- if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) {
- return false;
- }
- if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) {
- return false;
- }
- return getOperations() != null ? getOperations().equals(that.getOperations()) : that.getOperations() == null;
+ return Objects.equals(type, that.type)
+ && Objects.equals(inputs, that.inputs)
+ && Objects.equals(operations, that.operations);
}
@Override
public int hashCode() {
- int result = getType() != null ? getType().hashCode() : 0;
- result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0);
- result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0);
- return result;
+ return Objects.hash(type, inputs, operations);
}
@Override
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
index 57906140cf..07c4031b34 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
@@ -65,7 +65,7 @@ public class InterfaceType extends Interface {
throw new ToscaRuntimeException(CONVERT_INTERFACE_TYPE_OBJECT_ERROR + toscaInterfaceTypeObj.toString());
}
} catch (Exception exc) {
- throw new ToscaRuntimeException(CONVERT_INTERFACE_TYPE_OBJECT_ERROR + toscaInterfaceTypeObj.toString(),exc);
+ throw new ToscaRuntimeException(CONVERT_INTERFACE_TYPE_OBJECT_ERROR + toscaInterfaceTypeObj.toString(), exc);
}
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java
index 42cc7158ec..8114686168 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java
@@ -24,7 +24,7 @@ import java.util.Objects;
public class OperationDefinition implements Cloneable {
- protected String description;
+ private String description;
public String getDescription() {
return description;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java
index 84c1586454..0c1f804efa 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java
@@ -39,8 +39,8 @@ package org.onap.sdc.tosca.datatypes.model;
public class PropertyDefinition extends DefinitionOfDataType {
public PropertyDefinition() {
- this.status = Status.SUPPORTED;
- this.required = true;
+ setStatus(Status.SUPPORTED);
+ setRequired(true);
}
@Override
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java
index aaaae31f4e..facdb2a7b1 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java
@@ -30,9 +30,9 @@ public enum PropertyType {
SCALAR_UNIT_SIZE("scalar-unit.size"),
SCALAR_UNIT_FREQUENCY("scalar-unit.frequency");
- private static final Map<String, PropertyType> mMap =
+ private static final Map<String, PropertyType> M_MAP =
Collections.unmodifiableMap(initializeMapping());
- private static final Set<String> simplePropertyTypes =
+ private static final Set<String> SIMPLE_PROPERTY_TYPES =
Collections.unmodifiableSet(initializeSimplePropertyTypes());
private String displayName;
@@ -59,14 +59,15 @@ public enum PropertyType {
* @return PropertyType
*/
public static PropertyType getPropertyTypeByDisplayName(String displayName) {
- if (mMap.containsKey(displayName)) {
- return mMap.get(displayName);
+ if (M_MAP.containsKey(displayName)) {
+ return M_MAP.get(displayName);
}
return null;
}
private static Set<String> initializeSimplePropertyTypes() {
- Set<String> simplePropertyTypes = new HashSet<>(4);
+ final int setSize = 4;
+ Set<String> simplePropertyTypes = new HashSet<>(setSize);
simplePropertyTypes.add(STRING.getDisplayName().toLowerCase());
simplePropertyTypes.add(INTEGER.getDisplayName().toLowerCase());
simplePropertyTypes.add(FLOAT.getDisplayName().toLowerCase());
@@ -75,12 +76,11 @@ public enum PropertyType {
}
public static Set<String> getSimplePropertyTypes() {
- return simplePropertyTypes;
+ return SIMPLE_PROPERTY_TYPES;
}
public String getDisplayName() {
return displayName;
}
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java
index 222fdd0a61..b58f13c3a5 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java
@@ -31,7 +31,7 @@ public enum Status {
EXPERIMENTAL("experimental"),
experimental("experimental"),
DEPRECATED("deprecated"),
- deprecated("deprecated"),;
+ deprecated("deprecated");
private String displayName;
Status(String displayName) {
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
index 9d6d9d8eac..440429461b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
@@ -20,6 +20,8 @@
package org.onap.sdc.tosca.datatypes.model;
+import java.util.Objects;
+
public class Trigger {
private String description;
@@ -29,48 +31,6 @@ public class Trigger {
private Condition condition;
private Object action;
- @Override
- public int hashCode() {
- int result = getDescription() != null ? getDescription().hashCode() : 0;
- result = 31 * result + getEvent_type().hashCode();
- result = 31 * result + (getSchedule() != null ? getSchedule().hashCode() : 0);
- result = 31 * result + (getTarget_filter() != null ? getTarget_filter().hashCode() : 0);
- result = 31 * result + (getCondition() != null ? getCondition().hashCode() : 0);
- result = 31 * result + getAction().hashCode();
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof Trigger)) {
- return false;
- }
-
- Trigger trigger = (Trigger) o;
-
- if (getDescription() != null ? !getDescription().equals(trigger.getDescription()) :
- trigger.getDescription() != null) {
- return false;
- }
- if (!getEvent_type().equals(trigger.getEvent_type())) {
- return false;
- }
- if (getSchedule() != null ? !getSchedule().equals(trigger.getSchedule()) : trigger.getSchedule() != null) {
- return false;
- }
- if (getTarget_filter() != null ? !getTarget_filter().equals(trigger.getTarget_filter()) :
- trigger.getTarget_filter() != null) {
- return false;
- }
- if (getCondition() != null ? !getCondition().equals(trigger.getCondition()) : trigger.getCondition() != null) {
- return false;
- }
- return getAction().equals(trigger.getAction());
- }
-
public String getDescription() {
return description;
}
@@ -119,4 +79,26 @@ public class Trigger {
public void setAction(Object action) {
this.action = action;
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(description, event_type, schedule, target_filter, condition, action);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Trigger trigger = (Trigger) o;
+ return Objects.equals(description, trigger.description)
+ && Objects.equals(event_type, trigger.event_type)
+ && Objects.equals(schedule, trigger.schedule)
+ && Objects.equals(target_filter, trigger.target_filter)
+ && Objects.equals(condition, trigger.condition)
+ && Objects.equals(action, trigger.action);
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
index 6c57d2b285..572af3d16c 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
@@ -21,7 +21,7 @@ import org.onap.sdc.tosca.datatypes.model.NodeFilter;
public class ServiceFilter extends NodeFilter {
- Object tosca_id;
+ private Object tosca_id;
public Object getTosca_id() {
return tosca_id;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExt.java
index 1fa3719571..d60931d180 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExt.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExt.java
@@ -41,8 +41,8 @@ public class SubstitutionMappingExt extends SubstitutionMapping {
SubstitutionMappingExt that = (SubstitutionMappingExt) o;
- return getSubstitution_filter() != null ? getSubstitution_filter().equals(that.getSubstitution_filter()) :
- that.getSubstitution_filter() == null;
+ return getSubstitution_filter() != null ? getSubstitution_filter().equals(that.getSubstitution_filter())
+ : that.getSubstitution_filter() == null;
}
@Override
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
index ffe06e6b9a..8d1b5525de 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
@@ -34,7 +34,7 @@ public enum PropertyTypeExt {
*/
JSON("json");
- private static final Map<String, PropertyTypeExt> mMap =
+ private static final Map<String, PropertyTypeExt> M_MAP =
Collections.unmodifiableMap(initializeMapping());
private String displayName;
@@ -63,8 +63,8 @@ public enum PropertyTypeExt {
* @return the property type by display name
*/
public static PropertyTypeExt getPropertyTypeByDisplayName(String displayName) {
- if (mMap.containsKey(displayName)) {
- return mMap.get(displayName);
+ if (M_MAP.containsKey(displayName)) {
+ return M_MAP.get(displayName);
}
return null;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java
index fdbcb253dc..bb26e6a2b9 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java
@@ -35,7 +35,7 @@ import org.apache.commons.beanutils.BeanUtils;
public class CommonUtil {
private static final String DEFAULT = "default";
- private static final String _DEFAULT = "_default";
+ private static final String UNDERSCORE_DEFAULT = "_default";
private static ImmutableSet<Class<?>> complexClassType = ImmutableSet.of(Map.class, String.class, Integer.class, Float.class,
Double.class, Set.class, Object.class, List.class);
@@ -85,7 +85,7 @@ public class CommonUtil {
if (objectAsMap.containsKey(DEFAULT)) {
Object defaultValue = objectAsMap.get(DEFAULT);
objectAsMap.remove(DEFAULT);
- objectAsMap.put(_DEFAULT, defaultValue);
+ objectAsMap.put(UNDERSCORE_DEFAULT, defaultValue);
}
return objectAsMap;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java
index b05fdb5b35..c41282ff0d 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java
@@ -165,7 +165,7 @@ public class DataModelCloneUtil {
} else if (mapEntry.getValue() instanceof List) {
List cloneObj = yamlUtil.yamlToObject(yamlUtil.objectToYaml(mapEntry.getValue()), List.class);
cloneMap.put(mapEntry.getKey(), cloneObj);
- } else if (mapEntry.getValue() instanceof Cloneable){
+ } else if (mapEntry.getValue() instanceof Cloneable) {
throw new ToscaRuntimeException("Clone Not Supported Exception");
} else {
cloneMap.put(mapEntry.getKey(), mapEntry.getValue());
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java
index cd19ff9ec0..4030d3acd1 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java
@@ -32,7 +32,11 @@ import org.yaml.snakeyaml.representer.Representer;
import java.beans.IntrospectionException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.*;
+import java.util.AbstractMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
/**
* The type Yaml util.