2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.mdsal;
27 import com.fasterxml.jackson.databind.ObjectMapper;
28 import org.junit.Before;
29 import org.junit.Ignore;
30 import org.junit.runner.RunWith;
31 import org.mockito.Mockito;
32 import org.onap.appc.mdsal.exception.MDSALStoreException;
33 import org.onap.appc.mdsal.impl.MDSALStoreFactory;
34 import org.onap.appc.mdsal.impl.MDSALStoreImpl;
35 import com.att.eelf.configuration.EELFLogger;
36 import com.att.eelf.configuration.EELFManager;
37 import org.onap.appc.mdsal.operation.ConfigOperationRequestFormatter;
38 import org.onap.appc.rest.client.RestClientInvoker;
39 import org.osgi.framework.*;
40 import org.powermock.api.mockito.PowerMockito;
41 import org.powermock.core.classloader.annotations.PrepareForTest;
42 import org.powermock.modules.junit4.PowerMockRunner;
49 @RunWith(PowerMockRunner.class)
50 @PrepareForTest({FrameworkUtil.class, BundleContext.class, ServiceReference.class,
51 BundleReference.class, Bundle.class, Filter.class, BundleListener.class, InvalidSyntaxException.class,
52 BundleException.class, FrameworkListener.class, ServiceRegistration.class, ServiceListener.class,
54 public class MDSALStoreTest {
56 private final EELFLogger logger = EELFManager.getInstance().getLogger(MDSALStoreTest.class);
57 private RestClientInvoker client = Mockito.mock(RestClientInvoker.class);
58 private ConfigOperationRequestFormatter requestFormatter = new ConfigOperationRequestFormatter();
59 private ObjectMapper mapper = new ObjectMapper();
63 public void init() throws Exception{
64 PowerMockito.whenNew(RestClientInvoker.class).withArguments(Mockito.any(URL.class)).thenReturn(client);
65 store = (MDSALStoreImpl) MDSALStoreFactory.createMDSALStore();
69 public void testYangInput() throws MDSALStoreException {
70 store.storeYangModuleOnLeader("module test { }", "Name");