Committed by
Gerrit Code Review
Unit tests to be sure drivers will load
Change-Id: I95cd5c7ffa52727cab409541b7dd0e6d5a8d0bd4
Showing
20 changed files
with
274 additions
and
0 deletions
1 | +package org.onosproject.net.driver; | ||
2 | + | ||
3 | +import java.util.Set; | ||
4 | + | ||
5 | +import org.junit.Test; | ||
6 | +import org.onosproject.net.DeviceId; | ||
7 | + | ||
8 | +/** | ||
9 | + * Base test class for driver loading. | ||
10 | + */ | ||
11 | +public abstract class AbstractDriverLoaderTest { | ||
12 | + | ||
13 | + private class DriverAdminServiceAdapter implements DriverAdminService { | ||
14 | + @Override | ||
15 | + public Set<DriverProvider> getProviders() { | ||
16 | + return null; | ||
17 | + } | ||
18 | + | ||
19 | + @Override | ||
20 | + public void registerProvider(DriverProvider provider) { | ||
21 | + | ||
22 | + } | ||
23 | + | ||
24 | + @Override | ||
25 | + public void unregisterProvider(DriverProvider provider) { | ||
26 | + | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public Set<Driver> getDrivers() { | ||
31 | + return null; | ||
32 | + } | ||
33 | + | ||
34 | + @Override | ||
35 | + public Set<Driver> getDrivers(Class<? extends Behaviour> withBehaviour) { | ||
36 | + return null; | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public Driver getDriver(String mfr, String hw, String sw) { | ||
41 | + return null; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public Driver getDriver(DeviceId deviceId) { | ||
46 | + return null; | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public DriverHandler createHandler(DeviceId deviceId, String... credentials) { | ||
51 | + return null; | ||
52 | + } | ||
53 | + | ||
54 | + @Override | ||
55 | + public Driver getDriver(String driverName) { | ||
56 | + return null; | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + protected AbstractDriverLoader loader; | ||
61 | + | ||
62 | + @Test | ||
63 | + public void testLoader() { | ||
64 | + loader.driverAdminService = new DriverAdminServiceAdapter(); | ||
65 | + loader.activate(); | ||
66 | + loader.deactivate(); | ||
67 | + } | ||
68 | +} |
... | @@ -8,8 +8,14 @@ COMPILE_DEPS = [ | ... | @@ -8,8 +8,14 @@ COMPILE_DEPS = [ |
8 | '//lib:mibs-net-snmp', | 8 | '//lib:mibs-net-snmp', |
9 | ] | 9 | ] |
10 | 10 | ||
11 | +TEST_DEPS = [ | ||
12 | + '//lib:TEST_ADAPTERS', | ||
13 | + '//core/api:onos-api-tests', | ||
14 | +] | ||
15 | + | ||
11 | osgi_jar_with_tests ( | 16 | osgi_jar_with_tests ( |
12 | deps = COMPILE_DEPS, | 17 | deps = COMPILE_DEPS, |
18 | + test_deps = TEST_DEPS, | ||
13 | resources_root = 'src/main/resources', | 19 | resources_root = 'src/main/resources', |
14 | resources = glob(['src/main/resources/**']), | 20 | resources = glob(['src/main/resources/**']), |
15 | ) | 21 | ) | ... | ... |
1 | +package org.onosproject.drivers.bti; | ||
2 | + | ||
3 | + | ||
4 | +import org.junit.Before; | ||
5 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
6 | + | ||
7 | +/** | ||
8 | + * BTI Drivers loader test. | ||
9 | + */ | ||
10 | +public class BtiDriversLoaderTest extends AbstractDriverLoaderTest { | ||
11 | + | ||
12 | + @Before | ||
13 | + public void setUp() { | ||
14 | + loader = new BtiDriversLoader(); | ||
15 | + } | ||
16 | +} |
... | @@ -6,8 +6,14 @@ COMPILE_DEPS = [ | ... | @@ -6,8 +6,14 @@ COMPILE_DEPS = [ |
6 | '//protocols/rest/api:onos-protocols-rest-api', | 6 | '//protocols/rest/api:onos-protocols-rest-api', |
7 | ] | 7 | ] |
8 | 8 | ||
9 | +TEST_DEPS = [ | ||
10 | + '//lib:TEST_ADAPTERS', | ||
11 | + '//core/api:onos-api-tests', | ||
12 | +] | ||
13 | + | ||
9 | osgi_jar_with_tests ( | 14 | osgi_jar_with_tests ( |
10 | deps = COMPILE_DEPS, | 15 | deps = COMPILE_DEPS, |
16 | + test_deps = TEST_DEPS, | ||
11 | resources_root = 'src/main/resources', | 17 | resources_root = 'src/main/resources', |
12 | resources = glob(['src/main/resources/**']), | 18 | resources = glob(['src/main/resources/**']), |
13 | ) | 19 | ) | ... | ... |
1 | +package org.onosproject.drivers.ciena; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * Ciena drivers loader test. | ||
8 | + */ | ||
9 | +public class CienaDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new CienaDriversLoader(); | ||
14 | + } | ||
15 | +} |
... | @@ -4,8 +4,14 @@ COMPILE_DEPS = [ | ... | @@ -4,8 +4,14 @@ COMPILE_DEPS = [ |
4 | '//protocols/netconf/api:onos-protocols-netconf-api', | 4 | '//protocols/netconf/api:onos-protocols-netconf-api', |
5 | ] | 5 | ] |
6 | 6 | ||
7 | +TEST_DEPS = [ | ||
8 | + '//lib:TEST_ADAPTERS', | ||
9 | + '//core/api:onos-api-tests', | ||
10 | +] | ||
11 | + | ||
7 | osgi_jar_with_tests ( | 12 | osgi_jar_with_tests ( |
8 | deps = COMPILE_DEPS, | 13 | deps = COMPILE_DEPS, |
14 | + test_deps = TEST_DEPS, | ||
9 | resources_root = 'src/main/resources', | 15 | resources_root = 'src/main/resources', |
10 | resources = glob(['src/main/resources/**']), | 16 | resources = glob(['src/main/resources/**']), |
11 | ) | 17 | ) | ... | ... |
1 | +package org.onosproject.drivers.cisco; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | + | ||
7 | +/** | ||
8 | + * Cisco drivers loader test. | ||
9 | + */ | ||
10 | +public class CiscoDriversLoaderTest extends AbstractDriverLoaderTest { | ||
11 | + | ||
12 | + @Before | ||
13 | + public void setUp() { | ||
14 | + loader = new CiscoDriversLoader(); | ||
15 | + } | ||
16 | +} |
... | @@ -5,8 +5,14 @@ COMPILE_DEPS = [ | ... | @@ -5,8 +5,14 @@ COMPILE_DEPS = [ |
5 | '//protocols/openflow/api:onos-protocols-openflow-api', | 5 | '//protocols/openflow/api:onos-protocols-openflow-api', |
6 | ] | 6 | ] |
7 | 7 | ||
8 | +TEST_DEPS = [ | ||
9 | + '//lib:TEST_ADAPTERS', | ||
10 | + '//core/api:onos-api-tests', | ||
11 | +] | ||
12 | + | ||
8 | osgi_jar_with_tests ( | 13 | osgi_jar_with_tests ( |
9 | deps = COMPILE_DEPS, | 14 | deps = COMPILE_DEPS, |
15 | + test_deps = TEST_DEPS, | ||
10 | resources_root = 'src/main/resources', | 16 | resources_root = 'src/main/resources', |
11 | resources = glob(['src/main/resources/**']), | 17 | resources = glob(['src/main/resources/**']), |
12 | ) | 18 | ) | ... | ... |
1 | +package org.onosproject.drivers.corsa; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * Corsa drivers loader test. | ||
8 | + */ | ||
9 | +public class CorsaDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new CorsaDriversLoader(); | ||
14 | + } | ||
15 | +} |
... | @@ -6,8 +6,14 @@ COMPILE_DEPS = [ | ... | @@ -6,8 +6,14 @@ COMPILE_DEPS = [ |
6 | '//core/store/serializers:onos-core-serializers', | 6 | '//core/store/serializers:onos-core-serializers', |
7 | ] | 7 | ] |
8 | 8 | ||
9 | +TEST_DEPS = [ | ||
10 | + '//lib:TEST_ADAPTERS', | ||
11 | + '//core/api:onos-api-tests', | ||
12 | +] | ||
13 | + | ||
9 | osgi_jar_with_tests ( | 14 | osgi_jar_with_tests ( |
10 | deps = COMPILE_DEPS, | 15 | deps = COMPILE_DEPS, |
16 | + test_deps = TEST_DEPS, | ||
11 | resources_root = 'src/main/resources', | 17 | resources_root = 'src/main/resources', |
12 | resources = glob(['src/main/resources/**']), | 18 | resources = glob(['src/main/resources/**']), |
13 | ) | 19 | ) | ... | ... |
1 | +package org.onosproject.driver; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * Default drivers loader test. | ||
8 | + */ | ||
9 | +public class DefaultDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new DefaultDriversLoader(); | ||
14 | + } | ||
15 | +} |
... | @@ -4,8 +4,14 @@ COMPILE_DEPS = [ | ... | @@ -4,8 +4,14 @@ COMPILE_DEPS = [ |
4 | '//protocols/netconf/api:onos-protocols-netconf-api', | 4 | '//protocols/netconf/api:onos-protocols-netconf-api', |
5 | ] | 5 | ] |
6 | 6 | ||
7 | +TEST_DEPS = [ | ||
8 | + '//lib:TEST_ADAPTERS', | ||
9 | + '//core/api:onos-api-tests', | ||
10 | +] | ||
11 | + | ||
7 | osgi_jar_with_tests ( | 12 | osgi_jar_with_tests ( |
8 | deps = COMPILE_DEPS, | 13 | deps = COMPILE_DEPS, |
14 | + test_deps = TEST_DEPS, | ||
9 | resources_root = 'src/main/resources', | 15 | resources_root = 'src/main/resources', |
10 | resources = glob(['src/main/resources/**']), | 16 | resources = glob(['src/main/resources/**']), |
11 | ) | 17 | ) | ... | ... |
drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuDriversLoaderTest.java
0 → 100644
1 | +package org.onosproject.drivers.fujitsu; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * Fujistu driver loader test. | ||
8 | + */ | ||
9 | +public class FujitsuDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new FujitsuDriversLoader(); | ||
14 | + } | ||
15 | +} |
... | @@ -6,8 +6,14 @@ COMPILE_DEPS = [ | ... | @@ -6,8 +6,14 @@ COMPILE_DEPS = [ |
6 | '//incubator/api:onos-incubator-api', | 6 | '//incubator/api:onos-incubator-api', |
7 | ] | 7 | ] |
8 | 8 | ||
9 | +TEST_DEPS = [ | ||
10 | + '//lib:TEST_ADAPTERS', | ||
11 | + '//core/api:onos-api-tests', | ||
12 | +] | ||
13 | + | ||
9 | osgi_jar_with_tests ( | 14 | osgi_jar_with_tests ( |
10 | deps = COMPILE_DEPS, | 15 | deps = COMPILE_DEPS, |
16 | + test_deps = TEST_DEPS, | ||
11 | resources_root = 'src/main/resources', | 17 | resources_root = 'src/main/resources', |
12 | resources = glob(['src/main/resources/**']), | 18 | resources = glob(['src/main/resources/**']), |
13 | ) | 19 | ) | ... | ... |
drivers/lumentum/src/test/java/org/onosproject/drivers/lumentum/LumentumDriversLoaderTest.java
0 → 100644
1 | +package org.onosproject.drivers.lumentum; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * Lumentum drivers loader test. | ||
8 | + */ | ||
9 | +public class LumentumDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new LumentumDriversLoader(); | ||
14 | + } | ||
15 | +} |
... | @@ -4,8 +4,14 @@ COMPILE_DEPS = [ | ... | @@ -4,8 +4,14 @@ COMPILE_DEPS = [ |
4 | '//protocols/netconf/api:onos-protocols-netconf-api', | 4 | '//protocols/netconf/api:onos-protocols-netconf-api', |
5 | ] | 5 | ] |
6 | 6 | ||
7 | +TEST_DEPS = [ | ||
8 | + '//lib:TEST_ADAPTERS', | ||
9 | + '//core/api:onos-api-tests', | ||
10 | +] | ||
11 | + | ||
7 | osgi_jar_with_tests ( | 12 | osgi_jar_with_tests ( |
8 | deps = COMPILE_DEPS, | 13 | deps = COMPILE_DEPS, |
14 | + test_deps = TEST_DEPS, | ||
9 | resources_root = 'src/main/resources', | 15 | resources_root = 'src/main/resources', |
10 | resources = glob(['src/main/resources/**']), | 16 | resources = glob(['src/main/resources/**']), |
11 | ) | 17 | ) | ... | ... |
drivers/netconf/src/test/java/org/onosproject/drivers/netconf/NetconfDriversLoaderTest.java
0 → 100644
1 | +package org.onosproject.drivers.netconf; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * Netconf drivers loader test. | ||
8 | + */ | ||
9 | +public class NetconfDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new NetconfDriversLoader(); | ||
14 | + } | ||
15 | +} |
... | @@ -5,8 +5,14 @@ COMPILE_DEPS = [ | ... | @@ -5,8 +5,14 @@ COMPILE_DEPS = [ |
5 | '//drivers/default:onos-drivers-default', | 5 | '//drivers/default:onos-drivers-default', |
6 | ] | 6 | ] |
7 | 7 | ||
8 | +TEST_DEPS = [ | ||
9 | + '//lib:TEST_ADAPTERS', | ||
10 | + '//core/api:onos-api-tests', | ||
11 | +] | ||
12 | + | ||
8 | osgi_jar_with_tests ( | 13 | osgi_jar_with_tests ( |
9 | deps = COMPILE_DEPS, | 14 | deps = COMPILE_DEPS, |
15 | + test_deps = TEST_DEPS, | ||
10 | resources_root = 'src/main/resources', | 16 | resources_root = 'src/main/resources', |
11 | resources = glob(['src/main/resources/**']), | 17 | resources = glob(['src/main/resources/**']), |
12 | ) | 18 | ) | ... | ... |
drivers/optical/src/test/java/org/onosproject/drivers/optical/OpticalDriversLoaderTest.java
0 → 100644
1 | +package org.onosproject.drivers.optical; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * Optical drivers loader test. | ||
8 | + */ | ||
9 | +public class OpticalDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new OpticalDriversLoader(); | ||
14 | + } | ||
15 | +} |
1 | +package org.onosproject.drivers.ovsdb; | ||
2 | + | ||
3 | +import org.junit.Before; | ||
4 | +import org.onosproject.net.driver.AbstractDriverLoaderTest; | ||
5 | + | ||
6 | +/** | ||
7 | + * OVSDB drivers loader test. | ||
8 | + */ | ||
9 | +public class OvsdbDriversLoaderTest extends AbstractDriverLoaderTest { | ||
10 | + | ||
11 | + @Before | ||
12 | + public void setUp() { | ||
13 | + loader = new OvsdbDriversLoader(); | ||
14 | + } | ||
15 | +} |
-
Please register or login to post a comment