6513e6ab115a0e4e512a78934aa9b66361bf8435
[appc.git] / appc-inbound / appc-artifact-handler / provider / src / test / java / org / onap / appc / artifact / handler / dbservices / MockSvcLogicResource.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Modifications Copyright (C) 2018 IBM
10  * ================================================================================
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  * 
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  * 
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  * 
23  * ============LICENSE_END=========================================================
24  */
25
26 package org.onap.appc.artifact.handler.dbservices;
27
28 import java.util.Map;
29
30 import com.att.eelf.configuration.EELFLogger;
31 import com.att.eelf.configuration.EELFManager;
32 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
33 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
34 import org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource;
35
36 public class MockSvcLogicResource extends SqlResource {
37
38     @Override
39     public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix,
40             String orderBy, SvcLogicContext ctx) throws SvcLogicException {
41         QueryStatus status = QueryStatus.SUCCESS;
42         ctx.setAttribute("keys",key);
43         ctx.setAttribute("id", "testId");
44         ctx.setAttribute("VNF_TYPE", "testvnf");
45         ctx.setAttribute("maximum", "1");
46         ctx.setAttribute("COUNT(*)", "1");
47         ctx.setAttribute("download-config-dg", "TestDG");
48         return status;
49     }
50
51
52     @Override
53     public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> parms,
54             String prefix, SvcLogicContext ctx) throws SvcLogicException {
55         ctx.setAttribute("keys", key);
56         return QueryStatus.SUCCESS;
57     }
58 }