summaryrefslogtreecommitdiffstats
path: root/auth/cli-editor/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-10-21 19:59:22 +0100
committerliamfallon <liam.fallon@est.tech>2019-10-31 07:54:57 +0000
commitc03a0455e2956e43e425d6f4121ab5d8d20158f1 (patch)
tree94d9d73731aef727fb83e5e71c8a852fde85e3d4 /auth/cli-editor/src/main
parent0f10bb04a9325fe59893c942a5109f353fd1cde1 (diff)
Use updated APPC model code in apex vcpe example
The APPC implementation was changed in a recent review, this review fixes the apex vcpe example to use this new model. Also fixes an an issue in the CLI editor where escape characters are not now required in example JSON. Issue-ID: POLICY-2043 Change-Id: Id251948c9de27f73ba48cec498e68a43f71c4062 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'auth/cli-editor/src/main')
-rw-r--r--auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java
index 2454f39fa..9459a7ffd 100644
--- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java
+++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java
@@ -47,11 +47,6 @@ import org.slf4j.LoggerFactory;
* @author Ajith Sreekumar (ajith.sreekumar@est.tech)
*/
public class CliUtils {
-
- private CliUtils() {
- // This class cannot be initialized
- }
-
private static final Logger LOGGER = LoggerFactory.getLogger(CliUtils.class);
// Recurring string constants
@@ -59,13 +54,20 @@ public class CliUtils {
private static final int MAX_HELP_LINE_LENGTH = 120;
/**
- * Method to create apex policy in tosca service template.
+ * Private constructor to prevent sub-classing.
+ */
+ private CliUtils() {
+ // This class cannot be initialized
+ }
+
+ /**
+ * Method to create apex policy in TOSCA service template.
*
* @param parameters containing paths to the apex config and tosca template skeleton file
* @param policyModelFilePath path of apex policy model
*/
public static void createToscaServiceTemplate(ApexCliToscaParameters parameters, String policyModelFilePath)
- throws IOException, CoderException {
+ throws IOException, CoderException {
final StandardCoder standardCoder = new StandardCoder();
String apexConfig = TextFileUtils.getTextFileAsString(parameters.getApexConfigFileName());
JsonObject apexConfigJson = standardCoder.decode(apexConfig, JsonObject.class);
@@ -79,7 +81,7 @@ public class CliUtils {
JsonObject toscaPolicyProperties = toscaTemplateJson.get("topology_template").getAsJsonObject();
JsonObject toscaPolicy = toscaPolicyProperties.get("policies").getAsJsonArray().get(0).getAsJsonObject();
JsonObject toscaProperties = toscaPolicy.get(toscaPolicy.keySet().toArray()[0].toString()).getAsJsonObject()
- .get("properties").getAsJsonObject();
+ .get("properties").getAsJsonObject();
toscaProperties.add("content", apexConfigJson);
final String toscaPolicyString = standardCoder.encode(toscaTemplateJson);
@@ -192,7 +194,7 @@ public class CliUtils {
* @return list of arguments
*/
public static List<String> generateArgumentsForCliEditor(CommandLineParameters parameters,
- Properties optionVariableMap, Class<?> class1) {
+ Properties optionVariableMap, Class<?> class1) {
List<String> cliArgsList = new ArrayList<>();
PropertyDescriptor pd;
@@ -209,7 +211,7 @@ public class CliUtils {
if (argValue instanceof String && !key.equals("o")) {
cliArgsList.add("-" + key);
cliArgsList.add(argValue.toString());
- } else if (argValue instanceof Boolean && (Boolean)argValue) {
+ } else if (argValue instanceof Boolean && (Boolean) argValue) {
cliArgsList.add("-" + key);
}
} catch (Exception e) {