2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.ccsdk.sli.core.sli.provider.base;
24 import java.util.Map.Entry;
25 import java.util.Properties;
27 import org.onap.ccsdk.sli.core.sli.DuplicateValueException;
28 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
29 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
30 import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
31 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
32 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
33 import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
34 import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor;
35 import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
36 import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase;
38 import junit.framework.TestCase;
40 public class ExecuteNodeExecutorTest extends TestCase {
41 public class MockExecuteNodeExecutor extends ExecuteNodeExecutor {
43 protected SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName) {
44 return (SvcLogicJavaPlugin) new LunchSelectorPlugin();
47 protected String evaluate(SvcLogicExpression expr, SvcLogicNode node,
48 SvcLogicContext ctx) throws SvcLogicException {
53 public void testBadPlugin() throws DuplicateValueException, SvcLogicException {
54 LunchSelectorPlugin p = new LunchSelectorPlugin();
55 MockExecuteNodeExecutor execute = new MockExecuteNodeExecutor();
56 SvcLogicNode node = new SvcLogicNode(0, "", "", new SvcLogicGraph());
57 node.setAttribute("method", "selectLunch");
58 SvcLogicPropertiesProvider resourceProvider = new SvcLogicPropertiesProvider() {
60 public Properties getProperties() {
61 return new Properties();
66 execute.execute(new SvcLogicServiceImplBase(null), new SvcLogicNode(0, "", "", new SvcLogicGraph()), new SvcLogicContext());