ONOS-1846 Added new class TopologyBatchOperation that can be used to
represent mixed sequence of topology event operations.
Added Kryo serialization unit test for the new class.
Also, added methods equals(), hashCode() and toString() to
classes BatchOperation and BatchOperationEntry.
Change-Id: I8c91499c95a48ba68ca6ff99c0ec613c951dd648
diff --git a/src/test/java/net/onrc/onos/core/util/serializers/KryoFactoryTest.java b/src/test/java/net/onrc/onos/core/util/serializers/KryoFactoryTest.java
index 712a50f..4d05849 100644
--- a/src/test/java/net/onrc/onos/core/util/serializers/KryoFactoryTest.java
+++ b/src/test/java/net/onrc/onos/core/util/serializers/KryoFactoryTest.java
@@ -12,6 +12,7 @@
import net.onrc.onos.core.topology.HostEvent;
import net.onrc.onos.core.topology.LinkEvent;
import net.onrc.onos.core.topology.PortEvent;
+import net.onrc.onos.core.topology.TopologyBatchOperation;
import net.onrc.onos.core.topology.TopologyElement;
import net.onrc.onos.core.topology.TopologyEvent;
import net.onrc.onos.core.topology.SwitchEvent;
@@ -249,6 +250,31 @@
assertEquals(21, result.size);
}
+ { // CHECKSTYLE IGNORE THIS LINE
+ TopologyBatchOperation tbo = new TopologyBatchOperation();
+ OnosInstanceId onosInstanceId =
+ new OnosInstanceId(ONOS_INSTANCE_NAME);
+
+ // using the back door to access package-scoped constructor
+ Constructor<TopologyEvent> swConst
+ = TopologyEvent.class.getDeclaredConstructor(SwitchEvent.class,
+ OnosInstanceId.class);
+ swConst.setAccessible(true);
+
+ for (int i = 1; i <= 10; i++) {
+ Dpid dpid = new Dpid(i);
+ SwitchEvent switchEvent = new SwitchEvent(dpid);
+ TopologyEvent topologyEvent =
+ swConst.newInstance(switchEvent, onosInstanceId);
+ tbo.addAddTopologyOperation(topologyEvent);
+ }
+
+ Result result = benchType(tbo, EqualityCheck.EQUALS);
+ results.add(result);
+ // update me if serialized form is expected to change
+ assertEquals(215, result.size);
+ }
+
// TODO Add registered classes we still use.