Unit tests to be sure drivers will load

Change-Id: I95cd5c7ffa52727cab409541b7dd0e6d5a8d0bd4
diff --git a/core/api/src/test/java/org/onosproject/net/driver/AbstractDriverLoaderTest.java b/core/api/src/test/java/org/onosproject/net/driver/AbstractDriverLoaderTest.java
new file mode 100644
index 0000000..90d1bc6
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/driver/AbstractDriverLoaderTest.java
@@ -0,0 +1,68 @@
+package org.onosproject.net.driver;
+
+import java.util.Set;
+
+import org.junit.Test;
+import org.onosproject.net.DeviceId;
+
+/**
+ * Base test class for driver loading.
+ */
+public abstract class AbstractDriverLoaderTest {
+
+    private class DriverAdminServiceAdapter implements DriverAdminService {
+        @Override
+        public Set<DriverProvider> getProviders() {
+            return null;
+        }
+
+        @Override
+        public void registerProvider(DriverProvider provider) {
+
+        }
+
+        @Override
+        public void unregisterProvider(DriverProvider provider) {
+
+        }
+
+        @Override
+        public Set<Driver> getDrivers() {
+            return null;
+        }
+
+        @Override
+        public Set<Driver> getDrivers(Class<? extends Behaviour> withBehaviour) {
+            return null;
+        }
+
+        @Override
+        public Driver getDriver(String mfr, String hw, String sw) {
+            return null;
+        }
+
+        @Override
+        public Driver getDriver(DeviceId deviceId) {
+            return null;
+        }
+
+        @Override
+        public DriverHandler createHandler(DeviceId deviceId, String... credentials) {
+            return null;
+        }
+
+        @Override
+        public Driver getDriver(String driverName) {
+            return null;
+        }
+    }
+
+    protected AbstractDriverLoader loader;
+
+    @Test
+    public void testLoader() {
+        loader.driverAdminService = new DriverAdminServiceAdapter();
+        loader.activate();
+        loader.deactivate();
+    }
+}
diff --git a/drivers/bti/BUCK b/drivers/bti/BUCK
index 90ab148..b80854c 100644
--- a/drivers/bti/BUCK
+++ b/drivers/bti/BUCK
@@ -8,8 +8,14 @@
     '//lib:mibs-net-snmp',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/bti/src/test/java/org/onosproject/drivers/bti/BtiDriversLoaderTest.java b/drivers/bti/src/test/java/org/onosproject/drivers/bti/BtiDriversLoaderTest.java
new file mode 100644
index 0000000..b90c82e
--- /dev/null
+++ b/drivers/bti/src/test/java/org/onosproject/drivers/bti/BtiDriversLoaderTest.java
@@ -0,0 +1,16 @@
+package org.onosproject.drivers.bti;
+
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * BTI Drivers loader test.
+ */
+public class BtiDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new BtiDriversLoader();
+    }
+}
diff --git a/drivers/ciena/BUCK b/drivers/ciena/BUCK
index 6537ee6..b340270 100644
--- a/drivers/ciena/BUCK
+++ b/drivers/ciena/BUCK
@@ -6,8 +6,14 @@
     '//protocols/rest/api:onos-protocols-rest-api',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/ciena/src/test/java/org/onosproject/drivers/ciena/CienaDriversLoaderTest.java b/drivers/ciena/src/test/java/org/onosproject/drivers/ciena/CienaDriversLoaderTest.java
new file mode 100644
index 0000000..4513da1
--- /dev/null
+++ b/drivers/ciena/src/test/java/org/onosproject/drivers/ciena/CienaDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.drivers.ciena;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * Ciena drivers loader test.
+ */
+public class CienaDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new CienaDriversLoader();
+    }
+}
diff --git a/drivers/cisco/BUCK b/drivers/cisco/BUCK
index b5dbef5..c850e9d 100644
--- a/drivers/cisco/BUCK
+++ b/drivers/cisco/BUCK
@@ -4,8 +4,14 @@
     '//protocols/netconf/api:onos-protocols-netconf-api',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/cisco/src/test/java/org/onosproject/drivers/cisco/CiscoDriversLoaderTest.java b/drivers/cisco/src/test/java/org/onosproject/drivers/cisco/CiscoDriversLoaderTest.java
new file mode 100644
index 0000000..ef38134
--- /dev/null
+++ b/drivers/cisco/src/test/java/org/onosproject/drivers/cisco/CiscoDriversLoaderTest.java
@@ -0,0 +1,16 @@
+package org.onosproject.drivers.cisco;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+
+/**
+ * Cisco drivers loader test.
+ */
+public class CiscoDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new CiscoDriversLoader();
+    }
+}
diff --git a/drivers/corsa/BUCK b/drivers/corsa/BUCK
index 3fc9d5d..73a2549 100644
--- a/drivers/corsa/BUCK
+++ b/drivers/corsa/BUCK
@@ -5,8 +5,14 @@
     '//protocols/openflow/api:onos-protocols-openflow-api',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/corsa/src/test/java/org/onosproject/drivers/corsa/CorsaDriversLoaderTest.java b/drivers/corsa/src/test/java/org/onosproject/drivers/corsa/CorsaDriversLoaderTest.java
new file mode 100644
index 0000000..3c3ccda
--- /dev/null
+++ b/drivers/corsa/src/test/java/org/onosproject/drivers/corsa/CorsaDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.drivers.corsa;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * Corsa drivers loader test.
+ */
+public class CorsaDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new CorsaDriversLoader();
+    }
+}
diff --git a/drivers/default/BUCK b/drivers/default/BUCK
index e64db2d..f132524 100644
--- a/drivers/default/BUCK
+++ b/drivers/default/BUCK
@@ -6,8 +6,14 @@
     '//core/store/serializers:onos-core-serializers',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/default/src/test/java/org/onosproject/driver/DefaultDriversLoaderTest.java b/drivers/default/src/test/java/org/onosproject/driver/DefaultDriversLoaderTest.java
new file mode 100644
index 0000000..08c4b9d
--- /dev/null
+++ b/drivers/default/src/test/java/org/onosproject/driver/DefaultDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.driver;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * Default drivers loader test.
+ */
+public class DefaultDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new DefaultDriversLoader();
+    }
+}
diff --git a/drivers/fujitsu/BUCK b/drivers/fujitsu/BUCK
index 0ea201d..64893d0 100644
--- a/drivers/fujitsu/BUCK
+++ b/drivers/fujitsu/BUCK
@@ -4,8 +4,14 @@
     '//protocols/netconf/api:onos-protocols-netconf-api',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuDriversLoaderTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuDriversLoaderTest.java
new file mode 100644
index 0000000..9b366d8
--- /dev/null
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.drivers.fujitsu;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * Fujistu driver loader test.
+ */
+public class FujitsuDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new FujitsuDriversLoader();
+    }
+}
diff --git a/drivers/lumentum/BUCK b/drivers/lumentum/BUCK
index 768feac..e2df8fa 100644
--- a/drivers/lumentum/BUCK
+++ b/drivers/lumentum/BUCK
@@ -6,8 +6,14 @@
     '//incubator/api:onos-incubator-api',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/lumentum/src/test/java/org/onosproject/drivers/lumentum/LumentumDriversLoaderTest.java b/drivers/lumentum/src/test/java/org/onosproject/drivers/lumentum/LumentumDriversLoaderTest.java
new file mode 100644
index 0000000..1723337
--- /dev/null
+++ b/drivers/lumentum/src/test/java/org/onosproject/drivers/lumentum/LumentumDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.drivers.lumentum;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * Lumentum drivers loader test.
+ */
+public class LumentumDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new LumentumDriversLoader();
+    }
+}
diff --git a/drivers/netconf/BUCK b/drivers/netconf/BUCK
index 577d01e..2924b97 100644
--- a/drivers/netconf/BUCK
+++ b/drivers/netconf/BUCK
@@ -4,8 +4,14 @@
     '//protocols/netconf/api:onos-protocols-netconf-api',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/netconf/src/test/java/org/onosproject/drivers/netconf/NetconfDriversLoaderTest.java b/drivers/netconf/src/test/java/org/onosproject/drivers/netconf/NetconfDriversLoaderTest.java
new file mode 100644
index 0000000..2af8d11
--- /dev/null
+++ b/drivers/netconf/src/test/java/org/onosproject/drivers/netconf/NetconfDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.drivers.netconf;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * Netconf drivers loader test.
+ */
+public class NetconfDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new NetconfDriversLoader();
+    }
+}
diff --git a/drivers/optical/BUCK b/drivers/optical/BUCK
index 23ee9b7..98eb012 100644
--- a/drivers/optical/BUCK
+++ b/drivers/optical/BUCK
@@ -5,8 +5,14 @@
     '//drivers/default:onos-drivers-default',
 ]
 
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
diff --git a/drivers/optical/src/test/java/org/onosproject/drivers/optical/OpticalDriversLoaderTest.java b/drivers/optical/src/test/java/org/onosproject/drivers/optical/OpticalDriversLoaderTest.java
new file mode 100644
index 0000000..ddec363
--- /dev/null
+++ b/drivers/optical/src/test/java/org/onosproject/drivers/optical/OpticalDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.drivers.optical;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * Optical drivers loader test.
+ */
+public class OpticalDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new OpticalDriversLoader();
+    }
+}
diff --git a/drivers/ovsdb/src/test/java/org/onosproject/drivers/ovsdb/OvsdbDriversLoaderTest.java b/drivers/ovsdb/src/test/java/org/onosproject/drivers/ovsdb/OvsdbDriversLoaderTest.java
new file mode 100644
index 0000000..0bee8db
--- /dev/null
+++ b/drivers/ovsdb/src/test/java/org/onosproject/drivers/ovsdb/OvsdbDriversLoaderTest.java
@@ -0,0 +1,15 @@
+package org.onosproject.drivers.ovsdb;
+
+import org.junit.Before;
+import org.onosproject.net.driver.AbstractDriverLoaderTest;
+
+/**
+ * OVSDB drivers loader test.
+ */
+public class OvsdbDriversLoaderTest extends AbstractDriverLoaderTest {
+
+    @Before
+    public void setUp() {
+        loader = new OvsdbDriversLoader();
+    }
+}