summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java12
-rw-r--r--src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/target/ToscaMetadataTargetProcess.java12
-rw-r--r--src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java4
3 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java b/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
index bd3a1cb13..4ad47422c 100644
--- a/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
+++ b/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,6 +23,8 @@
package org.onap.policy.clamp.clds.tosca.update.execution.cds;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -31,6 +33,7 @@ import java.util.Set;
import org.onap.policy.clamp.clds.tosca.ToscaSchemaConstants;
import org.onap.policy.clamp.clds.tosca.ToscaSchemaConstants;
import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataProcess;
+import org.onap.policy.clamp.clds.tosca.update.execution.target.ToscaMetadataTargetProcess;
import org.onap.policy.clamp.loop.service.Service;
@@ -39,8 +42,15 @@ import org.onap.policy.clamp.loop.service.Service;
*/
public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
+ private static final EELFLogger logger =
+ EELFManager.getInstance().getLogger(ToscaMetadataCdsProcess.class);
+
@Override
public void executeProcess(String parameters, JsonObject childObject, Service serviceModel) {
+ if (serviceModel == null) {
+ logger.info("serviceModel is null, therefore the ToscaMetadataCdsProcess is skipped");
+ return;
+ }
switch (parameters) {
case "actor":
JsonArray jsonArray = new JsonArray();
diff --git a/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/target/ToscaMetadataTargetProcess.java b/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/target/ToscaMetadataTargetProcess.java
index f4ca9909b..dcfd0594f 100644
--- a/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/target/ToscaMetadataTargetProcess.java
+++ b/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/target/ToscaMetadataTargetProcess.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,10 @@
package org.onap.policy.clamp.clds.tosca.update.execution.target;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.JsonObject;
+import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataExecutor;
import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataProcess;
import org.onap.policy.clamp.loop.service.Service;
import org.onap.policy.clamp.policy.operational.OperationalPolicyRepresentationBuilder;
@@ -33,8 +36,15 @@ import org.onap.policy.clamp.policy.operational.OperationalPolicyRepresentationB
*/
public class ToscaMetadataTargetProcess extends ToscaMetadataProcess {
+ private static final EELFLogger logger =
+ EELFManager.getInstance().getLogger(ToscaMetadataTargetProcess.class);
+
@Override
public void executeProcess(String parameters, JsonObject childObject, Service serviceModel) {
+ if (serviceModel == null) {
+ logger.info("serviceModel is null, therefore the ToscaMetadataTargetProcess is skipped");
+ return;
+ }
childObject.add("anyOf", OperationalPolicyRepresentationBuilder.createAnyOfArray(serviceModel, false));
}
}
diff --git a/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java b/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java
index 5a9720a00..74fd8e5fd 100644
--- a/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java
+++ b/src/main/java/org/onap/policy/clamp/clds/tosca/update/parser/ToscaConverterToJsonSchema.java
@@ -118,8 +118,8 @@ public class ToscaConverterToJsonSchema {
JsonArray requirements = new JsonArray();
ToscaElement toParse = components.get(nameComponent);
//Check for a father component, and launch the same process
- if (!toParse.getDerivedFrom().equals("tosca.datatypes.Root")
- && !toParse.getDerivedFrom().equals("tosca.policies.Root")) {
+ 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