6bf6959e27a1f37106a0f97dd58c57f4ef160527
[sdnc/northbound.git] / generic-resource-api / provider / src / test / java / org / onap / sdnc / northbound / GenericResourceApiProviderTest.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.northbound;
23
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.mockito.Mock;
27 import org.onap.sdnc.northbound.util.DataBrokerUtil;
28 import org.onap.sdnc.northbound.util.GenericResourceApiSvcLogicServiceClientMockUtil;
29 import org.onap.sdnc.northbound.util.PropBuilder;
30 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
31 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
32 import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
33 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
34 import org.slf4j.Logger;
35 import org.slf4j.LoggerFactory;
36
37
38 public class GenericResourceApiProviderTest extends AbstractConcurrentDataBrokerTest {
39
40     protected static final Logger LOG = LoggerFactory.getLogger(GenericResourceApiProvider.class);
41     protected GenericResourceApiProvider genericResourceApiProvider;
42     protected DataBroker dataBroker;
43     protected @Mock NotificationPublishService mockNotificationPublishService;
44     protected @Mock RpcProviderRegistry mockRpcProviderRegistry;
45     protected @Mock GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient;
46
47
48
49     protected DataBrokerUtil db;
50     protected GenericResourceApiSvcLogicServiceClientMockUtil svcClient;
51
52
53     @Before
54     public void setUp() throws Exception {
55         svcClient = new GenericResourceApiSvcLogicServiceClientMockUtil(mockGenericResourceApiSvcLogicServiceClient);
56         dataBroker = getDataBroker();
57         db = new DataBrokerUtil(dataBroker);
58          try {
59             genericResourceApiProvider = new GenericResourceApiProvider(
60                     dataBroker,
61                     mockNotificationPublishService,
62                     mockRpcProviderRegistry,
63                     mockGenericResourceApiSvcLogicServiceClient
64             );
65         } catch (Exception e) {
66             LOG.error("Caught exception on setUp", e);
67             throw e;
68         }
69     }
70
71
72     public static PropBuilder prop(){
73         return (new PropBuilder());
74     }
75 }