diff options
author | Jim Hahn <jrh3@att.com> | 2021-09-02 09:57:16 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-09-02 11:26:11 -0400 |
commit | a84ef3cb2133fde745c50d7a23290505e4f4659a (patch) | |
tree | 9edcaf76ba26edbcf5c3be67b1e06518d1a5d344 | |
parent | 5af35328dd1cab498c1d361126fd123dd859eb07 (diff) |
Fix eclipse warnings in clamp
Fixed some of these warnings, just in policy-clamp-runtime:
- equals() with wrong argument type in junit
- remove unneeded "SuppressWarning"
- unused fields
- deprecated classes/methods
Fixed some sonars, too:
- use isEqualByComparingTo()
- method complexity: used eclipse to auto-extract methods
Fixed checkstyle issues:
- indentation level
Did not address all deprecation issues (e.g., SSLSocketFactory).
Issue-ID: POLICY-3200
Change-Id: Ibd92e5326854002dc0ca2d7b3b777699cafb5e98
Signed-off-by: Jim Hahn <jrh3@att.com>
14 files changed, 120 insertions, 129 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java index d544915dd..5458f7c34 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java @@ -74,8 +74,8 @@ public class IntermediaryActivator extends ServiceManagerContainer implements Cl // @formatter:off addAction("Topic endpoint management", - () -> TopicEndpointManager.getManager().start(), - () -> TopicEndpointManager.getManager().shutdown()); + () -> TopicEndpointManager.getManager().start(), + () -> TopicEndpointManager.getManager().shutdown()); publishers.forEach(publisher -> addAction("Publisher " + publisher.getClass().getSimpleName(), @@ -84,8 +84,8 @@ public class IntermediaryActivator extends ServiceManagerContainer implements Cl listeners.forEach(listener -> addAction("Listener " + listener.getClass().getSimpleName(), - () -> msgDispatcher.register(listener.getType(), listener.getScoListener()), - () -> msgDispatcher.unregister(listener.getType()))); + () -> msgDispatcher.register(listener.getType(), listener.getScoListener()), + () -> msgDispatcher.unregister(listener.getType()))); addAction("Topic Message Dispatcher", this::registerMsgDispatcher, this::unregisterMsgDispatcher); // @formatter:on diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivator.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivator.java index e0ab2ba91..284094bc4 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivator.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/messaging/MessageDispatcherActivator.java @@ -69,8 +69,8 @@ public class MessageDispatcherActivator extends ServiceManagerContainer implemen // @formatter:off addAction("Topic endpoint management", - () -> TopicEndpointManager.getManager().start(), - () -> TopicEndpointManager.getManager().shutdown()); + () -> TopicEndpointManager.getManager().start(), + () -> TopicEndpointManager.getManager().shutdown()); publishers.forEach(publisher -> addAction("Publisher " + publisher.getClass().getSimpleName(), @@ -79,8 +79,8 @@ public class MessageDispatcherActivator extends ServiceManagerContainer implemen listeners.forEach(listener -> addAction("Listener " + listener.getClass().getSimpleName(), - () -> msgDispatcher.register(listener.getType(), listener.getScoListener()), - () -> msgDispatcher.unregister(listener.getType()))); + () -> msgDispatcher.register(listener.getType(), listener.getScoListener()), + () -> msgDispatcher.unregister(listener.getType()))); addAction("Topic Message Dispatcher", this::registerMsgDispatcher, this::unregisterMsgDispatcher); // @formatter:on diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java index f136b9f10..7f04056cf 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java @@ -246,8 +246,8 @@ class ControlLoopInstantiationProviderTest { new ControlLoopInstantiationProvider(clProvider, commissioningProvider, supervisionHandler); assertThatThrownBy( - () -> instantiationProvider.deleteControlLoop(controlLoop0.getName(), controlLoop0.getVersion())) - .hasMessageMatching(CONTROL_LOOP_NOT_FOUND); + () -> instantiationProvider.deleteControlLoop(controlLoop0.getName(), controlLoop0.getVersion())) + .hasMessageMatching(CONTROL_LOOP_NOT_FOUND); InstantiationUtils.assertInstantiationResponse(instantiationProvider.createControlLoops(controlLoops), controlLoops); @@ -282,8 +282,8 @@ class ControlLoopInstantiationProviderTest { instantiationProvider.updateControlLoops(controlLoops); assertThatThrownBy( - () -> instantiationProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion())) - .hasMessageMatching(String.format(DELETE_BAD_REQUEST, state)); + () -> instantiationProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion())) + .hasMessageMatching(String.format(DELETE_BAD_REQUEST, state)); } @Test diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java b/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java index 524733115..387ea8c1f 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java @@ -28,7 +28,6 @@ import java.io.IOException; import java.util.Date; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; -import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.ExchangeBuilder; import org.json.simple.JSONArray; import org.json.simple.JSONObject; diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/CamelConfiguration.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/CamelConfiguration.java index 0880e9b74..b1141ea49 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/CamelConfiguration.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/CamelConfiguration.java @@ -91,10 +91,6 @@ public class CamelConfiguration extends RouteBuilder { @Value("${clamp.config.keyFile:#{null}}") private String keyFile; - - @Autowired - private ClampProperties clampProperties; - private void configureDefaultSslProperties() { if (trustStore != null) { System.setProperty("javax.net.ssl.trustStore", Thread.currentThread().getContextClassLoader() diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java index 71986f6fb..f871df70e 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java @@ -88,9 +88,9 @@ public class SdcControllersConfiguration { Map<String, SdcSingleControllerConfiguration> result = new HashMap<>(); if (jsonRootNode.get(CONTROLLER_SUBTREE_KEY) != null) { jsonRootNode.get(CONTROLLER_SUBTREE_KEY).getAsJsonObject().entrySet().forEach( - entry -> result.put(entry.getKey(), - new SdcSingleControllerConfiguration(entry.getValue().getAsJsonObject(), entry.getKey(), - keyFile))); + entry -> result.put(entry.getKey(), + new SdcSingleControllerConfiguration(entry.getValue().getAsJsonObject(), entry.getKey(), + keyFile))); } else { throw new SdcParametersException( CONTROLLER_SUBTREE_KEY + " key not found in the file: " + sdcControllerFile); diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java index 2d193355e..4a4155446 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java @@ -29,10 +29,8 @@ import java.util.Map; import javax.annotation.PostConstruct; import org.onap.policy.clamp.clds.tosca.update.execution.cds.ToscaMetadataCdsProcess; import org.onap.policy.clamp.loop.service.Service; -import org.onap.policy.clamp.tosca.DictionaryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** @@ -44,9 +42,6 @@ public class ToscaMetadataExecutor { private static final Logger logger = LoggerFactory.getLogger(ToscaMetadataExecutor.class); - @Autowired - private DictionaryService dictionaryService; - private Map<String, ToscaMetadataProcess> mapOfProcesses = new HashMap<>(); /** diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java index 1d5ed26e0..9fe199af2 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java @@ -27,7 +27,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedHashMap; +import java.util.Map; import java.util.Map.Entry; import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElement; import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElementProperty; @@ -59,8 +59,8 @@ public class ToscaConverterToJsonSchema { private static final String TITLE = "title"; private static final String TYPE = "type"; - private LinkedHashMap<String, ToscaElement> components; - private LinkedHashMap<String, JsonTemplate> templates; + private Map<String, ToscaElement> components; + private Map<String, JsonTemplate> templates; private ToscaMetadataParser metadataParser; @@ -74,8 +74,8 @@ public class ToscaConverterToJsonSchema { * @param metadataParser The metadata parser to use for metadata section * @param serviceModel The service model for clamp enrichment */ - public ToscaConverterToJsonSchema(LinkedHashMap<String, ToscaElement> toscaElementsMap, - LinkedHashMap<String, JsonTemplate> jsonSchemaTemplates, ToscaMetadataParser metadataParser, + public ToscaConverterToJsonSchema(Map<String, ToscaElement> toscaElementsMap, + Map<String, JsonTemplate> jsonSchemaTemplates, ToscaMetadataParser metadataParser, Service serviceModel) { this.components = toscaElementsMap; this.templates = jsonSchemaTemplates; @@ -204,43 +204,7 @@ public class ToscaConverterToJsonSchema { for (String propertyField : toscaElementProperty.getItems().keySet()) { switch (propertyField) { case TYPE: - if (currentPropertyJsonTemplate.hasFields(propertyField)) { - String fieldtype = (String) toscaElementProperty.getItems().get(propertyField); - switch (fieldtype.toLowerCase()) { - case LIST: - propertiesInJson.addProperty(TYPE, ARRAY); - break; - case MAP: - propertiesInJson.addProperty(TYPE, OBJECT); - break; - case "scalar-unit.time": - case "scalar-unit.frequency": - case "scalar-unit.size": - propertiesInJson.addProperty(TYPE, "string"); - break; - case "timestamp": - propertiesInJson.addProperty(TYPE, "string"); - propertiesInJson.addProperty(FORMAT, "date-time"); - break; - case "float": - propertiesInJson.addProperty(TYPE, "number"); - break; - case "range": - propertiesInJson.addProperty(TYPE, "integer"); - if (!checkConstraintPresence(toscaElementProperty, "greater_than") - && currentPropertyJsonTemplate.hasFields("exclusiveMinimum")) { - propertiesInJson.addProperty("exclusiveMinimum", false); - } - if (!checkConstraintPresence(toscaElementProperty, "less_than") - && currentPropertyJsonTemplate.hasFields("exclusiveMaximum")) { - propertiesInJson.addProperty("exclusiveMaximum", false); - } - break; - default: - propertiesInJson.addProperty(TYPE, currentPropertyJsonTemplate.getName()); - break; - } - } + parseType(toscaElementProperty, propertyField, propertiesInJson, currentPropertyJsonTemplate); break; case METADATA: if (metadataParser != null) { @@ -254,37 +218,7 @@ public class ToscaConverterToJsonSchema { currentPropertyJsonTemplate); break; case ENTRY_SCHEMA: - // Here, a way to check if entry is a component (datatype) or a simple string - if (getToscaElement(this.extractSpecificFieldFromMap(toscaElementProperty, ENTRY_SCHEMA)) != null) { - String nameComponent = this.extractSpecificFieldFromMap(toscaElementProperty, ENTRY_SCHEMA); - var child = new ToscaConverterToJsonSchema(components, templates, metadataParser, serviceModel); - var propertiesContainer = new JsonObject(); - - if (((String) toscaElementProperty.getItems().get(TYPE)).equals(MAP)) { - JsonObject componentAsProperty = child.getJsonSchemaOfToscaElement(nameComponent); - propertiesContainer.add(nameComponent, componentAsProperty); - if (currentPropertyJsonTemplate.hasFields(PROPERTIES)) { - propertiesInJson.add(PROPERTIES, propertiesContainer); - } - } else { - JsonObject componentAsItem = child.getJsonSchemaOfToscaElement(nameComponent); - if (currentPropertyJsonTemplate.hasFields(PROPERTIES)) { - propertiesInJson.add("items", componentAsItem); - propertiesInJson.addProperty(FORMAT, "tabs-top"); - } - } - } else if (toscaElementProperty.getItems().get(TYPE).equals(LIST)) { - // Native cases - var itemContainer = new JsonObject(); - String valueInEntrySchema = - this.extractSpecificFieldFromMap(toscaElementProperty, ENTRY_SCHEMA); - itemContainer.addProperty(TYPE, valueInEntrySchema); - propertiesInJson.add("items", itemContainer); - propertiesInJson.addProperty(FORMAT, "tabs-top"); - } - - // MAP Case, for now nothing - + parseEntrySchema(toscaElementProperty, propertiesInJson, currentPropertyJsonTemplate); break; default: // Each classical field : type, description, default.. @@ -298,6 +232,81 @@ public class ToscaConverterToJsonSchema { return propertiesInJson; } + private void parseType(ToscaElementProperty toscaElementProperty, String propertyField, JsonObject propertiesInJson, + JsonTemplate currentPropertyJsonTemplate) { + if (currentPropertyJsonTemplate.hasFields(propertyField)) { + String fieldtype = (String) toscaElementProperty.getItems().get(propertyField); + switch (fieldtype.toLowerCase()) { + case LIST: + propertiesInJson.addProperty(TYPE, ARRAY); + break; + case MAP: + propertiesInJson.addProperty(TYPE, OBJECT); + break; + case "scalar-unit.time": + case "scalar-unit.frequency": + case "scalar-unit.size": + propertiesInJson.addProperty(TYPE, "string"); + break; + case "timestamp": + propertiesInJson.addProperty(TYPE, "string"); + propertiesInJson.addProperty(FORMAT, "date-time"); + break; + case "float": + propertiesInJson.addProperty(TYPE, "number"); + break; + case "range": + propertiesInJson.addProperty(TYPE, "integer"); + if (!checkConstraintPresence(toscaElementProperty, "greater_than") + && currentPropertyJsonTemplate.hasFields("exclusiveMinimum")) { + propertiesInJson.addProperty("exclusiveMinimum", false); + } + if (!checkConstraintPresence(toscaElementProperty, "less_than") + && currentPropertyJsonTemplate.hasFields("exclusiveMaximum")) { + propertiesInJson.addProperty("exclusiveMaximum", false); + } + break; + default: + propertiesInJson.addProperty(TYPE, currentPropertyJsonTemplate.getName()); + break; + } + } + } + + private void parseEntrySchema(ToscaElementProperty toscaElementProperty, JsonObject propertiesInJson, + JsonTemplate currentPropertyJsonTemplate) { + // Here, a way to check if entry is a component (datatype) or a simple string + if (getToscaElement(this.extractSpecificFieldFromMap(toscaElementProperty, ENTRY_SCHEMA)) != null) { + String nameComponent = this.extractSpecificFieldFromMap(toscaElementProperty, ENTRY_SCHEMA); + var child = new ToscaConverterToJsonSchema(components, templates, metadataParser, serviceModel); + var propertiesContainer = new JsonObject(); + + if (((String) toscaElementProperty.getItems().get(TYPE)).equals(MAP)) { + JsonObject componentAsProperty = child.getJsonSchemaOfToscaElement(nameComponent); + propertiesContainer.add(nameComponent, componentAsProperty); + if (currentPropertyJsonTemplate.hasFields(PROPERTIES)) { + propertiesInJson.add(PROPERTIES, propertiesContainer); + } + } else { + JsonObject componentAsItem = child.getJsonSchemaOfToscaElement(nameComponent); + if (currentPropertyJsonTemplate.hasFields(PROPERTIES)) { + propertiesInJson.add("items", componentAsItem); + propertiesInJson.addProperty(FORMAT, "tabs-top"); + } + } + } else if (toscaElementProperty.getItems().get(TYPE).equals(LIST)) { + // Native cases + var itemContainer = new JsonObject(); + String valueInEntrySchema = + this.extractSpecificFieldFromMap(toscaElementProperty, ENTRY_SCHEMA); + itemContainer.addProperty(TYPE, valueInEntrySchema); + propertiesInJson.add("items", itemContainer); + propertiesInJson.addProperty(FORMAT, "tabs-top"); + } + + // MAP Case, for now nothing + } + /** * Look for a matching Component for the name parameter, in the components list. * @@ -326,8 +335,8 @@ public class ToscaConverterToJsonSchema { */ @SuppressWarnings("unchecked") public String extractSpecificFieldFromMap(ToscaElementProperty toscaElementProperty, String fieldName) { - LinkedHashMap<String, String> entrySchemaFields = - (LinkedHashMap<String, String>) toscaElementProperty.getItems().get(fieldName); + Map<String, String> entrySchemaFields = + (Map<String, String>) toscaElementProperty.getItems().get(fieldName); return entrySchemaFields.get(TYPE); } @@ -344,8 +353,8 @@ public class ToscaConverterToJsonSchema { @SuppressWarnings("unchecked") ArrayList<Object> constraints = (ArrayList<Object>) toscaElementProperty.getItems().get(CONSTRAINTS); for (Object constraint : constraints) { - if (constraint instanceof LinkedHashMap - && ((LinkedHashMap<?, ?>) constraint).containsKey(nameConstraint)) { + if (constraint instanceof Map + && ((Map<?, ?>) constraint).containsKey(nameConstraint)) { presentConstraint = true; } } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplateManager.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplateManager.java index af7f8cc54..f9b274e26 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplateManager.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplateManager.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights + * Copyright (C) 2020, 2021 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,8 +38,8 @@ import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.loop.service.Service; public class JsonTemplateManager { - private LinkedHashMap<String, JsonTemplate> jsonSchemaTemplates; - private LinkedHashMap<String, ToscaElement> toscaElements; + private Map<String, JsonTemplate> jsonSchemaTemplates; + private Map<String, ToscaElement> toscaElements; /** * Constructor. @@ -58,19 +58,19 @@ public class JsonTemplateManager { } // GETTERS & SETTERS - public LinkedHashMap<String, ToscaElement> getToscaElements() { + public Map<String, ToscaElement> getToscaElements() { return toscaElements; } - public void setToscaElements(LinkedHashMap<String, ToscaElement> toscaElements) { + public void setToscaElements(Map<String, ToscaElement> toscaElements) { this.toscaElements = toscaElements; } - public LinkedHashMap<String, JsonTemplate> getJsonSchemaTemplates() { + public Map<String, JsonTemplate> getJsonSchemaTemplates() { return jsonSchemaTemplates; } - public void setJsonSchemaTemplates(LinkedHashMap<String, JsonTemplate> jsonSchemaTemplates) { + public void setJsonSchemaTemplates(Map<String, JsonTemplate> jsonSchemaTemplates) { this.jsonSchemaTemplates = jsonSchemaTemplates; } @@ -157,10 +157,9 @@ public class JsonTemplateManager { * @param jsonTemplates The template properties as String * @return a map */ - @SuppressWarnings("unused") - private LinkedHashMap<String, JsonTemplate> initializeTemplates(String jsonTemplates) { + private Map<String, JsonTemplate> initializeTemplates(String jsonTemplates) { - LinkedHashMap<String, JsonTemplate> generatedTemplates = new LinkedHashMap<>(); + Map<String, JsonTemplate> generatedTemplates = new LinkedHashMap<>(); JsonObject templates = JsonUtils.GSON.fromJson(jsonTemplates, JsonObject.class); for (Map.Entry<String, JsonElement> templateAsJson : templates.entrySet()) { diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java b/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java index aefe4556d..1542d9736 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java @@ -43,7 +43,6 @@ import org.onap.policy.clamp.loop.service.Service; import org.onap.policy.clamp.loop.template.LoopElementModel; import org.onap.policy.clamp.loop.template.LoopTemplate; import org.onap.policy.clamp.loop.template.LoopTemplatesRepository; -import org.onap.policy.clamp.loop.template.PolicyModelsRepository; import org.onap.policy.clamp.policy.PolicyEngineServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,9 +62,6 @@ public class CsarInstaller { private static final Logger logger = LoggerFactory.getLogger(CsarInstaller.class); @Autowired - private PolicyModelsRepository policyModelsRepository; - - @Autowired private LoopTemplatesRepository loopTemplatesRepository; @Autowired diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java b/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java index bbf33d54c..a161860ad 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java @@ -119,12 +119,12 @@ public class PdpGroupPayload { this.deploymentGroups.getGroups().stream().filter(group -> group.getName().equals(pdpGroup)).findFirst() .ifPresentOrElse(group -> group.getDeploymentSubgroups().add(newSubGroup), - () -> { - var newGroup = new DeploymentGroup(); - newGroup.setName(pdpGroup); - newGroup.setDeploymentSubgroups(new ArrayList<>(Arrays.asList(newSubGroup))); - this.deploymentGroups.getGroups().add(newGroup); - }); + () -> { + var newGroup = new DeploymentGroup(); + newGroup.setName(pdpGroup); + newGroup.setDeploymentSubgroups(new ArrayList<>(Arrays.asList(newSubGroup))); + this.deploymentGroups.getGroups().add(newGroup); + }); } /** diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java index 1d78d6ce1..165fd3fd6 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java @@ -29,7 +29,6 @@ import javax.transaction.Transactional; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.policy.clamp.clds.Application; -import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataExecutor; import org.onap.policy.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport; import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager; import org.onap.policy.clamp.clds.util.JsonUtils; @@ -55,9 +54,6 @@ public class ToscaConverterWithDictionarySupportItTestCase { @Autowired private ToscaMetadataParserWithDictionarySupport toscaMetadataParserWithDictionarySupport; - @Autowired - private ToscaMetadataExecutor toscaMetadataExecutor; - /** * This Test validates Tosca yaml with metadata tag that contains policy_model_type and acronym * parameters which defines the Tosca Policy name and its short name. diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/util/LoggingUtilsTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/util/LoggingUtilsTest.java index f3ca978e7..57837eff4 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/util/LoggingUtilsTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/util/LoggingUtilsTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * Copyright (C) 2019 Samsung. All rights reserved. +* Modifications Copyright (C) 2021 AT&T Intellectual Property. 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. @@ -22,7 +23,6 @@ package org.onap.policy.clamp.clds.util; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -38,7 +38,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java b/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java index 567cad69d..de8ec4a48 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java @@ -40,6 +40,7 @@ public class ExternalComponentStateTest { } @Test + @SuppressWarnings("unlikely-arg-type") public void equalsTest() { assertThat(state.equals(null)).isFalse(); @@ -68,7 +69,7 @@ public class ExternalComponentStateTest { public void compareToTest() { ExternalComponentState state2 = new ExternalComponentState("NOT_SENT", "The policies defined have NOT yet been created on the policy engine", 90); - assertThat(state.compareTo(state2)).isEqualTo(0); + assertThat(state).isEqualByComparingTo(state2); ExternalComponentState state3 = new ExternalComponentState("SENT", "The policies defined have NOT yet been created on the policy engine", 50); |