2 * ============LICENSE_START=======================================================
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
15 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * ============LICENSE_END=========================================================
26 package org.onap.appc.mdsal;
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;
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,
55 public class MDSALStoreTest {
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();
64 public void init() throws Exception{
65 PowerMockito.whenNew(RestClientInvoker.class).withArguments(Mockito.any(URL.class)).thenReturn(client);
66 store = (MDSALStoreImpl) MDSALStoreFactory.createMDSALStore();
70 public void testYangInput() throws MDSALStoreException {
71 store.storeYangModuleOnLeader("module test { }", "Name");