aboutsummaryrefslogtreecommitdiffstats
path: root/appc-provider/appc-provider-bundle/src/test/java
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-02-15 23:11:26 -0800
committerPatrick Brady <pb071s@att.com>2017-02-15 23:13:06 -0800
commit1c192d2dd68724e292b6a30f463085a262e1e813 (patch)
treed0e2b3a396e169863cd0efaa835c8675e9d5aaac /appc-provider/appc-provider-bundle/src/test/java
parentc69ba05c7508aa7d7f675189a45c8c87569369ef (diff)
Moving all files to root directory
Change-Id: Ica5535fd6ec85f350fe1640b42137b49f83f10f0 Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-provider/appc-provider-bundle/src/test/java')
-rw-r--r--appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java b/appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java
new file mode 100644
index 000000000..3915c8da0
--- /dev/null
+++ b/appc-provider/appc-provider-bundle/src/test/java/org/openecomp/appc/AppcProviderTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.junit.After;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.openecomp.appc.provider.AppcProvider;
+
+/**
+ * Defines a unit test class which tests the provider. This class leverages the AbstractDataBrokerTest class which
+ * starts a real MD-SAL implementation to use inside of your unit tests. This is not an exhaustive test, but rather is
+ * used to illustrate how one can leverage the AbstractDataBrokerTest to test MD-SAL providers/listeners.
+ */
+public class AppcProviderTest extends AbstractDataBrokerTest {
+
+ private ExecutorService threadPool = Executors.newSingleThreadExecutor();
+ private AppcProvider provider;
+ private DataBroker dataBroker;
+
+ /**
+ * The @Before annotation is defined in the AbstractDataBrokerTest class. The method setupWithDataBroker is invoked
+ * from inside the @Before method and is used to initialize the databroker with objects for a test runs. In our case
+ * we use this oportunity to create an instance of our provider and initialize it (which registers it as a listener
+ * etc). This method runs before every @Test method below.
+ */
+ @Override
+ protected void setupWithDataBroker(DataBroker dataBroker) {
+ super.setupWithDataBroker(dataBroker);
+
+ this.dataBroker = dataBroker;
+ NotificationProviderService nps = null;
+ RpcProviderRegistry registry = null;
+
+ provider = new AppcProvider(dataBroker, nps, registry);
+ }
+
+ /**
+ * Shuts down our provider, testing close code. @After runs after every @Test method below.
+ */
+ @After
+ public void stop() throws Exception {
+ if (provider != null) {
+ provider.close();
+ }
+ }
+
+ /**
+ * This validates that when a task is created, the run count is initialized to 0
+ */
+ @Ignore
+ @Test
+ public void sampleUnitTest() {
+ // This is where you add your unit testing. You can access "DataBroker" as
+ // needed to create items etc.
+ // This a "Real" data broker.
+ }
+}