Adding unit tests for simple link manager.
Converted ConnectPoint and HostLocation to classes.
diff --git a/net/api/src/main/java/org/onlab/onos/net/HostLocation.java b/net/api/src/main/java/org/onlab/onos/net/HostLocation.java
index 022a6f9..22673a6 100644
--- a/net/api/src/main/java/org/onlab/onos/net/HostLocation.java
+++ b/net/api/src/main/java/org/onlab/onos/net/HostLocation.java
@@ -1,10 +1,19 @@
package org.onlab.onos.net;
+import java.util.Objects;
+
/**
* Representation of a network edge location where an end-station host is
* connected.
*/
-public interface HostLocation extends ConnectPoint {
+public class HostLocation extends ConnectPoint {
+
+ private final long time;
+
+ public HostLocation(DeviceId deviceId, PortNumber portNumber, long time) {
+ super(deviceId, portNumber);
+ this.time = time;
+ }
/**
* Returns the timestamp when the location was established, given in
@@ -12,6 +21,22 @@
*
* @return timestamp in milliseconds since start of epoch
*/
- long time();
+ public long time() {
+ return time;
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * super.hashCode() + Objects.hash(time);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof HostLocation) {
+ final HostLocation other = (HostLocation) obj;
+ return super.equals(obj) && Objects.equals(this.time, other.time);
+ }
+ return false;
+ }
}