diff options
Diffstat (limited to 'sli')
8 files changed, 8 insertions, 214 deletions
diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java index a51accbb..3574b88f 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java @@ -21,6 +21,7 @@ package org.onap.ccsdk.sli.core.sli.provider.base; +import org.onap.ccsdk.sli.core.sli.MetricLogger; import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -69,6 +70,7 @@ public abstract class AbstractSvcLogicNodeExecutor { } protected SvcLogicNode getNextNode(SvcLogicNode node, String outValue) { + MetricLogger.resetContext(); SvcLogicNode nextNode = node.getOutcomeValue(outValue); if (nextNode != null) { if (LOG.isDebugEnabled()) { diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java index 92fdb9a3..f850bc4c 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java @@ -114,7 +114,6 @@ public class SvcLogicServiceImplBase implements SvcLogicServiceBase { LOG.info("About to execute graph {}", graph.toString()); try { while (curNode != null) { - resetContext(); SvcLogicNode nextNode = executeNode(curNode, ctx); curNode = nextNode; } @@ -126,10 +125,6 @@ public class SvcLogicServiceImplBase implements SvcLogicServiceBase { return (ctx); } - - protected void resetContext() { - - } public SvcLogicNode executeNode(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { if (node == null) { diff --git a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyAdaptor.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyAdaptor.java deleted file mode 100644 index 58582e0e..00000000 --- a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyAdaptor.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - */ -package org.onap.ccsdk.sli.core.sli.provider.base; - -import java.util.Map; -import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; - -/** - * @author dt5972 - * - */ - -public class DummyAdaptor implements SvcLogicAdaptor { - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor#configure(java.lang.String, java.util.Map, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public ConfigStatus configure(String key, Map<String, String> parameters, SvcLogicContext ctx) { - - if ("ALREADY_ACTIVE".equalsIgnoreCase(key)) { - return ConfigStatus.ALREADY_ACTIVE; - } else if ("NOT_FOUND".equalsIgnoreCase(key)) { - return ConfigStatus.NOT_FOUND; - }else if ("NOT_READY".equalsIgnoreCase(key)) { - return ConfigStatus.NOT_READY; - } else if ("FAILURE".equalsIgnoreCase(key)) { - return ConfigStatus.FAILURE; - } else if ("SUCCESS".equalsIgnoreCase(key)) { - return ConfigStatus.SUCCESS; - } - - return ConfigStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor#activate(java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public ConfigStatus activate(String key, SvcLogicContext ctx) { - return ConfigStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor#deactivate(java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public ConfigStatus deactivate(String key, SvcLogicContext ctx) { - return ConfigStatus.SUCCESS; - } - -} diff --git a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyRecorder.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyRecorder.java deleted file mode 100644 index 52bc123a..00000000 --- a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyRecorder.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.onap.ccsdk.sli.core.sli.provider.base; - -import java.util.Map; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder; - -public class DummyRecorder implements SvcLogicRecorder { - - @Override - public void record(Map<String, String> parmMap) throws SvcLogicException { - return; - } - -} diff --git a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyResource.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyResource.java deleted file mode 100644 index 2e15f3fb..00000000 --- a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyResource.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * - */ -package org.onap.ccsdk.sli.core.sli.provider.base; - -import java.util.Map; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource; - -/** - * @author dt5972 - * - */ -public class DummyResource implements SvcLogicResource { - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#isAvailable(java.lang.String, java.lang.String, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#exists(java.lang.String, java.lang.String, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#query(java.lang.String, boolean, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, - String orderBy, SvcLogicContext ctx) throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#reserve(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#save(java.lang.String, boolean, boolean, java.lang.String, java.util.Map, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> parms, - String prefix, SvcLogicContext ctx) throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#release(java.lang.String, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#delete(java.lang.String, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#notify(java.lang.String, java.lang.String, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) - throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.SvcLogicResource#update(java.lang.String, java.lang.String, java.util.Map, java.lang.String, org.onap.ccsdk.sli.core.sli.SvcLogicContext) - */ - @Override - public QueryStatus update(String resource, String key, Map<String, String> parms, String prefix, - SvcLogicContext ctx) throws SvcLogicException { - return QueryStatus.SUCCESS; - } - -} 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 cbeb5971..8eb5755e 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 @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Map; 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.SvcLogicJavaPlugin; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; @@ -41,7 +42,11 @@ public class PluginTest extends TestCase { // The attribute emitsOutcome will not be present, the expected outcome is success when no exception is thrown by the plugin public void testOldPlugin() throws Exception { ExecuteNodeExecutor executor = new ExecuteNodeExecutor(); - SvcLogicJavaPlugin plugin = new VoidDummyPlugin(); + SvcLogicJavaPlugin plugin = new SvcLogicJavaPlugin() { + public void dummy(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException { + return; + } + }; Class pluginClass = plugin.getClass(); Method pluginMethod = pluginClass.getMethod("dummy", Map.class, SvcLogicContext.class); diff --git a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/VoidDummyPlugin.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/VoidDummyPlugin.java deleted file mode 100644 index b2332e05..00000000 --- a/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/VoidDummyPlugin.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : CCSDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.ccsdk.sli.core.sli.provider.base; - -import java.util.Map; - -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; - - - -public class VoidDummyPlugin implements SvcLogicJavaPlugin { - - public void dummy(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException { - return; - } - -} diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java index 23d703c2..b4059ed2 100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java @@ -115,11 +115,6 @@ public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcL } @Override - protected void resetContext() { - MetricLogger.resetContext(); - } - - @Override public SvcLogicStore getStore() throws SvcLogicException { // Create and initialize SvcLogicStore object - used to access // saved service logic. |