458e6d41dc364e5c0cd226bb49f27804de0744cd
[sdnc/northbound.git] / vnfapi / provider / src / test / java / org / onap / sdnc / vnfapi / VnfApiProviderTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : SDN-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                                                      reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.sdnc.vnfapi;
23
24 import org.junit.Before;
25 import org.mockito.Mock;
26 import org.onap.sdnc.vnfapi.util.DataBrokerUtil;
27 import org.onap.sdnc.vnfapi.util.PropBuilder;
28 import org.onap.sdnc.vnfapi.util.VNFSDNSvcLogicServiceClientMockUtil;
29 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
30 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
31 import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
32 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35
36
37 public class VnfApiProviderTest extends AbstractConcurrentDataBrokerTest {
38
39     protected VnfApiProvider vnfapiProvider;
40     protected DataBroker dataBroker;
41     protected @Mock NotificationPublishService mockNotificationPublishService;
42     protected @Mock RpcProviderRegistry mockRpcProviderRegistry;
43     protected @Mock VNFSDNSvcLogicServiceClient mockVNFSDNSvcLogicServiceClient;
44     protected static final Logger LOG = LoggerFactory.getLogger(VnfApiProvider.class);
45
46     protected DataBrokerUtil db;
47     protected VNFSDNSvcLogicServiceClientMockUtil svcClient;
48
49     @Before
50     public void setUp() throws Exception {
51         svcClient = new VNFSDNSvcLogicServiceClientMockUtil(mockVNFSDNSvcLogicServiceClient);
52         dataBroker = getDataBroker();
53         db = new DataBrokerUtil(dataBroker);
54          try {
55             vnfapiProvider = new VnfApiProvider(
56                     dataBroker,
57                     mockNotificationPublishService,
58                     mockRpcProviderRegistry,
59                     mockVNFSDNSvcLogicServiceClient
60             );
61         } catch (Exception e) {
62             LOG.error("Caught exception on setUp", e);
63             throw e;
64         }
65     }
66
67     public static PropBuilder prop(){
68         return (new PropBuilder());
69     }
70  }