Added deviceId to the DriverData as part of available context.
Change-Id: I5be94f35a2889e0c93cf3c20c4c9d6f907411121
diff --git a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverDataTest.java b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverDataTest.java
index 006957d..e3d6910 100644
--- a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverDataTest.java
+++ b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverDataTest.java
@@ -18,11 +18,15 @@
import com.google.common.collect.ImmutableMap;
import org.junit.Before;
import org.junit.Test;
+import org.onosproject.net.DeviceId;
import static org.junit.Assert.*;
+import static org.onosproject.net.DeviceId.deviceId;
public class DefaultDriverDataTest {
+ public static final DeviceId DEVICE_ID = deviceId("of:0011223344556677");
+
DefaultDriver ddc;
DefaultDriverData data;
@@ -32,12 +36,13 @@
ImmutableMap.of(TestBehaviour.class,
TestBehaviourImpl.class),
ImmutableMap.of("foo", "bar"));
- data = new DefaultDriverData(ddc);
+ data = new DefaultDriverData(ddc, DEVICE_ID);
}
@Test
public void basics() {
- assertSame("incorrect type", ddc, data.driver());
+ assertSame("incorrect driver", ddc, data.driver());
+ assertEquals("incorrect device id", DEVICE_ID, data.deviceId());
assertTrue("incorrect toString", data.toString().contains("foo.bar"));
}
diff --git a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverHandlerTest.java b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverHandlerTest.java
index 08a508c..717cda2 100644
--- a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverHandlerTest.java
+++ b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverHandlerTest.java
@@ -36,7 +36,7 @@
TestBehaviourTwo.class,
TestBehaviourTwoImpl.class),
ImmutableMap.of("foo", "bar"));
- data = new DefaultDriverData(ddc);
+ data = new DefaultDriverData(ddc, DefaultDriverDataTest.DEVICE_ID);
handler = new DefaultDriverHandler(data);
}
diff --git a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java
index 17af6c7..01cc7a1 100644
--- a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java
+++ b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java
@@ -20,6 +20,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.onosproject.net.driver.DefaultDriverDataTest.DEVICE_ID;
public class DefaultDriverTest {
@@ -45,10 +46,10 @@
assertEquals("incorrect behaviour count", 0, ddc.behaviours().size());
assertTrue("incorrect behaviour", ddc.hasBehaviour(TestBehaviour.class));
- Behaviour b1 = ddc.createBehaviour(new DefaultDriverData(ddc), TestBehaviour.class);
+ Behaviour b1 = ddc.createBehaviour(new DefaultDriverData(ddc, DEVICE_ID), TestBehaviour.class);
assertTrue("incorrect behaviour class", b1 instanceof TestBehaviourImpl);
- Behaviour b2 = ddc.createBehaviour(new DefaultDriverHandler(new DefaultDriverData(ddc)),
+ Behaviour b2 = ddc.createBehaviour(new DefaultDriverHandler(new DefaultDriverData(ddc, DEVICE_ID)),
TestBehaviourTwo.class);
assertTrue("incorrect behaviour class", b2 instanceof TestBehaviourTwoImpl);
diff --git a/core/api/src/test/java/org/onosproject/net/driver/XmlDriverLoaderTest.java b/core/api/src/test/java/org/onosproject/net/driver/XmlDriverLoaderTest.java
index ea77a50..f54e741 100644
--- a/core/api/src/test/java/org/onosproject/net/driver/XmlDriverLoaderTest.java
+++ b/core/api/src/test/java/org/onosproject/net/driver/XmlDriverLoaderTest.java
@@ -23,6 +23,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.onosproject.net.driver.DefaultDriverDataTest.DEVICE_ID;
/**
* Tests of the XML driver loader implementation.
@@ -73,7 +74,7 @@
InputStream stream = getClass().getResourceAsStream("drivers.noconstructor.xml");
DriverProvider provider = loader.loadDrivers(stream, null);
Driver driver = provider.getDrivers().iterator().next();
- driver.createBehaviour(new DefaultDriverData(driver), TestBehaviour.class);
+ driver.createBehaviour(new DefaultDriverData(driver, DEVICE_ID), TestBehaviour.class);
}
}
\ No newline at end of file