summaryrefslogtreecommitdiffstats
path: root/auth/cli-codegen
diff options
context:
space:
mode:
authorlapentafd <francesco.lapenta@est.tech>2021-05-27 10:18:49 +0100
committerlapentafd <francesco.lapenta@est.tech>2021-05-31 16:39:15 +0100
commitb6c674891e00f3bac43bd7b4fca06e7a87b8dd34 (patch)
tree35e0dfe7f60b01e651e1ad8741825419537855de /auth/cli-codegen
parentc70c2179f1555e356794145956cbe32a3407e622 (diff)
Fix Sonar Issues on Apex-pdp
Changes made into cli-codegen, cli-editor, and core-engine Renamed one test class to match other test classes Issue-ID: POLICY-3093 Change-Id: Ib2d947782021590ffc08d426e7a1607a8c33f98a Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Diffstat (limited to 'auth/cli-codegen')
-rw-r--r--auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CgStringRenderer.java5
-rw-r--r--auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditor.java36
-rw-r--r--auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportGenerationTest.java (renamed from auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportGenerationTester.java)9
3 files changed, 26 insertions, 24 deletions
diff --git a/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CgStringRenderer.java b/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CgStringRenderer.java
index b2cd9b9ca..c7235afb6 100644
--- a/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CgStringRenderer.java
+++ b/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CgStringRenderer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +43,7 @@ public class CgStringRenderer implements AttributeRenderer<Object> {
if (obj == null) {
return null;
}
- String ret = obj.toString();
+ var ret = obj.toString();
if (ret.length() == 0) {
return "\"\"";
}
@@ -53,7 +54,7 @@ public class CgStringRenderer implements AttributeRenderer<Object> {
}
if ("doDescription".equals(format)) {
- String ret = obj.toString();
+ var ret = obj.toString();
if (ret.contains("\n") || ret.contains("\"")) {
ret = "LS" + "\n" + ret + "\n" + "LE";
} else {
diff --git a/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditor.java b/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditor.java
index 53acc9cf2..6ad5fbc3c 100644
--- a/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditor.java
+++ b/auth/cli-codegen/src/main/java/org/onap/policy/apex/auth/clicodegen/CodeGeneratorCliEditor.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -172,7 +172,7 @@ public class CodeGeneratorCliEditor {
*/
public void addSchemaDeclaration(final String name, final String version, final String uuid,
final String description, final String flavour, final String schema) {
- final ST st = stg.getInstanceOf("schemaDecl");
+ final var st = stg.getInstanceOf("schemaDecl");
st.add(NAME, name);
st.add(VERSION, version);
st.add(UUID, uuid);
@@ -188,7 +188,7 @@ public class CodeGeneratorCliEditor {
* @param codeGenCliEditorBuilder The parameters for the context album
*/
public void addContextAlbumDeclaration(CodeGenCliEditorBuilder codeGenCliEditorBuilder) {
- final ST st = stg.getInstanceOf("ctxAlbumDecl");
+ final var st = stg.getInstanceOf("ctxAlbumDecl");
st.add(NAME, codeGenCliEditorBuilder.getName());
st.add(VERSION, codeGenCliEditorBuilder.getVersion());
st.add(UUID, codeGenCliEditorBuilder.getUuid());
@@ -213,7 +213,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createEventFieldDefinition(final String eventName, final String version, final String fieldName,
final String fieldSchema, final String fieldSchemaVersion, final boolean optional) {
- final ST st = stg.getInstanceOf("eventDefField");
+ final var st = stg.getInstanceOf("eventDefField");
st.add(EVENT_NAME, eventName);
st.add(VERSION, version);
st.add(FIELD_NAME, fieldName);
@@ -234,7 +234,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createTaskDefLogic(final String taskName, final String version, final String flavour,
final String logic) {
- final ST st = stg.getInstanceOf("taskDefLogic");
+ final var st = stg.getInstanceOf("taskDefLogic");
st.add(TASK_NAME, taskName);
st.add(VERSION, version);
st.add(FLAVOUR, flavour);
@@ -248,7 +248,7 @@ public class CodeGeneratorCliEditor {
* @param eventDeclarationBuilder param object for event declaration
*/
public void addEventDeclaration(EventDeclarationBuilder eventDeclarationBuilder) {
- final ST st = stg.getInstanceOf("eventDecl");
+ final var st = stg.getInstanceOf("eventDecl");
st.add(NAME, eventDeclarationBuilder.getName());
st.add(VERSION, eventDeclarationBuilder.getVersion());
st.add(UUID, eventDeclarationBuilder.getUuid());
@@ -272,7 +272,7 @@ public class CodeGeneratorCliEditor {
* @param taskDeclarationBuilder builder for the task declaration parameters
*/
public void addTaskDeclaration(TaskDeclarationBuilder taskDeclarationBuilder) {
- final ST st = stg.getInstanceOf("taskDecl");
+ final var st = stg.getInstanceOf("taskDecl");
st.add(NAME, taskDeclarationBuilder.getName());
st.add(VERSION, taskDeclarationBuilder.getVersion());
st.add(UUID, taskDeclarationBuilder.getUuid());
@@ -298,7 +298,7 @@ public class CodeGeneratorCliEditor {
*/
public void addPolicyDefinition(final String name, final String version, final String uuid,
final String description, final String template, final String firstState, final List<ST> states) {
- final ST st = stg.getInstanceOf("policyDef");
+ final var st = stg.getInstanceOf("policyDef");
st.add(NAME, name);
st.add(VERSION, version);
st.add(UUID, uuid);
@@ -321,7 +321,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createTaskDefinitionInfields(final String taskName, final String version, final String fieldName,
final String fieldSchema, final String fieldSchemaVersion) {
- final ST st = stg.getInstanceOf("taskDefInputFields");
+ final var st = stg.getInstanceOf("taskDefInputFields");
st.add(TASK_NAME, taskName);
st.add(VERSION, version);
st.add(FIELD_NAME, fieldName);
@@ -342,7 +342,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createTaskDefinitionOutfields(final String taskName, final String version, final String fieldName,
final String fieldSchema, final String fieldSchemaVersion) {
- final ST st = stg.getInstanceOf("taskDefOutputFields");
+ final var st = stg.getInstanceOf("taskDefOutputFields");
st.add(TASK_NAME, taskName);
st.add(VERSION, version);
st.add(FIELD_NAME, fieldName);
@@ -362,7 +362,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createTaskDefinitionParameters(final String name, final String version, final String parName,
final String defaultValue) {
- final ST st = stg.getInstanceOf("taskDefParameter");
+ final var st = stg.getInstanceOf("taskDefParameter");
st.add(NAME, name);
st.add(VERSION, version);
st.add(PAR_NAME, parName);
@@ -381,7 +381,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createTaskDefinitionContextRef(final String name, final String version, final String albumName,
final String albumVersion) {
- final ST st = stg.getInstanceOf("taskDefCtxRef");
+ final var st = stg.getInstanceOf("taskDefCtxRef");
st.add(NAME, name);
st.add(VERSION, version);
st.add(ALBUM_NAME, albumName);
@@ -396,7 +396,7 @@ public class CodeGeneratorCliEditor {
* @return a CLI command for a policy state task definition
*/
public ST createPolicyStateTask(PolicyStateTaskBuilder policyStateTaskBuilder) {
- final ST st = stg.getInstanceOf("policyStateTask");
+ final var st = stg.getInstanceOf("policyStateTask");
st.add(POLICY_NAME, policyStateTaskBuilder.getPolicyName());
st.add(VERSION, policyStateTaskBuilder.getVersion());
st.add(STATE_NAME, policyStateTaskBuilder.getStateName());
@@ -423,7 +423,7 @@ public class CodeGeneratorCliEditor {
public ST createPolicyStateOutput(final String policyName, final String version, final String stateName,
final String outputName, final String eventName, final String eventVersion,
final String nextState) {
- final ST st = stg.getInstanceOf("policyStateOutput");
+ final var st = stg.getInstanceOf("policyStateOutput");
st.add(POLICY_NAME, policyName);
st.add(VERSION, version);
st.add(STATE_NAME, stateName);
@@ -441,7 +441,7 @@ public class CodeGeneratorCliEditor {
* @return a CLI command for a policy state definition
*/
public ST createPolicyStateDef(PolicyStateDefBuilder policyStateDefBuilder) {
- final ST st = stg.getInstanceOf("policyStateDef");
+ final var st = stg.getInstanceOf("policyStateDef");
st.add(POLICY_NAME, policyStateDefBuilder.getPolicyName());
st.add(VERSION, policyStateDefBuilder.getVersion());
st.add(STATE_NAME, policyStateDefBuilder.getStateName());
@@ -469,7 +469,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createPolicyStateDefTaskSelLogic(final String name, final String version, final String stateName,
final String logicFlavour, final String logic) {
- final ST st = stg.getInstanceOf("policyStateTaskSelectionLogic");
+ final var st = stg.getInstanceOf("policyStateTaskSelectionLogic");
st.add(NAME, name);
st.add(VERSION, version);
st.add(STATE_NAME, stateName);
@@ -491,7 +491,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createPolicyStateDefFinalizerLogic(final String name, final String version, final String stateName,
final String finalizerLogicName, final String logicFlavour, final String logic) {
- final ST st = stg.getInstanceOf("policyStateFinalizerLogic");
+ final var st = stg.getInstanceOf("policyStateFinalizerLogic");
st.add(NAME, name);
st.add(VERSION, version);
st.add(STATE_NAME, stateName);
@@ -513,7 +513,7 @@ public class CodeGeneratorCliEditor {
*/
public ST createPolicyStateDefContextRef(final String name, final String version, final String stateName,
final String albumName, final String albumVersion) {
- final ST st = stg.getInstanceOf("policyStateContextRef");
+ final var st = stg.getInstanceOf("policyStateContextRef");
st.add(NAME, name);
st.add(VERSION, version);
st.add(STATE_NAME, stateName);
diff --git a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportGenerationTester.java b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportGenerationTest.java
index 3e010d056..aed334590 100644
--- a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportGenerationTester.java
+++ b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportGenerationTest.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -37,7 +38,7 @@ import org.stringtemplate.v4.STGroupFile;
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
-public class SupportGenerationTester {
+public class SupportGenerationTest {
/**
* Get the chunks for the codegen.