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.mdsal;
27 import com.fasterxml.jackson.databind.ObjectMapper;
28 import org.apache.http.HttpResponse;
29 import org.junit.Before;
30 import org.junit.Ignore;
31 import org.junit.Test;
32 import org.junit.runner.RunWith;
33 import org.mockito.Mockito;
34 import org.onap.appc.mdsal.exception.MDSALStoreException;
35 import org.onap.appc.mdsal.impl.MDSALStoreFactory;
36 import org.onap.appc.mdsal.impl.MDSALStoreImpl;
37 import com.att.eelf.configuration.EELFLogger;
38 import com.att.eelf.configuration.EELFManager;
39 import org.onap.appc.mdsal.operation.ConfigOperationRequestFormatter;
40 import org.onap.appc.rest.client.RestClientInvoker;
41 import org.osgi.framework.*;
42 import org.powermock.api.mockito.PowerMockito;
43 import org.powermock.core.classloader.annotations.PrepareForTest;
44 import org.powermock.modules.junit4.PowerMockRunner;
51 @RunWith(PowerMockRunner.class)
52 @PrepareForTest({FrameworkUtil.class,BundleContext.class,ServiceReference.class,
53 BundleReference.class,Bundle.class,Filter.class,BundleListener.class,InvalidSyntaxException.class,
54 BundleException.class,FrameworkListener.class,ServiceRegistration.class,ServiceListener.class,
56 public class MDSALStoreTest {
58 private final EELFLogger logger = EELFManager.getInstance().getLogger(MDSALStoreTest.class);
59 private RestClientInvoker client = Mockito.mock(RestClientInvoker.class);
60 private ConfigOperationRequestFormatter requestFormatter = new ConfigOperationRequestFormatter();
61 private ObjectMapper mapper = new ObjectMapper();
65 public void init() throws Exception{
66 PowerMockito.whenNew(RestClientInvoker.class).withArguments(Mockito.any(URL.class)).thenReturn(client);
67 store = (MDSALStoreImpl) MDSALStoreFactory.createMDSALStore();
71 public void testYangInput() throws MDSALStoreException {
72 store.storeYangModuleOnLeader("module test { }", "Name");