summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicConstants.java7
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java15
-rw-r--r--sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java27
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java5
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java21
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java5
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java17
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java5
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java5
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java9
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java5
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java9
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java5
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java9
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java9
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java5
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java9
-rw-r--r--sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java2
-rw-r--r--sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/GraphTests.java61
-rw-r--r--sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java6
-rw-r--r--sli/provider-base/src/test/resources/breakGraph.xml26
-rw-r--r--sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java17
-rw-r--r--sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java3
-rw-r--r--sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java5
-rw-r--r--utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java3
-rw-r--r--utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java3
-rw-r--r--utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/BundleContexFileResolverTest.java6
-rw-r--r--utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/CoreDefaultFileResolverTest.java4
-rw-r--r--utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/SdncConfigEnvVarFileResolverTest.java4
-rw-r--r--utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java4
-rw-r--r--utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java4
31 files changed, 225 insertions, 90 deletions
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicConstants.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicConstants.java
new file mode 100644
index 00000000..61bfe7c2
--- /dev/null
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicConstants.java
@@ -0,0 +1,7 @@
+package org.onap.ccsdk.sli.core.sli;
+
+public class SvcLogicConstants {
+ public final static String SUCCESS = "success";
+ public final static String FAILURE = "failure";
+
+}
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
index b592c15f..549e6364 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
@@ -40,7 +40,7 @@ public class SvcLogicContext {
private HashMap<String, String> attributes;
- private String status = "success";
+ private String status = SvcLogicConstants.SUCCESS;
public SvcLogicContext()
{
@@ -91,15 +91,28 @@ public class SvcLogicContext {
{
return attributes.keySet();
}
+ public Boolean isSuccess() {
+ return status.equals(SvcLogicConstants.SUCCESS);
+ }
+ @Deprecated
public String getStatus() {
return status;
}
+ @Deprecated
public void setStatus(String status) {
this.status = status;
}
+ public void markFailed() {
+ this.status = SvcLogicConstants.FAILURE;
+ }
+
+ public void markSuccess() {
+ this.status = SvcLogicConstants.SUCCESS;
+ }
+
public Properties toProperties()
{
Properties props = new Properties();
diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java
index 3b9fff75..bad1209b 100644
--- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java
+++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/SvcLogicContextTest.java
@@ -24,20 +24,17 @@ package org.onap.ccsdk.sli.core.sli;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
-
import junit.framework.TestCase;
public class SvcLogicContextTest extends TestCase {
private static final Logger LOG = LoggerFactory
.getLogger(SvcLogicContext.class);
-
+
public void testMerge() {
try {
@@ -62,4 +59,26 @@ public class SvcLogicContextTest extends TestCase {
}
+ public void testIsSuccess() {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setStatus(SvcLogicConstants.SUCCESS);
+ assertTrue(ctx.isSuccess());
+ ctx.setStatus(SvcLogicConstants.FAILURE);
+ assertFalse(ctx.isSuccess());
+ }
+
+ public void testMarkSuccess() {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.markSuccess();
+ assertTrue(ctx.isSuccess());
+ assertEquals(SvcLogicConstants.SUCCESS, ctx.getStatus());
+ }
+
+ public void testMarkFailed() {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.markFailed();
+ assertFalse(ctx.isSuccess());
+ assertEquals(SvcLogicConstants.FAILURE, ctx.getStatus());
+ }
+
}
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java
index fb152790..7079e263 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -42,12 +43,12 @@ public class BlockNodeExecutor extends AbstractSvcLogicNodeExecutor {
boolean isAtomic = "true".equalsIgnoreCase(atomicStr);
// Initialize status to success so that at least one outcome will execute
- ctx.setStatus("success");
+ ctx.markSuccess();
int numOutcomes = node.getNumOutcomes();
for (int i = 0; i < numOutcomes; i++) {
- if ("failure".equals(ctx.getStatus()) && isAtomic) {
+ if (SvcLogicConstants.FAILURE.equals(ctx.getStatus()) && isAtomic) {
LOG.info("Block - stopped executing nodes due to failure status");
return(null);
}
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java
index 55afa859..a0e3af18 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java
@@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Set;
import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -48,7 +49,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
String adaptorName = SvcLogicExpressionResolver.evaluate(
node.getAttribute("adaptor"), node, ctx);
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug("configure node encountered - looking for adaptor "
@@ -82,7 +83,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
switch (confStatus) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
if ((activate != null) && (activate.length() > 0)) {
if ("true".equalsIgnoreCase(activate)) {
SvcLogicAdaptor.ConfigStatus activateStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
@@ -108,7 +109,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else if ("false".equalsIgnoreCase(activate)) {
SvcLogicAdaptor.ConfigStatus deactivateStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
@@ -134,7 +135,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
}
}
@@ -150,7 +151,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
if ((activate != null) && (activate.length() > 0)) {
@@ -164,7 +165,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
}
switch (activateStatus) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case ALREADY_ACTIVE:
outValue = ALREADY_ACTIVE;
@@ -177,7 +178,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else if ("false".equalsIgnoreCase(activate)) {
SvcLogicAdaptor.ConfigStatus deactivateStatus = SvcLogicAdaptor.ConfigStatus.FAILURE;
@@ -190,7 +191,7 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
}
switch (deactivateStatus) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case ALREADY_ACTIVE:
outValue = ALREADY_ACTIVE;
@@ -203,12 +204,12 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor {
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
}
} else {
LOG.warn("Nothing to configure - no parameters passed, and activate attribute is not set");
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
}
}
} else {
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java
index 2393a159..00f0629c 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
@@ -31,7 +32,7 @@ import org.slf4j.LoggerFactory;
public class DeleteNodeExecutor extends AbstractSvcLogicNodeExecutor {
private static final Logger LOG = LoggerFactory.getLogger(DeleteNodeExecutor.class);
- private static final String FAILURE="failure";
+ private static final String FAILURE=SvcLogicConstants.FAILURE;
@Override
public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
@@ -52,7 +53,7 @@ public class DeleteNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
switch (resourcePlugin.delete(resourceType, key, ctx)) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case NOT_FOUND:
outValue = "not-found";
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java
index 0fe179b7..7f2674e5 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java
@@ -25,11 +25,8 @@ package org.onap.ccsdk.sli.core.sli.provider.base;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
-
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -41,7 +38,7 @@ import org.slf4j.LoggerFactory;
public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
private static final Logger LOG = LoggerFactory
.getLogger(ExecuteNodeExecutor.class);
- private static final String FAILURE="failure";
+ private static final String FAILURE=SvcLogicConstants.FAILURE;
private static final String pluginErrorMessage = "Could not execute plugin. SvcLogic status will be set to failure.";
public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node,
@@ -93,15 +90,15 @@ public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
LOG.error(pluginErrorMessage, e);
}
outValue = FAILURE;
- ctx.setStatus(FAILURE);
+ ctx.markFailed();
} catch (IllegalAccessException e) {
LOG.error(pluginErrorMessage, e);
outValue = FAILURE;
- ctx.setStatus(FAILURE);
+ ctx.markFailed();
} catch (IllegalArgumentException e) {
LOG.error(pluginErrorMessage, e);
outValue = FAILURE;
- ctx.setStatus(FAILURE);
+ ctx.markFailed();
}
}
@@ -119,10 +116,10 @@ public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor {
if (nodeEmitsOutcome) {
return (String) o;
} else {
- return "success";
+ return SvcLogicConstants.SUCCESS;
}
} else {
- return "success";
+ return SvcLogicConstants.SUCCESS;
}
}
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java
index 397c5f32..ca12e35d 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
@@ -41,7 +42,7 @@ public class ExistsNodeExecutor extends AbstractSvcLogicNodeExecutor {
String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx);
String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx);
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug("exists node encountered - looking for resource class " + plugin);
@@ -64,7 +65,7 @@ public class ExistsNodeExecutor extends AbstractSvcLogicNodeExecutor {
}
} catch (SvcLogicException e) {
LOG.error("Caught exception from resource plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java
index 8ca1f32d..2d9721c7 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java
@@ -22,6 +22,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
import org.onap.ccsdk.sli.core.sli.BreakNodeException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -79,7 +80,7 @@ public class ForNodeExecutor extends AbstractSvcLogicNodeExecutor {
for (int i = 0; i < numOutcomes; i++) {
- if ("failure".equals(ctx.getStatus()) && isAtomic) {
+ if (SvcLogicConstants.FAILURE.equals(ctx.getStatus()) && isAtomic) {
LOG.info("For - stopped executing nodes due to failure status");
return(null);
}
@@ -101,7 +102,7 @@ public class ForNodeExecutor extends AbstractSvcLogicNodeExecutor {
}
}
} catch (BreakNodeException br) {
- LOG.error("ForNodeExecutor caught break",br);
+ LOG.trace("ForNodeExecutor caught break" + br.getMessage());
}
return (null);
}
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java
index a2f1c63d..f7cfc66d 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -65,7 +66,7 @@ public class GetResourceNodeExecutor extends AbstractSvcLogicNodeExecutor {
orderBy = SvcLogicExpressionResolver.evaluateAsKey(orderByExpr, node, ctx);
}
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug(node.getNodeType() + " node encountered - looking for resource class " + plugin);
@@ -77,18 +78,18 @@ public class GetResourceNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
switch (resourcePlugin.query(resourceType, localOnly, select, key, pfx, orderBy, ctx)) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case NOT_FOUND:
outValue = "not-found";
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} catch (SvcLogicException e) {
LOG.error("Caught exception from resource plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java
index a93c0d6f..1d6e34e8 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
@@ -41,7 +42,7 @@ public class IsAvailableNodeExecutor extends AbstractSvcLogicNodeExecutor {
String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx);
String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx);
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
SvcLogicResource resourcePlugin = getSvcLogicResource(plugin);
@@ -60,7 +61,7 @@ public class IsAvailableNodeExecutor extends AbstractSvcLogicNodeExecutor {
}
} catch (SvcLogicException e) {
LOG.error("Caught exception from resource plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java
index de59a4b7..fb560db5 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
@@ -41,7 +42,7 @@ public class NotifyNodeExecutor extends AbstractSvcLogicNodeExecutor {
String action = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("action"), node, ctx);
String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx);
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug("release node encountered - looking for resource class " + plugin);
@@ -52,18 +53,18 @@ public class NotifyNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
switch (resourcePlugin.notify(resourceType, action, key, ctx)) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case NOT_FOUND:
outValue = "not-found";
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} catch (SvcLogicException e) {
LOG.error("Caught exception from resource plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java
index d233a36d..2dd5a081 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -44,7 +45,7 @@ public class RecordNodeExecutor extends AbstractSvcLogicNodeExecutor {
throws SvcLogicException {
String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx);
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
Map<String, String> parmMap = getResolvedParameters(node,ctx);
@@ -54,7 +55,7 @@ public class RecordNodeExecutor extends AbstractSvcLogicNodeExecutor {
recorder.record(parmMap);
} catch (SvcLogicException e) {
LOG.error("Caught exception from recorder plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicRecorder object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java
index ed9d7d7d..ee06031d 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
@@ -40,7 +41,7 @@ public class ReleaseNodeExecutor extends AbstractSvcLogicNodeExecutor {
String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx);
String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx);
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug("release node encountered - looking for resource class " + plugin);
@@ -51,18 +52,18 @@ public class ReleaseNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
switch (resourcePlugin.release(resourceType, key, ctx)) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case NOT_FOUND:
outValue = "not-found";
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} catch (SvcLogicException e) {
LOG.error("Caught exception from resource plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java
index 8e21a459..d22d36eb 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.sli.provider.base;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -50,7 +51,7 @@ public class ReserveNodeExecutor extends AbstractSvcLogicNodeExecutor {
select = SvcLogicExpressionResolver.evaluateAsKey(selectExpr, node, ctx);
}
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug("reserve node encountered - looking for resource class " + plugin);
@@ -65,18 +66,18 @@ public class ReserveNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
switch (resourcePlugin.reserve(resourceType, select, key, pfx, ctx)) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case NOT_FOUND:
outValue = "not-found";
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} catch (SvcLogicException e) {
LOG.error("Caught exception from resource plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java
index 64a44b3b..b0b70f1f 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory;
public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
private static final Logger LOG = LoggerFactory.getLogger(SaveNodeExecutor.class);
- private static final String FAILURE= "failure";
+ private static final String FAILURE= SvcLogicConstants.FAILURE;
@Override
public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx)
@@ -71,7 +72,7 @@ public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
switch (resourcePlugin.save(resourceType, force, localOnly, key, parmMap, pfx, ctx)) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case NOT_FOUND:
outValue = "not-found";
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java
index 104f36f5..c22c573c 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
@@ -51,7 +52,7 @@ public class UpdateNodeExecutor extends AbstractSvcLogicNodeExecutor {
Map<String, String> parmMap = getResolvedParameters(node,ctx);
- String outValue = "failure";
+ String outValue = SvcLogicConstants.FAILURE;
if (LOG.isDebugEnabled()) {
LOG.debug("save node encountered - looking for resource class " + plugin);
@@ -66,18 +67,18 @@ public class UpdateNodeExecutor extends AbstractSvcLogicNodeExecutor {
try {
switch (resourcePlugin.update(resourceType, key, parmMap, pfx, ctx)) {
case SUCCESS:
- outValue = "success";
+ outValue = SvcLogicConstants.SUCCESS;
break;
case NOT_FOUND:
outValue = "not-found";
break;
case FAILURE:
default:
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} catch (SvcLogicException e) {
LOG.error("Caught exception from resource plugin", e);
- outValue = "failure";
+ outValue = SvcLogicConstants.FAILURE;
}
} else {
LOG.warn("Could not find SvcLogicResource object for plugin " + plugin);
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java
index c01e2f51..3078b343 100644
--- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java
+++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java
@@ -67,7 +67,7 @@ public class WhileNodeExecutor extends AbstractSvcLogicNodeExecutor {
}
LOG.debug("testResult was " + testResult + " which is not equal to true, exiting while loop.");
} catch (BreakNodeException e) {
- LOG.debug("WhileNodeExecutor caught break");
+ LOG.debug("WhileNodeExecutor caught break" + e.getMessage());
}
return (null);
}
diff --git a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/GraphTests.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/GraphTests.java
new file mode 100644
index 00000000..3534d5f9
--- /dev/null
+++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/GraphTests.java
@@ -0,0 +1,61 @@
+package org.onap.ccsdk.sli.core.sli.provider.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
+import org.onap.ccsdk.sli.core.sli.SvcLogicParser;
+import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
+import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GraphTests {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GraphTests.class);
+ private static final SvcLogicStore store = new InMemorySvcLogicStore();
+ private static final HashMapResolver resolver = new HashMapResolver();
+ private static final SvcLogicServiceBase svc = new SvcLogicServiceImplBase(store, resolver);
+ private static final SvcLogicParser p = new SvcLogicParser();
+ // Write a very simple recorder so record nodes can be used during debugging
+ private static final SvcLogicRecorder recorder = new SvcLogicRecorder() {
+ @Override
+ public void record(Map<String, String> map) throws SvcLogicException {
+ map.remove("level");
+ for (Entry<String, String> entry : map.entrySet()) {
+ LOG.debug(entry.getKey() + " = " + entry.getValue());
+ }
+ }
+ };
+
+ @Test
+ public void testBreakNode() throws Exception {
+ // This graph as a for node that will loop with start 0 and end 999
+ // in the loop idx is printed and variable "a" is incremented by 1
+ // there is an if block in the loop that when a equals 2 a break node should execute and break out of the for
+ // loop
+ SvcLogicContext ctx = executeGraph("src/test/resources/breakGraph.xml");
+ assertTrue(ctx.isSuccess());
+ assertEquals("2", ctx.getAttribute("idx")); // the break should happen when idx equals 2
+ assertEquals("3", ctx.getAttribute("a")); // incrementing a happens before the break so a should be idx + 1
+ }
+
+ public SvcLogicContext executeGraph(String pathToGraph) throws SvcLogicException {
+ return executeGraph(pathToGraph, new SvcLogicContext());
+ }
+
+ public SvcLogicContext executeGraph(String pathToGraph, SvcLogicContext context) throws SvcLogicException {
+ resolver.addSvcLogicRecorder("org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder", recorder);
+ LinkedList<SvcLogicGraph> graphList = p.parse(pathToGraph);
+ SvcLogicGraph graph = graphList.get(0);
+ store.store(graph);
+ store.activate(graph);
+ return svc.execute(graph, context);
+ }
+
+}
diff --git a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java
index 8eb5755e..b154ecf0 100644
--- a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java
+++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java
@@ -24,7 +24,7 @@ package org.onap.ccsdk.sli.core.sli.provider.base;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
-
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
@@ -58,7 +58,7 @@ public class PluginTest extends TestCase {
SvcLogicNode node = new SvcLogicNode(1, "return", graph);
String emitsOutcome = SvcLogicExpressionResolver.evaluate(node.getAttribute("emitsOutcome"), node, ctx);
String outValue = executor.mapOutcome(o, emitsOutcome);
- assertEquals("success",outValue);
+ assertEquals(SvcLogicConstants.SUCCESS,outValue);
}
//Newer plugins can set the attribute emitsOutcome to true, if so they should return a string
@@ -107,7 +107,7 @@ public class PluginTest extends TestCase {
SvcLogicNode node = new SvcLogicNode(1, "return", graph);
String emitsOutcome = SvcLogicExpressionResolver.evaluate(node.getAttribute("emitsOutcome"), node, ctx);
String outValue = executor.mapOutcome(o, emitsOutcome);
- assertEquals("success",outValue);
+ assertEquals(SvcLogicConstants.SUCCESS,outValue);
}
}
diff --git a/sli/provider-base/src/test/resources/breakGraph.xml b/sli/provider-base/src/test/resources/breakGraph.xml
new file mode 100644
index 00000000..e2b89e84
--- /dev/null
+++ b/sli/provider-base/src/test/resources/breakGraph.xml
@@ -0,0 +1,26 @@
+<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='JUNIT' version='1'>
+ <method rpc='BREAK' mode='sync'>
+ <block>
+ <set>
+ <parameter name='a' value='0' />
+ </set>
+ <for index='idx' start='0' end='999' >
+ <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
+ <parameter name="logger" value="message-log" />
+ <parameter name="level" value="error" />
+ <parameter name="field1" value="`$idx`" />
+ </record>
+ <set>
+ <parameter name='a' value='`$a + 1`' />
+ </set>
+ <switch test="`$idx == 2`">
+ <outcome value='true'>
+ <break/>
+ </outcome>
+ </switch>
+ </for>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
index 1fc05253..0d9ab217 100644
--- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
+++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
@@ -41,6 +41,7 @@ import java.util.Set;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
@@ -935,19 +936,19 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
try {
checkParameters(parameters, new String[]{"root"}, LOG);
} catch (Exception ex) {
- return "failure";
+ return SvcLogicConstants.FAILURE;
}
String root = parameters.get("root");
if (StringUtils.isEmpty(root)) {
- return "failure";
+ return SvcLogicConstants.FAILURE;
}
// set context memory to the the properties passed with root as prefix
setParameterValuesToRoot(parameters, ctx, root);
- return "success";
+ return SvcLogicConstants.SUCCESS;
}
private static boolean setParameterValuesToRoot(Map<String, String> parameters, SvcLogicContext ctx, String root) {
@@ -1003,7 +1004,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
checkParameters(parameters, new String[]{"prefixKey", "keyName", "keyValue"}, LOG);
} catch (Exception e) {
LOG.error("a required parameter is missing");
- return "failure";
+ return SvcLogicConstants.FAILURE;
}
String prefixKey = parameters.get("prefixKey");
@@ -1012,7 +1013,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
if (StringUtils.isEmpty(keyName) || StringUtils.isEmpty(keyValue) || StringUtils.isEmpty(prefixKey)) {
LOG.error("a required parameters value is empty or null");
- return "failure";
+ return SvcLogicConstants.FAILURE;
}
int listLength = getArrayLength(ctx, prefixKey);
@@ -1037,7 +1038,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
+ "but " + map.size() + " entries were found in context memory "
+ "where the key begins with: " + prefixKey);
- return "failure";
+ return SvcLogicConstants.FAILURE;
}
} else if (ctxListContains(containParams, ctx) == "false") {
setNewEntryInList(parameters, ctx, keyName, keyValue, prefixKey, valuePrefixKey, listLength);
@@ -1059,10 +1060,10 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
} catch (SvcLogicException e) {
LOG.error("Call to ctxListContains failed: " + e.getMessage());
- return "failure";
+ return SvcLogicConstants.FAILURE;
}
- return "success";
+ return SvcLogicConstants.SUCCESS;
}
private static void setNewEntryInList(Map<String, String> parameters, SvcLogicContext ctx, String keyName,
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java
index 64645b36..5c222c83 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_StaticFunctionsTest.java
@@ -32,6 +32,7 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils.LogLevel;
@@ -313,7 +314,7 @@ public class SliPluginUtils_StaticFunctionsTest {
Map<String, String> parameters = new HashMap<>();
parameters.put("root", "RootVal");
parameters.put("valueRoot", "ValueRootVal");
- assertEquals("success", SliPluginUtils.setPropertiesForRoot(parameters, ctx));
+ assertEquals(SvcLogicConstants.SUCCESS, SliPluginUtils.setPropertiesForRoot(parameters, ctx));
}
@Test
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java
index 78e846ae..3d4469bf 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils_ctxSortList.java
@@ -25,12 +25,11 @@ package org.onap.ccsdk.sli.core.slipluginutils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-
import java.util.HashMap;
import java.util.Random;
-
import org.junit.Before;
import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.slf4j.Logger;
@@ -144,7 +143,7 @@ public class SliPluginUtils_ctxSortList {
parameters.put("keyName", "testKey");
parameters.put("keyValue", "testValue");
- assertEquals("success", SliPluginUtils.setPropertiesForList(parameters, ctx));
+ assertEquals(SvcLogicConstants.SUCCESS, SliPluginUtils.setPropertiesForList(parameters, ctx));
}
}
diff --git a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java
index e5051d65..8a066f05 100644
--- a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java
+++ b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java
@@ -1,7 +1,6 @@
package org.onap.ccsdk.sli.core.utils;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class JREFileResolverTest {
diff --git a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java
index 5e407daf..df16b41d 100644
--- a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java
+++ b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java
@@ -1,7 +1,6 @@
package org.onap.ccsdk.sli.core.utils;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class KarafRootFileResolverTest {
diff --git a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/BundleContexFileResolverTest.java b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/BundleContexFileResolverTest.java
index 4ec5e1b4..7ddf550b 100644
--- a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/BundleContexFileResolverTest.java
+++ b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/BundleContexFileResolverTest.java
@@ -1,7 +1,6 @@
package org.onap.ccsdk.sli.core.utils.common;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver;
@@ -9,7 +8,8 @@ public class BundleContexFileResolverTest {
@Test
public void getSuccessfulResolutionMessage() throws Exception {
- final PropertiesFileResolver resolver = new BundleContextFileResolver("success", BundleContexFileResolverTest.class);
+ final PropertiesFileResolver resolver =
+ new BundleContextFileResolver("success", BundleContexFileResolverTest.class);
assertEquals("success", resolver.getSuccessfulResolutionMessage());
}
diff --git a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/CoreDefaultFileResolverTest.java b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/CoreDefaultFileResolverTest.java
index a4f8817f..f1f5f224 100644
--- a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/CoreDefaultFileResolverTest.java
+++ b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/CoreDefaultFileResolverTest.java
@@ -1,7 +1,7 @@
package org.onap.ccsdk.sli.core.utils.common;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import java.io.File;
import java.util.Optional;
import org.junit.Test;
diff --git a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/SdncConfigEnvVarFileResolverTest.java b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/SdncConfigEnvVarFileResolverTest.java
index 0f3536b7..130dc0a1 100644
--- a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/SdncConfigEnvVarFileResolverTest.java
+++ b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/common/SdncConfigEnvVarFileResolverTest.java
@@ -1,7 +1,7 @@
package org.onap.ccsdk.sli.core.utils.common;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import java.io.File;
import java.util.Optional;
import org.junit.Test;
diff --git a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java
index 4b28d449..834a8c44 100644
--- a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java
+++ b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java
@@ -1,7 +1,7 @@
package org.onap.ccsdk.sli.core.utils.dblib;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import java.io.File;
import java.util.Optional;
import org.junit.Test;
diff --git a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java
index bae4168d..b5150ab6 100644
--- a/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java
+++ b/utils/provider/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java
@@ -1,7 +1,7 @@
package org.onap.ccsdk.sli.core.utils.dblib;
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import java.io.File;
import java.util.Optional;
import org.junit.Test;