diff options
Diffstat (limited to 'runtime/src')
38 files changed, 559 insertions, 414 deletions
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java index ba300ac09..07c174293 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java @@ -39,7 +39,6 @@ import org.apache.catalina.connector.Connector; import org.onap.policy.clamp.clds.util.ClampVersioning; import org.onap.policy.clamp.clds.util.ResourceFileUtils; import org.onap.policy.clamp.util.PassDecoder; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -54,7 +53,6 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.core.env.Environment; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.scheduling.annotation.EnableAsync; @@ -99,9 +97,6 @@ public class Application extends SpringBootServletInitializer { @Value("${clamp.config.keyFile:classpath:/clds/aaf/org.onap.clamp.keyfile}") private String keyFile; - @Autowired - private Environment env; - @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); @@ -124,11 +119,11 @@ public class Application extends SpringBootServletInitializer { * @throws IOException IO Exception */ @Bean - public ServletRegistrationBean camelServletRegistrationBean() throws IOException { + public ServletRegistrationBean<ClampServlet> camelServletRegistrationBean() throws IOException { eelfLogger.info(ResourceFileUtils.getResourceAsString("boot-message.txt") + "(v" + ClampVersioning.getCldsVersionFromProps() + ")" + System.getProperty("line.separator") + getSslExpirationDate()); - ServletRegistrationBean registration = new ServletRegistrationBean(new ClampServlet(), "/restservices/clds/*"); + var registration = new ServletRegistrationBean<ClampServlet>(new ClampServlet(), "/restservices/clds/*"); registration.setName("CamelServlet"); return registration; } @@ -140,11 +135,11 @@ public class Application extends SpringBootServletInitializer { */ @Bean public ServletWebServerFactory getEmbeddedServletContainerFactory() { - TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); + var tomcat = new TomcatServletWebServerFactory(); if (httpRedirectedPort != null && keystoreFile != null) { // Automatically redirect to HTTPS tomcat = new TomcatEmbeddedServletContainerFactoryRedirection(); - Connector newConnector = createRedirectConnector(Integer.parseInt(springServerPort)); + var newConnector = createRedirectConnector(Integer.parseInt(springServerPort)); if (newConnector != null) { tomcat.addAdditionalTomcatConnectors(newConnector); } @@ -158,7 +153,7 @@ public class Application extends SpringBootServletInitializer { + " (Connector disabled)"); return null; } - Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); + var connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); connector.setScheme("http"); connector.setSecure(false); connector.setPort(Integer.parseInt(httpRedirectedPort)); @@ -167,10 +162,10 @@ public class Application extends SpringBootServletInitializer { } private String getSslExpirationDate() throws IOException { - StringBuilder result = new StringBuilder(" :: SSL Certificates :: "); + var result = new StringBuilder(" :: SSL Certificates :: "); try { if (keystoreFile != null) { - KeyStore keystore = KeyStore.getInstance(keyStoreType); + var keystore = KeyStore.getInstance(keyStoreType); keystore.load(ResourceFileUtils.getResourceAsStream(keystoreFile.replace("classpath:", "")), PassDecoder.decode(keyStorePass, keyFile).toCharArray()); diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java index 9b6338e00..720a3f995 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/AafConfiguration.java @@ -50,8 +50,8 @@ public class AafConfiguration { * @return FilterRegistrationBean */ @Bean - public FilterRegistrationBean cadiFilterRegistration() { - FilterRegistrationBean registration = new FilterRegistrationBean(); + public FilterRegistrationBean<Filter> cadiFilterRegistration() { + var registration = new FilterRegistrationBean<Filter>(); registration.setFilter(cadiFilter()); registration.addUrlPatterns("/restservices/clds/v1/user/*"); registration.addUrlPatterns("/restservices/clds/v2/dictionary/*"); @@ -64,4 +64,4 @@ public class AafConfiguration { registration.setOrder(0); return registration; } -}
\ No newline at end of file +} 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 5f10c0afb..0880e9b74 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 @@ -117,22 +117,22 @@ public class CamelConfiguration extends RouteBuilder { private void configureCamelHttpComponent() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException, CertificateException, IOException { - RequestConfig requestConfig = RequestConfig.custom() + var requestConfig = RequestConfig.custom() .setConnectTimeout(connectTimeout) .setConnectionRequestTimeout(connectRequestTimeout) .setSocketTimeout(socketTimeout).build(); if (trustStore != null) { - KeyStore truststore = KeyStore.getInstance(trustStoreType); + var truststore = KeyStore.getInstance(trustStoreType); truststore.load( ResourceFileUtils.getResourceAsStream(trustStore), Objects.requireNonNull(PassDecoder.decode(trustStorePass, keyFile)).toCharArray()); - TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(trustStoreAlgorithm); + var trustFactory = TrustManagerFactory.getInstance(trustStoreAlgorithm); trustFactory.init(truststore); - SSLContext sslcontext = SSLContext.getInstance("TLS"); + var sslcontext = SSLContext.getInstance("TLS"); sslcontext.init(null, trustFactory.getTrustManagers(), null); camelContext.getComponent(HTTPS, HttpComponent.class).setHttpClientConfigurer(builder -> { - SSLSocketFactory factory = new SSLSocketFactory(sslcontext, + var factory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); builder.setSSLSocketFactory(factory); builder.setConnectionManager(new BasicHttpClientConnectionManager( diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryCache.java b/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryCache.java index a69d1a353..248fdcaea 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryCache.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryCache.java @@ -53,7 +53,7 @@ public class DcaeInventoryCache { } public Set<String> getAllLoopIds() { - return this.blueprintsMap.keySet(); + return blueprintsMap.keySet(); } public Set<DcaeInventoryResponse> getAllBlueprintsPerLoopId(String loopId) { diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/UnknownComponentException.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/UnknownComponentException.java index fb684b57b..d1d45a37d 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/UnknownComponentException.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/UnknownComponentException.java @@ -24,6 +24,8 @@ package org.onap.policy.clamp.clds.tosca.update; public class UnknownComponentException extends Exception { + private static final long serialVersionUID = 1187337836071750628L; + public UnknownComponentException(String nameEntry) { this.getWrongName(nameEntry); } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/Constraint.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/Constraint.java index 651456ca6..bdf9af08b 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/Constraint.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/Constraint.java @@ -31,6 +31,8 @@ import java.util.Map.Entry; import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplate; public class Constraint { + private static final String ARRAY = "array"; + private static final String STRING = "string"; private LinkedHashMap<String, Object> constraints; private JsonTemplate jsonTemplate; @@ -43,7 +45,7 @@ public class Constraint { /** * Deploy the linkedhashmap which contains the constraints, to extract them one to one. * - * @param jsonSchema The json Schema + * @param jsonSchema The json Schema * @param typeProperty The ype property * @return the json object */ @@ -57,14 +59,14 @@ public class Constraint { /** * Each case of Tosca constraints below parse specifically the field in the JsonObject. * - * @param jsonSchema Json Schema - * @param nameConstraint Name constraint + * @param jsonSchema Json Schema + * @param nameConstraint Name constraint * @param valueConstraint value constraint - * @param typeProperty Type Property + * @param typeProperty Type Property */ @SuppressWarnings("unchecked") public void parseConstraint(JsonObject jsonSchema, String nameConstraint, Object valueConstraint, - String typeProperty) { + String typeProperty) { switch (nameConstraint) { case "equal": checkTemplateField("const", jsonSchema, valueConstraint); @@ -100,7 +102,7 @@ public class Constraint { String[] maxtab = nameConstraint.split("_"); this.getLimitValue(jsonSchema, valueConstraint, typeProperty, maxtab[0]); break; - default://valid_value + default:// valid_value this.getValueArray(jsonSchema, valueConstraint, typeProperty); break; } @@ -110,17 +112,17 @@ public class Constraint { /** * To be done. * - * @param jsonSchema json schema - * @param fieldValue field value + * @param jsonSchema json schema + * @param fieldValue field value * @param typeProperty For the complex components, get a specific number of items/properties */ public void getSpecificLength(JsonObject jsonSchema, Object fieldValue, String typeProperty) { switch (typeProperty.toLowerCase()) { - case "string": + case STRING: checkTemplateField("minLength", jsonSchema, fieldValue); checkTemplateField("maxLength", jsonSchema, fieldValue); break; - case "array": + case ARRAY: if (fieldValue.equals(1) && jsonTemplate.hasFields("uniqueItems")) { jsonSchema.addProperty("uniqueItems", true); } else { @@ -139,48 +141,46 @@ public class Constraint { /** * To be done. * - * @param jsonSchema json schema - * @param fieldValue field value + * @param jsonSchema json schema + * @param fieldValue field value * @param typeProperty type property - * @param side Get the limits fieldValue for the properties : depend of the type of the component + * @param side Get the limits fieldValue for the properties : depend of the type of the component */ public void getLimitValue(JsonObject jsonSchema, Object fieldValue, String typeProperty, String side) { - switch (typeProperty) { - case "string": - if (side.equals("min")) { - checkTemplateField("minLength", jsonSchema, fieldValue); - } else { - checkTemplateField("maxLength", jsonSchema, fieldValue); - } - break; - default:// Array - if (side.equals("min")) { - checkTemplateField("minItems", jsonSchema, fieldValue); - } else { - checkTemplateField("maxItems", jsonSchema, fieldValue); - } - break; + if (typeProperty.equals(STRING)) { + if (side.equals("min")) { + checkTemplateField("minLength", jsonSchema, fieldValue); + } else { + checkTemplateField("maxLength", jsonSchema, fieldValue); + } + } else { + if (side.equals("min")) { + checkTemplateField("minItems", jsonSchema, fieldValue); + } else { + checkTemplateField("maxItems", jsonSchema, fieldValue); + } } - } /** * To be done. * - * @param jsonSchema Json schema - * @param fieldValue field value + * @param jsonSchema Json schema + * @param fieldValue field value * @param typeProperty Get as Enum the valid values for the property */ public void getValueArray(JsonObject jsonSchema, Object fieldValue, String typeProperty) { if (jsonTemplate.hasFields("enum")) { - JsonArray enumeration = new JsonArray(); - if (typeProperty.equals("string") || typeProperty.equals("String")) { + var enumeration = new JsonArray(); + if (typeProperty.equals(STRING) || typeProperty.equals("String")) { + @SuppressWarnings("unchecked") ArrayList<String> arrayValues = (ArrayList<String>) fieldValue; for (String arrayItem : arrayValues) { enumeration.add(arrayItem); } jsonSchema.add("enum", enumeration); } else { + @SuppressWarnings("unchecked") ArrayList<Number> arrayValues = (ArrayList<Number>) fieldValue; for (Number arrayItem : arrayValues) { enumeration.add(arrayItem); @@ -193,7 +193,7 @@ public class Constraint { /** * To be done. * - * @param field Field + * @param field Field * @param jsonSchema Json schema * @param fieldValue Simple way to avoid code duplication */ @@ -219,4 +219,4 @@ public class Constraint { } } -}
\ No newline at end of file +} diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/ToscaElementProperty.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/ToscaElementProperty.java index 4db8b0356..77d920860 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/ToscaElementProperty.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/elements/ToscaElementProperty.java @@ -27,6 +27,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.List; import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplate; public class ToscaElementProperty { @@ -40,7 +41,7 @@ public class ToscaElementProperty { /** * Constructor. * - * @param name the name + * @param name the name * @param items the items */ public ToscaElementProperty(String name, LinkedHashMap<String, Object> items) { @@ -69,9 +70,10 @@ public class ToscaElementProperty { * For each primitive value, requires to get each field Value and cast it and add it in a Json. * * @param fieldsContent field - * @param fieldName field - * @param value value + * @param fieldName field + * @param value value */ + @SuppressWarnings("unchecked") public void addFieldToJson(JsonObject fieldsContent, String fieldName, Object value) { if (value != null) { String typeValue = value.getClass().getSimpleName(); @@ -89,7 +91,7 @@ public class ToscaElementProperty { fieldsContent.addProperty(fieldName, (Integer) value); break; default: - fieldsContent.add(fieldName, parseArray((ArrayList) value)); + fieldsContent.add(fieldName, parseArray((ArrayList<Object>) value)); break; } } @@ -101,31 +103,29 @@ public class ToscaElementProperty { * @param arrayProperties array pro * @return a json array */ - public JsonArray parseArray(ArrayList<Object> arrayProperties) { - JsonArray arrayContent = new JsonArray(); + public JsonArray parseArray(List<Object> arrayProperties) { ArrayList<Object> arrayComponent = new ArrayList<>(); for (Object itemArray : arrayProperties) { arrayComponent.add(itemArray); } - ArrayField af = new ArrayField(arrayComponent); - arrayContent = af.deploy(); - return arrayContent; + var af = new ArrayField(arrayComponent); + return af.deploy(); } /** * Create an instance of Constraint, to extract the values and add it to the Json (according to the type - * * of the current property). + * * of the current property). * * @param json a json * @param constraints constraints * @param jsonTemplate template */ @SuppressWarnings("unchecked") - public void addConstraintsAsJson(JsonObject json, ArrayList<Object> constraints, JsonTemplate jsonTemplate) { + public void addConstraintsAsJson(JsonObject json, List<Object> constraints, JsonTemplate jsonTemplate) { for (Object constraint : constraints) { if (constraint instanceof LinkedHashMap) { LinkedHashMap<String, Object> valueConstraint = (LinkedHashMap<String, Object>) constraint; - Constraint constraintParser = new Constraint(valueConstraint, jsonTemplate); + var constraintParser = new Constraint(valueConstraint, jsonTemplate); constraintParser.deployConstraints(json, (String) getItems().get("type")); } } 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 74fd8e5fd..1d5ed26e0 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 @@ -45,6 +45,20 @@ import org.onap.policy.clamp.loop.service.Service; * @see org.onap.policy.clamp.clds.tosca.update.parser.ToscaConverterToJsonSchema#getJsonSchemaOfToscaElement */ public class ToscaConverterToJsonSchema { + private static final String ARRAY = "array"; + private static final String CONSTRAINTS = "constraints"; + private static final String DESCRIPTION = "description"; + private static final String ENTRY_SCHEMA = "entry_schema"; + private static final String FORMAT = "format"; + private static final String LIST = "list"; + private static final String MAP = "map"; + private static final String METADATA = "metadata"; + private static final String OBJECT = "object"; + private static final String PROPERTIES = "properties"; + private static final String REQUIRED = "required"; + private static final String TITLE = "title"; + private static final String TYPE = "type"; + private LinkedHashMap<String, ToscaElement> components; private LinkedHashMap<String, JsonTemplate> templates; @@ -55,14 +69,14 @@ public class ToscaConverterToJsonSchema { /** * Constructor. * - * @param toscaElementsMap All the tosca elements found (policy type + data types + native tosca datatypes) + * @param toscaElementsMap All the tosca elements found (policy type + data types + native tosca datatypes) * @param jsonSchemaTemplates All Json schema templates to use - * @param metadataParser The metadata parser to use for metadata section - * @param serviceModel The service model for clamp enrichment + * @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, Service serviceModel) { + LinkedHashMap<String, JsonTemplate> jsonSchemaTemplates, ToscaMetadataParser metadataParser, + Service serviceModel) { this.components = toscaElementsMap; this.templates = jsonSchemaTemplates; this.metadataParser = metadataParser; @@ -87,23 +101,21 @@ public class ToscaConverterToJsonSchema { */ public JsonObject getFieldAsObject(ToscaElement toscaElement) { - JsonObject globalFields = new JsonObject(); - if (templates.get("object").hasFields("title")) { - globalFields.addProperty("title", toscaElement.getName()); + var globalFields = new JsonObject(); + if (templates.get(OBJECT).hasFields(TITLE)) { + globalFields.addProperty(TITLE, toscaElement.getName()); } - if (templates.get("object").hasFields("type")) { - globalFields.addProperty("type", "object"); + if (templates.get(OBJECT).hasFields(TYPE)) { + globalFields.addProperty(TYPE, OBJECT); } - if (templates.get("object").hasFields("description")) { - if (toscaElement.getDescription() != null) { - globalFields.addProperty("description", toscaElement.getDescription()); - } + if (templates.get(OBJECT).hasFields(DESCRIPTION) && (toscaElement.getDescription() != null)) { + globalFields.addProperty(DESCRIPTION, toscaElement.getDescription()); } - if (templates.get("object").hasFields("required")) { - globalFields.add("required", this.getRequirements(toscaElement.getName())); + if (templates.get(OBJECT).hasFields(REQUIRED)) { + globalFields.add(REQUIRED, this.getRequirements(toscaElement.getName())); } - if (templates.get("object").hasFields("properties")) { - globalFields.add("properties", this.deploy(toscaElement.getName())); + if (templates.get(OBJECT).hasFields(PROPERTIES)) { + globalFields.add(PROPERTIES, this.deploy(toscaElement.getName())); } return globalFields; } @@ -115,18 +127,18 @@ public class ToscaConverterToJsonSchema { * @return a json array */ public JsonArray getRequirements(String nameComponent) { - JsonArray requirements = new JsonArray(); + var requirements = new JsonArray(); ToscaElement toParse = components.get(nameComponent); - //Check for a father component, and launch the same process + // Check for a father component, and launch the same process if (!"tosca.datatypes.Root".equals(toParse.getDerivedFrom()) && !"tosca.policies.Root".equals(toParse.getDerivedFrom())) { requirements.addAll(getRequirements(toParse.getDerivedFrom())); } - //Each property is checked, and add to the requirement array if it's required + // Each property is checked, and add to the requirement array if it's required Collection<ToscaElementProperty> properties = toParse.getProperties().values(); for (ToscaElementProperty toscaElementProperty : properties) { - if (toscaElementProperty.getItems().containsKey("required") - && toscaElementProperty.getItems().get("required").equals(true)) { + if (toscaElementProperty.getItems().containsKey(REQUIRED) + && toscaElementProperty.getItems().get(REQUIRED).equals(true)) { requirements.add(toscaElementProperty.getName()); } } @@ -141,19 +153,19 @@ public class ToscaConverterToJsonSchema { * @return a json object */ public JsonObject deploy(String nameComponent) { - JsonObject jsonSchema = new JsonObject(); + var jsonSchema = new JsonObject(); ToscaElement toParse = components.get(nameComponent); - //Check for a father component, and launch the same process + // Check for a father component, and launch the same process if (!toParse.getDerivedFrom().equals("tosca.datatypes.Root") && !toParse.getDerivedFrom().equals("tosca.policies.Root")) { jsonSchema = this.getParent(toParse.getDerivedFrom()); } - //For each component property, check if its a complex properties (a component) or not. In that case, - //launch the analyse of the property. + // For each component property, check if its a complex properties (a component) or not. In that case, + // launch the analyse of the property. for (Entry<String, ToscaElementProperty> property : toParse.getProperties().entrySet()) { - if (getToscaElement((String) property.getValue().getItems().get("type")) != null) { + if (getToscaElement((String) property.getValue().getItems().get(TYPE)) != null) { jsonSchema.add(property.getValue().getName(), - this.getJsonSchemaOfToscaElement((String) property.getValue().getItems().get("type"))); + this.getJsonSchemaOfToscaElement((String) property.getValue().getItems().get(TYPE))); } else { jsonSchema.add(property.getValue().getName(), this.complexParse(property.getValue())); } @@ -179,42 +191,42 @@ public class ToscaConverterToJsonSchema { */ @SuppressWarnings("unchecked") public JsonObject complexParse(ToscaElementProperty toscaElementProperty) { - JsonObject propertiesInJson = new JsonObject(); + var propertiesInJson = new JsonObject(); JsonTemplate currentPropertyJsonTemplate; - String typeProperty = (String) toscaElementProperty.getItems().get("type"); - if (typeProperty.toLowerCase().equals("list") || typeProperty.toLowerCase().equals("map")) { - currentPropertyJsonTemplate = templates.get("object"); + String typeProperty = (String) toscaElementProperty.getItems().get(TYPE); + if (LIST.equalsIgnoreCase(typeProperty) || MAP.equalsIgnoreCase(typeProperty)) { + currentPropertyJsonTemplate = templates.get(OBJECT); } else { - String propertyType = (String) toscaElementProperty.getItems().get("type"); + String propertyType = (String) toscaElementProperty.getItems().get(TYPE); currentPropertyJsonTemplate = templates.get(propertyType.toLowerCase()); } - //Each "special" field is analysed, and has a specific treatment + // Each "special" field is analysed, and has a specific treatment for (String propertyField : toscaElementProperty.getItems().keySet()) { switch (propertyField) { - case "type": + case TYPE: if (currentPropertyJsonTemplate.hasFields(propertyField)) { String fieldtype = (String) toscaElementProperty.getItems().get(propertyField); switch (fieldtype.toLowerCase()) { - case "list": - propertiesInJson.addProperty("type", "array"); + case LIST: + propertiesInJson.addProperty(TYPE, ARRAY); break; - case "map": - propertiesInJson.addProperty("type", "object"); + case MAP: + propertiesInJson.addProperty(TYPE, OBJECT); break; case "scalar-unit.time": case "scalar-unit.frequency": case "scalar-unit.size": - propertiesInJson.addProperty("type", "string"); + propertiesInJson.addProperty(TYPE, "string"); break; case "timestamp": - propertiesInJson.addProperty("type", "string"); - propertiesInJson.addProperty("format", "date-time"); + propertiesInJson.addProperty(TYPE, "string"); + propertiesInJson.addProperty(FORMAT, "date-time"); break; case "float": - propertiesInJson.addProperty("type", "number"); + propertiesInJson.addProperty(TYPE, "number"); break; case "range": - propertiesInJson.addProperty("type", "integer"); + propertiesInJson.addProperty(TYPE, "integer"); if (!checkConstraintPresence(toscaElementProperty, "greater_than") && currentPropertyJsonTemplate.hasFields("exclusiveMinimum")) { propertiesInJson.addProperty("exclusiveMinimum", false); @@ -225,68 +237,58 @@ public class ToscaConverterToJsonSchema { } break; default: - propertiesInJson.addProperty("type", currentPropertyJsonTemplate.getName()); + propertiesInJson.addProperty(TYPE, currentPropertyJsonTemplate.getName()); break; } } break; - case "metadata": + case METADATA: if (metadataParser != null) { metadataParser.processAllMetadataElement(toscaElementProperty, serviceModel).entrySet() - .forEach((jsonEntry) -> { - propertiesInJson.add(jsonEntry.getKey(), - jsonEntry.getValue()); - - }); + .forEach(jsonEntry -> propertiesInJson.add(jsonEntry.getKey(), jsonEntry.getValue())); } break; - case "constraints": + case CONSTRAINTS: toscaElementProperty.addConstraintsAsJson(propertiesInJson, - (ArrayList<Object>) toscaElementProperty.getItems().get("constraints"), + (ArrayList<Object>) toscaElementProperty.getItems().get(CONSTRAINTS), 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"); - ToscaConverterToJsonSchema child = new ToscaConverterToJsonSchema(components, templates, - metadataParser, serviceModel); - JsonObject propertiesContainer = new JsonObject(); + 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(); - switch ((String) toscaElementProperty.getItems().get("type")) { - case "map": // Get it as an object - JsonObject componentAsProperty = child.getJsonSchemaOfToscaElement(nameComponent); - propertiesContainer.add(nameComponent, componentAsProperty); - if (currentPropertyJsonTemplate.hasFields("properties")) { - propertiesInJson.add("properties", propertiesContainer); - } - break; - default://list : get it as an Array - JsonObject componentAsItem = child.getJsonSchemaOfToscaElement(nameComponent); - if (currentPropertyJsonTemplate.hasFields("properties")) { - propertiesInJson.add("items", componentAsItem); - propertiesInJson.addProperty("format", "tabs-top"); - } - break; + 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")) { + } else if (toscaElementProperty.getItems().get(TYPE).equals(LIST)) { // Native cases - JsonObject itemContainer = new JsonObject(); + var itemContainer = new JsonObject(); String valueInEntrySchema = - this.extractSpecificFieldFromMap(toscaElementProperty, "entry_schema"); - itemContainer.addProperty("type", valueInEntrySchema); + this.extractSpecificFieldFromMap(toscaElementProperty, ENTRY_SCHEMA); + itemContainer.addProperty(TYPE, valueInEntrySchema); propertiesInJson.add("items", itemContainer); - propertiesInJson.addProperty("format", "tabs-top"); + propertiesInJson.addProperty(FORMAT, "tabs-top"); } // MAP Case, for now nothing break; default: - //Each classical field : type, description, default.. - if (currentPropertyJsonTemplate.hasFields(propertyField) && !propertyField.equals("required")) { + // Each classical field : type, description, default.. + if (currentPropertyJsonTemplate.hasFields(propertyField) && !propertyField.equals(REQUIRED)) { toscaElementProperty.addFieldToJson(propertiesInJson, propertyField, toscaElementProperty.getItems().get(propertyField)); } @@ -319,32 +321,32 @@ public class ToscaConverterToJsonSchema { * Simple method to extract quickly a type field from particular property item. * * @param toscaElementProperty the property - * @param fieldName the fieldname + * @param fieldName the fieldname * @return a string */ @SuppressWarnings("unchecked") public String extractSpecificFieldFromMap(ToscaElementProperty toscaElementProperty, String fieldName) { LinkedHashMap<String, String> entrySchemaFields = (LinkedHashMap<String, String>) toscaElementProperty.getItems().get(fieldName); - return entrySchemaFields.get("type"); + return entrySchemaFields.get(TYPE); } /** * Check if a constraint, for a specific property, is there. * * @param toscaElementProperty property - * @param nameConstraint name constraint + * @param nameConstraint name constraint * @return a flag boolean */ public boolean checkConstraintPresence(ToscaElementProperty toscaElementProperty, String nameConstraint) { - boolean presentConstraint = false; - if (toscaElementProperty.getItems().containsKey("constraints")) { - ArrayList<Object> constraints = (ArrayList) toscaElementProperty.getItems().get("constraints"); + var presentConstraint = false; + if (toscaElementProperty.getItems().containsKey(CONSTRAINTS)) { + @SuppressWarnings("unchecked") + ArrayList<Object> constraints = (ArrayList<Object>) toscaElementProperty.getItems().get(CONSTRAINTS); for (Object constraint : constraints) { - if (constraint instanceof LinkedHashMap) { - if (((LinkedHashMap) constraint).containsKey(nameConstraint)) { - presentConstraint = true; - } + if (constraint instanceof LinkedHashMap + && ((LinkedHashMap<?, ?>) constraint).containsKey(nameConstraint)) { + presentConstraint = true; } } } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaElementParser.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaElementParser.java index a3dd9c3e1..04d577f86 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaElementParser.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaElementParser.java @@ -30,6 +30,11 @@ import org.onap.policy.clamp.clds.tosca.update.elements.ToscaElementProperty; import org.yaml.snakeyaml.Yaml; public class ToscaElementParser { + private static final String DERIVED_FROM = "derived_from"; + private static final String DESCRIPTION = "description"; + private static final String PROPERTIES = "properties"; + private static final String TYPE_VERSION = "type_version"; + /** * Constructor. */ @@ -37,17 +42,19 @@ public class ToscaElementParser { } private static LinkedHashMap<String, Object> searchAllDataTypesAndPolicyTypes(String toscaYaml) { + @SuppressWarnings("unchecked") LinkedHashMap<String, LinkedHashMap<String, Object>> file = (LinkedHashMap<String, LinkedHashMap<String, Object>>) new Yaml().load(toscaYaml); LinkedHashMap<String, Object> allDataTypesFound = file.get("data_types"); LinkedHashMap<String, Object> allPolicyTypesFound = file.get("policy_types"); - LinkedHashMap<String, Object> allItemsFound = new LinkedHashMap<>(); + LinkedHashMap<String, Object> allItemsFound; // Put the policies and datatypes in the same collection allItemsFound = (allDataTypesFound == null) ? (new LinkedHashMap<>()) : allDataTypesFound; allItemsFound.putAll(allPolicyTypesFound == null ? new LinkedHashMap<>() : allPolicyTypesFound); return allItemsFound; } + @SuppressWarnings("unchecked") private static LinkedHashMap<String, Object> searchAllNativeToscaDataTypes(String toscaNativeYaml) { return ((LinkedHashMap<String, LinkedHashMap<String, Object>>) new Yaml().load(toscaNativeYaml)) .get("data_types"); @@ -57,12 +64,11 @@ public class ToscaElementParser { * Yaml Parse gets raw policies and datatypes, in different sections : necessary to extract * all entities and put them at the same level. * - * @param toscaYaml the tosca model content + * @param toscaYaml the tosca model content * @param nativeToscaYaml the tosca native datatype content * @return a map of Tosca Element containing all tosca elements found (policy types and datatypes) */ - public static LinkedHashMap<String, ToscaElement> searchAllToscaElements(String toscaYaml, - String nativeToscaYaml) { + public static LinkedHashMap<String, ToscaElement> searchAllToscaElements(String toscaYaml, String nativeToscaYaml) { LinkedHashMap<String, Object> allItemsFound = searchAllDataTypesAndPolicyTypes(toscaYaml); allItemsFound.putAll(searchAllNativeToscaDataTypes(nativeToscaYaml)); return parseAllItemsFound(allItemsFound); @@ -73,25 +79,25 @@ public class ToscaElementParser { * * @param allMaps maps */ + @SuppressWarnings("unchecked") private static LinkedHashMap<String, ToscaElement> parseAllItemsFound(LinkedHashMap<String, Object> allMaps) { - LinkedHashMap<String, ToscaElement> allItemsFound = new LinkedHashMap<String, ToscaElement>(); - //Component creations, from the file maps + LinkedHashMap<String, ToscaElement> allItemsFound = new LinkedHashMap<>(); + // Component creations, from the file maps for (Entry<String, Object> itemToParse : allMaps.entrySet()) { LinkedHashMap<String, Object> componentBody = (LinkedHashMap<String, Object>) itemToParse.getValue(); - ToscaElement toscaElement = - new ToscaElement(itemToParse.getKey(), (String) componentBody.get("derived_from"), - (String) componentBody.get("description")); - //If policy, version and type_version : - if (componentBody.get("type_version") != null) { - toscaElement.setVersion((String) componentBody.get("type_version")); - toscaElement.setTypeVersion((String) componentBody.get("type_version")); + var toscaElement = new ToscaElement(itemToParse.getKey(), (String) componentBody.get(DERIVED_FROM), + (String) componentBody.get(DESCRIPTION)); + // If policy, version and type_version : + if (componentBody.get(TYPE_VERSION) != null) { + toscaElement.setVersion((String) componentBody.get(TYPE_VERSION)); + toscaElement.setTypeVersion((String) componentBody.get(TYPE_VERSION)); } - //Properties creation, from the map - if (componentBody.get("properties") != null) { - LinkedHashMap<String, Object> properties = - (LinkedHashMap<String, Object>) componentBody.get("properties"); - for (Entry<String, Object> itemToProperty : properties.entrySet()) { - ToscaElementProperty toscaElementProperty = new ToscaElementProperty(itemToProperty.getKey(), + // Properties creation, from the map + if (componentBody.get(PROPERTIES) != null) { + LinkedHashMap<String, Object> foundProperties = + (LinkedHashMap<String, Object>) componentBody.get(PROPERTIES); + for (Entry<String, Object> itemToProperty : foundProperties.entrySet()) { + var toscaElementProperty = new ToscaElementProperty(itemToProperty.getKey(), (LinkedHashMap<String, Object>) itemToProperty.getValue()); toscaElement.addProperties(toscaElementProperty); } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParserWithDictionarySupport.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParserWithDictionarySupport.java index 4e55263fb..2a886df3c 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParserWithDictionarySupport.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/metadata/ToscaMetadataParserWithDictionarySupport.java @@ -63,10 +63,11 @@ public class ToscaMetadataParserWithDictionarySupport implements ToscaMetadataPa } } + @SuppressWarnings("unchecked") private static JsonObject parseMetadataPossibleValues(LinkedHashMap<String, Object> childNodeMap, DictionaryService dictionaryService, Service serviceModel, ToscaMetadataExecutor toscaMetadataExecutor) { - JsonObject childObject = new JsonObject(); + var childObject = new JsonObject(); if (childNodeMap.containsKey(ToscaSchemaConstants.METADATA) && childNodeMap.get(ToscaSchemaConstants.METADATA) != null) { ((LinkedHashMap<String, Object>) childNodeMap.get(ToscaSchemaConstants.METADATA)).forEach((key, @@ -108,14 +109,14 @@ public class ToscaMetadataParserWithDictionarySupport implements ToscaMetadataPa if (dictionaryKeyArray.length == 2) { dictionaryElements = new ArrayList<>(dictionaryService.getDictionary(dictionaryKeyArray[0]) .getDictionaryElements()); - JsonArray subDictionaryNames = new JsonArray(); + var subDictionaryNames = new JsonArray(); new ArrayList<DictionaryElement>(dictionaryService.getDictionary(dictionaryKeyArray[1]) .getDictionaryElements()).forEach(elem -> subDictionaryNames.add(elem.getShortName())); - JsonArray jsonArray = new JsonArray(); + var jsonArray = new JsonArray(); Optional.of(dictionaryElements).get().forEach(c -> { - JsonObject jsonObject = new JsonObject(); + var jsonObject = new JsonObject(); jsonObject.addProperty(JsonEditorSchemaConstants.TYPE, getJsonType(c.getType())); if (c.getType() != null && c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) { @@ -128,7 +129,7 @@ public class ToscaMetadataParserWithDictionarySupport implements ToscaMetadataPa jsonArray.add(jsonObject); }); - JsonObject filterObject = new JsonObject(); + var filterObject = new JsonObject(); filterObject.add(JsonEditorSchemaConstants.FILTERS, jsonArray); childObject.addProperty(JsonEditorSchemaConstants.TYPE, @@ -149,8 +150,8 @@ public class ToscaMetadataParserWithDictionarySupport implements ToscaMetadataPa */ private static void processSimpleDictionaryElements(String[] dictionaryKeyArray, JsonObject childObject, DictionaryService dictionaryService) { - JsonArray dictionaryNames = new JsonArray(); - JsonArray dictionaryFullNames = new JsonArray(); + var dictionaryNames = new JsonArray(); + var dictionaryFullNames = new JsonArray(); dictionaryService.getDictionary(dictionaryKeyArray[0]).getDictionaryElements().forEach(c -> { // Json type will be translated before Policy creation if (c.getType() != null && !c.getType().equalsIgnoreCase("json")) { @@ -167,7 +168,7 @@ public class ToscaMetadataParserWithDictionarySupport implements ToscaMetadataPa } // Add Enum titles for generated translated values during JSON instance // generation - JsonObject enumTitles = new JsonObject(); + var enumTitles = new JsonObject(); enumTitles.add(JsonEditorSchemaConstants.ENUM_TITLES, dictionaryNames); if (childObject.get(JsonEditorSchemaConstants.OPTIONS) != null) { childObject.get(JsonEditorSchemaConstants.OPTIONS).getAsJsonArray().add(enumTitles); 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 1813d0786..af7f8cc54 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 @@ -44,9 +44,9 @@ public class JsonTemplateManager { /** * Constructor. * - * @param toscaYamlContent Policy Tosca Yaml content as string + * @param toscaYamlContent Policy Tosca Yaml content as string * @param nativeToscaDatatypes The tosca yaml with tosca native datatypes - * @param jsonSchemaTemplates template properties as string + * @param jsonSchemaTemplates template properties as string */ public JsonTemplateManager(String toscaYamlContent, String nativeToscaDatatypes, String jsonSchemaTemplates) { if (toscaYamlContent != null && !toscaYamlContent.isEmpty()) { @@ -57,7 +57,7 @@ public class JsonTemplateManager { } } - //GETTERS & SETTERS + // GETTERS & SETTERS public LinkedHashMap<String, ToscaElement> getToscaElements() { return toscaElements; } @@ -77,12 +77,12 @@ public class JsonTemplateManager { /** * Add a template. * - * @param name name + * @param name name * @param jsonTemplateFields fields */ public void addTemplate(String name, List<JsonTemplateField> jsonTemplateFields) { - JsonTemplate jsonTemplate = new JsonTemplate(name, jsonTemplateFields); - //If it is true, the operation does not have any interest : + var jsonTemplate = new JsonTemplate(name, jsonTemplateFields); + // If it is true, the operation does not have any interest : // replace OR put two different object with the same body if (!jsonSchemaTemplates.containsKey(jsonTemplate.getName()) || !this.hasTemplate(jsonTemplate)) { this.jsonSchemaTemplates.put(jsonTemplate.getName(), jsonTemplate); @@ -101,11 +101,11 @@ public class JsonTemplateManager { /** * Update Template : adding with true flag, removing with false. * - * @param nameTemplate name template + * @param nameTemplate name template * @param jsonTemplateField field name - * @param operation operation + * @param operation operation */ - public void updateTemplate(String nameTemplate, JsonTemplateField jsonTemplateField, Boolean operation) { + public void updateTemplate(String nameTemplate, JsonTemplateField jsonTemplateField, boolean operation) { // Operation = true && field is not present => add Field if (operation && !this.jsonSchemaTemplates.get(nameTemplate).getJsonTemplateFields().contains(jsonTemplateField)) { @@ -124,10 +124,10 @@ public class JsonTemplateManager { * @return a boolean */ public boolean hasTemplate(JsonTemplate jsonTemplate) { - boolean duplicateTemplate = false; + var duplicateTemplate = false; Collection<String> templatesName = jsonSchemaTemplates.keySet(); if (templatesName.contains(jsonTemplate.getName())) { - JsonTemplate existingJsonTemplate = jsonSchemaTemplates.get(jsonTemplate.getName()); + var existingJsonTemplate = jsonSchemaTemplates.get(jsonTemplate.getName()); duplicateTemplate = existingJsonTemplate.checkFields(jsonTemplate); } return duplicateTemplate; @@ -136,17 +136,15 @@ public class JsonTemplateManager { /** * For a given policy type, get a corresponding JsonObject from the tosca model. * - * @param policyType The policy type in the tosca + * @param policyType The policy type in the tosca * @param toscaMetadataParser The MetadataParser class that must be used if metadata section are encountered, - * if null they will be skipped + * if null they will be skipped * @return an json object defining the equivalent json schema from the tosca for a given policy type */ public JsonObject getJsonSchemaForPolicyType(String policyType, ToscaMetadataParser toscaMetadataParser, - Service serviceModel) - throws UnknownComponentException { - ToscaConverterToJsonSchema - toscaConverterToJsonSchema = new ToscaConverterToJsonSchema(toscaElements, jsonSchemaTemplates, - toscaMetadataParser, serviceModel); + Service serviceModel) throws UnknownComponentException { + var toscaConverterToJsonSchema = + new ToscaConverterToJsonSchema(toscaElements, jsonSchemaTemplates, toscaMetadataParser, serviceModel); if (toscaConverterToJsonSchema.getToscaElement(policyType) == null) { throw new UnknownComponentException(policyType); } @@ -166,7 +164,7 @@ public class JsonTemplateManager { JsonObject templates = JsonUtils.GSON.fromJson(jsonTemplates, JsonObject.class); for (Map.Entry<String, JsonElement> templateAsJson : templates.entrySet()) { - JsonTemplate jsonTemplate = new JsonTemplate(templateAsJson.getKey()); + var jsonTemplate = new JsonTemplate(templateAsJson.getKey()); JsonObject templateBody = (JsonObject) templateAsJson.getValue(); for (Map.Entry<String, JsonElement> field : templateBody.entrySet()) { String fieldName = field.getKey(); @@ -174,12 +172,11 @@ public class JsonTemplateManager { Object fieldValue = bodyFieldAsJson.get("defaultValue").getAsString(); Boolean fieldVisible = bodyFieldAsJson.get("visible").getAsBoolean(); Boolean fieldStatic = bodyFieldAsJson.get("static").getAsBoolean(); - JsonTemplateField - bodyJsonTemplateField = new JsonTemplateField(fieldName, fieldValue, fieldVisible, fieldStatic); + var bodyJsonTemplateField = new JsonTemplateField(fieldName, fieldValue, fieldVisible, fieldStatic); jsonTemplate.getJsonTemplateFields().add(bodyJsonTemplateField); } generatedTemplates.put(jsonTemplate.getName(), jsonTemplate); } return generatedTemplates; } -}
\ No newline at end of file +} diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/util/ResourceFileUtils.java b/runtime/src/main/java/org/onap/policy/clamp/clds/util/ResourceFileUtils.java index d6184c656..ab33984da 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/util/ResourceFileUtils.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/util/ResourceFileUtils.java @@ -81,9 +81,9 @@ public final class ResourceFileUtils { } private static String streamToString(InputStream inputStream) { - try (Scanner scanner = new Scanner(inputStream)) { - Scanner delimitedScanner = scanner.useDelimiter("\\A"); + try (var scanner = new Scanner(inputStream)) { + var delimitedScanner = scanner.useDelimiter("\\A"); return delimitedScanner.hasNext() ? delimitedScanner.next() : ""; } } -}
\ No newline at end of file +} diff --git a/runtime/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java b/runtime/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java index 6479cf767..5cb5e143f 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java +++ b/runtime/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java @@ -96,7 +96,7 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D @Override public void marshal(final Exchange exchange, final Object graph, final OutputStream stream) throws Exception { - try (final OutputStreamWriter osw = new OutputStreamWriter(stream, StandardCharsets.UTF_8); + try (final var osw = new OutputStreamWriter(stream, StandardCharsets.UTF_8); final BufferedWriter writer = IOHelper.buffered(osw)) { gson.toJson(graph, writer); } @@ -112,7 +112,7 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D @Override public Object unmarshal(final Exchange exchange, final InputStream stream) throws Exception { - try (final InputStreamReader isr = new InputStreamReader(stream, StandardCharsets.UTF_8); + try (final var isr = new InputStreamReader(stream, StandardCharsets.UTF_8); final BufferedReader reader = IOHelper.buffered(isr)) { if (unmarshalType.equals(String.class)) { return IOUtils.toString(reader); diff --git a/runtime/src/main/java/org/onap/policy/clamp/dao/model/jsontype/JsonTypeDescriptor.java b/runtime/src/main/java/org/onap/policy/clamp/dao/model/jsontype/JsonTypeDescriptor.java index ed8464b14..ddc39599c 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/dao/model/jsontype/JsonTypeDescriptor.java +++ b/runtime/src/main/java/org/onap/policy/clamp/dao/model/jsontype/JsonTypeDescriptor.java @@ -73,6 +73,7 @@ public class JsonTypeDescriptor extends AbstractTypeDescriptor<JsonObject> { return JsonUtils.GSON_JPA_MODEL.fromJson(string, JsonObject.class); } + @SuppressWarnings("unchecked") @Override public <X> X unwrap(JsonObject value, Class<X> type, WrapperOptions options) { if (value == null) { @@ -95,7 +96,7 @@ public class JsonTypeDescriptor extends AbstractTypeDescriptor<JsonObject> { return null; } - if (String.class.isInstance(value)) { + if (value instanceof String) { return JsonUtils.GSON_JPA_MODEL.fromJson((String) value, JsonObject.class); } 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 f46f4227b..2da1c0553 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 @@ -45,7 +45,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.PolicyModel; import org.onap.policy.clamp.loop.template.PolicyModelsRepository; import org.onap.policy.clamp.policy.PolicyEngineServices; import org.springframework.beans.factory.annotation.Autowired; @@ -95,11 +94,11 @@ public class CsarInstaller { boolean alreadyInstalled = csarServiceInstaller.isServiceAlreadyDeployed(csar); for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) { - alreadyInstalled = alreadyInstalled - && loopTemplatesRepository.existsById(LoopTemplate.generateLoopTemplateName( - csar.getSdcNotification().getServiceName(), csar.getSdcNotification().getServiceVersion(), - blueprint.getValue().getResourceAttached().getResourceInstanceName(), - blueprint.getValue().getBlueprintArtifactName())); + alreadyInstalled = + alreadyInstalled && loopTemplatesRepository.existsById(LoopTemplate.generateLoopTemplateName( + csar.getSdcNotification().getServiceName(), csar.getSdcNotification().getServiceVersion(), + blueprint.getValue().getResourceAttached().getResourceInstanceName(), + blueprint.getValue().getBlueprintArtifactName())); } return alreadyInstalled; } @@ -109,14 +108,14 @@ public class CsarInstaller { * * @param csar The Csar Handler * @throws SdcArtifactInstallerException The SdcArtifactInstallerException - * @throws InterruptedException The InterruptedException - * @throws BlueprintParserException In case of issues with the blueprint - * parsing + * @throws InterruptedException The InterruptedException + * @throws BlueprintParserException In case of issues with the blueprint + * parsing */ public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException, InterruptedException, BlueprintParserException { logger.info("Installing the CSAR " + csar.getFilePath()); - Service associatedService = csarServiceInstaller.installTheService(csar); + var associatedService = csarServiceInstaller.installTheService(csar); cdsDataInstaller.installCdsServiceProperties(csar, associatedService); installTheLoopTemplates(csar, associatedService); @@ -126,12 +125,12 @@ public class CsarInstaller { /** * Install the loop templates from the csar. * - * @param csar The Csar Handler + * @param csar The Csar Handler * @param service The service object that is related to the loop * @throws SdcArtifactInstallerException The SdcArtifactInstallerException - * @throws InterruptedException The InterruptedException - * @throws BlueprintParserException In case of issues with the blueprint - * parsing + * @throws InterruptedException The InterruptedException + * @throws BlueprintParserException In case of issues with the blueprint + * parsing */ public void installTheLoopTemplates(CsarHandler csar, Service service) throws SdcArtifactInstallerException, InterruptedException, BlueprintParserException { @@ -150,10 +149,9 @@ public class CsarInstaller { } private LoopTemplate createLoopTemplateFromBlueprint(CsarHandler csar, BlueprintArtifact blueprintArtifact, - Service service) - throws IOException, ParseException, InterruptedException, BlueprintParserException, + Service service) throws IOException, ParseException, InterruptedException, BlueprintParserException, SdcArtifactInstallerException { - LoopTemplate newLoopTemplate = new LoopTemplate(); + var newLoopTemplate = new LoopTemplate(); newLoopTemplate.setBlueprint(blueprintArtifact.getDcaeBlueprint()); newLoopTemplate.setName(LoopTemplate.generateLoopTemplateName(csar.getSdcNotification().getServiceName(), csar.getSdcNotification().getServiceVersion(), @@ -173,22 +171,19 @@ public class CsarInstaller { } private HashSet<LoopElementModel> createMicroServiceModels(BlueprintArtifact blueprintArtifact, - List<BlueprintMicroService> microServicesChain) - throws SdcArtifactInstallerException { + List<BlueprintMicroService> microServicesChain) throws SdcArtifactInstallerException { HashSet<LoopElementModel> newSet = new HashSet<>(); for (BlueprintMicroService microService : microServicesChain) { - LoopElementModel loopElementModel = - new LoopElementModel(microService.getModelType(), LoopElementModel.MICRO_SERVICE_TYPE, - null); + var loopElementModel = + new LoopElementModel(microService.getModelType(), LoopElementModel.MICRO_SERVICE_TYPE, null); newSet.add(loopElementModel); - PolicyModel newPolicyModel = policyEngineServices.createPolicyModelFromPolicyEngine(microService); + var newPolicyModel = policyEngineServices.createPolicyModelFromPolicyEngine(microService); if (newPolicyModel != null) { loopElementModel.addPolicyModel(newPolicyModel); } else { - throw new SdcArtifactInstallerException( - "Unable to find the policy specified in the blueprint " + blueprintArtifact - .getBlueprintArtifactName() + ") on the Policy Engine:" - + microService.getModelType() + "/" + microService.getModelVersion()); + throw new SdcArtifactInstallerException("Unable to find the policy specified in the blueprint " + + blueprintArtifact.getBlueprintArtifactName() + ") on the Policy Engine:" + + microService.getModelType() + "/" + microService.getModelVersion()); } } return newSet; diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java b/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java index 6a935d011..e6c05ddd9 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java @@ -43,6 +43,10 @@ import org.onap.policy.clamp.loop.Loop; import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; public class DcaeComponent extends ExternalComponent { + private static final String INSTALL = "install"; + private static final String PROCESSING = "processing"; + private static final String SUCCEEDED = "succeeded"; + private static final String UNINSTALL = "uninstall"; @Transient private static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeComponent.class); @@ -136,12 +140,12 @@ public class DcaeComponent extends ExternalComponent { */ public static String getDeployPayload(Loop loop) { JsonObject globalProp = loop.getGlobalPropertiesJson(); - JsonObject deploymentProp = globalProp.getAsJsonObject(DEPLOYMENT_PARAMETER).getAsJsonObject( + var deploymentProp = globalProp.getAsJsonObject(DEPLOYMENT_PARAMETER).getAsJsonObject( UNIQUE_BLUEPRINT_PARAMETERS); String serviceTypeId = loop.getLoopTemplate().getDcaeBlueprintId(); - JsonObject rootObject = new JsonObject(); + var rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, serviceTypeId); if (deploymentProp != null) { rootObject.add(DCAE_INPUTS, deploymentProp); @@ -159,12 +163,12 @@ public class DcaeComponent extends ExternalComponent { */ public static String getDeployPayload(Loop loop, MicroServicePolicy microServicePolicy) { JsonObject globalProp = loop.getGlobalPropertiesJson(); - JsonObject deploymentProp = + var deploymentProp = globalProp.getAsJsonObject(DEPLOYMENT_PARAMETER).getAsJsonObject(microServicePolicy.getName()); String serviceTypeId = microServicePolicy.getDcaeBlueprintId(); - JsonObject rootObject = new JsonObject(); + var rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, serviceTypeId); if (deploymentProp != null) { rootObject.add(DCAE_INPUTS, deploymentProp); @@ -180,7 +184,7 @@ public class DcaeComponent extends ExternalComponent { * @return The payload in string (json) */ public static String getUndeployPayload(Loop loop) { - JsonObject rootObject = new JsonObject(); + var rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, loop.getLoopTemplate().getDcaeBlueprintId()); logger.info("DCAE Undeploy payload for unique blueprint: " + rootObject.toString()); return rootObject.toString(); @@ -193,7 +197,7 @@ public class DcaeComponent extends ExternalComponent { * @return The payload in string (json) */ public static String getUndeployPayload(MicroServicePolicy policy) { - JsonObject rootObject = new JsonObject(); + var rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, policy.getDcaeBlueprintId()); logger.info("DCAE Undeploy payload for multiple blueprints: " + rootObject.toString()); return rootObject.toString(); @@ -208,26 +212,26 @@ public class DcaeComponent extends ExternalComponent { if (dcaeResponse == null) { setState(BLUEPRINT_DEPLOYED); } else { - if (dcaeResponse.getOperationType().equals("install") && dcaeResponse.getStatus().equals("succeeded")) { + if (dcaeResponse.getOperationType().equals(INSTALL) && dcaeResponse.getStatus().equals(SUCCEEDED)) { setState(MICROSERVICE_INSTALLED_SUCCESSFULLY); } else { - if (dcaeResponse.getOperationType().equals("install") && dcaeResponse.getStatus() - .equals("processing")) { + if (dcaeResponse.getOperationType().equals(INSTALL) && dcaeResponse.getStatus() + .equals(PROCESSING)) { setState(PROCESSING_MICROSERVICE_INSTALLATION); } else { - if (dcaeResponse.getOperationType().equals("install") && dcaeResponse.getStatus() + if (dcaeResponse.getOperationType().equals(INSTALL) && dcaeResponse.getStatus() .equals("failed")) { setState(MICROSERVICE_INSTALLATION_FAILED); } else { - if (dcaeResponse.getOperationType().equals("uninstall") - && dcaeResponse.getStatus().equals("succeeded")) { + if (dcaeResponse.getOperationType().equals(UNINSTALL) + && dcaeResponse.getStatus().equals(SUCCEEDED)) { setState(MICROSERVICE_UNINSTALLED_SUCCESSFULLY); } else { - if (dcaeResponse.getOperationType().equals("uninstall") - && dcaeResponse.getStatus().equals("processing")) { + if (dcaeResponse.getOperationType().equals(UNINSTALL) + && dcaeResponse.getStatus().equals(PROCESSING)) { setState(PROCESSING_MICROSERVICE_UNINSTALLATION); } else { - if (dcaeResponse.getOperationType().equals("uninstall") && dcaeResponse.getStatus() + if (dcaeResponse.getOperationType().equals(UNINSTALL) && dcaeResponse.getStatus() .equals("failed")) { setState(MICROSERVICE_UNINSTALLATION_FAILED); } else { @@ -251,10 +255,10 @@ public class DcaeComponent extends ExternalComponent { */ public static List<DcaeInventoryResponse> convertToDcaeInventoryResponse(String responseBody) throws ParseException { - JSONParser parser = new JSONParser(); + var parser = new JSONParser(); JSONObject jsonObj = (JSONObject) parser.parse(responseBody); JSONArray itemsArray = (JSONArray) jsonObj.get("items"); - Iterator it = itemsArray.iterator(); + Iterator<?> it = itemsArray.iterator(); List<DcaeInventoryResponse> inventoryResponseList = new LinkedList<>(); while (it.hasNext()) { JSONObject item = (JSONObject) it.next(); diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/deploy/DcaeDeployParameters.java b/runtime/src/main/java/org/onap/policy/clamp/loop/deploy/DcaeDeployParameters.java index 1a1414611..d4b80e509 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/deploy/DcaeDeployParameters.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/deploy/DcaeDeployParameters.java @@ -27,6 +27,8 @@ import com.google.gson.JsonObject; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.loop.Loop; import org.onap.policy.clamp.loop.components.external.DcaeComponent; @@ -36,8 +38,8 @@ import org.yaml.snakeyaml.Yaml; /** * To decode the bluprint input parameters. */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public class DcaeDeployParameters { - private static LinkedHashMap<String, JsonObject> init(Loop loop) { LinkedHashMap<String, JsonObject> deploymentParamMap = new LinkedHashMap<>(); Set<MicroServicePolicy> microServiceList = loop.getMicroServicePolicies(); @@ -54,9 +56,10 @@ public class DcaeDeployParameters { microService.getName()); } + @SuppressWarnings("unchecked") private static JsonObject generateDcaeDeployParameter(String blueprint, String policyId) { - JsonObject deployJsonBody = new JsonObject(); - Yaml yaml = new Yaml(); + var deployJsonBody = new JsonObject(); + var yaml = new Yaml(); Map<String, Object> inputsNodes = ((Map<String, Object>) ((Map<String, Object>) yaml .load(blueprint)).get("inputs")); inputsNodes.entrySet().stream().filter(e -> !e.getKey().contains("policy_id")).forEach(elem -> { @@ -91,8 +94,8 @@ public class DcaeDeployParameters { * @return The deploymentParameters in Json */ public static JsonObject getDcaeDeploymentParametersInJson(Loop loop) { - JsonObject globalProperties = new JsonObject(); - JsonObject deployParamJson = new JsonObject(); + var globalProperties = new JsonObject(); + var deployParamJson = new JsonObject(); if (loop.getLoopTemplate().getUniqueBlueprint()) { // Normally the unique blueprint could contain multiple microservices but then we can't guess // the policy id params that will be used, so here we expect only one by default. diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java b/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java index f8bdab6c2..11587ce57 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java @@ -27,34 +27,26 @@ package org.onap.policy.clamp.policy; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; import java.io.UnsupportedEncodingException; -import java.util.Map; import javax.persistence.Column; import javax.persistence.FetchType; import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.MappedSuperclass; import javax.persistence.Transient; import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; -import org.hibernate.annotations.TypeDefs; -import org.json.JSONObject; import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport; import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType; import org.onap.policy.clamp.loop.common.AuditEntity; import org.onap.policy.clamp.loop.service.Service; import org.onap.policy.clamp.loop.template.LoopElementModel; import org.onap.policy.clamp.loop.template.PolicyModel; -import org.yaml.snakeyaml.Yaml; @MappedSuperclass -@TypeDefs({@TypeDef(name = "json", typeClass = StringJsonUserType.class)}) +@TypeDef(name = "json", typeClass = StringJsonUserType.class) public abstract class Policy extends AuditEntity { @Transient @@ -89,8 +81,8 @@ public abstract class Policy extends AuditEntity { @Expose @ManyToOne(fetch = FetchType.EAGER) - @JoinColumns({@JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"), - @JoinColumn(name = "policy_model_version", referencedColumnName = "version")}) + @JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type") + @JoinColumn(name = "policy_model_version", referencedColumnName = "version") private PolicyModel policyModel; /** diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java b/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java index 4142841e2..d56480053 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.util.LinkedHashMap; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; -import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.ExchangeBuilder; import org.onap.policy.clamp.clds.config.ClampProperties; import org.onap.policy.clamp.clds.sdc.controller.installer.BlueprintMicroService; @@ -95,7 +94,7 @@ public class PolicyEngineServices { * @return A PolicyModel created from policyEngine data or null if nothing is found on policyEngine */ public PolicyModel createPolicyModelFromPolicyEngine(String policyType, String policyVersion) { - PolicyModel policyModelFound = policyModelsService.getPolicyModel(policyType, policyVersion); + var policyModelFound = policyModelsService.getPolicyModel(policyType, policyVersion); if (policyModelFound == null) { String policyTosca = this.downloadOnePolicyToscaModel(policyType, policyVersion); if (policyTosca != null && !policyTosca.isEmpty()) { @@ -127,6 +126,7 @@ public class PolicyEngineServices { * This method synchronize the clamp database and the policy engine. * So it creates the required PolicyModel. */ + @SuppressWarnings("unchecked") public void synchronizeAllPolicies() { LinkedHashMap<String, Object> loadedYaml; loadedYaml = new Yaml().load(downloadAllPolicyModels()); @@ -162,12 +162,12 @@ public class PolicyEngineServices { */ public String downloadOnePolicyToscaModel(String policyType, String policyVersion) { logger.info("Downloading the policy tosca model " + policyType + "/" + policyVersion); - DumperOptions options = new DumperOptions(); + var options = new DumperOptions(); options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); options.setIndent(4); options.setPrettyFlow(true); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - Yaml yamlParser = new Yaml(options); + var yamlParser = new Yaml(options); String responseBody = callCamelRoute( ExchangeBuilder.anExchange(camelContext).withProperty("policyModelType", policyType) .withProperty("policyModelVersion", policyVersion).withProperty(RAISE_EXCEPTION_FLAG, false) @@ -200,9 +200,9 @@ public class PolicyEngineServices { } private String callCamelRoute(Exchange exchange, String camelFlow, String logMsg) { - for (int i = 0; i < retryLimit; i++) { - try (ProducerTemplate producerTemplate = camelContext.createProducerTemplate()) { - Exchange exchangeResponse = producerTemplate.send(camelFlow, exchange); + for (var i = 0; i < retryLimit; i++) { + try (var producerTemplate = camelContext.createProducerTemplate()) { + var exchangeResponse = producerTemplate.send(camelFlow, exchange); if (HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE)) .is2xxSuccessful()) { return (String) exchangeResponse.getIn().getBody(); diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java b/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java index 6098d0f63..38425fe93 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java @@ -26,7 +26,6 @@ package org.onap.policy.clamp.policy.pdpgroup; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; @@ -82,7 +81,7 @@ public class PdpGroupsAnalyzer { // Copy the subgroup but empty the policies & types pdpGroupsDeploymentPerToscaIdentifier.computeIfAbsent(toscaId, toscaKey -> new ConcurrentHashMap<>()) .computeIfAbsent(pdpGroupSource.getName(), pdpGroupName -> { - PdpGroup pdpGroupCopy = new PdpGroup(pdpGroupSource); + var pdpGroupCopy = new PdpGroup(pdpGroupSource); pdpGroupCopy.setPdpSubgroups(new ArrayList<>()); return pdpGroupCopy; }).getPdpSubgroups().add(new PdpSubGroup(pdpSubGroupSource)); @@ -107,8 +106,8 @@ public class PdpGroupsAnalyzer { Map<String, PdpGroup> mapOfGroups = this.pdpGroupsDeploymentPerPolicy.get(new ToscaConceptIdentifier(policyName, version)); if (mapOfGroups != null) { - JsonObject policyPdpGroups = new JsonObject(); - JsonArray pdpGroupsArray = new JsonArray(); + var policyPdpGroups = new JsonObject(); + var pdpGroupsArray = new JsonArray(); policyPdpGroups.add(ASSIGNED_PDP_GROUPS_INFO, pdpGroupsArray); pdpGroupsArray.add(JsonUtils.GSON .toJsonTree(mapOfGroups)); @@ -133,8 +132,8 @@ public class PdpGroupsAnalyzer { if (PdpState.TERMINATED.equals(pdpGroup.getPdpGroupState())) { return null; } - JsonObject supportedPdpGroup = new JsonObject(); - JsonArray supportedSubgroups = new JsonArray(); + var supportedPdpGroup = new JsonObject(); + var supportedSubgroups = new JsonArray(); supportedPdpGroup.add(pdpGroup.getName(), supportedSubgroups); pdpGroup.getPdpSubgroups().stream().forEach(pdpSubGroup -> { if (pdpSubGroup.getSupportedPolicyTypes().stream().anyMatch(policyTypeIdentifier -> @@ -155,8 +154,8 @@ public class PdpGroupsAnalyzer { * @return It returns a JsonObject containing each pdpGroup and subgroups associated */ public static JsonObject getSupportedPdpGroupsForModelType(PdpGroups pdpGroups, String policyType, String version) { - JsonObject supportedPdpGroups = new JsonObject(); - JsonArray pdpGroupsArray = new JsonArray(); + var supportedPdpGroups = new JsonObject(); + var pdpGroupsArray = new JsonArray(); supportedPdpGroups.add(SUPPORTED_PDP_GROUPS_INFO, pdpGroupsArray); pdpGroups.getGroups().stream().map(pdpGroup -> PdpGroupsAnalyzer.getSupportedPdpSubgroupsForModelType(pdpGroup, @@ -177,4 +176,4 @@ public class PdpGroupsAnalyzer { .setPolicyPdpGroup(getSupportedPdpGroupsForModelType(pdpGroups, policyModel.getPolicyModelType(), policyModel.getVersion()))); } -}
\ No newline at end of file +} diff --git a/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java b/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java index 4b01d6902..4f748d5dd 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java +++ b/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java @@ -188,8 +188,8 @@ public class Dictionary extends AuditEntity implements Serializable { @Override public int hashCode() { - final int prime = 31; - int result = 1; + final var prime = 31; + var result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } diff --git a/runtime/src/main/resources/META-INF/resources/swagger.html b/runtime/src/main/resources/META-INF/resources/swagger.html index 64530f1c3..20cdda7ad 100644 --- a/runtime/src/main/resources/META-INF/resources/swagger.html +++ b/runtime/src/main/resources/META-INF/resources/swagger.html @@ -444,31 +444,31 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </li> <li><a href="#_paths">2. Paths</a> <ul class="sectlevel2"> -<li><a href="#_verb116">2.1. GET /v1/healthcheck</a> +<li><a href="#_verb39">2.1. GET /v1/healthcheck</a> <ul class="sectlevel3"> <li><a href="#_responses">2.1.1. Responses</a></li> <li><a href="#_produces">2.1.2. Produces</a></li> </ul> </li> -<li><a href="#_verb117">2.2. GET /v1/user/getUser</a> +<li><a href="#_verb40">2.2. GET /v1/user/getUser</a> <ul class="sectlevel3"> <li><a href="#_responses_2">2.2.1. Responses</a></li> <li><a href="#_produces_2">2.2.2. Produces</a></li> </ul> </li> -<li><a href="#_verb115">2.3. GET /v2/clampInformation</a> +<li><a href="#_verb38">2.3. GET /v2/clampInformation</a> <ul class="sectlevel3"> <li><a href="#_responses_3">2.3.1. Responses</a></li> <li><a href="#_produces_3">2.3.2. Produces</a></li> </ul> </li> -<li><a href="#_verb99">2.4. GET /v2/dictionary</a> +<li><a href="#_verb21">2.4. GET /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_responses_4">2.4.1. Responses</a></li> <li><a href="#_produces_4">2.4.2. Produces</a></li> </ul> </li> -<li><a href="#_verb102">2.5. PUT /v2/dictionary</a> +<li><a href="#_verb24">2.5. PUT /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_parameters">2.5.1. Parameters</a></li> <li><a href="#_responses_5">2.5.2. Responses</a></li> @@ -476,20 +476,20 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_5">2.5.4. Produces</a></li> </ul> </li> -<li><a href="#_verb100">2.6. GET /v2/dictionary/secondary/names</a> +<li><a href="#_verb22">2.6. GET /v2/dictionary/secondary/names</a> <ul class="sectlevel3"> <li><a href="#_responses_6">2.6.1. Responses</a></li> <li><a href="#_produces_6">2.6.2. Produces</a></li> </ul> </li> -<li><a href="#_verb101">2.7. GET /v2/dictionary/{dictionaryName}</a> +<li><a href="#_verb23">2.7. GET /v2/dictionary/{dictionaryName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_2">2.7.1. Parameters</a></li> <li><a href="#_responses_7">2.7.2. Responses</a></li> <li><a href="#_produces_7">2.7.3. Produces</a></li> </ul> </li> -<li><a href="#_verb103">2.8. PUT /v2/dictionary/{name}</a> +<li><a href="#_verb25">2.8. PUT /v2/dictionary/{name}</a> <ul class="sectlevel3"> <li><a href="#_parameters_3">2.8.1. Parameters</a></li> <li><a href="#_responses_8">2.8.2. Responses</a></li> @@ -497,28 +497,28 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_8">2.8.4. Produces</a></li> </ul> </li> -<li><a href="#_verb104">2.9. DELETE /v2/dictionary/{name}</a> +<li><a href="#_verb26">2.9. DELETE /v2/dictionary/{name}</a> <ul class="sectlevel3"> <li><a href="#_parameters_4">2.9.1. Parameters</a></li> <li><a href="#_responses_9">2.9.2. Responses</a></li> <li><a href="#_produces_9">2.9.3. Produces</a></li> </ul> </li> -<li><a href="#_verb105">2.10. DELETE /v2/dictionary/{name}/elements/{shortName}</a> +<li><a href="#_verb27">2.10. DELETE /v2/dictionary/{name}/elements/{shortName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_5">2.10.1. Parameters</a></li> <li><a href="#_responses_10">2.10.2. Responses</a></li> <li><a href="#_produces_10">2.10.3. Produces</a></li> </ul> </li> -<li><a href="#_verb93">2.11. PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</a> +<li><a href="#_verb15">2.11. PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</a> <ul class="sectlevel3"> <li><a href="#_parameters_6">2.11.1. Parameters</a></li> <li><a href="#_responses_11">2.11.2. Responses</a></li> <li><a href="#_produces_11">2.11.3. Produces</a></li> </ul> </li> -<li><a href="#_verb95">2.12. POST /v2/loop/create/{loopName}?templateName={templateName}</a> +<li><a href="#_verb17">2.12. POST /v2/loop/create/{loopName}?templateName={templateName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_7">2.12.1. Parameters</a></li> <li><a href="#_responses_12">2.12.2. Responses</a></li> @@ -526,82 +526,82 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_12">2.12.4. Produces</a></li> </ul> </li> -<li><a href="#_verb91">2.13. PUT /v2/loop/delete/{loopName}</a> +<li><a href="#_verb13">2.13. PUT /v2/loop/delete/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_8">2.13.1. Parameters</a></li> <li><a href="#_responses_13">2.13.2. Responses</a></li> </ul> </li> -<li><a href="#_verb84">2.14. PUT /v2/loop/deploy/{loopName}</a> +<li><a href="#_verb6">2.14. PUT /v2/loop/deploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_9">2.14.1. Parameters</a></li> <li><a href="#_responses_14">2.14.2. Responses</a></li> <li><a href="#_produces_13">2.14.3. Produces</a></li> </ul> </li> -<li><a href="#_verb79">2.15. GET /v2/loop/getAllNames</a> +<li><a href="#_verb1">2.15. GET /v2/loop/getAllNames</a> <ul class="sectlevel3"> <li><a href="#_responses_15">2.15.1. Responses</a></li> <li><a href="#_produces_14">2.15.2. Produces</a></li> </ul> </li> -<li><a href="#_verb92">2.16. GET /v2/loop/getstatus/{loopName}</a> +<li><a href="#_verb14">2.16. GET /v2/loop/getstatus/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_10">2.16.1. Parameters</a></li> <li><a href="#_responses_16">2.16.2. Responses</a></li> <li><a href="#_produces_15">2.16.3. Produces</a></li> </ul> </li> -<li><a href="#_verb85">2.17. PUT /v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}</a> +<li><a href="#_verb7">2.17. PUT /v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_11">2.17.1. Parameters</a></li> <li><a href="#_responses_17">2.17.2. Responses</a></li> <li><a href="#_produces_16">2.17.3. Produces</a></li> </ul> </li> -<li><a href="#_verb86">2.18. PUT /v2/loop/refreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}</a> +<li><a href="#_verb8">2.18. PUT /v2/loop/refreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_12">2.18.1. Parameters</a></li> <li><a href="#_responses_18">2.18.2. Responses</a></li> <li><a href="#_produces_17">2.18.3. Produces</a></li> </ul> </li> -<li><a href="#_verb94">2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}</a> +<li><a href="#_verb16">2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_13">2.19.1. Parameters</a></li> <li><a href="#_responses_19">2.19.2. Responses</a></li> <li><a href="#_produces_18">2.19.3. Produces</a></li> </ul> </li> -<li><a href="#_verb89">2.20. PUT /v2/loop/restart/{loopName}</a> +<li><a href="#_verb11">2.20. PUT /v2/loop/restart/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_14">2.20.1. Parameters</a></li> <li><a href="#_responses_20">2.20.2. Responses</a></li> <li><a href="#_produces_19">2.20.3. Produces</a></li> </ul> </li> -<li><a href="#_verb88">2.21. PUT /v2/loop/stop/{loopName}</a> +<li><a href="#_verb10">2.21. PUT /v2/loop/stop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_15">2.21.1. Parameters</a></li> <li><a href="#_responses_21">2.21.2. Responses</a></li> <li><a href="#_produces_20">2.21.3. Produces</a></li> </ul> </li> -<li><a href="#_verb90">2.22. PUT /v2/loop/submit/{loopName}</a> +<li><a href="#_verb12">2.22. PUT /v2/loop/submit/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_16">2.22.1. Parameters</a></li> <li><a href="#_responses_22">2.22.2. Responses</a></li> <li><a href="#_produces_21">2.22.3. Produces</a></li> </ul> </li> -<li><a href="#_verb87">2.23. PUT /v2/loop/undeploy/{loopName}</a> +<li><a href="#_verb9">2.23. PUT /v2/loop/undeploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_17">2.23.1. Parameters</a></li> <li><a href="#_responses_23">2.23.2. Responses</a></li> <li><a href="#_produces_22">2.23.3. Produces</a></li> </ul> </li> -<li><a href="#_verb81">2.24. POST /v2/loop/updateGlobalProperties/{loopName}</a> +<li><a href="#_verb3">2.24. POST /v2/loop/updateGlobalProperties/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_18">2.24.1. Parameters</a></li> <li><a href="#_responses_24">2.24.2. Responses</a></li> @@ -609,7 +609,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_23">2.24.4. Produces</a></li> </ul> </li> -<li><a href="#_verb83">2.25. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> +<li><a href="#_verb5">2.25. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_19">2.25.1. Parameters</a></li> <li><a href="#_responses_25">2.25.2. Responses</a></li> @@ -617,7 +617,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_24">2.25.4. Produces</a></li> </ul> </li> -<li><a href="#_verb82">2.26. POST /v2/loop/updateOperationalPolicies/{loopName}</a> +<li><a href="#_verb4">2.26. POST /v2/loop/updateOperationalPolicies/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_20">2.26.1. Parameters</a></li> <li><a href="#_responses_26">2.26.2. Responses</a></li> @@ -625,34 +625,34 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_25">2.26.4. Produces</a></li> </ul> </li> -<li><a href="#_verb80">2.27. GET /v2/loop/{loopName}</a> +<li><a href="#_verb2">2.27. GET /v2/loop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_21">2.27.1. Parameters</a></li> <li><a href="#_responses_27">2.27.2. Responses</a></li> <li><a href="#_produces_26">2.27.3. Produces</a></li> </ul> </li> -<li><a href="#_verb109">2.28. GET /v2/policies</a> +<li><a href="#_verb31">2.28. GET /v2/policies</a> <ul class="sectlevel3"> <li><a href="#_responses_28">2.28.1. Responses</a></li> <li><a href="#_produces_27">2.28.2. Produces</a></li> </ul> </li> -<li><a href="#_verb112">2.29. PUT /v2/policies/pdpDeployment</a> +<li><a href="#_verb34">2.29. PUT /v2/policies/pdpDeployment</a> <ul class="sectlevel3"> <li><a href="#_parameters_22">2.29.1. Parameters</a></li> <li><a href="#_responses_29">2.29.2. Responses</a></li> <li><a href="#_consumes_7">2.29.3. Consumes</a></li> </ul> </li> -<li><a href="#_verb113">2.30. POST /v2/policies/policytype</a> +<li><a href="#_verb35">2.30. POST /v2/policies/policytype</a> <ul class="sectlevel3"> <li><a href="#_parameters_23">2.30.1. Parameters</a></li> <li><a href="#_responses_30">2.30.2. Responses</a></li> <li><a href="#_consumes_8">2.30.3. Consumes</a></li> </ul> </li> -<li><a href="#_verb110">2.31. POST /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a> +<li><a href="#_verb32">2.31. POST /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a> <ul class="sectlevel3"> <li><a href="#_parameters_24">2.31.1. Parameters</a></li> <li><a href="#_responses_31">2.31.2. Responses</a></li> @@ -660,55 +660,63 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_28">2.31.4. Produces</a></li> </ul> </li> -<li><a href="#_verb111">2.32. DELETE /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a> +<li><a href="#_verb33">2.32. DELETE /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a> <ul class="sectlevel3"> <li><a href="#_parameters_25">2.32.1. Parameters</a></li> <li><a href="#_responses_32">2.32.2. Responses</a></li> </ul> </li> -<li><a href="#_verb106">2.33. GET /v2/policyToscaModels</a> +<li><a href="#_verb28">2.33. GET /v2/policyToscaModels</a> <ul class="sectlevel3"> <li><a href="#_responses_33">2.33.1. Responses</a></li> <li><a href="#_produces_29">2.33.2. Produces</a></li> </ul> </li> -<li><a href="#_verb108">2.34. GET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}</a> +<li><a href="#_verb30">2.34. GET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}</a> <ul class="sectlevel3"> <li><a href="#_parameters_26">2.34.1. Parameters</a></li> <li><a href="#_responses_34">2.34.2. Responses</a></li> <li><a href="#_produces_30">2.34.3. Produces</a></li> </ul> </li> -<li><a href="#_verb107">2.35. GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</a> +<li><a href="#_verb29">2.35. GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</a> <ul class="sectlevel3"> <li><a href="#_parameters_27">2.35.1. Parameters</a></li> <li><a href="#_responses_35">2.35.2. Responses</a></li> <li><a href="#_produces_31">2.35.3. Produces</a></li> </ul> </li> -<li><a href="#_verb96">2.36. GET /v2/templates</a> +<li><a href="#_verb18">2.36. GET /v2/templates</a> <ul class="sectlevel3"> <li><a href="#_responses_36">2.36.1. Responses</a></li> <li><a href="#_produces_32">2.36.2. Produces</a></li> </ul> </li> -<li><a href="#_verb98">2.37. GET /v2/templates/names</a> +<li><a href="#_verb20">2.37. GET /v2/templates/names</a> <ul class="sectlevel3"> <li><a href="#_responses_37">2.37.1. Responses</a></li> <li><a href="#_produces_33">2.37.2. Produces</a></li> </ul> </li> -<li><a href="#_verb97">2.38. GET /v2/templates/{templateName}</a> +<li><a href="#_verb19">2.38. GET /v2/templates/{templateName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_28">2.38.1. Parameters</a></li> <li><a href="#_responses_38">2.38.2. Responses</a></li> <li><a href="#_produces_34">2.38.3. Produces</a></li> </ul> </li> -<li><a href="#_verb114">2.39. GET /v2/toscaControlLoop/getToscaTemplate</a> +<li><a href="#_verb37">2.39. POST /v2/toscaControlLoop/commissionToscaTemplate</a> <ul class="sectlevel3"> -<li><a href="#_responses_39">2.39.1. Responses</a></li> -<li><a href="#_produces_35">2.39.2. Produces</a></li> +<li><a href="#_parameters_29">2.39.1. Parameters</a></li> +<li><a href="#_responses_39">2.39.2. Responses</a></li> +<li><a href="#_consumes_10">2.39.3. Consumes</a></li> +<li><a href="#_produces_35">2.39.4. Produces</a></li> +</ul> +</li> +<li><a href="#_verb36">2.40. GET /v2/toscaControlLoop/getToscaTemplate</a> +<ul class="sectlevel3"> +<li><a href="#_responses_40">2.40.1. Responses</a></li> +<li><a href="#_produces_36">2.40.2. Produces</a></li> </ul> </li> </ul> @@ -754,7 +762,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <div class="sect2"> <h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a><a class="link" href="#_uri_scheme">1.2. URI scheme</a></h3> <div class="paragraph"> -<p><em>Host</em> : localhost:33201<br> +<p><em>Host</em> : localhost:40313<br> <em>BasePath</em> : /restservices/clds/<br> <em>Schemes</em> : HTTP</p> </div> @@ -765,7 +773,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <h2 id="_paths"><a class="anchor" href="#_paths"></a><a class="link" href="#_paths">2. Paths</a></h2> <div class="sectionbody"> <div class="sect2"> -<h3 id="_verb116"><a class="anchor" href="#_verb116"></a><a class="link" href="#_verb116">2.1. GET /v1/healthcheck</a></h3> +<h3 id="_verb39"><a class="anchor" href="#_verb39"></a><a class="link" href="#_verb39">2.1. GET /v1/healthcheck</a></h3> <div class="sect3"> <h4 id="_responses"><a class="anchor" href="#_responses"></a><a class="link" href="#_responses">2.1.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -802,7 +810,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb117"><a class="anchor" href="#_verb117"></a><a class="link" href="#_verb117">2.2. GET /v1/user/getUser</a></h3> +<h3 id="_verb40"><a class="anchor" href="#_verb40"></a><a class="link" href="#_verb40">2.2. GET /v1/user/getUser</a></h3> <div class="sect3"> <h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a><a class="link" href="#_responses_2">2.2.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -836,7 +844,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb115"><a class="anchor" href="#_verb115"></a><a class="link" href="#_verb115">2.3. GET /v2/clampInformation</a></h3> +<h3 id="_verb38"><a class="anchor" href="#_verb38"></a><a class="link" href="#_verb38">2.3. GET /v2/clampInformation</a></h3> <div class="sect3"> <h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a><a class="link" href="#_responses_3">2.3.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -873,7 +881,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb99"><a class="anchor" href="#_verb99"></a><a class="link" href="#_verb99">2.4. GET /v2/dictionary</a></h3> +<h3 id="_verb21"><a class="anchor" href="#_verb21"></a><a class="link" href="#_verb21">2.4. GET /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_responses_4"><a class="anchor" href="#_responses_4"></a><a class="link" href="#_responses_4">2.4.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -910,7 +918,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb102"><a class="anchor" href="#_verb102"></a><a class="link" href="#_verb102">2.5. PUT /v2/dictionary</a></h3> +<h3 id="_verb24"><a class="anchor" href="#_verb24"></a><a class="link" href="#_verb24">2.5. PUT /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.5.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -982,7 +990,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb100"><a class="anchor" href="#_verb100"></a><a class="link" href="#_verb100">2.6. GET /v2/dictionary/secondary/names</a></h3> +<h3 id="_verb22"><a class="anchor" href="#_verb22"></a><a class="link" href="#_verb22">2.6. GET /v2/dictionary/secondary/names</a></h3> <div class="sect3"> <h4 id="_responses_6"><a class="anchor" href="#_responses_6"></a><a class="link" href="#_responses_6">2.6.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1019,7 +1027,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb101"><a class="anchor" href="#_verb101"></a><a class="link" href="#_verb101">2.7. GET /v2/dictionary/{dictionaryName}</a></h3> +<h3 id="_verb23"><a class="anchor" href="#_verb23"></a><a class="link" href="#_verb23">2.7. GET /v2/dictionary/{dictionaryName}</a></h3> <div class="sect3"> <h4 id="_parameters_2"><a class="anchor" href="#_parameters_2"></a><a class="link" href="#_parameters_2">2.7.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1081,7 +1089,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb103"><a class="anchor" href="#_verb103"></a><a class="link" href="#_verb103">2.8. PUT /v2/dictionary/{name}</a></h3> +<h3 id="_verb25"><a class="anchor" href="#_verb25"></a><a class="link" href="#_verb25">2.8. PUT /v2/dictionary/{name}</a></h3> <div class="sect3"> <h4 id="_parameters_3"><a class="anchor" href="#_parameters_3"></a><a class="link" href="#_parameters_3">2.8.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1159,7 +1167,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb104"><a class="anchor" href="#_verb104"></a><a class="link" href="#_verb104">2.9. DELETE /v2/dictionary/{name}</a></h3> +<h3 id="_verb26"><a class="anchor" href="#_verb26"></a><a class="link" href="#_verb26">2.9. DELETE /v2/dictionary/{name}</a></h3> <div class="sect3"> <h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.9.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1218,7 +1226,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb105"><a class="anchor" href="#_verb105"></a><a class="link" href="#_verb105">2.10. DELETE /v2/dictionary/{name}/elements/{shortName}</a></h3> +<h3 id="_verb27"><a class="anchor" href="#_verb27"></a><a class="link" href="#_verb27">2.10. DELETE /v2/dictionary/{name}/elements/{shortName}</a></h3> <div class="sect3"> <h4 id="_parameters_5"><a class="anchor" href="#_parameters_5"></a><a class="link" href="#_parameters_5">2.10.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1283,7 +1291,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb93"><a class="anchor" href="#_verb93"></a><a class="link" href="#_verb93">2.11. PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</a></h3> +<h3 id="_verb15"><a class="anchor" href="#_verb15"></a><a class="link" href="#_verb15">2.11. PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}</a></h3> <div class="sect3"> <h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.11.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1357,7 +1365,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb95"><a class="anchor" href="#_verb95"></a><a class="link" href="#_verb95">2.12. POST /v2/loop/create/{loopName}?templateName={templateName}</a></h3> +<h3 id="_verb17"><a class="anchor" href="#_verb17"></a><a class="link" href="#_verb17">2.12. POST /v2/loop/create/{loopName}?templateName={templateName}</a></h3> <div class="sect3"> <h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.12.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1435,7 +1443,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb91"><a class="anchor" href="#_verb91"></a><a class="link" href="#_verb91">2.13. PUT /v2/loop/delete/{loopName}</a></h3> +<h3 id="_verb13"><a class="anchor" href="#_verb13"></a><a class="link" href="#_verb13">2.13. PUT /v2/loop/delete/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a><a class="link" href="#_parameters_8">2.13.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1484,7 +1492,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb84"><a class="anchor" href="#_verb84"></a><a class="link" href="#_verb84">2.14. PUT /v2/loop/deploy/{loopName}</a></h3> +<h3 id="_verb6"><a class="anchor" href="#_verb6"></a><a class="link" href="#_verb6">2.14. PUT /v2/loop/deploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a><a class="link" href="#_parameters_9">2.14.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1546,7 +1554,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb79"><a class="anchor" href="#_verb79"></a><a class="link" href="#_verb79">2.15. GET /v2/loop/getAllNames</a></h3> +<h3 id="_verb1"><a class="anchor" href="#_verb1"></a><a class="link" href="#_verb1">2.15. GET /v2/loop/getAllNames</a></h3> <div class="sect3"> <h4 id="_responses_15"><a class="anchor" href="#_responses_15"></a><a class="link" href="#_responses_15">2.15.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1583,7 +1591,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb92"><a class="anchor" href="#_verb92"></a><a class="link" href="#_verb92">2.16. GET /v2/loop/getstatus/{loopName}</a></h3> +<h3 id="_verb14"><a class="anchor" href="#_verb14"></a><a class="link" href="#_verb14">2.16. GET /v2/loop/getstatus/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.16.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1645,7 +1653,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb85"><a class="anchor" href="#_verb85"></a><a class="link" href="#_verb85">2.17. PUT /v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}</a></h3> +<h3 id="_verb7"><a class="anchor" href="#_verb7"></a><a class="link" href="#_verb7">2.17. PUT /v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}</a></h3> <div class="sect3"> <h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.17.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1713,7 +1721,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb86"><a class="anchor" href="#_verb86"></a><a class="link" href="#_verb86">2.18. PUT /v2/loop/refreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}</a></h3> +<h3 id="_verb8"><a class="anchor" href="#_verb8"></a><a class="link" href="#_verb8">2.18. PUT /v2/loop/refreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}</a></h3> <div class="sect3"> <h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.18.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1781,7 +1789,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb94"><a class="anchor" href="#_verb94"></a><a class="link" href="#_verb94">2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}</a></h3> +<h3 id="_verb16"><a class="anchor" href="#_verb16"></a><a class="link" href="#_verb16">2.19. PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}</a></h3> <div class="sect3"> <h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a><a class="link" href="#_parameters_13">2.19.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1861,7 +1869,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb89"><a class="anchor" href="#_verb89"></a><a class="link" href="#_verb89">2.20. PUT /v2/loop/restart/{loopName}</a></h3> +<h3 id="_verb11"><a class="anchor" href="#_verb11"></a><a class="link" href="#_verb11">2.20. PUT /v2/loop/restart/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a><a class="link" href="#_parameters_14">2.20.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1923,7 +1931,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb88"><a class="anchor" href="#_verb88"></a><a class="link" href="#_verb88">2.21. PUT /v2/loop/stop/{loopName}</a></h3> +<h3 id="_verb10"><a class="anchor" href="#_verb10"></a><a class="link" href="#_verb10">2.21. PUT /v2/loop/stop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a><a class="link" href="#_parameters_15">2.21.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1985,7 +1993,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb90"><a class="anchor" href="#_verb90"></a><a class="link" href="#_verb90">2.22. PUT /v2/loop/submit/{loopName}</a></h3> +<h3 id="_verb12"><a class="anchor" href="#_verb12"></a><a class="link" href="#_verb12">2.22. PUT /v2/loop/submit/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a><a class="link" href="#_parameters_16">2.22.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2047,7 +2055,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb87"><a class="anchor" href="#_verb87"></a><a class="link" href="#_verb87">2.23. PUT /v2/loop/undeploy/{loopName}</a></h3> +<h3 id="_verb9"><a class="anchor" href="#_verb9"></a><a class="link" href="#_verb9">2.23. PUT /v2/loop/undeploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a><a class="link" href="#_parameters_17">2.23.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2109,7 +2117,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb81"><a class="anchor" href="#_verb81"></a><a class="link" href="#_verb81">2.24. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> +<h3 id="_verb3"><a class="anchor" href="#_verb3"></a><a class="link" href="#_verb3">2.24. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_18"><a class="anchor" href="#_parameters_18"></a><a class="link" href="#_parameters_18">2.24.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2187,7 +2195,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb83"><a class="anchor" href="#_verb83"></a><a class="link" href="#_verb83">2.25. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> +<h3 id="_verb5"><a class="anchor" href="#_verb5"></a><a class="link" href="#_verb5">2.25. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_19"><a class="anchor" href="#_parameters_19"></a><a class="link" href="#_parameters_19">2.25.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2265,7 +2273,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb82"><a class="anchor" href="#_verb82"></a><a class="link" href="#_verb82">2.26. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> +<h3 id="_verb4"><a class="anchor" href="#_verb4"></a><a class="link" href="#_verb4">2.26. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_20"><a class="anchor" href="#_parameters_20"></a><a class="link" href="#_parameters_20">2.26.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2343,7 +2351,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb80"><a class="anchor" href="#_verb80"></a><a class="link" href="#_verb80">2.27. GET /v2/loop/{loopName}</a></h3> +<h3 id="_verb2"><a class="anchor" href="#_verb2"></a><a class="link" href="#_verb2">2.27. GET /v2/loop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_21"><a class="anchor" href="#_parameters_21"></a><a class="link" href="#_parameters_21">2.27.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2405,7 +2413,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb109"><a class="anchor" href="#_verb109"></a><a class="link" href="#_verb109">2.28. GET /v2/policies</a></h3> +<h3 id="_verb31"><a class="anchor" href="#_verb31"></a><a class="link" href="#_verb31">2.28. GET /v2/policies</a></h3> <div class="sect3"> <h4 id="_responses_28"><a class="anchor" href="#_responses_28"></a><a class="link" href="#_responses_28">2.28.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2442,7 +2450,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb112"><a class="anchor" href="#_verb112"></a><a class="link" href="#_verb112">2.29. PUT /v2/policies/pdpDeployment</a></h3> +<h3 id="_verb34"><a class="anchor" href="#_verb34"></a><a class="link" href="#_verb34">2.29. PUT /v2/policies/pdpDeployment</a></h3> <div class="sect3"> <h4 id="_parameters_22"><a class="anchor" href="#_parameters_22"></a><a class="link" href="#_parameters_22">2.29.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2501,7 +2509,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb113"><a class="anchor" href="#_verb113"></a><a class="link" href="#_verb113">2.30. POST /v2/policies/policytype</a></h3> +<h3 id="_verb35"><a class="anchor" href="#_verb35"></a><a class="link" href="#_verb35">2.30. POST /v2/policies/policytype</a></h3> <div class="sect3"> <h4 id="_parameters_23"><a class="anchor" href="#_parameters_23"></a><a class="link" href="#_parameters_23">2.30.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2560,7 +2568,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb110"><a class="anchor" href="#_verb110"></a><a class="link" href="#_verb110">2.31. POST /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a></h3> +<h3 id="_verb32"><a class="anchor" href="#_verb32"></a><a class="link" href="#_verb32">2.31. POST /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a></h3> <div class="sect3"> <h4 id="_parameters_24"><a class="anchor" href="#_parameters_24"></a><a class="link" href="#_parameters_24">2.31.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2656,7 +2664,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb111"><a class="anchor" href="#_verb111"></a><a class="link" href="#_verb111">2.32. DELETE /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a></h3> +<h3 id="_verb33"><a class="anchor" href="#_verb33"></a><a class="link" href="#_verb33">2.32. DELETE /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}</a></h3> <div class="sect3"> <h4 id="_parameters_25"><a class="anchor" href="#_parameters_25"></a><a class="link" href="#_parameters_25">2.32.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2723,7 +2731,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb106"><a class="anchor" href="#_verb106"></a><a class="link" href="#_verb106">2.33. GET /v2/policyToscaModels</a></h3> +<h3 id="_verb28"><a class="anchor" href="#_verb28"></a><a class="link" href="#_verb28">2.33. GET /v2/policyToscaModels</a></h3> <div class="sect3"> <h4 id="_responses_33"><a class="anchor" href="#_responses_33"></a><a class="link" href="#_responses_33">2.33.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2760,7 +2768,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb108"><a class="anchor" href="#_verb108"></a><a class="link" href="#_verb108">2.34. GET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}</a></h3> +<h3 id="_verb30"><a class="anchor" href="#_verb30"></a><a class="link" href="#_verb30">2.34. GET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}</a></h3> <div class="sect3"> <h4 id="_parameters_26"><a class="anchor" href="#_parameters_26"></a><a class="link" href="#_parameters_26">2.34.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2828,7 +2836,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb107"><a class="anchor" href="#_verb107"></a><a class="link" href="#_verb107">2.35. GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</a></h3> +<h3 id="_verb29"><a class="anchor" href="#_verb29"></a><a class="link" href="#_verb29">2.35. GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}</a></h3> <div class="sect3"> <h4 id="_parameters_27"><a class="anchor" href="#_parameters_27"></a><a class="link" href="#_parameters_27">2.35.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2896,7 +2904,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb96"><a class="anchor" href="#_verb96"></a><a class="link" href="#_verb96">2.36. GET /v2/templates</a></h3> +<h3 id="_verb18"><a class="anchor" href="#_verb18"></a><a class="link" href="#_verb18">2.36. GET /v2/templates</a></h3> <div class="sect3"> <h4 id="_responses_36"><a class="anchor" href="#_responses_36"></a><a class="link" href="#_responses_36">2.36.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2933,7 +2941,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb98"><a class="anchor" href="#_verb98"></a><a class="link" href="#_verb98">2.37. GET /v2/templates/names</a></h3> +<h3 id="_verb20"><a class="anchor" href="#_verb20"></a><a class="link" href="#_verb20">2.37. GET /v2/templates/names</a></h3> <div class="sect3"> <h4 id="_responses_37"><a class="anchor" href="#_responses_37"></a><a class="link" href="#_responses_37">2.37.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2970,7 +2978,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb97"><a class="anchor" href="#_verb97"></a><a class="link" href="#_verb97">2.38. GET /v2/templates/{templateName}</a></h3> +<h3 id="_verb19"><a class="anchor" href="#_verb19"></a><a class="link" href="#_verb19">2.38. GET /v2/templates/{templateName}</a></h3> <div class="sect3"> <h4 id="_parameters_28"><a class="anchor" href="#_parameters_28"></a><a class="link" href="#_parameters_28">2.38.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -3032,9 +3040,81 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_verb114"><a class="anchor" href="#_verb114"></a><a class="link" href="#_verb114">2.39. GET /v2/toscaControlLoop/getToscaTemplate</a></h3> +<h3 id="_verb37"><a class="anchor" href="#_verb37"></a><a class="link" href="#_verb37">2.39. POST /v2/toscaControlLoop/commissionToscaTemplate</a></h3> +<div class="sect3"> +<h4 id="_parameters_29"><a class="anchor" href="#_parameters_29"></a><a class="link" href="#_parameters_29">2.39.1. Parameters</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 22.2222%;"> +<col style="width: 33.3333%;"> +<col style="width: 44.4445%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">Type</th> +<th class="tableblock halign-left valign-middle">Name</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>Body</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>body</strong><br> +<em>required</em></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_responses_39"><a class="anchor" href="#_responses_39"></a><a class="link" href="#_responses_39">2.39.2. Responses</a></h4> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 10%;"> +<col style="width: 70%;"> +<col style="width: 20%;"> +</colgroup> +<thead> +<tr> +<th class="tableblock halign-left valign-middle">HTTP Code</th> +<th class="tableblock halign-left valign-middle">Description</th> +<th class="tableblock halign-left valign-middle">Schema</th> +</tr> +</thead> +<tbody> +<tr> +<td class="tableblock halign-left valign-middle"><p class="tableblock"><strong>200</strong></p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">Output type</p></td> +<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td> +</tr> +</tbody> +</table> +</div> +<div class="sect3"> +<h4 id="_consumes_10"><a class="anchor" href="#_consumes_10"></a><a class="link" href="#_consumes_10">2.39.3. Consumes</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>plain/text</code></p> +</li> +</ul> +</div> +</div> +<div class="sect3"> +<h4 id="_produces_35"><a class="anchor" href="#_produces_35"></a><a class="link" href="#_produces_35">2.39.4. Produces</a></h4> +<div class="ulist"> +<ul> +<li> +<p><code>application/json</code></p> +</li> +</ul> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_verb36"><a class="anchor" href="#_verb36"></a><a class="link" href="#_verb36">2.40. GET /v2/toscaControlLoop/getToscaTemplate</a></h3> <div class="sect3"> -<h4 id="_responses_39"><a class="anchor" href="#_responses_39"></a><a class="link" href="#_responses_39">2.39.1. Responses</a></h4> +<h4 id="_responses_40"><a class="anchor" href="#_responses_40"></a><a class="link" href="#_responses_40">2.40.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> <colgroup> <col style="width: 10%;"> @@ -3058,7 +3138,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </table> </div> <div class="sect3"> -<h4 id="_produces_35"><a class="anchor" href="#_produces_35"></a><a class="link" href="#_produces_35">2.39.2. Produces</a></h4> +<h4 id="_produces_36"><a class="anchor" href="#_produces_36"></a><a class="link" href="#_produces_36">2.40.2. Produces</a></h4> <div class="ulist"> <ul> <li> @@ -4544,7 +4624,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> <div id="footer"> <div id="footer-text"> -Last updated 2021-06-08 11:33:09 IST +Last updated 2021-06-17 16:04:11 IST </div> </div> </body> diff --git a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml index 6a5da8710..5fd242282 100644 --- a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -1461,7 +1461,8 @@ </route> </post> - <get uri="/v2/toscaControlLoop/getToscaTemplate" outType="java.lang.String" bindingMode="off" produces="application/json"> + <get uri="/v2/toscaControlLoop/getToscaTemplate" outType="java.lang.String" bindingMode="off" + produces="application/json"> <route> <removeHeaders pattern="*" excludePattern="name|version"/> @@ -1499,6 +1500,49 @@ </route> </get> + <post uri="/v2/toscaControlLoop/commissionToscaTemplate" + type="java.lang.String" + consumes="plain/text" + outType="java.lang.String" + produces="application/json" + bindingMode="off"> + <route> + <removeHeaders pattern="*"/> + <setProperty name="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <setHeader name="Content-Type"> + <constant>application/json</constant> + </setHeader> + <doTry> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update the global properties')"/> + <to + uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')"/> + <to uri="direct:commission-service-template"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=endLog()"/> + <doCatch> + <exception>java.lang.Exception</exception> + <handled> + <constant>true</constant> + </handled> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=errorLog()"/> + <log loggingLevel="ERROR" + message="Commissioning of Tosca Service Template FAILED"/> + + <setHeader name="CamelHttpResponseCode"> + <constant>500</constant> + </setHeader> + <setBody> + <simple>Commissioning Tosca Service Template FAILED</simple> + </setBody> + </doCatch> + </doTry> + </route> + </post> + <get uri="/v2/clampInformation" outType="org.onap.policy.clamp.clds.model.ClampInformation" produces="application/json"> <route> diff --git a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml index b1fad103b..0641b326e 100644 --- a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml +++ b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml @@ -30,4 +30,26 @@ </doFinally> </doTry> </route> + <route id="commission-service-template"> + <from uri="direct:commission-service-template"/> + <doTry> + <log loggingLevel="INFO" + message="Commissioning the tosca service template"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Commissioning the tosca service template')"/> + <setHeader name="CamelHttpMethod"> + <constant>POST</constant> + </setHeader> + <log loggingLevel="INFO" + message="Endpoint to send Tosca Service Template: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission"></log> + <toD + uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.controlloop.runtime.userName}}&authPassword={{clamp.config.controlloop.runtime.password}}&authenticationPreemptive=true&connectionClose=true"/> + <convertBodyTo type="java.lang.String"/> + <doFinally> + <to uri="direct:reset-raise-http-exception-flag"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> + </doFinally> + </doTry> + </route> </routes> diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java index 557a2e96c..45d4d64b1 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java @@ -70,6 +70,8 @@ public class AuthorizationControllerItCase { public static void setupBefore() { sc.setAuthentication(new Authentication() { + private static final long serialVersionUID = -6282526745791629050L; + @Override public Collection<? extends GrantedAuthority> getAuthorities() { return Arrays.asList(new SimpleGrantedAuthority( @@ -121,7 +123,7 @@ public class AuthorizationControllerItCase { @Test public void testIsUserPermitted() { - assertEquals(AuthorizationController.getPrincipalName(sc), "admin"); + assertEquals("admin", AuthorizationController.getPrincipalName(sc)); assertTrue(auth.isUserPermitted(new SecureServicePermission("permission-type-cl", "dev", "read"))); assertTrue(auth.isUserPermitted(new SecureServicePermission("permission-type-cl-manage", "dev", "DEPLOY"))); assertTrue(auth.isUserPermitted( diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java index 017881ba7..ad7efed36 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java @@ -67,11 +67,13 @@ public class RobotItCase { public void robotTests() throws Exception { File robotFolder = new File(getClass().getClassLoader().getResource("robotframework").getFile()); Volume testsVolume = new Volume("/opt/robotframework/tests"); - DockerClient client = DockerClientBuilder - .getInstance() - .withDockerCmdExecFactory(new NettyDockerCmdExecFactory()) - .build(); - + // @formatter:off + DockerClient client = + DockerClientBuilder + .getInstance() + .withDockerCmdExecFactory(new NettyDockerCmdExecFactory()) + .build(); + // @formatter:on BuildImageResultCallback callback = new BuildImageResultCallback() { @Override @@ -82,14 +84,17 @@ public class RobotItCase { }; String imageId = client.buildImageCmd(robotFolder).exec(callback).awaitImageId(); - CreateContainerResponse createContainerResponse = client.createContainerCmd(imageId) + // @formatter:off + CreateContainerResponse createContainerResponse = + client + .createContainerCmd(imageId) .withVolumes(testsVolume) - .withBinds( - new Bind(robotFolder.getAbsolutePath() + "/tests/", testsVolume, AccessMode.rw)) + .withBinds(new Bind(robotFolder.getAbsolutePath() + "/tests/", testsVolume, AccessMode.rw)) .withEnv("CLAMP_PORT=" + httpPort) .withStopTimeout(TIMEOUT_S) .withNetworkMode("host") .exec(); + // @formatter:on String id = createContainerResponse.getId(); client.startContainerCmd(id).exec(); InspectContainerResponse exec; diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandlerTest.java index 08e425abf..423876ede 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandlerTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandlerTest.java @@ -55,7 +55,6 @@ public class CsarHandlerTest { private static final String SERVICE_UUID = "serviceUUID"; private static final String RESOURCE1_UUID = "resource1UUID"; private static final String RESOURCE1_INSTANCE_NAME = "sim-1802 0"; - private static final String RESOURCE1_INSTANCE_NAME_IN_CSAR = "sim18020"; private static final String BLUEPRINT1_NAME = "FOI.Simfoimap223S0112.event_proc_bp.yaml"; private static final String BLUEPRINT2_NAME = "FOI.Simfoimap223S0112.event_proc_bp2.yaml"; diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ArrayFieldTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ArrayFieldTest.java index 6f6f5c104..9cf7cee6b 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ArrayFieldTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ArrayFieldTest.java @@ -47,9 +47,10 @@ public class ArrayFieldTest extends TestCase { ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json")); ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor"); ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor"); + @SuppressWarnings("unchecked") ArrayField arrayParser = new ArrayField((ArrayList<Object>) toscaElementProperty.getItems().get("default")); JsonArray toTest = arrayParser.deploy(); String reference = "[1,\"String\",5.5,true]"; assertEquals(reference, String.valueOf(toTest)); } -}
\ No newline at end of file +} diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ConstraintTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ConstraintTest.java index 493ee992c..06a8bdac8 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ConstraintTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ConstraintTest.java @@ -48,6 +48,7 @@ public class ConstraintTest extends TestCase { /** * Test get value array. */ + @SuppressWarnings("unchecked") public void testGetValuesArray() { ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("timeout"); JsonTemplate jsonTemplate = jsonTemplateManager.getJsonSchemaTemplates().get("integer"); @@ -70,6 +71,7 @@ public class ConstraintTest extends TestCase { /** * Test get Specific length. */ + @SuppressWarnings("unchecked") public void testGetSpecificLength() { //Test for string type, same process for array ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("id"); @@ -88,6 +90,7 @@ public class ConstraintTest extends TestCase { /** * Test get limit value. */ + @SuppressWarnings("unchecked") public void testGetLimitValue() { //Test for array type, same process for string ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("description"); @@ -102,5 +105,4 @@ public class ConstraintTest extends TestCase { toTest = resultProcess.get("maxItems").getAsInt(); assertEquals(7, toTest); } - -}
\ No newline at end of file +} diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementPropertyTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementPropertyTest.java index 5652fa9cd..c43b84a66 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementPropertyTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaElementPropertyTest.java @@ -50,6 +50,7 @@ public class ToscaElementPropertyTest extends TestCase { ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json")); ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor"); ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor"); + @SuppressWarnings("unchecked") JsonArray toTest = toscaElementProperty.parseArray((ArrayList<Object>) toscaElementProperty.getItems().get("default")); assertNotNull(toTest); @@ -60,6 +61,7 @@ public class ToscaElementPropertyTest extends TestCase { * * @throws IOException In case of failure */ + @SuppressWarnings("unchecked") public void testAddConstraintsAsJson() throws IOException { JsonTemplateManager jsonTemplateManager = new JsonTemplateManager( ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"), @@ -76,4 +78,4 @@ public class ToscaElementPropertyTest extends TestCase { String test = "{\"enum\":[\"error\",\"timeout\",\"retries\",\"guard\",\"exception\"]}"; assertEquals(test, String.valueOf(toTest)); } -}
\ No newline at end of file +} 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 ab6a41bca..4b93ed7be 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 @@ -132,7 +132,7 @@ public class LoggingUtilsTest { assertEquals(targetServiceName, mdc.get(OnapLogConstants.Mdcs.TARGET_SERVICE_NAME)); } - private boolean checkMapKeys(Map map, String[] keys) { + private boolean checkMapKeys(Map<String, String> map, String[] keys) { return Arrays.stream(keys).allMatch(key -> map.get(key) != null); } } diff --git a/runtime/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java b/runtime/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java index 622fd5999..1cc7e9032 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java @@ -24,7 +24,6 @@ package org.onap.policy.clamp.flow; -import static junit.framework.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -74,8 +73,8 @@ public class FlowLogOperationTest { // then String entity = mdcAdapter.get(OnapLogConstants.Mdcs.TARGET_ENTITY); String serviceName = mdcAdapter.get(OnapLogConstants.Mdcs.TARGET_SERVICE_NAME); - assertEquals(entity, mockEntity); - assertEquals(serviceName, mockServiceName); + assertThat(entity).isEqualTo(mockEntity); + assertThat(serviceName).isEqualTo(mockServiceName); } @Test @@ -99,4 +98,4 @@ public class FlowLogOperationTest { // then assertThat(mdcAdapter.get(OnapLogConstants.Mdcs.ENTRY_TIMESTAMP)).isNull(); } -}
\ No newline at end of file +} diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java index 6728d292c..54ecaa639 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java +++ b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java @@ -104,8 +104,7 @@ public class LoopControllerTestItCase { + "\"success\":\"\",\"failure\":\"\",\"failure_timeout\":\"\",\"failure_retries\":\"\"," + "\"failure_exception\":\"\",\"failure_guard\":\"\",\"target\":{\"type\":\"VNF\"," + "\"resourceID\":\"vFW_PG_T1\"}}]}}}]"; - JsonParser parser = new JsonParser(); - JsonElement ele = parser.parse(policy); + JsonElement ele = JsonParser.parseString(policy); JsonArray arr = ele.getAsJsonArray(); Loop loop = loopController.updateOperationalPolicies(EXAMPLE_LOOP_NAME, arr); assertThat(loop.getOperationalPolicies()).hasSize(1); @@ -126,8 +125,7 @@ public class LoopControllerTestItCase { + "\"cbs_host\":\"config-binding-service\",\"cbs_port\":\"10000\",\"external_port\":\"32012\"," + "\"policy_model_id\":\"onap.policies.monitoring.cdap.tca.hi.lo.app\"," + "\"policy_id\":\"tca_k8s_CLTCA_v1_0_vFW_PG_T10_k8s-tca-clamp-policy-05162019\"}}"; - JsonParser parser = new JsonParser(); - JsonElement ele = parser.parse(policy); + JsonElement ele = JsonParser.parseString(policy); JsonObject obj = ele.getAsJsonObject(); loopController.updateGlobalPropertiesJson(EXAMPLE_LOOP_NAME, obj); Loop loop = loopController.getLoop(EXAMPLE_LOOP_NAME); @@ -170,6 +168,6 @@ public class LoopControllerTestItCase { loopController.removeOperationalPolicy(EXAMPLE_LOOP_NAME, "testPolicyModel", "1.0.0"); Loop newLoop2 = loopController.getLoop(EXAMPLE_LOOP_NAME); - assertThat(newLoop2.getOperationalPolicies().size()).isEqualTo(0); + assertThat(newLoop2.getOperationalPolicies().size()).isZero(); } -}
\ No newline at end of file +} diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java index 7b0ab8614..ab256eafb 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java +++ b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java @@ -47,7 +47,6 @@ public class LoopLogServiceTestItCase { private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}"; private static final String CLAMP_COMPONENT = "CLAMP"; private static final String SAMPLE_LOG_MESSAGE = "Sample log"; - private static final String BLUEPRINT = "blueprint"; @Autowired LoopService loopService; @@ -93,4 +92,4 @@ public class LoopLogServiceTestItCase { assertThat(log.getId()).isEqualTo(id); Assertions.assertThat(log.getLoop()).isEqualTo(testLoop); } -}
\ No newline at end of file +} diff --git a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java index 30d4ebe28..03cd89aeb 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupAnalyzerTest.java @@ -26,7 +26,6 @@ package org.onap.policy.clamp.policy.pdpgroup; import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import org.junit.BeforeClass; diff --git a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadExceptionTest.java b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadExceptionTest.java index f3c3fc6cd..ce695ec6f 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadExceptionTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadExceptionTest.java @@ -21,7 +21,6 @@ package org.onap.policy.clamp.policy.pdpgroup; import org.junit.Test; -import org.onap.policy.clamp.policy.pdpgroup.PdpGroupPayloadException; import org.onap.policy.common.utils.test.ExceptionsTester; public class PdpGroupPayloadExceptionTest extends ExceptionsTester { diff --git a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadTest.java b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadTest.java index 34674e3ec..b07d3869c 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayloadTest.java @@ -70,6 +70,6 @@ public class PdpGroupPayloadTest { JsonObject listOfOperations = new JsonObject(); listOfOperations.add(PdpGroupPayload.PDP_ACTIONS, operations); - PdpGroupPayload pdpGroupPayload = new PdpGroupPayload(listOfOperations); + new PdpGroupPayload(listOfOperations); } } diff --git a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PoliciesPdpMergerTest.java b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PoliciesPdpMergerTest.java index be7a9d674..733e3734e 100644 --- a/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PoliciesPdpMergerTest.java +++ b/runtime/src/test/java/org/onap/policy/clamp/policy/pdpgroup/PoliciesPdpMergerTest.java @@ -23,9 +23,6 @@ package org.onap.policy.clamp.policy.pdpgroup; -import static org.assertj.core.api.Assertions.assertThat; - -import com.google.gson.JsonObject; import java.io.IOException; import java.util.Arrays; import org.junit.BeforeClass; |