Applying license changes to all files
[appc.git] / appc-provider / appc-provider-bundle / src / test / java / org / openecomp / appc / AppcProviderTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
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
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
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.
20  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.openecomp.appc;
26
27 import java.util.concurrent.ExecutorService;
28 import java.util.concurrent.Executors;
29
30 import org.junit.After;
31 import org.junit.Ignore;
32 import org.junit.Test;
33 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
34 import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
35 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
36 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
37 import org.openecomp.appc.provider.AppcProvider;
38
39 /**
40  * Defines a unit test class which tests the provider. This class leverages the AbstractDataBrokerTest class which
41  * starts a real MD-SAL implementation to use inside of your unit tests. This is not an exhaustive test, but rather is
42  * used to illustrate how one can leverage the AbstractDataBrokerTest to test MD-SAL providers/listeners.
43  */
44 public class AppcProviderTest extends AbstractDataBrokerTest {
45
46     private ExecutorService threadPool = Executors.newSingleThreadExecutor();
47     private AppcProvider provider;
48     private DataBroker dataBroker;
49
50     /**
51      * The @Before annotation is defined in the AbstractDataBrokerTest class. The method setupWithDataBroker is invoked
52      * from inside the @Before method and is used to initialize the databroker with objects for a test runs. In our case
53      * we use this oportunity to create an instance of our provider and initialize it (which registers it as a listener
54      * etc). This method runs before every @Test method below.
55      */
56     @Override
57     protected void setupWithDataBroker(DataBroker dataBroker) {
58         super.setupWithDataBroker(dataBroker);
59
60         this.dataBroker = dataBroker;
61         NotificationProviderService nps = null;
62         RpcProviderRegistry registry = null;
63
64         provider = new AppcProvider(dataBroker, nps, registry);
65     }
66
67     /**
68      * Shuts down our provider, testing close code. @After runs after every @Test method below.
69      */
70     @After
71     public void stop() throws Exception {
72         if (provider != null) {
73             provider.close();
74         }
75     }
76
77     /**
78      * This validates that when a task is created, the run count is initialized to 0
79      */
80     @Ignore
81     @Test
82     public void sampleUnitTest() {
83         // This is where you add your unit testing. You can access "DataBroker" as
84         // needed to create items etc.
85         // This a "Real" data broker.
86     }
87 }