2229eff9df915bce6c971a512d5cae248e43b126
[appc.git] / appc-dg / appc-dg-shared / appc-dg-mdsal-store / appc-dg-mdsal-bundle / src / test / java / org / onap / appc / mdsal / MDSALStoreTest.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 (C) 2019 Ericsson
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.mdsal;
27
28 import com.fasterxml.jackson.databind.ObjectMapper;
29 import org.junit.Before;
30 import org.junit.Ignore;
31 import org.junit.runner.RunWith;
32 import org.mockito.Mockito;
33 import org.onap.appc.mdsal.exception.MDSALStoreException;
34 import org.onap.appc.mdsal.impl.MDSALStoreFactory;
35 import org.onap.appc.mdsal.impl.MDSALStoreImpl;
36 import com.att.eelf.configuration.EELFLogger;
37 import com.att.eelf.configuration.EELFManager;
38 import org.onap.appc.mdsal.operation.ConfigOperationRequestFormatter;
39 import org.onap.appc.rest.client.RestClientInvoker;
40 import org.osgi.framework.*;
41 import org.powermock.api.mockito.PowerMockito;
42 import org.powermock.core.classloader.annotations.PrepareForTest;
43 import org.powermock.modules.junit4.PowerMockRunner;
44
45 import java.net.URL;
46
47 /**
48  * MDSALStore Tests
49  */
50 @RunWith(PowerMockRunner.class)
51 @PrepareForTest({FrameworkUtil.class,BundleContext.class,ServiceReference.class,
52         BundleReference.class,Bundle.class,Filter.class,BundleListener.class,InvalidSyntaxException.class,
53         BundleException.class,FrameworkListener.class,ServiceRegistration.class,ServiceListener.class,
54         Version.class})
55 public class MDSALStoreTest {
56
57     private final EELFLogger logger = EELFManager.getInstance().getLogger(MDSALStoreTest.class);
58     private RestClientInvoker client = Mockito.mock(RestClientInvoker.class);
59     private ConfigOperationRequestFormatter requestFormatter = new ConfigOperationRequestFormatter();
60     private ObjectMapper mapper = new ObjectMapper();
61     MDSALStoreImpl store;
62
63     @Before
64     public void init() throws Exception{
65         PowerMockito.whenNew(RestClientInvoker.class).withArguments(Mockito.any(URL.class)).thenReturn(client);
66         store = (MDSALStoreImpl) MDSALStoreFactory.createMDSALStore();
67     }
68
69     @Ignore
70     public void testYangInput() throws MDSALStoreException {
71         store.storeYangModuleOnLeader("module test { }", "Name");
72     }
73
74 }