2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * =============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.dg.mock.instance;
27 import java.io.FileNotFoundException;
28 import java.io.IOException;
31 import org.apache.commons.lang.StringUtils;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
35 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
36 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
37 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
39 public class MockSvcLogicJavaPlugin implements SvcLogicJavaPlugin{
40 private final static Logger logger = LoggerFactory.getLogger(MockSvcLogicJavaPlugin.class);
41 public static String INPUT_PARAM_RESPONSE_PREFIX = "responsePrefix";
42 public static String OUTPUT_STATUS_SUCCESS = "success";
43 public static String OUTPUT_STATUS_FAILURE = "failure";
44 public static String OUTPUT_PARAM_STATUS = "status";
47 public void mountDevice(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException{
48 logger.info("Executed MountDevice Plugin");
51 public void downloadDeviceConfiguration(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException{
52 ctx.setAttribute("downloadStatus", "success");
53 logger.info("Executed Download Device Configuration Plugin");
54 throw new SvcLogicException("failed in Download..");
57 public void getCommonConfigInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException, FileNotFoundException, IOException {
58 logger.info("Mock getCommonConfigInfo Called....");
61 public void getConfigFileReference(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
62 logger.info("Mock getConfigFileReference Called....");
65 public void getTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
66 logger.info("Mock getTemplate Called....");
69 public void saveConfigFiles(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
70 logger.info("Mock saveConfigFiles called...");
73 public void updateUploadConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
74 logger.info("Mock updateUploadConfig called...");
77 public void savePrepareRelationship(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
78 logger.info("Mock savePrepareRelationship called...");
81 public void saveConfigBlock(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
82 logger.info("Mock saveConfigBlock called...");
84 if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) {
85 logger.info("No params...");
86 ctx.setAttribute("file-category", "device_configuration");
87 ctx.setAttribute("deviceconfig-file-content", "deviceConfig");
89 logger.info("Config params exist...");
90 ctx.setAttribute("file-category", "device_configuration");
91 ctx.setAttribute("file-category1", "configuration_block");
92 ctx.setAttribute("file-category2", "config_data");
96 public void saveTemplateConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
97 logger.info("Mock saveTemplateConfig called...");
99 if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) {
100 logger.info("No params...");
101 ctx.setAttribute("file-category", "device_configuration");
102 ctx.setAttribute("deviceconfig-file-content", "deviceConfig");
105 logger.info("Config params exist...");
106 ctx.setAttribute("file-category", "device_configuration");
107 ctx.setAttribute("file-category1", "config_data");